Forked from
agnumpde / dune-tectonic
462 commits behind the upstream repository.
-
Elias Pipping authored
Also kill the kink logic and thus minimisation2
Elias Pipping authoredAlso kill the kink logic and thus minimisation2
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
globalruinanonlinearity.hh 1.56 KiB
#ifndef DUNE_TECTONIC_GLOBAL_RUINA_NONLINEARITY_HH
#define DUNE_TECTONIC_GLOBAL_RUINA_NONLINEARITY_HH
#include <vector>
#include <dune/common/nullptr.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <dune/istl/bvector.hh>
#include "globalnonlinearity.hh"
#include "localfriction.hh"
#include "frictionpotential.hh"
namespace Dune {
template <class MatrixType, class VectorType>
class GlobalRuinaNonlinearity
: public GlobalNonlinearity<MatrixType, VectorType> {
private:
using dataref = BlockVector<FieldVector<double, 1>> const &;
public:
using GlobalNonlinearity<MatrixType, VectorType>::dim;
GlobalRuinaNonlinearity(dataref nodalIntegrals, FrictionData const &fd,
dataref state)
: restrictions(nodalIntegrals.size()) {
auto trivialNonlinearity = make_shared<LocalFriction<dim> const>(
make_shared<TrivialFunction const>());
for (size_t i = 0; i < restrictions.size(); ++i) {
restrictions[i] = nodalIntegrals[i] == 0
? trivialNonlinearity
: make_shared<LocalFriction<dim> const>(
make_shared<FrictionPotential const>(
nodalIntegrals[i], fd, state[i]));
}
}
/*
Return a restriction of the outer function to the i'th node.
*/
virtual shared_ptr<LocalFriction<dim> const> restriction(int i) const {
return restrictions[i];
}
private:
std::vector<shared_ptr<LocalFriction<dim> const>> restrictions;
};
}
#endif