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