diff --git a/src/timestepping/backward_euler.cc b/src/timestepping/backward_euler.cc index c31714dfba3f1355c656af12aafdacddd4bdaf17..981483c55dfcfd597183f566dd1db32c03e57ec2 100644 --- a/src/timestepping/backward_euler.cc +++ b/src/timestepping/backward_euler.cc @@ -71,26 +71,13 @@ void BackwardEuler<Vector, Matrix, Function, dim>::setup( iterate = 0.0; for (size_t i = 0; i < dirichletNodes.size(); ++i) - switch (dirichletNodes[i].count()) { - case 0: - continue; - case dim: - iterate[i] = 0; - dirichletFunction.evaluate(relativeTime, iterate[i][0]); - break; - case 1: - if (dirichletNodes[i][0]) { - dirichletFunction.evaluate(relativeTime, iterate[i][0]); - break; - } - if (dirichletNodes[i][1]) { - iterate[i][1] = 0; - break; - } - assert(false); - default: - assert(false); - } + 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; + } } template <class Vector, class Matrix, class Function, size_t dim> diff --git a/src/timestepping/newmark.cc b/src/timestepping/newmark.cc index 02be5f6df5bbc62acc0e6758ce442ac7f64cd19b..91dfa0e043fccec3f7cdb729516b8b738e9ef308 100644 --- a/src/timestepping/newmark.cc +++ b/src/timestepping/newmark.cc @@ -78,26 +78,13 @@ void Newmark<Vector, Matrix, Function, dim>::setup(Vector const &ell, iterate = 0.0; for (size_t i = 0; i < dirichletNodes.size(); ++i) - switch (dirichletNodes[i].count()) { - case 0: - continue; - case dim: - iterate[i] = 0; - dirichletFunction.evaluate(relativeTime, iterate[i][0]); - break; - case 1: - if (dirichletNodes[i][0]) { - dirichletFunction.evaluate(relativeTime, iterate[i][0]); - break; - } - if (dirichletNodes[i][1]) { - iterate[i][1] = 0; - break; - } - assert(false); - default: - assert(false); - } + 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; + } } template <class Vector, class Matrix, class Function, size_t dim>