← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Automatically read parameters from the following files in increasing

 

On Mon, Sep 7, 2009 at 11:12 AM, Anders Logg<logg@xxxxxxxxx> wrote:
> On Mon, Sep 07, 2009 at 08:47:00AM +0200, Johannes Ring wrote:
>> On Sun, Sep 6, 2009 at 12:00 PM, DOLFIN<dolfin@xxxxxxxxxx> wrote:
>> > One or more new changesets pushed to the primary dolfin repository.
>> > A short summary of the last three changesets is included below.
>> >
>> > changeset:   6951:b552e55f706da220bc3b205976f08e34f1c9a547
>> > tag:         tip
>> > user:        Anders Logg <logg@xxxxxxxxx>
>> > date:        Sun Sep 06 11:57:03 2009 +0200
>> > files:       demo/parameters/cpp/main.cpp dolfin/fem/VariationalProblem.cpp dolfin/parameter/GlobalParameters.cpp dolfin/parameter/Parameters.cpp
>> > description:
>> > Automatically read parameters from the following files in increasing
>> > order of priority:
>> >
>> >  $HOME/.dolfin/parameters.xml.gz
>> >  $HOME/.dolfin/parameters.xml
>> >  parameters.xml.gz
>> >  parameters.xml
>> >
>> > The global parameter set will be *updated* with values found in
>> > these parameter sets.
>> >
>> > Not sure how the first two files work on a Windows system.
>>
>> Not very well as HOME is not defined. You should use the USERPROFILE
>> environment variable on Windows.
>>
>> In Python one should use os.path.expanduser("~") which works on all platforms.
>>
>> Johannes
>
> I'm not sure how to do this and I can't test it. Could you suggest a fix?

Yes, I can take a look.

Johannes

> I guess we would need some #ifdef around the following code in GlobalParameters.cpp:
>
>  std::string home_directory(std::getenv("HOME"));
>  parameter_files.push_back(home_directory + "/.dolfin/parameters.xml.gz");
>  parameter_files.push_back(home_directory + "/.dolfin/parameters.xml");
>
> --
> Anders
>
>
>> > changeset:   6950:e685bced17258c83ec9c55badc4ce3adf991c1d8
>> > user:        Anders Logg <logg@xxxxxxxxx>
>> > date:        Sat Sep 05 23:40:39 2009 +0200
>> > files:       ChangeLog demo/parameters/cpp/main.cpp dolfin/main/SubSystemsManager.cpp dolfin/main/SubSystemsManager.h dolfin/parameter/GlobalParameters.cpp dolfin/parameter/GlobalParameters.h dolfin/parameter/Parameters.cpp dolfin/parameter/Parameters.h
>> > description:
>> > Filter out PETSc argument when parsing command-line parameters.
>> > The following should now work:
>> >
>> >  ./demo <other options> --petsc.foo bar <other options>
>> >
>> > provided the program in question parses command-line arguments by
>> >
>> >  parameters.parse(argc, argv).
>> >
>> > All arguments starting with "--petsc." will be sent to PETSc. In the
>> > above example,
>> >
>> >  -foo bar
>> >
>> > will be sent to PETSc. (Note '-' instead of '--'.)
>> >
>> > Other arguments will be parsed by the parameter set in question.
>> >
>> > This only happens for the global DOLFIN parameter set (or any other
>> > parameter set named "dolfin").
>> >
>> >
>> > changeset:   6949:e34f22563ad2f44e18211f278c4830777342651c
>> > user:        Anders Logg <logg@xxxxxxxxx>
>> > date:        Sat Sep 05 15:26:54 2009 +0200
>> > files:       demo/parameters/cpp/SConstruct demo/parameters/cpp/main.cpp dolfin/mesh/Mesh.cpp dolfin/parameter/Parameters.cpp sandbox/misc/cpp/main.cpp
>> > description:
>> > Add C++ demo of parameter system, will add Python version later.
>> >
>> > ----------------------------------------------------------------------
>> > For more details, visit http://www.fenics.org/hg/dolfin
>> > _______________________________________________
>> > DOLFIN-dev mailing list
>> > DOLFIN-dev@xxxxxxxxxx
>> > http://www.fenics.org/mailman/listinfo/dolfin-dev
>> >
>> _______________________________________________
>> DOLFIN-dev mailing list
>> DOLFIN-dev@xxxxxxxxxx
>> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkqkzmoACgkQTuwUCDsYZdF8RgCgggzOKEhzGJb90YGOrjjKtl0s
> /gMAn0ORKKR2KFXyoEJKQcvcvGGlWxIC
> =/zwE
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
>


References