Allow to set the partition type to assemble on

Some forms of distributed computing require assembly on the Interior
partition of each subdomain.  However, current OperatorAssembler has
the All partition hard-wired, leading to unwanted contributions
of ghost elements.

This patch introduces a new template parameter for the OperatorAssembler
class that allows to set the partition type.  The parameter defaults
to All, hence this change is fully backward-compatible.
parent a41d0a1c
Pipeline #17127 passed with stage
in 57 minutes and 51 seconds
......@@ -2,6 +2,7 @@
#define OPERATOR_ASSEMBLER_HH
#include <dune/grid/common/rangegenerators.hh>
#include <dune/grid/common/partitionset.hh>
#include <dune/istl/matrix.hh>
#include <dune/istl/matrixindexset.hh>
......@@ -10,8 +11,11 @@
#include "dune/fufem/functionspacebases/functionspacebasis.hh"
//! Generic global assembler for operators on a gridview
template <class TrialBasis, class AnsatzBasis>
/** \brief Generic global assembler for operators on a gridview
*
* \tparam PartitionSet For distributed grids: The subset of the grid elements to assemble on
*/
template <class TrialBasis, class AnsatzBasis, class PartitionSet=Dune::Partitions::All>
class OperatorAssembler
{
private:
......@@ -72,7 +76,7 @@ class OperatorAssembler
typedef typename LocalAssemblerType::BoolMatrix BoolMatrix;
typedef typename TrialBasis::LinearCombination LinearCombination;
for (const auto& element : Dune::elements(tBasis_.getGridView()))
for (const auto& element : Dune::elements(tBasis_.getGridView(), PartitionSet()))
{
// get shape functions
const typename TrialBasis::LocalFiniteElement& tFE = tBasis_.getLocalFiniteElement(element);
......@@ -139,7 +143,7 @@ class OperatorAssembler
typedef typename LocalAssemblerType::LocalMatrix LocalMatrix;
typedef typename TrialBasis::LinearCombination LinearCombination;
for (const auto& element : Dune::elements(tBasis_.getGridView()))
for (const auto& element : Dune::elements(tBasis_.getGridView(), PartitionSet()))
{
// get shape functions
const typename TrialBasis::LocalFiniteElement& tFE = tBasis_.getLocalFiniteElement(element);
......
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