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

Use a shared pointer

parent ec5173ee
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ template <int dimension> class LocalNonlinearity {
typedef FieldVector<double, dimension> VectorType;
typedef FieldMatrix<double, dimension, dimension> MatrixType;
LocalNonlinearity(NiceFunction const *func) : func_(func) {}
LocalNonlinearity(Dune::shared_ptr<NiceFunction> &func) : func_(func) {}
double operator()(VectorType const x) const {
double ret;
......@@ -63,7 +63,7 @@ template <int dimension> class LocalNonlinearity {
}
private:
NiceFunction const *func_;
Dune::shared_ptr<NiceFunction> &func_;
};
}
#endif
......@@ -113,14 +113,13 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject {
}
assert(localA != NULL);
auto const f = problem.phi.restriction(m);
Dune::shared_ptr<Dune::NiceFunction> f(problem.phi.restriction(m));
Dune::LocalNonlinearity<block_size> const phi(f);
Dune::SampleFunctional<block_size> localJ(*localA, localb, phi,
ignore_component);
LocalVectorType correction;
Dune::minimise(localJ, ui, 5, bisection); // FIXME: hardcoded value
free(f);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment