CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   reading a list of lists from a dictionary (https://www.cfd-online.com/Forums/openfoam-solving/65061-reading-list-lists-dictionary.html)

kian June 2, 2009 14:42

reading a list of lists from a dictionary
 
Hello,

I can read a list of points from a dictionary by:

List<vector> pnts(pointsDict.lookup("objects"));

how can I read more than one list? Please note that I don't want to have multiple Lists, I want a List of Lists or something similar that holds the individual lists.
Thanks,

Kian Mehravaran

wikstrom June 2, 2009 16:19

Did not try it for vectors, but is this what you ask for? Simply lookup a List<List<vector> >

Code:

int main(int argc, char *argv[])
{

#  include "setRootCase.H"
#  include "createTime.H"
#  include "createMesh.H"

    IOobject dictHdr
    (
        "listListTestDict",
        runTime.system(),
        mesh,
        IOobject::MUST_READ,
        IOobject::NO_WRITE
    );

    IOdictionary dict(dictHdr);

    List<List<scalar> > v(dict.lookup("listan"));
   
    Info << v << endl;

    Info<< "End\n" << endl;

    return(0);
}


kian June 3, 2009 11:44

Thanks Niklas!


All times are GMT -4. The time now is 17:04.