From 3b414b0ab123c981e0b20a23e59e37187fb9a8ac Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Sun, 11 Mar 2012 14:04:30 +0100
Subject: [PATCH] Explicit template instantiation

---
 src/Makefile.am        |  2 +-
 src/assemblers.cc      |  8 +++++
 src/assemblers.hh      |  1 -
 src/assemblers_tmpl.cc | 66 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 src/assemblers_tmpl.cc

diff --git a/src/Makefile.am b/src/Makefile.am
index 1fc9749e..cb534a6c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@ run-one-body-sample-gdb: one-body-sample
 	libtool --mode execute gdb ./one-body-sample
 
 one_body_sample_SOURCES = \
-	one-body-sample.cc LambertW.cc
+	one-body-sample.cc assemblers.cc LambertW.cc
 one_body_sample_CPPFLAGS = \
 	$(AM_CPPFLAGS) -Dsrcdir=\"$(srcdir)\"
 
diff --git a/src/assemblers.cc b/src/assemblers.cc
index f8a6ca19..383279bb 100644
--- a/src/assemblers.cc
+++ b/src/assemblers.cc
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <dune/fufem/boundarypatch.hh>
 #include <dune/fufem/functions/constantfunction.hh>
 #include <dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh>
@@ -6,6 +10,8 @@
 #include <dune/tectonic/globallaursennonlinearity.hh>
 #include <dune/tectonic/globalruinanonlinearity.hh>
 
+#include "assemblers.hh"
+
 // Assembles Neumann boundary term in f
 template <class GridType, class GridView, class LocalVectorType, class FEBasis>
 void assemble_neumann(GridView const &gridView, FEBasis const &feBasis,
@@ -90,3 +96,5 @@ assemble_nonlinearity(
     assert(false);
   }
 }
+
+#include "assemblers_tmpl.cc"
diff --git a/src/assemblers.hh b/src/assemblers.hh
index 196c6b7b..4d44efd5 100644
--- a/src/assemblers.hh
+++ b/src/assemblers.hh
@@ -31,5 +31,4 @@ assemble_nonlinearity(
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
     double h);
 
-#include "assemblers.cc"
 #endif
diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc
new file mode 100644
index 00000000..163d8f73
--- /dev/null
+++ b/src/assemblers_tmpl.cc
@@ -0,0 +1,66 @@
+#include <dune/common/fmatrix.hh>
+#include <dune/common/fvector.hh>
+#include <dune/grid/yaspgrid.hh>
+
+#include <dune/fufem/functionspacebases/p1nodalbasis.hh>
+
+// {{{ 2D
+typedef Dune::FieldVector<double, 2> SmallVector2;
+typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2;
+typedef Dune::BCRSMatrix<SmallMatrix2> OperatorType2;
+typedef Dune::BlockVector<SmallVector2> VectorType2;
+
+typedef Dune::YaspGrid<2> GridType2;
+typedef GridType2::LeafGridView GridView2;
+typedef P1NodalBasis<GridView2, double> P1Basis2;
+
+template void assemble_neumann<GridType2, GridView2, SmallVector2, P1Basis2>(
+    GridView2 const &gridView, P1Basis2 const &feBasis,
+    Dune::BitSetVector<1> const &neumannNodes,
+    Dune::BlockVector<SmallVector2> &f,
+    Dune::VirtualFunction<double, double> const &neumann, double time);
+
+template Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
+assemble_frictional<GridType2, GridView2, SmallVector2, P1Basis2>(
+    GridView2 const &gridView, P1Basis2 const &feBasis,
+    Dune::BitSetVector<1> const &frictionalNodes);
+
+template Dune::shared_ptr<
+    Dune::GlobalNonlinearity<VectorType2, OperatorType2> const>
+assemble_nonlinearity<VectorType2, OperatorType2>(
+    int size, Dune::ParameterTree const &parset,
+    Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
+        nodalIntegrals,
+    Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
+    double h);
+// }}}
+
+// {{{ 3D
+typedef Dune::FieldVector<double, 3> SmallVector3;
+typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3;
+typedef Dune::BCRSMatrix<SmallMatrix3> OperatorType3;
+typedef Dune::BlockVector<SmallVector3> VectorType3;
+
+typedef Dune::YaspGrid<3> GridType3;
+typedef GridType3::LeafGridView GridView3;
+typedef P1NodalBasis<GridView3, double> P1Basis3;
+
+template void assemble_neumann<GridType3, GridView3, SmallVector3, P1Basis3>(
+    GridView3 const &gridView, P1Basis3 const &feBasis,
+    Dune::BitSetVector<1> const &neumannNodes,
+    Dune::BlockVector<SmallVector3> &f,
+    Dune::VirtualFunction<double, double> const &neumann, double time);
+template Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
+assemble_frictional<GridType3, GridView3, SmallVector3, P1Basis3>(
+    GridView3 const &gridView, P1Basis3 const &feBasis,
+    Dune::BitSetVector<1> const &frictionalNodes);
+
+template Dune::shared_ptr<
+    Dune::GlobalNonlinearity<VectorType3, OperatorType3> const>
+assemble_nonlinearity<VectorType3, OperatorType3>(
+    int size, Dune::ParameterTree const &parset,
+    Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
+        nodalIntegrals,
+    Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
+    double h);
+// }}}
-- 
GitLab