diff --git a/src/timestepping/backward_euler.cc b/src/timestepping/backward_euler.cc index 6e14784a79e400e9774ba29a736dbc96e5f5bc03..6d5f6bed7611082acca1dd2942870341a52974cb 100644 --- a/src/timestepping/backward_euler.cc +++ b/src/timestepping/backward_euler.cc @@ -23,7 +23,7 @@ void BackwardEuler<Vector, Matrix, Function, dim>::setup( Vector const &ell, double _tau, double relativeTime, Vector &rhs, Vector &iterate, Matrix &AM) { postProcessCalled = false; - + dirichletFunction.evaluate(relativeTime, dirichletValue); tau = _tau; /* We start out with the formulation @@ -72,12 +72,8 @@ void BackwardEuler<Vector, Matrix, Function, dim>::setup( for (size_t i = 0; i < dirichletNodes.size(); ++i) for (size_t j = 0; j < dim; ++j) - if (dirichletNodes[i][j]) { - if (j == 0) - dirichletFunction.evaluate(relativeTime, iterate[i][j]); - else - iterate[i][j] = 0; - } + if (dirichletNodes[i][j]) + iterate[i][j] = (j == 0) ? dirichletValue : 0; } template <class Vector, class Matrix, class Function, size_t dim> diff --git a/src/timestepping/backward_euler.hh b/src/timestepping/backward_euler.hh index c598c8ffb75a42ef3808baa7e3ace8592c81176b..a07b878d8f9cea2108406bf44f0455c261244f3c 100644 --- a/src/timestepping/backward_euler.hh +++ b/src/timestepping/backward_euler.hh @@ -25,6 +25,7 @@ class BackwardEuler : public TimeSteppingScheme<Vector, Matrix, Function, dim> { Vector v; Dune::BitSetVector<dim> const &dirichletNodes; Function const &dirichletFunction; + double dirichletValue; Vector u_o; Vector v_o; diff --git a/src/timestepping/newmark.cc b/src/timestepping/newmark.cc index b6f90e31dc3c2a9afaf62499019e68d4cdd41dea..6b70313585fc53bc4625310f5963db837524828e 100644 --- a/src/timestepping/newmark.cc +++ b/src/timestepping/newmark.cc @@ -27,7 +27,7 @@ void Newmark<Vector, Matrix, Function, dim>::setup(Vector const &ell, Vector &rhs, Vector &iterate, Matrix &AM) { postProcessCalled = false; - + dirichletFunction.evaluate(relativeTime, dirichletValue); tau = _tau; /* We start out with the formulation @@ -79,12 +79,8 @@ void Newmark<Vector, Matrix, Function, dim>::setup(Vector const &ell, for (size_t i = 0; i < dirichletNodes.size(); ++i) for (size_t j = 0; j < dim; ++j) - if (dirichletNodes[i][j]) { - if (j == 0) - dirichletFunction.evaluate(relativeTime, iterate[i][j]); - else - iterate[i][j] = 0; - } + if (dirichletNodes[i][j]) + iterate[i][j] = (j == 0) ? dirichletValue : 0; } template <class Vector, class Matrix, class Function, size_t dim> diff --git a/src/timestepping/newmark.hh b/src/timestepping/newmark.hh index 0d5774d6d76c324ea18951c9f336a827793ffd28..78f7731a19d22c7b8eed853de827ea17ca3f0d67 100644 --- a/src/timestepping/newmark.hh +++ b/src/timestepping/newmark.hh @@ -27,6 +27,7 @@ class Newmark : public TimeSteppingScheme<Vector, Matrix, Function, dim> { Vector a; Dune::BitSetVector<dim> const &dirichletNodes; Function const &dirichletFunction; + double dirichletValue; Vector u_o; Vector v_o;