Commit e53f5c6f authored by Müller, Felix's avatar Müller, Felix Committed by Praetorius, Simon
Browse files

Make SymmetryStructure a member of BiLinearForm

Add BiLinearForm::setSymmetryStructure
Change SymmetryStructure is now supposed to be set by the user after adding operators
parent 2a2ec748
......@@ -52,6 +52,7 @@ namespace AMDiS
BiLinearForm(std::shared_ptr<RB> const& rowBasis, std::shared_ptr<CB> const& colBasis)
: Super(*rowBasis, *colBasis)
, ObserverSequence<event::adapt,2>(*rowBasis, *colBasis)
, symmetry_(SymmetryStructure::unknown)
, rowBasis_(rowBasis)
, colBasis_(colBasis)
{
......@@ -128,6 +129,15 @@ namespace AMDiS
}
/// @}
/// Set the symmetry property of the bilinear form
void setSymmetryStructure(SymmetryStructure symm)
{
symmetry_ = symm;
}
/// Set the symmetry property using a string
void setSymmetryStructure(std::string str) { setSymmetryStructure(symmetryStructure(str)); }
/// Assemble the matrix operators on the bound element.
template <class RowLocalView, class ColLocalView,
REQUIRES(Concepts::LocalView<RowLocalView>),
......@@ -136,15 +146,13 @@ namespace AMDiS
ColLocalView const& colLocalView);
/// Assemble all matrix operators, TODO: incorporate boundary conditions
void assemble(SymmetryStructure symmetry = SymmetryStructure::unknown);
void assemble();
void init(SymmetryStructure symmetry = SymmetryStructure::unknown)
void init()
{
Super::init(pattern_, symmetry);
Super::init(pattern_, symmetry_);
}
using Super::init;
void updateImpl(event::adapt e, index_t<0> i) override { updateImpl2(e,i); }
void updateImpl(event::adapt e, index_t<1> i) override { updateImpl2(e,i); }
......@@ -166,6 +174,9 @@ namespace AMDiS
/// The structure of the non-zeros in the matrix
SparsityPattern pattern_;
/// The symmetry property if the bilinear form
SymmetryStructure symmetry_;
/// Dense matrix to store coefficients during \ref assemble()
ElementMatrix elementMatrix_;
......
......@@ -63,12 +63,12 @@ assemble(RowLocalView const& rowLocalView, ColLocalView const& colLocalView)
template <class RB, class CB, class T, class Traits>
void BiLinearForm<RB,CB,T,Traits>::
assemble(SymmetryStructure symmetry)
assemble()
{
auto rowLocalView = this->rowBasis()->localView();
auto colLocalView = this->colBasis()->localView();
this->init(symmetry);
this->init();
for (auto const& element : elements(this->rowBasis()->gridView(), typename Traits::PartitionSet{})) {
rowLocalView.bind(element);
if (this->rowBasis() == this->colBasis())
......
......@@ -219,6 +219,10 @@ template <class Traits>
void ProblemStat<Traits>::createMatricesAndVectors()
{
systemMatrix_ = std::make_shared<SystemMatrix>(globalBasis_, globalBasis_);
std::string symmetryStr = "unknown";
Parameters::get(name_ + "->symmetry", symmetryStr);
systemMatrix_->setSymmetryStructure(symmetryStr);
solution_ = std::make_shared<SolutionVector>(globalBasis_);
rhs_ = std::make_shared<SystemVector>(globalBasis_);
......@@ -476,10 +480,7 @@ buildAfterAdapt(AdaptInfo& /*adaptInfo*/, Flag /*flag*/, bool asmMatrix, bool as
t2.reset();
// 1. init matrix and rhs vector and initialize dirichlet boundary conditions
std::string symmetryStr = "unknown";
Parameters::get(name_ + "->symmetry", symmetryStr);
systemMatrix_->init(symmetryStructure(symmetryStr));
systemMatrix_->init();
rhs_->init(sizeInfo(*globalBasis_), asmVector);
// statistic about system size
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment