← Back to team overview

dolfin team mailing list archive

Redesign of parameter system: [...]

 

Commit from logg (2005-12-19 23:45 CET)
----------------

Redesign of parameter system:

 - Move to src/kernel/parameter

 - Clean up, simplify, and improve parameter system

 - To get access to the parameter system include <dolfin/ParameterSystem.h>
   instead of <dolfin/dolfin_settings.h>

 - Default parameters are now specified in

       src/kernel/parameter/dolfin/DefaultParameters.h

 - stdarg.h is no longer used (replaced by overloading on parameter type)

 - Basic functionality is now placed directly in the namespace dolfin:

       void      dolfin::add(std::string key, Parameter value);
       void      dolfin::set(std::string key, Parameter value);
       Parameter dolfin::get(std::string key);

   No need to have multiple qualifiers (dolfin::dolfin_*).

   Supported parameter types are int, real, bool and string (and uint).
   Parameter is automatically cast to and constructed from the correct
   type on assignment and function calls:

       add("tolerance", 0.01);
       set("tolerance", 0.001);
       real tol = get("tolerance");

 - Parameters hashed on key using std::map, which should be fairly
   efficient, but note that parameter values should still be fetched from
   the database before they are used:

       real tol = get("tolerance");
       while ( e > tol ) { ... }

   Avoid

       while ( e > get("tolerance") ) { ... }

 - Saving parameters/loading parameters is now handled using the File
   interface:

       File file("parameters.xml");
       file >> ParameterSystem::parameters;
       file << ParameterSystem::parameters;

 - Function dolfin_parameter_changed() removed. As a consequence, the
   discrete tolerance is now set to the minimum of "discrete tolerance" and
   "discrete tolerance factor" * "tolerance" in the ODE solver.

 - Functions dolfin_get(), dolfin_set() removed

Parameters are still global, but support for localization of parameters
to objects will be added.

  dolfin  ChangeLog                                                   1.267
  dolfin  configure                                                   1.237
  dolfin  configure.ac                                                1.114
  dolfin  src/demo/solvers/elasticity-updated/main.cpp                1.42
  dolfin  src/demo/solvers/heat/main.cpp                              1.11
  dolfin  src/demo/solvers/ode/bistable/main.cpp                      1.25
  dolfin  src/demo/solvers/ode/complex/main.cpp                       1.5
  dolfin  src/demo/solvers/ode/homotopy/economy/CES.h                 1.13
  dolfin  src/demo/solvers/ode/homotopy/economy/ces.cpp               1.6
  dolfin  src/demo/solvers/ode/homotopy/economy/test.cpp              1.3
  dolfin  src/demo/solvers/ode/homotopy/simple/main.cpp               1.16
  dolfin  src/demo/solvers/ode/lorenz/main.cpp                        1.23
  dolfin  src/demo/solvers/ode/mechanical/main.cpp                    1.4
  dolfin  src/demo/solvers/ode/modeling/lattice/main.cpp              1.5
  dolfin  src/demo/solvers/ode/modeling/simple/main.cpp               1.8
  dolfin  src/demo/solvers/ode/reaction/main.cpp                      1.32
  dolfin  src/demo/solvers/ode/residual/main.cpp                      1.4
  dolfin  src/demo/solvers/ode/stiff/main.cpp                         1.4
  dolfin  src/demo/solvers/ode/wave/main.cpp                          1.24
  dolfin  src/kernel/Makefile.am                                      1.13
  dolfin  src/kernel/Makefile.in                                      1.133
  dolfin  src/kernel/fem/FEM.cpp                                      1.49
  dolfin  src/kernel/io/OpenDXFile.cpp                                1.21
  dolfin  src/kernel/io/XMLFile.cpp                                   1.34
  dolfin  src/kernel/io/XMLMesh.cpp                                   1.8
  dolfin  src/kernel/io/XMLParameterList.cpp                          1.3
  dolfin  src/kernel/log/Logger.cpp                                   1.23
  dolfin  src/kernel/main/dolfin.h                                    1.20
  dolfin  src/kernel/mesh/MeshRefinement.cpp                          1.11
  dolfin  src/kernel/nls/NewtonSolver.cpp                             1.5
  dolfin  src/kernel/ode/Adaptivity.cpp                               1.13
  dolfin  src/kernel/ode/Dependencies.cpp                             1.10
  dolfin  src/kernel/ode/Homotopy.cpp                                 1.26
  dolfin  src/kernel/ode/HomotopyODE.cpp                              1.13
  dolfin  src/kernel/ode/MonoAdaptiveNewtonSolver.cpp                 1.35
  dolfin  src/kernel/ode/MonoAdaptiveTimeSlab.cpp                     1.31
  dolfin  src/kernel/ode/MonoAdaptivity.cpp                           1.21
  dolfin  src/kernel/ode/MultiAdaptiveFixedPointSolver.cpp            1.23
  dolfin  src/kernel/ode/MultiAdaptiveNewtonSolver.cpp                1.30
  dolfin  src/kernel/ode/MultiAdaptiveTimeSlab.cpp                    1.50
  dolfin  src/kernel/ode/MultiAdaptivity.cpp                          1.20
  dolfin  src/kernel/ode/ODE.cpp                                      1.44
  dolfin  src/kernel/ode/ODESolver.cpp                                1.17
  dolfin  src/kernel/ode/Partition.cpp                                1.23
  dolfin  src/kernel/ode/ReducedModel.cpp                             1.11
  dolfin  src/kernel/ode/TimeSlab.cpp                                 1.28
  dolfin  src/kernel/ode/TimeSlabSolver.cpp                           1.37
  dolfin  src/kernel/ode/TimeStepper.cpp                              1.85
  dolfin  src/kernel/ode/dolfin/TimeSlab.h                            1.29
+ dolfin  src/kernel/parameter/Makefile.am                            1.1
+ dolfin  src/kernel/parameter/Makefile.in                            1.1
+ dolfin  src/kernel/parameter/Parameter.cpp                          1.1
+ dolfin  src/kernel/parameter/ParameterList.cpp                      1.1
+ dolfin  src/kernel/parameter/ParameterSystem.cpp                    1.1
+ dolfin  src/kernel/parameter/ParameterValue.cpp                     1.1
+ dolfin  src/kernel/parameter/dolfin/DefaultParameters.h             1.1
+ dolfin  src/kernel/parameter/dolfin/Makefile.am                     1.1
+ dolfin  src/kernel/parameter/dolfin/Makefile.in                     1.1
+ dolfin  src/kernel/parameter/dolfin/Parameter.h                     1.1
+ dolfin  src/kernel/parameter/dolfin/ParameterList.h                 1.1
+ dolfin  src/kernel/parameter/dolfin/ParameterSystem.h               1.1
+ dolfin  src/kernel/parameter/dolfin/ParameterValue.h                1.1
+ dolfin  src/kernel/parameter/dolfin/dolfin_parameter.h              1.1
- dolfin  src/kernel/settings/Makefile.am                             1.4
- dolfin  src/kernel/settings/Makefile.in                             1.121
- dolfin  src/kernel/settings/Parameter.cpp                           1.12
- dolfin  src/kernel/settings/ParameterList.cpp                       1.8
- dolfin  src/kernel/settings/SettingsMacros.cpp                      1.6
- dolfin  src/kernel/settings/SettingsManager.cpp                     1.4
- dolfin  src/kernel/settings/dolfin/Makefile.am                      1.2
- dolfin  src/kernel/settings/dolfin/Makefile.in                      1.121
- dolfin  src/kernel/settings/dolfin/Parameter.h                      1.14
- dolfin  src/kernel/settings/dolfin/ParameterList.h                  1.9
- dolfin  src/kernel/settings/dolfin/Settings.h                       1.66
- dolfin  src/kernel/settings/dolfin/SettingsMacros.h                 1.6
- dolfin  src/kernel/settings/dolfin/SettingsManager.h                1.3
- dolfin  src/kernel/settings/dolfin/dolfin_settings.h                1.3
  dolfin  src/modules/dolfin/Solver.h                                 1.5
  dolfin  src/modules/elasticity-updated/ElasticityUpdatedSolver.cpp  1.63