Be aware that the version of GetPot in libMesh is fairly different from the original project. We forked the original one many years ago and have added many of our own features.
Derek On Fri, Feb 17, 2017 at 11:20 AM Xikai Jiang <[email protected]> wrote: > Thanks, Shayan. Good to know these features, and it works well. > > > Xikai > > ________________________________ > From: Shayan Hoshyari <[email protected]> > Sent: Thursday, February 16, 2017 9:53:20 PM > To: Xikai Jiang > Cc: [email protected] > Subject: Re: [Libmesh-users] GetPot read vector from input file > > Xikai, > > Getpot is actually a standalone package. You can find the answer here: > > http://getpot.sourceforge.net/node9.html > > Concisely, you have to do something like: > > input file: > sample_vector='4 87 9 87 5' > code to read the vector: > std::vector<int> foo; > foo.resize( getpotl.vector_variable_size("sample_vector") ); > for (int bar=0 ; bar < int(foo.size()) ; bar++) > { > foo[bar] = getpotl("sample_vector", 0. /*default value*/, bar) > } > > > Shayan > > On Thu, Feb 16, 2017 at 7:21 PM, Xikai Jiang <[email protected]<mailto: > [email protected]>> wrote: > Dear all: > > I'd like to use libMesh's GetPot to read in a vector from a file, for > example in the main function: > > GetPot infile("input.in<http://input.in><http://input.in>"); > std::vector<int> N = infile("N"); > > In the input.in<http://input.in><http://input.in> file, for example I have > > N = 1 2 3 > > My purpose is to make the input file concise to some extent. I searched > around the libMesh examples and GetPot class, but didn't notice anything > like this. Do I miss anything there? or are there other ways to do this > sort of thing? > > Thanks in advance. > > Xikai > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Libmesh-users mailing list > [email protected]<mailto: > [email protected]> > https://lists.sourceforge.net/lists/listinfo/libmesh-users > > > > -- > Shayan Hoshyari > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Libmesh-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/libmesh-users > ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
