diff --git a/src/Makefile.am b/src/Makefile.am index 1fc9749e738bcf062fe4251d37221efed8049ecb..cb534a6c0149bdf8dfa50a902d799b1f43a19bb2 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 f8a6ca19ea74ead1bc08509f5b1b303f4494b46e..383279bb56a41994e337463a0ad6131569739408 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 196c6b7b31c77974d47d4b6a222c431f83e328c4..4d44efd59da836cffea2c5c4d85c222a518b153a 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 0000000000000000000000000000000000000000..163d8f7339b3270ae163358259fa549a188c96a5 --- /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); +// }}}