File globalindexer.hxx#
Typedefs
-
using IndexerPtr = std::shared_ptr<GlobalIndexer<T>>#
-
using InterpolationWeights = std::vector<ParallelTransform::PositionsAndWeights>#
-
template<class T>
class GlobalIndexer# - #include <globalindexer.hxx>
An object which accepts index objects produced by iterating over fields and returns a global index. This index can be used when constructing PETSc arrays. Guard regions used for communication between processes will have the indices of the part of the interior region they are mirroring. Boundaries required by the stencil will have unique indices. If no stencil is provided then only the interior region will be assigned global indices. By default, the indexer is fully initialised so that guard cells are communicated (ensuring they hold the appropriate global indices). However, by passing
autoInitialise = false
this behaviour can be turned off and the user can then manually call theinitialise()
method later. This can be useful for mocking/faking the class when testing.Public Functions
-
GlobalIndexer() = default#
-
inline explicit GlobalIndexer(Mesh *localmesh, OperatorStencil<ind_type> stencil = OperatorStencil<ind_type>(), bool autoInitialise = true)#
-
inline virtual ~GlobalIndexer()#
-
inline void initialiseTest()#
Call this immediately after construction when running unit tests.
-
inline void initialise()#
Finish setting up the indexer, communicating indices across processes and, if possible, calculating the sparsity pattern of any matrices.
-
inline int getGlobal(const ind_type &ind) const#
Convert the local index object to a global index which can be used in PETSc vectors and matrices.
-
inline bool isLocal(const ind_type &ind) const#
Check whether the local index corresponds to an element which is stored locally.
-
inline int getGlobalStart() const#
-
inline bool sparsityPatternAvailable() const#
-
inline int size() const#
Private Functions
-
inline virtual void registerFieldForTest(T &f)#
This gets called by initialiseTest and is used to register fields with fake parallel meshes.
-
inline void calculateSparsity() const#
-
GlobalIndexer() = default#
-
template<class T>
class GlobalIndexer - #include <globalindexer.hxx>
An object which accepts index objects produced by iterating over fields and returns a global index. This index can be used when constructing PETSc arrays. Guard regions used for communication between processes will have the indices of the part of the interior region they are mirroring. Boundaries required by the stencil will have unique indices. If no stencil is provided then only the interior region will be assigned global indices. By default, the indexer is fully initialised so that guard cells are communicated (ensuring they hold the appropriate global indices). However, by passing
autoInitialise = false
this behaviour can be turned off and the user can then manually call theinitialise()
method later. This can be useful for mocking/faking the class when testing.Public Types
-
using ind_type = typename T::ind_type
Public Functions
-
GlobalIndexer() = default
-
inline explicit GlobalIndexer(Mesh *localmesh, OperatorStencil<ind_type> stencil = OperatorStencil<ind_type>(), bool autoInitialise = true)
-
inline virtual ~GlobalIndexer()
-
inline void initialiseTest()
Call this immediately after construction when running unit tests.
-
inline void initialise()
Finish setting up the indexer, communicating indices across processes and, if possible, calculating the sparsity pattern of any matrices.
-
inline Mesh *getMesh() const
-
inline int getGlobal(const ind_type &ind) const
Convert the local index object to a global index which can be used in PETSc vectors and matrices.
-
inline bool isLocal(const ind_type &ind) const
Check whether the local index corresponds to an element which is stored locally.
-
inline int getGlobalStart() const
-
inline bool sparsityPatternAvailable() const
-
inline const std::vector<int> &getNumDiagonal() const
-
inline const std::vector<int> &getNumOffDiagonal() const
-
inline int size() const
Protected Functions
-
inline T &getIndices()
Private Functions
-
inline virtual void registerFieldForTest(T &f)
This gets called by initialiseTest and is used to register fields with fake parallel meshes.
-
inline void calculateSparsity() const
Private Members
-
Mesh *fieldmesh
-
T indices
Fields containing the indices for each element (as reals)
-
int globalStart
The first and last global index on this processor (inclusive in both cases)
-
int globalEnd
-
OperatorStencil<ind_type> stencils
Stencil for which this indexer has been configured.
-
mutable bool sparsityCalculated = false
-
mutable std::vector<int> numDiagonal
-
mutable std::vector<int> numOffDiagonal
-
using ind_type = typename T::ind_type