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

Rely on RVO; Allows to construct just once object

parent 08d37d87
No related branches found
No related tags found
No related merge requests found
...@@ -34,11 +34,11 @@ class GlobalLaursenNonlinearity ...@@ -34,11 +34,11 @@ class GlobalLaursenNonlinearity
sigma_n [id + mu id] = sigma_n (1 + mu) id sigma_n [id + mu id] = sigma_n (1 + mu) id
*/ */
virtual void restriction(int i, OuterFunctionType &f) const { OuterFunctionType restriction(int i) const {
double coefficient = nodalIntegrals[i][0]; double coefficient = nodalIntegrals[i][0];
coefficient *= normalStress[i]; coefficient *= normalStress[i];
coefficient *= 1 + coefficientOfFriction[i]; coefficient *= 1 + coefficientOfFriction[i];
f = OuterFunctionType(coefficient); return OuterFunctionType(coefficient);
} }
private: private:
......
...@@ -11,7 +11,7 @@ template <int dim, class OuterFunctionType> class GlobalNonlinearity { ...@@ -11,7 +11,7 @@ template <int dim, class OuterFunctionType> class GlobalNonlinearity {
/* /*
Return a restriction of the outer function to the i'th node. If Return a restriction of the outer function to the i'th node. If
*/ */
virtual void restriction(int i, OuterFunctionType &f) const = 0; virtual OuterFunctionType restriction(int i) const = 0;
}; };
} }
#endif #endif
...@@ -114,8 +114,7 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject { ...@@ -114,8 +114,7 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject {
} }
assert(localA != NULL); assert(localA != NULL);
FunctionType f; auto const f = problem.phi.restriction(m);
problem.phi.restriction(m, f);
Dune::LocalNonlinearity<block_size> const phi(f); Dune::LocalNonlinearity<block_size> const phi(f);
Dune::SampleFunctional<block_size> localJ(*localA, localb, phi, Dune::SampleFunctional<block_size> localJ(*localA, localb, phi,
ignore_component); ignore_component);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment