Skip to content
Snippets Groups Projects
Commit d42da6be authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Make dune-assembler optional again

parent 545ea074
No related branches found
No related tags found
No related merge requests found
Pipeline #77928 failed
......@@ -5,7 +5,6 @@
# that already contain all core and staging dependencies.
.release_based_job:
before_script:
- duneci-install-module https://gitlab.dune-project.org/staging/dune-assembler.git
- duneci-install-module https://gitlab.dune-project.org/extensions/dune-alugrid.git
- duneci-install-module https://gitlab.dune-project.org/extensions/dune-subgrid.git
- duneci-install-module https://gitlab.dune-project.org/extensions/dune-vtk.git
......
Module: dune-fufem
Depends: dune-common (>= 2.9) dune-geometry (>= 2.9) dune-grid (>= 2.9) dune-istl (>= 2.9) dune-localfunctions (>= 2.9) dune-functions (>= 2.9) dune-matrix-vector (>= 2.9) dune-vtk(>= 2.9) dune-assembler(>= 2.11)
Depends: dune-common (>= 2.9) dune-geometry (>= 2.9) dune-grid (>= 2.9) dune-istl (>= 2.9) dune-localfunctions (>= 2.9) dune-functions (>= 2.9) dune-matrix-vector (>= 2.9) dune-vtk(>= 2.9)
Version: 2.11-git
Maintainer: Carsten Gräser (graeser@math.fau.de)
Suggests: dune-alugrid dune-subgrid
Suggests: dune-alugrid dune-subgrid dune-assembler(>= 2.11)
......@@ -9,13 +9,16 @@
#include <dune/common/std/type_traits.hh>
#if HAVE_DUNE_ASSEMBLER
#include <dune/assembler/assemblerconcepts.hh>
#endif
#include <dune/fufem/forms/baseclass.hh>
namespace Dune::Fufem::Forms {
#if HAVE_DUNE_ASSEMBLER
namespace Impl {
template <class LocalAssembler, class Element>
......@@ -49,6 +52,7 @@ namespace Dune::Fufem::Forms {
};
}
#endif
......@@ -113,6 +117,7 @@ namespace Dune::Fufem::Forms {
});
}
#if HAVE_DUNE_ASSEMBLER
template<class Element, class LocalMatrix>
void assembleElementMatrix (const Element& element, LocalMatrix& localMatrix)
requires (Impl::HasAssembleElementMatrix<LocalAssemblers, Element> || ...)
......@@ -191,6 +196,7 @@ namespace Dune::Fufem::Forms {
localAssembler.assembleBoundaryIntersectionVector(intersection, localVector);
});
}
#endif
// Old Dune::Fufem matrix-assember interface
......
......@@ -33,14 +33,16 @@
#include <dune/functions/gridfunctions/gridviewfunction.hh>
#include <dune/fufem/parallel/elementcoloring.hh>
//#include <dune/fufem/assemblers/dunefunctionsoperatorassembler.hh>
#include <dune/fufem/assemblers/dunefunctionsoperatorassembler.hh>
#include <dune/fufem/assemblers/dunefunctionsfunctionalassembler.hh>
//#include <dune/fufem/backends/istlmatrixbackend.hh>
#include <dune/fufem/backends/istlmatrixbackend.hh>
#include <dune/fufem/functiontools/boundarydofs.hh>
#include <dune/fufem/forms/forms.hh>
#if HAVE_DUNE_ASSEMBLER
#include <dune/assembler/defaultglobalassembler.hh>
#include <dune/assembler/backends/istlmatrixbackend.hh>
#endif
#include "utilities.hh"
......@@ -54,6 +56,7 @@ auto makeEnergyNorm(Form form, const Partition& coloredGridViewPartition, int th
{
const auto& [testBasis, trialBasis] = form.integrandOperator().basis();
#if HAVE_DUNE_ASSEMBLER
auto assembler = Dune::Assembler::Assembler(testBasis, trialBasis);
Matrix M;
......@@ -67,6 +70,11 @@ auto makeEnergyNorm(Form form, const Partition& coloredGridViewPartition, int th
patternBackend.setupMatrix();
assembler.assembleMatrix(form, matrixBackend);
#else
auto matrixBackend = Dune::Fufem::istlMatrixBackend(M);
auto operatorAssembler = Dune::Fufem::DuneFunctionsOperatorAssembler(testBasis, trialBasis);
operatorAssembler.assembleBulk(matrixBackend, form, coloredGridViewPartition, threadCount);
#endif
return [M = M](const auto& v) {
auto Mv = v;
......
......@@ -51,8 +51,11 @@
#include <dune/fufem/forms/forms.hh>
#if HAVE_DUNE_ASSEMBLER
#include <dune/assembler/defaultglobalassembler.hh>
#include <dune/assembler/backends/istlmatrixbackend.hh>
#include <dune/assembler/backends/istlvectorbackend.hh>
#endif
#include "utilities.hh"
......@@ -188,8 +191,13 @@ int main (int argc, char *argv[]) try
using BitVector = MultiTypeBlockVector<VelocityBitVector, PressureBitVector>;
using Matrix00 = BCRSMatrix<FieldMatrix<double,dim,dim>>;
#if HAVE_DUNE_ASSEMBLER
using Matrix01 = BCRSMatrix<Dune::Assembler::SingleColumnMatrix<FieldMatrix<double,dim,1>>>;
using Matrix10 = BCRSMatrix<Dune::Assembler::SingleRowMatrix<FieldMatrix<double,1,dim>>>;
#else
using Matrix01 = BCRSMatrix<Dune::Fufem::SingleColumnMatrix<FieldMatrix<double,dim,1>>>;
using Matrix10 = BCRSMatrix<Dune::Fufem::SingleRowMatrix<FieldMatrix<double,1,dim>>>;
#endif
using Matrix11 = BCRSMatrix<double>; /*@\label{li:matrix_type_pressure_pressure}@*/
using MatrixRow0 = MultiTypeBlockVector<Matrix00, Matrix01>;
using MatrixRow1 = MultiTypeBlockVector<Matrix10, Matrix11>;
......@@ -234,6 +242,7 @@ int main (int argc, char *argv[]) try
auto A = integrate( dot(grad(u), grad(v)) - div(u)*q - div(v)*p );
#if HAVE_DUNE_ASSEMBLER
auto matrixBackend = Dune::Assembler::ISTLMatrixBackend(stiffnessMatrix);
auto patternBackend = matrixBackend.patternBuilder();
......@@ -246,6 +255,10 @@ int main (int argc, char *argv[]) try
assembler.assembleMatrixPattern(A, patternBackend);
patternBackend.setupMatrix();
assembler.assembleMatrix(A, matrixBackend);
#else
auto assembler = GlobalAssembler(taylorHoodBasis, taylorHoodBasis, 0, std::cref(gridViewPartition), threadCount);
assembler.assembleOperator(matrixBackend, A);
#endif
std::cout << "Assembling the problem took " << timer.elapsed() << "s" << std::endl;
}
......
......@@ -24,9 +24,11 @@
#include <dune/fufem/assemblers/dunefunctionsoperatorassembler.hh>
#include <dune/fufem/assemblers/dunefunctionsfunctionalassembler.hh>
#if HAVE_DUNE_ASSEMBLER
#include <dune/assembler/defaultglobalassembler.hh>
#include <dune/assembler/backends/istlvectorbackend.hh>
#include <dune/assembler/backends/istlmatrixbackend.hh>
#endif
......@@ -61,6 +63,7 @@ public:
void assembleOperator(Matrix& matrix, LocalAssembler&& localAssembler) const
{
Dune::Timer timer;
#if HAVE_DUNE_ASSEMBLER
auto assembler = Dune::Assembler::Assembler(testBasis_, trialBasis_);
auto&& matrixBackend = Dune::Assembler::ISTLMatrixBackend(matrix);
......@@ -73,6 +76,12 @@ public:
patternBuilder.setupMatrix();
assembler.assembleMatrix(localAssembler, matrixBackend);
#else
auto operatorAssembler = Dune::Fufem::DuneFunctionsOperatorAssembler{testBasis_, trialBasis_};
std::apply([&](auto&&... args) {
operatorAssembler.assembleBulk(matrix, localAssembler, Dune::resolveRef(args)...);
}, args_);
#endif
if (verbosity_>0)
std::cout << "Assembling operator took " << timer.elapsed() << "s" << std::endl;
}
......@@ -104,14 +113,20 @@ public:
void assembleFunctional(Vector& vector, LocalAssembler&& localAssembler) const
{
Dune::Timer timer;
#if HAVE_DUNE_ASSEMBLER
auto assembler = Dune::Assembler::Assembler(testBasis_);
auto functionalAssembler = Dune::Fufem::DuneFunctionsFunctionalAssembler{testBasis_};
auto vectorBackend = Dune::Assembler::ISTLVectorBackend(vector);
vectorBackend.resize(testBasis_);
vector = 0.0;
vectorBackend.setZero();
assembler.assembleVector(localAssembler, vectorBackend);
#else
std::apply([&](auto&&... args) {
functionalAssembler.assembleBulk(vector, localAssembler, Dune::resolveRef(args)...);
}, args_);
#endif
if (verbosity_>0)
std::cout << "Assembling functional took " << timer.elapsed() << "s" << std::endl;
}
......
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