1 #ifndef DUNE_FEM_DGMASSPASS_HH 2 #define DUNE_FEM_DGMASSPASS_HH 4 #include <dune/geometry/referenceelements.hh> 27 template<
class DiscreteModelImp,
class PreviousPassImp >
29 :
public LocalDGPass< DiscreteModelImp, PreviousPassImp >
74 PreviousPassType&
pass,
75 const DiscreteFunctionSpaceType& spc,
77 int volumeQuadOrd = -1,
int faceQuadOrd=-1) :
78 BaseType(problem, pass, spc,volumeQuadOrd,faceQuadOrd),
81 communicationManager_(spc_),
95 virtual void finalize(
const ArgumentType& arg, DestinationType& dest)
const 97 if(problem_.hasMass())
99 IteratorType endit = spc_.end();
100 for (IteratorType it = spc_.begin(); it != endit; ++it)
113 void applyLocalMass(EntityType& en)
const 116 typedef typename DiscreteFunctionSpaceType::IndexSetType
IndexSetType;
120 LocalFunctionType updEn = this->
dest_->localFunction(en);
121 const int updEn_numDofs = updEn.numDofs();
122 const BasisFunctionSetType& bsetEn = updEn.basisFunctionSet();
125 const GeometryType & geo = en.geometry();
127 const double massVolElinv = massVolInv(geo);
129 if((
int)massMatrix_.size() != updEn_numDofs)
131 massMatrix_.resize(updEn_numDofs);
135 for (
int i = 0; i < updEn_numDofs; ++i)
137 massMatrix_[i] = 0.0;
144 const int volQuad_nop = volQuad.nop();
145 for (
int l = 0; l < volQuad_nop; ++l)
147 const double intel = geo.integrationElement(volQuad.point(l))
148 * massVolElinv * volQuad.weight(l);
153 for (
int i = 0; i < updEn_numDofs; ++i)
156 bsetEn.evaluate(i, volQuad[l], tau_ );
159 massVal_.mv(tau_,tauTmp_);
161 massMatrix_[i] += bsetEn.evaluateSingle(i, volQuad[l], tauTmp_ ) * intel;
166 for(
int i=0; i<updEn_numDofs; ++i)
168 updEn[i] *= factor_ * massMatrix_[i];
178 double massVolInv(
const GeometryType& geo)
const 180 double volume = geo.volume();
182 typedef typename GeometryType :: ctype coordType;
183 enum { dim = GridType :: dimension };
184 const Dune::ReferenceElement< coordType, dim > & refElem =
185 Dune::ReferenceElements< coordType, dim >::general(geo.type());
187 double volRef = refElem.volume();
188 return volRef/volume;
192 DiscreteModelType& problem_;
194 const DiscreteFunctionSpaceType& spc_;
195 mutable CommunicationManagerType communicationManager_;
197 mutable RangeType tau_;
198 mutable RangeType tauTmp_;
199 mutable MassFactorType massVal_;
200 const double factor_;
202 mutable std::vector<RangeFieldType> massMatrix_;
210 #endif // #ifndef DUNE_FEM_DGMASSPASS_HH
GridType::template Codim< 0 >::Geometry Geometry
Definition: localdg/pass.hh:82
BaseType::LocalFunctionType LocalFunctionType
Definition: dgmasspass.hh:43
DiscreteFunctionSpaceType::IteratorType IteratorType
Iterator over the space.
Definition: localdg/pass.hh:69
BaseType::GridType GridType
Definition: dgmasspass.hh:46
DiscreteModelImp DiscreteModelType
Repetition of template arguments.
Definition: localdg/pass.hh:55
DiscreteModelType::MassFactorType MassFactorType
Definition: dgmasspass.hh:60
GridPartType::IntersectionIteratorType IntersectionIteratorType
Definition: localdg/pass.hh:80
BaseType::DiscreteModelType DiscreteModelType
Definition: dgmasspass.hh:35
virtual ~LocalDGMassPass()
Destructor.
Definition: dgmasspass.hh:90
Implementation of operator to calculate gradient of a given discrete function using the pass concept...
Definition: dgmasspass.hh:28
GridPartType::IndexSetType IndexSetType
Definition: localdg/pass.hh:94
CommunicationManager< DiscreteFunctionSpaceType > CommunicationManagerType
Definition: dgmasspass.hh:58
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: dgmasspass.hh:42
BaseType::PreviousPassType PreviousPassType
Definition: dgmasspass.hh:36
DiscreteModelCallerType * caller_
Definition: localdg/pass.hh:580
Definition: localdg/pass.hh:91
BaseType::DestinationType DestinationType
Definition: dgmasspass.hh:40
BaseType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: dgmasspass.hh:41
EntityType Entity
Definition: local.hh:57
BaseType::ArgumentType ArgumentType
Definition: dgmasspass.hh:38
BaseType::ArgumentType ArgumentType
Definition: localdg/pass.hh:61
BaseType::IntersectionIteratorType IntersectionIteratorType
Definition: dgmasspass.hh:50
void pass(const GlobalArgumentType &arg) const
Definition: common/pass.hh:267
Definition: coordinate.hh:4
DiscreteFunctionSpaceType::GridPartType GridPartType
Definition: localdg/pass.hh:73
DiscreteModelType::Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: localdg/pass.hh:67
BaseType::Entity EntityType
Definition: dgmasspass.hh:48
RangeType::value_type RangeFieldType
Definition: dgmasspass.hh:54
BaseType::Geometry GeometryType
Definition: dgmasspass.hh:49
const int volumeQuadOrd_
Definition: localdg/pass.hh:604
BaseType::RangeType RangeType
Definition: dgmasspass.hh:53
BaseType::GridPartType GridPartType
Definition: dgmasspass.hh:45
DiscreteModelType::Traits::DestinationType DestinationType
Definition: localdg/pass.hh:64
DiscreteModelType::Traits::VolumeQuadratureType VolumeQuadratureType
Definition: localdg/pass.hh:65
BaseType::IteratorType IteratorType
Definition: dgmasspass.hh:47
virtual void finalize(const ArgumentType &arg, DestinationType &dest) const
Some timestep size management.
Definition: localdg/pass.hh:194
DestinationType * dest_
Definition: localdg/pass.hh:584
DiscreteFunctionSpaceType::BasisFunctionSetType BasisFunctionSetType
Definition: localdg/pass.hh:77
Definition: dgmasspass.hh:62
DiscreteFunctionSpaceType::RangeType RangeType
Definition: localdg/pass.hh:75
PreviousPassImp PreviousPassType
Repetition of template arguments.
Definition: localdg/pass.hh:57
void mass(const EntityType &entity, const VolumeQuadratureType &quadrature, const int qp, MassFactorType &massFactor)
Definition: modelcaller.hh:199
BaseType::VolumeQuadratureType VolumeQuadratureType
Definition: dgmasspass.hh:56
DestinationType::LocalFunctionType LocalFunctionType
Definition: localdg/pass.hh:86
LocalDGMassPass(DiscreteModelType &problem, PreviousPassType &pass, const DiscreteFunctionSpaceType &spc, double factor=-1.0, int volumeQuadOrd=-1, int faceQuadOrd=-1)
Definition: dgmasspass.hh:73
void setEntity(const EntityType &entity)
Definition: modelcaller.hh:97
DiscreteFunctionSpaceType::GridType GridType
Definition: localdg/pass.hh:72
Definition: localdg/pass.hh:41