On Thu, Jul 02, 2009 at 02:31:32PM +0200, DOLFIN wrote:
changeset: 6398:9a984c7459ed594858b34aac700338a1ea2e6b67
parent: 6396:ea89145d8ec9846d689122b1b2cea5c964c09f00
user: Anders Logg <logg@xxxxxxxxx>
date: Thu Jul 02 14:31:14 2009 +0200
files: bench/ode/reaction/bench.log bench/ode/reaction/bench.py demo/ode/collection/cpp/main.cpp demo/ode/courtemanche/cpp/main.cpp demo/ode/harmonic/cpp/main.cpp demo/ode/lorenz/cpp/main.cpp demo/ode/reaction/cpp/main.cpp demo/ode/tentusscher/cpp/main.cpp demo/ode/tentusscher/cpp/tentusscher.h demo/pde/cahn-hilliard/cpp/main.cpp demo/pde/dg/poisson/cpp/main.cpp demo/pde/elasticity/cpp/main.cpp demo/pde/stokes/stabilized/cpp/main.cpp demo/pde/stokes/taylor-hood/cpp/main.cpp dolfin/common/Variable.cpp dolfin/common/Variable.h dolfin/fem/VariationalProblem.cpp dolfin/fem/VariationalProblem.h dolfin/la/GenericLinearSolver.h dolfin/la/KrylovSolver.h dolfin/la/LUSolver.h dolfin/la/LinearSolver.cpp dolfin/la/LinearSolver.h dolfin/la/PETScKrylovSolver.cpp dolfin/la/PETScLUSolver.cpp dolfin/la/PETScLUSolver.h dolfin/la/SingularSolver.cpp dolfin/la/SingularSolver.h dolfin/la/uBLASKrylovSolver.cpp dolfin/la/uBLASKrylovSolver.h dolfin/main/SubSystemsManager.cpp dolfin/main/SubS
2. Default values for all parameters are set in functions named
default_parameters(). For visibility, this function is implemented in
the header file of each class. Here's an example for the class
NewtonSolver:
/// Default parameter values
static NewParameters default_parameters()
{
NewParameters p("newton_solver");
p.add("maximum_iterations", 50);
p.add("relative_tolerance", 1e-9);
p.add("absolute_tolerance", 1e-10);
p.add("convergence_criterion", "residual");
p.add("method", "full");
p.add("report", true);
return p;
}
The parameter values must be explicitly set in the constructor by a
call to the function default_parameters(). This function is static
which means it cannot be placed in the base class Variable and then
inherited.
3. Nested parameter sets are handled explicitly from the parent to the
child. This means that the parent must both add the parameters of the
child (which makes it possible to set those parameters for the parent
without an error message about an illegal parameter name) and also
propagate those values to the child when appropriate. Here's an
example for the class VariationalProblem:
/// Default parameter values
static NewParameters default_parameters()
{
NewParameters p("variational_problem");
p.add("linear_solver", "direct");
p.add("symmetric", false);
p.add(NewtonSolver::default_parameters());
p.add(LUSolver::default_parameters());
p.add(KrylovSolver::default_parameters());
return p;
}
LUSolver solver;
solver.parameters.update(parameters["lu_solver"]);
4. So in summary, there are more things to think about with the new
parameter system:
a. Inherit from Variable (or just declare the parameters variable)
b. Implement default_parameters()
c. Assign parameters = default_parameters()
d. Add parameters for "childs"
e. Propagate parameter values to "childs"
It might be possible simplify this. Let's think about it.
5. The old global prefixes "Krylov", "ODE" have been removed.
6. It remains to move the few remaining global parameters to a common
global parameter set.
------------------------------------------------------------------------
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev