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

Constness, minor cleanup

parent 46b107ca
No related branches found
No related tags found
No related merge requests found
...@@ -110,21 +110,19 @@ void assemble_neumann(GridView const &gridView, FEBasis const &feBasis, ...@@ -110,21 +110,19 @@ void assemble_neumann(GridView const &gridView, FEBasis const &feBasis,
Dune::BlockVector<LocalVectorType> &f, Dune::BlockVector<LocalVectorType> &f,
double time) { // constant sample function on neumann double time) { // constant sample function on neumann
// boundary // boundary
BoundaryPatch<GridView> neumannBoundary(gridView, neumannNodes); BoundaryPatch<GridView> const neumannBoundary(gridView, neumannNodes);
LocalVectorType SampleVector(0); LocalVectorType SampleVector(0);
// FIXME: random values (time-dependent) // FIXME: random values (time-dependent)
SampleVector[0] = SampleVector[0] =
(time <= 0.5) ? sin(time * 2 * M_PI) * 1e3 : (time - 0.5) * 2 * 1e4; (time <= 0.5) ? sin(time * 2 * M_PI) * 1e3 : (time - 0.5) * 2 * 1e4;
SampleVector[1] = 0; SampleVector[1] = 0;
ConstantFunction<LocalVectorType, LocalVectorType> fNeumann(SampleVector); ConstantFunction<LocalVectorType, LocalVectorType> const fNeumann(
SampleVector);
NeumannBoundaryAssembler<GridType, LocalVectorType> neumannBoundaryAssembler( NeumannBoundaryAssembler<GridType, LocalVectorType> neumannBoundaryAssembler(
fNeumann); fNeumann);
BoundaryFunctionalAssembler<FEBasis> boundaryFunctionalAssembler( BoundaryFunctionalAssembler<FEBasis>(feBasis, neumannBoundary).assemble(
feBasis, neumannBoundary); neumannBoundaryAssembler, f, true); // resize and zero output vector
boundaryFunctionalAssembler.assemble(
neumannBoundaryAssembler, f,
true); // whether to resize the output vector and zero all of its entries
} }
// Assembles constant 1-function on frictional boundary in nodalIntegrals // Assembles constant 1-function on frictional boundary in nodalIntegrals
...@@ -133,12 +131,12 @@ Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> ...@@ -133,12 +131,12 @@ Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional(GridView const &gridView, FEBasis const &feBasis, assemble_frictional(GridView const &gridView, FEBasis const &feBasis,
Dune::BitSetVector<1> const &frictionalNodes) { Dune::BitSetVector<1> const &frictionalNodes) {
typedef Dune::FieldVector<double, 1> Singleton; typedef Dune::FieldVector<double, 1> Singleton;
BoundaryPatch<GridView> frictionalBoundary(gridView, frictionalNodes); BoundaryPatch<GridView> const frictionalBoundary(gridView, frictionalNodes);
ConstantFunction<LocalVectorType, Singleton> constantOneFunction(1); ConstantFunction<LocalVectorType, Singleton> const constantOneFunction(1);
NeumannBoundaryAssembler<GridType, Singleton> frictionalBoundaryAssembler( NeumannBoundaryAssembler<GridType, Singleton> frictionalBoundaryAssembler(
constantOneFunction); constantOneFunction);
auto nodalIntegrals = Dune::make_shared<Dune::BlockVector<Singleton>>(); auto const nodalIntegrals = Dune::make_shared<Dune::BlockVector<Singleton>>();
BoundaryFunctionalAssembler<FEBasis>(feBasis, frictionalBoundary) BoundaryFunctionalAssembler<FEBasis>(feBasis, frictionalBoundary)
.assemble(frictionalBoundaryAssembler, *nodalIntegrals, .assemble(frictionalBoundaryAssembler, *nodalIntegrals,
true); // resize and zero output vector true); // resize and zero output vector
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment