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

reading a list of lists from a dictionary

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 2, 2009, 13: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: 9
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, 15:19
Default
  #2
Member
 
Niklas Wikstrom
Join Date: Mar 2009
Posts: 85
Rep Power: 9
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, 10:44
Default
  #3
New Member
 
Kian Mehravaran
Join Date: Mar 2009
Location: London, U.K
Posts: 22
Rep Power: 9
kian is on a distinguished road
Thanks Niklas!
kian is offline   Reply With Quote

Reply

Tags
dictionary, lists

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem converting fluent mesh vinz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 28 October 12, 2015 06: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 01: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 17:51


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