CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

reading a list of lists from a dictionary

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2009, 14:42
Default reading a list of lists from a dictionary
  #1
New Member
 
Kian Mehravaran
Join Date: Mar 2009
Location: London, U.K
Posts: 22
Rep Power: 17
kian is on a distinguished road
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
kian is offline   Reply With Quote

Old   June 2, 2009, 16:19
Default
  #2
Member
 
Niklas Wikstrom
Join Date: Mar 2009
Posts: 86
Rep Power: 17
wikstrom is on a distinguished road
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);
}
wikstrom is offline   Reply With Quote

Old   June 3, 2009, 11:44
Default
  #3
New Member
 
Kian Mehravaran
Join Date: Mar 2009
Location: London, U.K
Posts: 22
Rep Power: 17
kian is on a distinguished road
Thanks Niklas!
kian is offline   Reply With Quote

Reply

Tags
dictionary, lists


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Commercial meshers] Problem converting fluent mesh vinz OpenFOAM Meshing & Mesh Conversion 28 October 12, 2015 07:37
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51


All times are GMT -4. The time now is 16:51.