Skip to content
Snippets Groups Projects
Commit 98b0b7dd authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Be explicit about templates

parent 799fd55f
No related branches found
No related tags found
No related merge requests found
...@@ -123,8 +123,9 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { ...@@ -123,8 +123,9 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
localb = <b - Au, v> localb = <b - Au, v>
*/ */
MyDirectionalConvexFunction<Dune::GlobalNonlinearity<block_size>> const psi( MyDirectionalConvexFunction<
localA, localb, problem.phi, u, v); Dune::GlobalNonlinearity<block_size, VectorType, MatrixType>> const
psi(localA, localb, problem.phi, u, v);
Interval<double> D; Interval<double> D;
psi.subDiff(0, D); psi.subDiff(0, D);
...@@ -197,7 +198,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { ...@@ -197,7 +198,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
linearization.A.mv(direction, tmp); // Av linearization.A.mv(direction, tmp); // Av
double const localb = tmp * direction; // <Av,v> double const localb = tmp * direction; // <Av,v>
MyDirectionalConvexFunction<Dune::GlobalNonlinearity<block_size>> const MyDirectionalConvexFunction<
Dune::GlobalNonlinearity<block_size, VectorType, MatrixType>> const
psi(localA, localb, problem.phi, u, direction); psi(localA, localb, problem.phi, u, direction);
Interval<double> D; Interval<double> D;
......
...@@ -21,13 +21,14 @@ class MyConvexProblem { ...@@ -21,13 +21,14 @@ class MyConvexProblem {
\param f The linear functional \param f The linear functional
\param u The solution vector \param u The solution vector
*/ */
MyConvexProblem(MatrixType const &A, MyConvexProblem(
Dune::GlobalNonlinearity<block_size> const &phi, MatrixType const &A,
VectorType const &f) Dune::GlobalNonlinearity<block_size, VectorType, MatrixType> const &phi,
VectorType const &f)
: A(A), phi(phi), f(f) {}; : A(A), phi(phi), f(f) {};
MatrixType const &A; MatrixType const &A;
Dune::GlobalNonlinearity<block_size> const &phi; Dune::GlobalNonlinearity<block_size, VectorType, MatrixType> const &phi;
VectorType const &f; VectorType const &f;
}; };
......
...@@ -136,9 +136,11 @@ void assemble_frictional( ...@@ -136,9 +136,11 @@ void assemble_frictional(
true); // whether to resize the output vector and zero all of its entries true); // whether to resize the output vector and zero all of its entries
} }
template <class VectorType, class MatrixType>
void assemble_nonlinearity( void assemble_nonlinearity(
int size, Dune::ParameterTree const &parset, int size, Dune::ParameterTree const &parset,
Dune::shared_ptr<Dune::GlobalNonlinearity<dim> const> &myGlobalNonlinearity, Dune::shared_ptr<Dune::GlobalNonlinearity<
dim, VectorType, MatrixType> const> &myGlobalNonlinearity,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
nodalIntegrals) { nodalIntegrals) {
typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType; typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType;
...@@ -159,13 +161,14 @@ void assemble_nonlinearity( ...@@ -159,13 +161,14 @@ void assemble_nonlinearity(
auto eta = Dune::make_shared<SingletonVectorType>(size); auto eta = Dune::make_shared<SingletonVectorType>(size);
*eta = parset.get<double>("boundary.friction.eta"); *eta = parset.get<double>("boundary.friction.eta");
myGlobalNonlinearity = myGlobalNonlinearity = Dune::make_shared<
Dune::make_shared<Dune::GlobalRuinaNonlinearity<dim> const>( Dune::GlobalRuinaNonlinearity<dim, VectorType, MatrixType> const>(
nodalIntegrals, a, mu, eta, normalStress); nodalIntegrals, a, mu, eta, normalStress);
} else if (friction_model == std::string("Laursen")) { } else if (friction_model == std::string("Laursen")) {
myGlobalNonlinearity = Dune::make_shared< myGlobalNonlinearity = Dune::make_shared<
Dune::GlobalLaursenNonlinearity<dim, Dune::LinearFunction> const>( Dune::GlobalLaursenNonlinearity<dim, Dune::LinearFunction, VectorType,
mu, normalStress, nodalIntegrals); MatrixType> const>(mu, normalStress,
nodalIntegrals);
} else { } else {
assert(false); assert(false);
} }
...@@ -266,9 +269,11 @@ int main(int argc, char *argv[]) { ...@@ -266,9 +269,11 @@ int main(int argc, char *argv[]) {
assemble_frictional<GridType, GridView, SmallVector, P1Basis>( assemble_frictional<GridType, GridView, SmallVector, P1Basis>(
leafView, p1Basis, frictionalNodes, *nodalIntegrals); leafView, p1Basis, frictionalNodes, *nodalIntegrals);
Dune::shared_ptr<Dune::GlobalNonlinearity<dim> const> myGlobalNonlinearity; Dune::shared_ptr<Dune::GlobalNonlinearity<
assemble_nonlinearity(grid.size(grid.maxLevel(), dim), parset, dim, VectorType, OperatorType> const> myGlobalNonlinearity;
myGlobalNonlinearity, nodalIntegrals); assemble_nonlinearity<VectorType, OperatorType>(
grid.size(grid.maxLevel(), dim), parset, myGlobalNonlinearity,
nodalIntegrals);
// {{{ Set up TNNMG solver // {{{ Set up TNNMG solver
// linear iteration step components // linear iteration step components
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment