From 289c1e64cebe8ec67e474537582e7f04dd6bed6e Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Sat, 1 Jun 2013 21:17:02 +0200
Subject: [PATCH] Pass frictionalNodes on to nonlinearity

---
 dune/tectonic/globalruinanonlinearity.hh | 5 +++--
 src/assemblers.cc                        | 3 ++-
 src/assemblers.hh                        | 1 +
 src/assemblers_tmpl.cc                   | 1 +
 src/one-body-sample.cc                   | 4 ++--
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dune/tectonic/globalruinanonlinearity.hh b/dune/tectonic/globalruinanonlinearity.hh
index 6a2c68c6..0181c619 100644
--- a/dune/tectonic/globalruinanonlinearity.hh
+++ b/dune/tectonic/globalruinanonlinearity.hh
@@ -23,13 +23,14 @@ class GlobalRuinaNonlinearity
 public:
   using GlobalNonlinearity<MatrixType, VectorType>::dim;
 
-  GlobalRuinaNonlinearity(dataref nodalIntegrals, FrictionData const &fd,
+  GlobalRuinaNonlinearity(Dune::BitSetVector<1> const &frictionalNodes,
+                          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)
+      restrictions[i] = frictionalNodes[i][0]
                             ? trivialNonlinearity
                             : make_shared<LocalFriction<dim> const>(
                                   make_shared<FrictionPotential const>(
diff --git a/src/assemblers.cc b/src/assemblers.cc
index 3f605f38..1e2e2b13 100644
--- a/src/assemblers.cc
+++ b/src/assemblers.cc
@@ -50,12 +50,13 @@ assemble_frictional(GridView const &gridView, AssemblerType const &assembler,
 template <class MatrixType, class VectorType>
 Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const>
 assemble_nonlinearity(
+    Dune::BitSetVector<1> const &frictionalNodes,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals,
     FrictionData const &fd,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &state) {
   return Dune::make_shared<
       Dune::GlobalRuinaNonlinearity<MatrixType, VectorType> const>(
-      nodalIntegrals, fd, state);
+      frictionalNodes, nodalIntegrals, fd, state);
 }
 
 #include "assemblers_tmpl.cc"
diff --git a/src/assemblers.hh b/src/assemblers.hh
index f7463260..acbde2fe 100644
--- a/src/assemblers.hh
+++ b/src/assemblers.hh
@@ -26,6 +26,7 @@ assemble_frictional(GridView const &gridView, AssemblerType const &assembler,
 template <class MatrixType, class VectorType>
 Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const>
 assemble_nonlinearity(
+    Dune::BitSetVector<1> const &frictionalNodes,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals,
     FrictionData const &fd,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &state);
diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc
index e9ac6824..aa565f59 100644
--- a/src/assemblers_tmpl.cc
+++ b/src/assemblers_tmpl.cc
@@ -34,6 +34,7 @@ assemble_frictional<GridView, SmallVector, AssemblerType>(
 template Dune::shared_ptr<
     Dune::GlobalNonlinearity<MatrixType, VectorType> const>
 assemble_nonlinearity<MatrixType, VectorType>(
+    Dune::BitSetVector<1> const &frictionalNodes,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals,
     FrictionData const &fd,
     Dune::BlockVector<Dune::FieldVector<double, 1>> const &state);
diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 9bb48e0e..50459522 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -408,8 +408,8 @@ int main(int argc, char *argv[]) {
       auto solveVelocityProblem = [&](VectorType &_problem_iterate,
                                       SingletonVectorType const &_alpha) {
         auto myGlobalNonlinearity =
-            assemble_nonlinearity<MatrixType, VectorType>(*nodalIntegrals,
-                                                          frictionData, _alpha);
+            assemble_nonlinearity<MatrixType, VectorType>(
+                frictionalNodes, *nodalIntegrals, frictionData, _alpha);
 
         using MyConvexProblemType = MyConvexProblem<MatrixType, VectorType>;
         MyConvexProblemType const myConvexProblem(
-- 
GitLab