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

dim -> block_size; FrictionType typedef

parent 67b2b386
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,9 @@ class GlobalNonlinearity {
public:
using MatrixType = MatrixTypeTEMPLATE;
using VectorType = VectorTypeTEMPLATE;
int static const dim = VectorTypeTEMPLATE::block_type::dimension;
using LocalVectorType = typename VectorType::block_type;
static const int block_size = LocalVectorType::dimension;
using FrictionType = LocalFriction<block_size>;
double operator()(VectorType const &x) const {
double tmp = 0;
......@@ -34,7 +36,7 @@ class GlobalNonlinearity {
/*
Return a restriction of the outer function to the i'th node.
*/
virtual shared_ptr<LocalFriction<dim>> restriction(int i) const = 0;
virtual shared_ptr<LocalFriction<block_size>> restriction(int i) const = 0;
void addHessian(VectorType const &v, MatrixType &hessian) const {
for (size_t i = 0; i < v.size(); ++i) {
......
......@@ -17,23 +17,25 @@ namespace Dune {
template <class MatrixType, class VectorType>
class GlobalRuinaNonlinearity
: public GlobalNonlinearity<MatrixType, VectorType> {
public:
using GlobalNonlinearity<MatrixType, VectorType>::block_size;
using typename GlobalNonlinearity<MatrixType, VectorType>::FrictionType;
private:
using typename GlobalNonlinearity<MatrixType,
VectorType>::SingletonVectorType;
public:
using GlobalNonlinearity<MatrixType, VectorType>::dim;
GlobalRuinaNonlinearity(Dune::BitSetVector<1> const &frictionalNodes,
SingletonVectorType const &nodalIntegrals,
FrictionData const &fd)
: restrictions(nodalIntegrals.size()) {
auto trivialNonlinearity =
make_shared<LocalFriction<dim>>(make_shared<TrivialFunction>());
make_shared<FrictionType>(make_shared<TrivialFunction>());
for (size_t i = 0; i < restrictions.size(); ++i) {
restrictions[i] =
frictionalNodes[i][0]
? make_shared<LocalFriction<dim>>(
? make_shared<FrictionType>(
make_shared<FrictionPotential>(nodalIntegrals[i], fd))
: trivialNonlinearity;
}
......@@ -47,12 +49,12 @@ class GlobalRuinaNonlinearity
/*
Return a restriction of the outer function to the i'th node.
*/
shared_ptr<LocalFriction<dim>> restriction(int i) const override {
shared_ptr<FrictionType> restriction(int i) const override {
return restrictions[i];
}
private:
std::vector<shared_ptr<LocalFriction<dim>>> restrictions;
std::vector<shared_ptr<FrictionType>> restrictions;
};
}
#endif
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