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

Make assemble_frictional a factory method

parent 3441176f
Branches
No related tags found
No related merge requests found
...@@ -122,21 +122,21 @@ void assemble_neumann(GridView const &gridView, FEBasis const &feBasis, ...@@ -122,21 +122,21 @@ void assemble_neumann(GridView const &gridView, FEBasis const &feBasis,
// Assembles constant 1-function on frictional boundary in nodalIntegrals // Assembles constant 1-function on frictional boundary in nodalIntegrals
template <class GridType, class GridView, class LocalVectorType, class FEBasis> template <class GridType, class GridView, class LocalVectorType, class FEBasis>
void assemble_frictional( Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
GridView const &gridView, FEBasis const &feBasis, assemble_frictional(GridView const &gridView, FEBasis const &feBasis,
Dune::BitSetVector<1> const &frictionalNodes, Dune::BitSetVector<1> const &frictionalNodes) {
Dune::BlockVector<Dune::FieldVector<double, 1>> &nodalIntegrals) {
BoundaryPatch<GridView> frictionalBoundary(gridView, frictionalNodes); BoundaryPatch<GridView> frictionalBoundary(gridView, frictionalNodes);
ConstantFunction<LocalVectorType, Dune::FieldVector<double, 1>> ConstantFunction<LocalVectorType, Dune::FieldVector<double, 1>>
constantOneFunction(1); constantOneFunction(1);
NeumannBoundaryAssembler<GridType, Dune::FieldVector<double, 1>> NeumannBoundaryAssembler<GridType, Dune::FieldVector<double, 1>>
frictionalBoundaryAssembler(constantOneFunction); frictionalBoundaryAssembler(constantOneFunction);
BoundaryFunctionalAssembler<FEBasis> boundaryFunctionalAssembler( auto nodalIntegrals =
feBasis, frictionalBoundary); Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>();
boundaryFunctionalAssembler.assemble( BoundaryFunctionalAssembler<FEBasis>(feBasis, frictionalBoundary)
frictionalBoundaryAssembler, nodalIntegrals, .assemble(frictionalBoundaryAssembler, *nodalIntegrals,
true); // whether to resize the output vector and zero all of its entries true); // resize and zero output vector
return nodalIntegrals;
} }
template <class VectorType, class MatrixType> template <class VectorType, class MatrixType>
...@@ -267,9 +267,8 @@ int main(int argc, char *argv[]) { ...@@ -267,9 +267,8 @@ int main(int argc, char *argv[]) {
VectorType b4; VectorType b4;
auto nodalIntegrals = auto nodalIntegrals =
Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>(); assemble_frictional<GridType, GridView, SmallVector, P1Basis>(
assemble_frictional<GridType, GridView, SmallVector, P1Basis>( leafView, p1Basis, frictionalNodes);
leafView, p1Basis, frictionalNodes, *nodalIntegrals);
auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>( auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>(
grid->size(grid->maxLevel(), dim), parset, nodalIntegrals); grid->size(grid->maxLevel(), dim), parset, nodalIntegrals);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment