diff --git a/dune/tectonic/globalruinanonlinearity.hh b/dune/tectonic/globalruinanonlinearity.hh index 13d9eed4d1671c1f9eea3fb58d5e041a69a00e5b..1616191807c12b2a0292baf33a89c8a71768590b 100644 --- a/dune/tectonic/globalruinanonlinearity.hh +++ b/dune/tectonic/globalruinanonlinearity.hh @@ -19,7 +19,7 @@ template <int dim> class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> { public: GlobalRuinaNonlinearity( - std::vector<FieldVector<double, 1>> const &nodalIntegrals, + shared_ptr<std::vector<FieldVector<double, 1>> const> nodalIntegrals, shared_ptr<std::vector<double> const> a, shared_ptr<std::vector<double> const> mu, shared_ptr<std::vector<double> const> eta, @@ -36,11 +36,11 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> { Return a restriction of the outer function to the i'th node. */ virtual shared_ptr<LocalNonlinearity<dim> const> restriction(int i) const { - if (nodalIntegrals[i][0] == 0) + if ((*nodalIntegrals)[i][0] == 0) return trivialNonlinearity; shared_ptr<NiceFunction const> const func( - new RuinaFunction(nodalIntegrals[i][0], (*a)[i], (*mu)[i], (*eta)[i], + new RuinaFunction((*nodalIntegrals)[i][0], (*a)[i], (*mu)[i], (*eta)[i], (*normalStress)[i])); return shared_ptr<LocalNonlinearity<dim>>(new LocalNonlinearity<dim>(func)); } @@ -48,7 +48,7 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> { private: shared_ptr<LocalNonlinearity<dim> const> const trivialNonlinearity; - std::vector<FieldVector<double, 1>> nodalIntegrals; + shared_ptr<std::vector<FieldVector<double, 1>> const> nodalIntegrals; shared_ptr<std::vector<double> const> a; shared_ptr<std::vector<double> const> mu; shared_ptr<std::vector<double> const> eta; diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 794de63e5c1ff0c4bb2442bfc03ed47b403a9a50..b837a84c1cd0bdcbe45c2f852c147c8c9e93eb17 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -138,7 +138,8 @@ void assemble_frictional( void assemble_nonlinearity( int size, Dune::ParameterTree const &parset, Dune::shared_ptr<Dune::GlobalNonlinearity<dim> const> &myGlobalNonlinearity, - std::vector<Dune::FieldVector<double, 1>> &nodalIntegrals) { + Dune::shared_ptr<std::vector<Dune::FieldVector<double, 1>>> + nodalIntegrals) { // {{{ Assemble terms for the nonlinearity auto mu = Dune::shared_ptr<std::vector<double>>(new std::vector<double>()); mu->resize(size); @@ -170,7 +171,7 @@ void assemble_nonlinearity( } else if (friction_model == std::string("Laursen")) { auto const tmp = new Dune::GlobalLaursenNonlinearity<dim, Dune::LinearFunction>( - mu, normalStress, nodalIntegrals); + mu, normalStress, *nodalIntegrals); myGlobalNonlinearity = Dune::shared_ptr<Dune::GlobalNonlinearity<dim> const>(tmp); } else { @@ -261,9 +262,11 @@ int main(int argc, char *argv[]) { VectorType b2; VectorType b3; - std::vector<Dune::FieldVector<double, 1>> nodalIntegrals; + auto nodalIntegrals = + Dune::shared_ptr<std::vector<Dune::FieldVector<double, 1>>>( + new std::vector<Dune::FieldVector<double, 1>>); assemble_frictional<GridType, GridView, SmallVector, P1Basis>( - leafView, p1Basis, frictionalNodes, nodalIntegrals); + leafView, p1Basis, frictionalNodes, *nodalIntegrals); Dune::shared_ptr<Dune::GlobalNonlinearity<dim> const> myGlobalNonlinearity; assemble_nonlinearity(grid.size(grid.maxLevel(), dim), parset,