/usr/include/dune/pdelab/gridoperator/default/localassembler.hh is in libdune-pdelab-dev 2.5.0~20170124g7cf9f47a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | #ifndef DUNE_PDELAB_GRIDOPERATOR_DEFAULT_LOCALASSEMBLER_HH
#define DUNE_PDELAB_GRIDOPERATOR_DEFAULT_LOCALASSEMBLER_HH
#include <dune/typetree/typetree.hh>
#include <dune/pdelab/gridoperator/default/residualengine.hh>
#include <dune/pdelab/gridoperator/default/patternengine.hh>
#include <dune/pdelab/gridoperator/default/jacobianengine.hh>
#include <dune/pdelab/gridoperator/default/jacobianapplyengine.hh>
#include <dune/pdelab/gridoperator/default/nonlinearjacobianapplyengine.hh>
#include <dune/pdelab/gridoperator/common/assemblerutilities.hh>
#include <dune/pdelab/gridfunctionspace/lfsindexcache.hh>
namespace Dune{
namespace PDELab{
/**
\brief The local assembler for DUNE grids
\tparam GFSU GridFunctionSpace for ansatz functions
\tparam GFSV GridFunctionSpace for test functions
\tparam X The solution vector representation type
\tparam R The residual vector representation type
\tparam A The jacobian matrix representation type
\tparam B The matrix backend
\tparam P The matrix pattern representation type
\tparam CU Constraints maps for the individual dofs (trial space)
\tparam CV Constraints maps for the individual dofs (test space)
*/
template<typename GO, typename LOP, bool nonoverlapping_mode = false>
class DefaultLocalAssembler :
public Dune::PDELab::LocalAssemblerBase<typename GO::Traits::MatrixBackend,
typename GO::Traits::TrialGridFunctionSpaceConstraints,
typename GO::Traits::TestGridFunctionSpaceConstraints>
{
// The GridOperator has to be a friend to modify the do{Pre,Post}Processing flags
template<typename, typename, typename,
typename, typename, typename, typename,
typename, typename, int>
friend class GridOperator;
public:
//! The traits class
typedef Dune::PDELab::LocalAssemblerTraits<GO> Traits;
//! The local operators type for real numbers e.g. time
typedef typename Traits::Residual::ElementType RangeField;
typedef RangeField Real;
typedef typename Traits::TrialGridFunctionSpace GFSU;
typedef typename Traits::TestGridFunctionSpace GFSV;
typedef typename Traits::TrialGridFunctionSpaceConstraints CU;
typedef typename Traits::TestGridFunctionSpaceConstraints CV;
//! The base class of this local assembler
typedef Dune::PDELab::LocalAssemblerBase<typename Traits::MatrixBackend,CU,CV> Base;
//! The local operator
typedef LOP LocalOperator;
static const bool isNonOverlapping = nonoverlapping_mode;
//! The local function spaces
//! @{
// Types of local function spaces
typedef Dune::PDELab::LocalFunctionSpace<GFSU, Dune::PDELab::TrialSpaceTag> LFSU;
typedef Dune::PDELab::LocalFunctionSpace<GFSV, Dune::PDELab::TestSpaceTag> LFSV;
typedef LFSIndexCache<LFSU,CU> LFSUCache;
typedef LFSIndexCache<LFSV,CV> LFSVCache;
//! @}
//! The local assembler engines
//! @{
typedef DefaultLocalPatternAssemblerEngine<DefaultLocalAssembler> LocalPatternAssemblerEngine;
typedef DefaultLocalResidualAssemblerEngine<DefaultLocalAssembler> LocalResidualAssemblerEngine;
typedef DefaultLocalJacobianAssemblerEngine<DefaultLocalAssembler> LocalJacobianAssemblerEngine;
typedef DefaultLocalJacobianApplyAssemblerEngine<DefaultLocalAssembler> LocalJacobianApplyAssemblerEngine;
typedef DefaultLocalNonlinearJacobianApplyAssemblerEngine<DefaultLocalAssembler> LocalNonlinearJacobianApplyAssemblerEngine;
friend class DefaultLocalPatternAssemblerEngine<DefaultLocalAssembler>;
friend class DefaultLocalResidualAssemblerEngine<DefaultLocalAssembler>;
friend class DefaultLocalJacobianAssemblerEngine<DefaultLocalAssembler>;
friend class DefaultLocalJacobianApplyAssemblerEngine<DefaultLocalAssembler>;
friend class DefaultLocalNonlinearJacobianApplyAssemblerEngine<DefaultLocalAssembler>;
//! @}
//! Constructor with empty constraints
DefaultLocalAssembler (LOP & lop_, shared_ptr<typename GO::BorderDOFExchanger> border_dof_exchanger)
: lop(lop_), weight(1.0), doPreProcessing(true), doPostProcessing(true),
pattern_engine(*this,border_dof_exchanger), residual_engine(*this), jacobian_engine(*this)
, jacobian_apply_engine(*this)
, nonlinear_jacobian_apply_engine(*this)
, _reconstruct_border_entries(isNonOverlapping)
{}
//! Constructor for non trivial constraints
DefaultLocalAssembler (LOP & lop_, const CU& cu_, const CV& cv_,
shared_ptr<typename GO::BorderDOFExchanger> border_dof_exchanger)
: Base(cu_, cv_),
lop(lop_), weight(1.0), doPreProcessing(true), doPostProcessing(true),
pattern_engine(*this,border_dof_exchanger), residual_engine(*this), jacobian_engine(*this)
, jacobian_apply_engine(*this)
, nonlinear_jacobian_apply_engine(*this)
, _reconstruct_border_entries(isNonOverlapping)
{}
//! Notifies the local assembler about the current time of
//! assembling. Should be called before assembling if the local
//! operator has time dependencies.
void setTime(Real time_){
lop.setTime(time_);
}
//! Notifies the assembler about the current weight of assembling.
void setWeight(RangeField weight_){
weight = weight_;
}
//! Time stepping interface
//! @{
void preStage (Real time_, int r_) { lop.preStage(time_,r_); }
void preStep (Real time_, Real dt_, std::size_t stages_){ lop.preStep(time_,dt_,stages_); }
void postStep (){ lop.postStep(); }
void postStage (){ lop.postStage(); }
Real suggestTimestep (Real dt) const{return lop.suggestTimestep(dt); }
//! @}
bool reconstructBorderEntries() const
{
return _reconstruct_border_entries;
}
//! Access methods which provid "ready to use" engines
//! @{
//! Returns a reference to the requested engine. This engine is
//! completely configured and ready to use.
LocalPatternAssemblerEngine & localPatternAssemblerEngine
(typename Traits::MatrixPattern & p)
{
pattern_engine.setPattern(p);
return pattern_engine;
}
//! Returns a reference to the requested engine. This engine is
//! completely configured and ready to use.
LocalResidualAssemblerEngine & localResidualAssemblerEngine
(typename Traits::Residual & r, const typename Traits::Solution & x)
{
residual_engine.setResidual(r);
residual_engine.setSolution(x);
return residual_engine;
}
//! Returns a reference to the requested engine. This engine is
//! completely configured and ready to use.
LocalJacobianAssemblerEngine & localJacobianAssemblerEngine
(typename Traits::Jacobian & a, const typename Traits::Solution & x)
{
jacobian_engine.setJacobian(a);
jacobian_engine.setSolution(x);
return jacobian_engine;
}
//! Returns a reference to the requested engine. This engine is
//! completely configured and ready to use.
LocalJacobianApplyAssemblerEngine & localJacobianApplyAssemblerEngine
(typename Traits::Residual & r, const typename Traits::Solution & x)
{
jacobian_apply_engine.setResidual(r);
jacobian_apply_engine.setSolution(x);
return jacobian_apply_engine;
}
//! Returns a reference to the requested engine. This engine is
//! completely configured and ready to use.
LocalNonlinearJacobianApplyAssemblerEngine & localNonlinearJacobianApplyAssemblerEngine
(typename Traits::Residual & r, const typename Traits::Solution & x, const typename Traits::Solution & z)
{
nonlinear_jacobian_apply_engine.setResidual(r);
nonlinear_jacobian_apply_engine.setSolution(x);
nonlinear_jacobian_apply_engine.setUpdate(z);
return nonlinear_jacobian_apply_engine;
}
//! @}
//! \brief Query methods for the assembler engines. Theses methods
//! do not belong to the assembler interface, but simplify the
//! implementations of query methods in the engines;
//! @{
static bool doAlphaVolume() { return LOP::doAlphaVolume; }
static bool doLambdaVolume() { return LOP::doLambdaVolume; }
static bool doAlphaSkeleton() { return LOP::doAlphaSkeleton; }
static bool doLambdaSkeleton() { return LOP::doLambdaSkeleton; }
static bool doAlphaBoundary() { return LOP::doAlphaBoundary; }
static bool doLambdaBoundary() { return LOP::doLambdaBoundary; }
static bool doAlphaVolumePostSkeleton() { return LOP::doAlphaVolumePostSkeleton; }
static bool doLambdaVolumePostSkeleton() { return LOP::doLambdaVolumePostSkeleton; }
static bool doSkeletonTwoSided() { return LOP::doSkeletonTwoSided; }
static bool doPatternVolume() { return LOP::doPatternVolume; }
static bool doPatternSkeleton() { return LOP::doPatternSkeleton; }
static bool doPatternBoundary() { return LOP::doPatternBoundary; }
static bool doPatternVolumePostSkeleton() { return LOP::doPatternVolumePostSkeleton; }
//! @}
//! This method allows to set the behavior with regard to any
//! preprocessing within the engines. It is called by the
//! setupGridOperators() method of the GridOperator and should
//! not be called directly.
void preProcessing(bool v)
{
doPreProcessing = v;
}
//! This method allows to set the behavior with regard to any
//! postprocessing within the engines. It is called by the
//! setupGridOperators() method of the GridOperator and should
//! not be called directly.
void postProcessing(bool v)
{
doPostProcessing = v;
}
private:
//! The local operator
LOP & lop;
//! The current weight of assembling
RangeField weight;
//! Indicates whether this local operator has to perform pre
//! processing
bool doPreProcessing;
//! Indicates whether this local operator has to perform post
//! processing
bool doPostProcessing;
//! The engine member objects
//! @{
LocalPatternAssemblerEngine pattern_engine;
LocalResidualAssemblerEngine residual_engine;
LocalJacobianAssemblerEngine jacobian_engine;
LocalJacobianApplyAssemblerEngine jacobian_apply_engine;
LocalNonlinearJacobianApplyAssemblerEngine nonlinear_jacobian_apply_engine;
//! @}
bool _reconstruct_border_entries;
};
}
}
#endif // DUNE_PDELAB_GRIDOPERATOR_DEFAULT_LOCALASSEMBLER_HH
|