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 the initialise() 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 const Region<ind_type> &getRegionAll() const#
inline const Region<ind_type> &getRegionNobndry() const#
inline const Region<ind_type> &getRegionBndry() const#
inline const Region<ind_type> &getRegionLowerY() const#
inline const Region<ind_type> &getRegionUpperY() const#
inline const Region<ind_type> &getRegionInnerX() const#
inline const Region<ind_type> &getRegionOuterX() 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.

Region<ind_type> regionAll#

Regions containing the elements for which there are global indices.

Region<ind_type> regionLowerY#
Region<ind_type> regionUpperY#
Region<ind_type> regionInnerX#
Region<ind_type> regionOuterX#
Region<ind_type> regionBndry#
mutable bool sparsityCalculated = false#
mutable std::vector<int> numDiagonal#
mutable std::vector<int> numOffDiagonal#

Private Static Functions

static inline void insertIndex(const ind_type i, std::set<ind_type> &allInds, std::set<ind_type> &newInds)#
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 the initialise() 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 const Region<ind_type> &getRegionAll() const
inline const Region<ind_type> &getRegionNobndry() const
inline const Region<ind_type> &getRegionBndry() const
inline const Region<ind_type> &getRegionLowerY() const
inline const Region<ind_type> &getRegionUpperY() const
inline const Region<ind_type> &getRegionInnerX() const
inline const Region<ind_type> &getRegionOuterX() 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.

Region<ind_type> regionAll

Regions containing the elements for which there are global indices.

Region<ind_type> regionLowerY
Region<ind_type> regionUpperY
Region<ind_type> regionInnerX
Region<ind_type> regionOuterX
Region<ind_type> regionBndry
mutable bool sparsityCalculated = false
mutable std::vector<int> numDiagonal
mutable std::vector<int> numOffDiagonal

Private Static Functions

static inline void insertIndex(const ind_type i, std::set<ind_type> &allInds, std::set<ind_type> &newInds)