1 #ifndef DUNE_PDELAB_GRIDOPERATOR_GRIDOPERATOR_HH 2 #define DUNE_PDELAB_GRIDOPERATOR_GRIDOPERATOR_HH 9 #include <dune/common/hybridutilities.hh> 27 "the nonoverlapping_mode parameter on the
GridOperator has been deprecated and will be removed after PDELab 2.4."
28 "The correct mode is now automatically deduced from the EntitySet of the function space.")
52 template<
typename GFSU,
typename GFSV,
typename LOP,
53 typename MB,
typename DF,
typename RF,
typename JF,
56 int nonoverlapping_mode = -1>
62 static_assert(nonoverlapping_mode == -1 ||
63 nonoverlapping_mode == 0 ||
64 nonoverlapping_mode == 1,
65 "invalid value for nonoverlapping_mode! This parameter is also deprecated in PDELab 2.4, so please remove it from your typedefs!");
84 GFSU::Traits::EntitySet::Partitions::partitionIterator() == InteriorBorder_Partition
88 typedef typename std::conditional<
89 GFSU::Traits::EntitySet::Partitions::partitionIterator() == InteriorBorder_Partition,
98 template <
typename MFT>
104 GridOperator(
const GFSU & gfsu_,
const CU & cu_,
const GFSV & gfsv_,
const CV & cv_, LOP & lop_,
const MB& mb_ = MB())
105 : global_assembler(gfsu_,gfsv_,cu_,cv_)
106 , dof_exchanger(
std::make_shared<BorderDOFExchanger>(*this))
107 , local_assembler(lop_, cu_, cv_,dof_exchanger)
112 GridOperator(
const GFSU & gfsu_,
const GFSV & gfsv_, LOP & lop_,
const MB& mb_ = MB())
113 : global_assembler(gfsu_,gfsv_)
114 , dof_exchanger(
std::make_shared<BorderDOFExchanger>(*this))
115 , local_assembler(lop_,dof_exchanger)
122 return global_assembler.trialGridFunctionSpace();
128 return global_assembler.testGridFunctionSpace();
134 return trialGridFunctionSpace().globalSize();
140 return testGridFunctionSpace().globalSize();
145 const Assembler &
assembler()
const {
return global_assembler; }
152 template <
typename Gr
idOperatorTuple>
155 : index(0), size(
std::tuple_size<GridOperatorTuple>::
value) {}
157 template <
typename T>
159 elem.localAssembler().doPreProcessing = index == 0;
160 elem.localAssembler().doPostProcessing = index == size-1;
171 template<
typename Gr
idOperatorTuple>
174 SetupGridOperator<GridOperatorTuple> setup_visitor;
175 Hybrid::forEach(tuple,
176 [&](
auto &el) { setup_visitor.visit(el); });
180 template<
typename F,
typename X>
193 PatternEngine & pattern_engine = local_assembler.localPatternAssemblerEngine(p);
194 global_assembler.assemble(pattern_engine);
200 ResidualEngine & residual_engine = local_assembler.localResidualAssemblerEngine(r,x);
201 global_assembler.assemble(residual_engine);
207 JacobianEngine & jacobian_engine = local_assembler.localJacobianAssemblerEngine(a,x);
208 global_assembler.assemble(jacobian_engine);
214 JacobianApplyEngine & jacobian_apply_engine = local_assembler.localJacobianApplyAssemblerEngine(r,z);
215 global_assembler.assemble(jacobian_apply_engine);
220 global_assembler.assemble(local_assembler.localNonlinearJacobianApplyAssemblerEngine(r,x,z));
225 dof_exchanger->accumulateBorderEntries(*
this,a);
231 dof_exchanger->update(*
this);
241 Assembler global_assembler;
242 shared_ptr<BorderDOFExchanger> dof_exchanger;
251 #endif // DUNE_PDELAB_GRIDOPERATOR_GRIDOPERATOR_HH void nonlinear_jacobian_apply(const Domain &x, const Domain &z, Range &r) const
Apply jacobian matrix without explicitly assembling it.
Definition: gridoperator.hh:219
int index
Definition: gridoperator.hh:164
typename impl::BackendVectorSelector< GridFunctionSpace, FieldType >::Type Vector
alias of the return type of BackendVectorSelector
Definition: backend/interface.hh:106
Dune::PDELab::Backend::Vector< GFS, field_type > Range
The type of the range (residual).
Definition: gridoperator.hh:73
GFSU::Traits::SizeType globalSizeU() const
Get dimension of space u.
Definition: gridoperator.hh:132
MB MatrixBackend
The matrix backend of the grid operator.
Definition: gridoperatorutilities.hh:51
Traits class for the grid operator.
Definition: gridoperatorutilities.hh:33
void interpolate(const X &xold, F &f, X &x) const
Interpolate the constrained dofs from given function.
Definition: gridoperator.hh:181
Assembler & assembler()
Definition: gridoperator.hh:143
MBE ::template Pattern< Jacobian, GFS, CGGFS > Pattern
The sparsity pattern container for the jacobian matrix.
Definition: gridoperator.hh:78
SetupGridOperator()
Definition: gridoperator.hh:154
void visit(T &elem)
Definition: gridoperator.hh:158
const Traits::MatrixBackend & matrixBackend() const
Get the matrix backend for this grid operator.
Definition: gridoperator.hh:235
Dune::PDELab::Backend::Vector< CGGFS, field_type > Domain
The type of the domain (solution).
Definition: gridoperator.hh:71
Definition: gridoperator.hh:23
void update()
Definition: gridoperator.hh:228
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
Dune::PDELab::GridOperatorTraits< GFSU, GFSV, MB, DF, RF, JF, CU, CV, Assembler, LocalAssembler > Traits
The grid operator traits.
Definition: gridoperator.hh:96
Dune::PDELab::Backend::Matrix< MB, Domain, Range, JF > Jacobian
The type of the jacobian.
Definition: gridoperatorutilities.hh:72
Standard grid operator implementation.
Definition: gridoperator.hh:57
typename impl::BackendMatrixSelector< Backend, VU, VV, E >::Type Matrix
alias of the return type of BackendMatrixSelector
Definition: backend/interface.hh:127
void jacobian(const Domain &x, Jacobian &a) const
Assembler jacobian.
Definition: gridoperator.hh:205
const GFSV & testGridFunctionSpace() const
Get the test grid function space.
Definition: gridoperator.hh:126
void make_consistent(Jacobian &a) const
Definition: gridoperator.hh:224
Dune::PDELab::Backend::Matrix< MBE, Domain, Range, field_type > Jacobian
The type of the jacobian.
Definition: gridoperator.hh:75
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
The local assembler for DUNE grids.
Definition: default/localassembler.hh:32
The assembler for standard DUNE grid.
Definition: default/assembler.hh:23
static void setupGridOperators(GridOperatorTuple tuple)
Definition: gridoperator.hh:172
Helper class for adding up matrix entries on border.
Definition: borderdofexchanger.hh:67
Definition: gridoperator.hh:153
GFSV::Traits::SizeType globalSizeV() const
Get dimension of space v.
Definition: gridoperator.hh:138
Definition: borderdofexchanger.hh:577
void copy_nonconstrained_dofs(const CG &cg, const XG &xgin, XG &xgout)
Definition: constraints.hh:989
const GFSU & trialGridFunctionSpace() const
Get the trial grid function space.
Definition: gridoperator.hh:120
void residual(const Domain &x, Range &r) const
Assemble residual.
Definition: gridoperator.hh:198
warn_on_deprecated_nonoverlapping_mode_parameter()
Definition: gridoperator.hh:26
const P & p
Definition: constraints.hh:147
void fill_pattern(Pattern &p) const
Fill pattern of jacobian matrix.
Definition: gridoperator.hh:191
Definition: gridoperator.hh:99
void interpolate(const F &f, const GFS &gfs, XG &xg)
interpolation from a given grid function
Definition: interpolate.hh:191
const Assembler & assembler() const
Definition: gridoperator.hh:145
DefaultLocalAssembler< GridOperator, LOP, GFSU::Traits::EntitySet::Partitions::partitionIterator()==InteriorBorder_Partition > LocalAssembler
The local assembler type.
Definition: gridoperator.hh:85
Traits::Jacobian Type
Definition: gridoperator.hh:100
GridOperator(const GFSU &gfsu_, const CU &cu_, const GFSV &gfsv_, const CV &cv_, LOP &lop_, const MB &mb_=MB())
Constructor for non trivial constraints.
Definition: gridoperator.hh:104
Definition: constraintstransformation.hh:111
LocalAssembler & localAssembler() const
Definition: gridoperator.hh:147
const int size
Definition: gridoperator.hh:165
GridOperator(const GFSU &gfsu_, const GFSV &gfsv_, LOP &lop_, const MB &mb_=MB())
Constructor for empty constraints.
Definition: gridoperator.hh:112
void jacobian_apply(const Domain &z, Range &r) const
Apply jacobian matrix without explicitly assembling it.
Definition: gridoperator.hh:212
std::conditional< GFSU::Traits::EntitySet::Partitions::partitionIterator()==InteriorBorder_Partition, NonOverlappingBorderDOFExchanger< GridOperator >, OverlappingBorderDOFExchanger< GridOperator > >::type BorderDOFExchanger
Definition: gridoperator.hh:92