Skip to content
Snippets Groups Projects
Commit a6ad59e5 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Template parameter can be inferred

parent 9899551e
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,7 @@
#include "assemblers.hh"
// Assembles Neumann boundary term in f
template <class GridType, class GridView, class LocalVectorType,
class AssemblerType>
template <class GridView, class LocalVectorType, class AssemblerType>
void assemble_neumann(GridView const &gridView, AssemblerType const &assembler,
Dune::BitSetVector<1> const &neumannNodes,
Dune::BlockVector<LocalVectorType> &f,
......@@ -25,23 +24,22 @@ void assemble_neumann(GridView const &gridView, AssemblerType const &assembler,
SampleVector[1] = 0;
ConstantFunction<LocalVectorType, LocalVectorType> const fNeumann(
SampleVector);
NeumannBoundaryAssembler<GridType, LocalVectorType> neumannBoundaryAssembler(
fNeumann);
NeumannBoundaryAssembler<typename GridView::Grid, LocalVectorType>
neumannBoundaryAssembler(fNeumann);
assembler.assembleBoundaryFunctional(neumannBoundaryAssembler, f,
neumannBoundary);
}
// Assembles constant 1-function on frictional boundary in nodalIntegrals
template <class GridType, class GridView, class LocalVectorType,
class AssemblerType>
template <class GridView, class LocalVectorType, class AssemblerType>
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional(GridView const &gridView, AssemblerType const &assembler,
Dune::BitSetVector<1> const &frictionalNodes) {
typedef Dune::FieldVector<double, 1> Singleton;
BoundaryPatch<GridView> const frictionalBoundary(gridView, frictionalNodes);
ConstantFunction<LocalVectorType, Singleton> const constantOneFunction(1);
NeumannBoundaryAssembler<GridType, Singleton> frictionalBoundaryAssembler(
constantOneFunction);
NeumannBoundaryAssembler<typename GridView::Grid, Singleton>
frictionalBoundaryAssembler(constantOneFunction);
auto const nodalIntegrals = Dune::make_shared<Dune::BlockVector<Singleton>>();
assembler.assembleBoundaryFunctional(frictionalBoundaryAssembler,
......
......@@ -12,16 +12,14 @@
#include <dune/tectonic/globalnonlinearity.hh>
template <class GridType, class GridView, class LocalVectorType,
class AssemblerType>
template <class GridView, class LocalVectorType, class AssemblerType>
void assemble_neumann(GridView const &gridView, AssemblerType const &assembler,
Dune::BitSetVector<1> const &neumannNodes,
Dune::BlockVector<LocalVectorType> &f,
Dune::VirtualFunction<double, double> const &neumann,
double time);
template <class GridType, class GridView, class LocalVectorType,
class AssemblerType>
template <class GridView, class LocalVectorType, class AssemblerType>
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional(GridView const &gridView, AssemblerType const &assembler,
Dune::BitSetVector<1> const &frictionalNodes);
......
......@@ -20,14 +20,14 @@ typedef GridType::LeafGridView GridView;
typedef P1NodalBasis<GridView, double> P1Basis;
typedef Assembler<P1Basis, P1Basis> AssemblerType;
template void assemble_neumann<GridType, GridView, SmallVector, AssemblerType>(
template void assemble_neumann<GridView, SmallVector, AssemblerType>(
GridView const &gridView, AssemblerType const &assembler,
Dune::BitSetVector<1> const &neumannNodes,
Dune::BlockVector<SmallVector> &f,
Dune::VirtualFunction<double, double> const &neumann, double time);
template Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional<GridType, GridView, SmallVector, AssemblerType>(
assemble_frictional<GridView, SmallVector, AssemblerType>(
GridView const &gridView, AssemblerType const &assembler,
Dune::BitSetVector<1> const &frictionalNodes);
......
......@@ -320,9 +320,8 @@ int main(int argc, char *argv[]) {
SumNorm<VectorType> const velocityEnergyNorm(1.0, stiffnessMatrixNorm, 1.0,
massMatrixNorm);
auto const nodalIntegrals =
assemble_frictional<GridType, GridView, SmallVector>(
leafView, p1Assembler, frictionalNodes);
auto const nodalIntegrals = assemble_frictional<GridView, SmallVector>(
leafView, p1Assembler, frictionalNodes);
// {{{ Initial conditions
VectorType u_initial(finestSize);
......@@ -374,8 +373,8 @@ int main(int argc, char *argv[]) {
auto const timesteps = parset.get<size_t>("timeSteps");
auto const tau = parset.get<double>("endOfTime") / timesteps;
auto const createRHS = [&](double _time, VectorType &_ell) {
assemble_neumann<GridType>(leafView, p1Assembler, neumannNodes, _ell,
neumannFunction, _time);
assemble_neumann(leafView, p1Assembler, neumannNodes, _ell,
neumannFunction, _time);
_ell += gravityFunctional;
};
......
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