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]> 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>");
>    std::vector<int> N = infile("N");
>
> In the 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]
> 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

Reply via email to