1 #ifndef DUNE_FEM_PASS_DGINVERSEMASS_HH 2 #define DUNE_FEM_PASS_DGINVERSEMASS_HH 9 #include <dune/common/typetraits.hh> 26 template<
int functionalId,
class PreviousPass >
30 typedef typename PreviousPass::PassIds PassIds;
31 typedef typename PreviousPass::NextArgumentType LocalArgumentType;
32 typedef typename PreviousPass::GlobalArgumentType GlobalArgumentType;
33 typedef typename PushFrontTuple< LocalArgumentType, GlobalArgumentType * >::type TotalArgumentType;
37 = Dune::FirstTypeIndex< PassIds, std::integral_constant< int, functionalId > >::type::value;
38 typedef typename std::tuple_element< functionalPosition, TotalArgumentType >::type
DestinationPtrType;
42 typedef typename Dune::TypeTraits< DestinationPtrType >::PointeeType
DestinationType;
60 template<
int functionalId,
class PreviousPass,
int id >
62 :
public Dune::Fem::LocalPass< DGInverseMassPassDiscreteModel< functionalId, PreviousPass >, PreviousPass, id >
85 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
89 typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
91 using BaseType::passNumber;
92 using BaseType::space;
95 const DiscreteFunctionSpaceType &space )
96 : BaseType( previousPass, space,
"DGInverseMassPass" ),
97 localMassMatrix_( space, 2*space.order() ),
104 PreviousPass &previousPass,
105 const DiscreteFunctionSpaceType &space,
106 const int volQuadOrd = -1,
107 const int faceQuadOrd = -1)
108 : BaseType( previousPass, space,
"DGInverseMassPass" ),
109 localMassMatrix_( space, ( volQuadOrd == -1 ) ? (2*space.order()) : volQuadOrd ),
116 BaseType::printTexInfo( out );
117 out <<
"DGInverseMassPass: " <<
"\\\\" << std::endl;
124 void prepare(
const TotalArgumentType &argument, DestinationType &destination )
const 127 dest_ = &destination;
131 void prepare(
const TotalArgumentType &argument, DestinationType &destination,
const bool )
const 133 prepare( argument, destination );
137 void finalize(
const TotalArgumentType &argument, DestinationType &destination,
const bool )
const 139 finalize( argument, destination );
143 void finalize(
const TotalArgumentType &argument, DestinationType &destination )
const 154 typename DestinationType::LocalFunctionType localDestination = dest_->localFunction( entity );
155 localDestination.assign( std::get< functionalPosition >( *arg_ )->localFunction( entity ) );
156 localMassMatrix_.applyInverse( entity, localDestination );
160 template <
class NBChecker>
161 void applyLocal(
const EntityType& entity,
const NBChecker& )
const 163 applyLocal( entity );
169 template <
class NBChecker>
172 applyLocal( entity );
178 template <
class NBChecker>
181 DUNE_THROW(InvalidStateException,
"DGInverseMassPass does not need a second phase for ThreadPass");
185 void compute (
const TotalArgumentType &argument, DestinationType &destination )
const 188 prepare( argument, destination );
190 typedef typename GridPartType::template Codim< 0 >::template Partition< All_Partition >::IteratorType
IteratorType;
191 const GridPartType &gridPart = space().gridPart();
192 const IteratorType end = gridPart.template end< 0, All_Partition >();
193 for( IteratorType it = gridPart.template begin< 0, All_Partition >(); it != end; ++it )
199 finalize( argument, destination );
203 using BaseType::destination_;
204 using BaseType::deleteHandler_;
207 LocalMassMatrixType localMassMatrix_;
209 mutable const TotalArgumentType* arg_;
210 mutable DestinationType* dest_;
217 #endif // #ifndef DUNE_FEM_PASS_APPLYLOCALOPERATOR_HH DiscreteFunctionSpaceType::IteratorType IteratorType
iterator over the space
Definition: local.hh:52
void applyLocalInterior(const EntityType &entity, const NBChecker &) const
apply local for all elements that do not need information from other processes (here all elements) ...
Definition: dginversemass.hh:170
CachingQuadrature< typename DiscreteFunctionSpaceType::GridPartType, 1 > FaceQuadratureType
Definition: dginversemass.hh:45
DiscreteModelType::Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
discrete function space type
Definition: dginversemass.hh:80
static const std::size_t functionalPosition
Definition: dginversemass.hh:37
Dune::TypeTraits< DestinationPtrType >::PointeeType DestinationType
Definition: dginversemass.hh:42
Pass applying the local inverse mass matrix on each element.
Definition: dginversemass.hh:61
DiscreteModelImp::Traits::DestinationType DestinationType
the discrete function representing the return value of this pass
Definition: local.hh:48
void compute(const TotalArgumentType &argument, DestinationType &destination) const
Definition: dginversemass.hh:185
BaseType::PassIds PassIds
pass ids up to here (tuple of integral constants)
Definition: dginversemass.hh:72
void printTexInfo(std::ostream &out) const
Definition: dginversemass.hh:114
quadrature class supporting base function caching
Definition: cachingquadrature.hh:41
DGInverseMassPass(PreviousPass &previousPass, const DiscreteFunctionSpaceType &space)
Definition: dginversemass.hh:94
DGInverseMassPassDiscreteModel< functionalId, PreviousPass > DiscreteModelType
type of the discrete model used
Definition: dginversemass.hh:69
void prepare(const TotalArgumentType &argument, DestinationType &destination, const bool) const
prepare for ThreadPass
Definition: dginversemass.hh:131
Definition: coordinate.hh:4
bool requireCommunication() const
this pass needs no communication
Definition: dginversemass.hh:121
BaseType::TotalArgumentType TotalArgumentType
argument type
Definition: dginversemass.hh:75
DGInverseMassPass(const DiscreteModelType &discreteModel, PreviousPass &previousPass, const DiscreteFunctionSpaceType &space, const int volQuadOrd=-1, const int faceQuadOrd=-1)
constructor for use with thread pass
Definition: dginversemass.hh:103
void finalize(const TotalArgumentType &argument, DestinationType &destination) const
interface method
Definition: dginversemass.hh:143
void applyLocal(const EntityType &entity, const NBChecker &) const
apply local with neighbor checker (not needed here)
Definition: dginversemass.hh:161
void applyLocal(const EntityType &entity) const
apply inverse mass matrix locally
Definition: dginversemass.hh:150
BaseType::DestinationType DestinationType
destination type
Definition: dginversemass.hh:77
void prepare(const TotalArgumentType &argument, DestinationType &destination) const
interface method
Definition: dginversemass.hh:124
void applyLocalProcessBoundary(const EntityType &entity, const NBChecker &) const
apply local for all elements that need information from other processes (here no elements) ...
Definition: dginversemass.hh:179
void finalize(const TotalArgumentType &argument, DestinationType &destination, const bool) const
finalize for ThreadPass
Definition: dginversemass.hh:137
DestinationType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: dginversemass.hh:43
Definition: dginversemass.hh:40
PushFrontTuple< LocalArgumentType, const GlobalArgumentType * >::type TotalArgumentType
Definition: common/pass.hh:177
CachingQuadrature< typename DiscreteFunctionSpaceType::GridPartType, 0 > VolumeQuadratureType
Definition: dginversemass.hh:44
Specialisation of Pass which provides a grid walk-through, but leaves open what needs to be done on e...
Definition: local.hh:32
std::tuple_element< functionalPosition, TotalArgumentType >::type DestinationPtrType
Definition: dginversemass.hh:38
Definition: dginversemass.hh:27
Dune::PushBackTuple< typename PreviousPassType::PassIds, std::integral_constant< int, passIdImp > >::type PassIds
pass ids up to here (tuple of integral constants)
Definition: common/pass.hh:157
Definition: discretemodel.hh:431