HyTeG
Matrix-Free Finite Elements
|
#include <DGOperator.hpp>
Public Types | |
typedef DGFunction< real_t > | dstType |
typedef DGFunction< real_t > | srcType |
Public Member Functions | |
DGOperator (const std::shared_ptr< PrimitiveStorage > &storage, uint_t minLevel, uint_t maxLevel, const std::shared_ptr< DGForm > &form) | |
void | apply (const DGFunction< real_t > &src, const DGFunction< real_t > &dst, size_t level, DoFType flag, UpdateType updateType) const override |
void | enableTiming (const std::shared_ptr< walberla::WcTimingTree > &timingTree) |
virtual void | gemv (const typename SourceFunction::valueType &alpha, const DGFunction< real_t > &src, const typename DestinationFunction::valueType &beta, const DGFunction< real_t > &dst, size_t level, DoFType flag) const |
Implements the BLAS level 2 routine gemv: | |
uint_t | getMaxLevel () const |
uint_t | getMinLevel () const |
const std::shared_ptr< PrimitiveStorage > | getStorage () const |
void | toMatrix (const std::shared_ptr< SparseMatrixProxy > &mat, const DGFunction< idx_t > &src, const DGFunction< idx_t > &dst, size_t level, DoFType flag) const override |
virtual void | toMatrix (const std::shared_ptr< SparseMatrixProxy > &mat, const typename srcType::template FunctionType< idx_t > &src, const typename dstType::template FunctionType< idx_t > &dst, size_t level, DoFType flag) const |
Protected Member Functions | |
void | startTiming (const std::string &timerString) const |
void | stopTiming (const std::string &timerString) const |
Protected Attributes | |
const uint_t | maxLevel_ |
const uint_t | minLevel_ |
const std::shared_ptr< PrimitiveStorage > | storage_ |
std::shared_ptr< walberla::WcTimingTree > | timingTree_ |
Private Member Functions | |
template<typename VType > | |
void | addLocalToGlobalMatrix (int dim, int numSrcDofs, int numDstDofs, VType *srcDofMemory, VType *dstDofMemory, VolumeDoFMemoryLayout srcMemLayout, VolumeDoFMemoryLayout dstMemLayout, Index srcElementIdx, Index dstElementIdx, uint_t srcMicroVolType, uint_t dstMicroVolType, uint_t level, std::shared_ptr< SparseMatrixProxy > mat, const MatrixXr &localMat) const |
Just a small helper method that writes the local matrix into the global sparse system. | |
template<typename VType > | |
void | assembleAndOrApply (const DGFunction< VType > &src, const DGFunction< VType > &dst, size_t level, DoFType flag, const std::shared_ptr< SparseMatrixProxy > &mat, UpdateType updateType=Replace) const |
Helper function that can be used to either apply the operator, or to assemble the sparse matrix. | |
Private Attributes | |
std::shared_ptr< DGForm > | form_ |
|
inherited |
|
inherited |
hyteg::dg::DGOperator::DGOperator | ( | const std::shared_ptr< PrimitiveStorage > & | storage, |
uint_t | minLevel, | ||
uint_t | maxLevel, | ||
const std::shared_ptr< DGForm > & | form ) |
|
inlineprivate |
Just a small helper method that writes the local matrix into the global sparse system.
|
overridevirtual |
Reimplemented from hyteg::Operator< DGFunction< real_t >, DGFunction< real_t > >.
|
inlineprivate |
Helper function that can be used to either apply the operator, or to assemble the sparse matrix.
Since about 99% of the implementation is equal, it makes sense to fuse that here.
Which operation is performed depends on the pointer to the sparse matrix proxy and the value type. If the pointer is a nullptr, apply is executed.
Some notes on the implementation:
For DG implementations there are two main possibilities to evaluate the interface integrals.
The "naive" (not necessarily worse) approach is to loop over all interfaces in a dedicated loop e.g. after evaluating all volume integrals. Alternatively, the interface integrals are evaluated during the loop over the volumes.
This function implements the latter, with the advantage that each DoF is only written to exactly once, also there is only a single loop over the macro-volume. On the downside, each interface integral has to be evaluated twice.
A nice description is found in
Kronbichler, M., & Kormann, K. (2019). Fast matrix-free evaluation of discontinuous Galerkin finite element operators. ACM Transactions on Mathematical Software (TOMS), 45(3), 1-40.
|
inlineinherited |
|
inlinevirtualinherited |
Implements the BLAS level 2 routine gemv:
y ← ɑAx + βy
where ɑ, β are scalars, A is this operator, x is the "src" function, and y is the "dst" function.
Note that the apply() method implements
y ← Ax + ɣy
where ɣ ∈ { 0, 1 } for UpdateType Replace and Add respectively. This is just a gemv with ɑ = 1 and β = ɣ.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
override |
|
inlinevirtualinherited |
|
private |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |