CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Creating a triple index volScalarField S[i][j][k] (https://www.cfd-online.com/Forums/openfoam-programming-development/220361-creating-triple-index-volscalarfield-s-i-j-k.html)

ec91 September 4, 2019 16:42

Creating a triple index volScalarField S[i][j][k]
 
Hello everyone,


with the following code I can create a double array of volScalarFields with two indexes, eI and eJ:


Code:

    List<PtrList<volScalarField>> S(number_I);
    forAll(S,eI)
    {
        S[eI].resize(number_J);

        forAll(S[eI],eJ)
        {
            S[eI].set
            (
                eJ,
                new volScalarField
                (
                    IOobject
                    (
                        "S"+Foam::name(eI)+Foam::name(eJ),
                        runTime.timeName(),
                        mesh,
                        IOobject::NO_READ,
                        IOobject::NO_WRITE
                    ),
                    field1 + field2 //some operations (just an example)
                )
            );
        }
    }

Where number_I and number_J are previously defined integers.



Is there a way to create a volScalarField with three indexes, say S[eI][eJ][eK]?


Thank you.


All times are GMT -4. The time now is 07:38.