An implementation of the CR (color and renumbering) object interface. The partition interface does nothing. The template parameters are the vector type (should be either GmSingleVector or GmDualVector and probably EQUAL to the type used by the mesh instantiation) and the Partition support. The later should be set to true when this class is being used as the base class for the GmpGemaPCR class.
More...
|
|
| GmpGemaCRBase (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger) |
| | Default plugin object constructor.
|
| |
|
virtual | ~GmpGemaCRBase () |
| | Virtual destructor.
|
| |
| virtual const char * | pluginName () const |
| |
| virtual const char * | pluginType () const |
| |
| virtual bool | loadPrivateData (LuaTable &table) |
| | Parses configuration options given by the user to create this PCR object. IMPORTANT: This method is called BOFORE the call to setMesh().
|
| |
| virtual void | printParameters (const GmLogCategory &logger) |
| | Print plugin parameters.
|
| |
| virtual bool | hasCapability (QString capabilityName) const |
| |
| virtual GmMesh * | mesh () const |
| |
| virtual bool | setMesh (GmMesh *mesh) |
| | Associates this PCR object with a mesh. Returns false on errors.
|
| |
| virtual size_t | printMemoryStatistics (const GmLogCategory &logger, GmLogLevel level) const |
| | Prints memory usage for this PCR object to the given logger. Returns the used memory as reported by usedMemory()
|
| |
| virtual size_t | usedMemory () const |
| | Returns an estimate of the used memory by the PCR object. This does not includes fixed (small) sizes.
|
| |
| virtual int | numPartitions () const |
| |
| virtual int | partition () const |
| |
| virtual int | numGlobalNodes () const |
| |
| virtual int | numGlobalGhostNodes () const |
| |
| virtual int | numGlobalCells () const |
| |
| virtual CellClass | cellClass (int cellId) const |
| |
| virtual int | cellClassData (int cellId) const |
| |
| virtual int | numCellsInClass (CellClass cellClass) const |
| |
| virtual NodeClass | nodeClass (int nodeId) const |
| |
| virtual int | nodeClassData (int nodeId) const |
| |
| virtual int | numNodesInClass (NodeClass nodeClass, GmCellFillMode mode=GM_CELL_NODES) const |
| |
| virtual int | numRemoteRanks (int templateIndex) const |
| |
| virtual const int * | remoteRanks (int templateIndex) const |
| |
| virtual bool | skipRemote () const |
| |
| virtual bool | addPartitionInfoAsMeshAttributes (QString cellAttrPrefix, QString nodeAttrPrefix) |
| |
| virtual bool | addDebugPartitionInfoAsMeshAttributes (QString cellAttrPrefix, QString nodeAttrPrefix) |
| |
| virtual void | printPartitionRankTemplateData (const GmLogCategory &logger) const |
| |
| virtual void | printPartitionClassStatistics (const GmLogCategory &logger) const |
| |
| virtual ColorType | coloringType () const |
| |
| virtual ColorState | coloringState (const GmCellGroupSet *gs) |
| |
| virtual const QVector< GmCellGroupSet * > & | coloredSets (const GmCellGroupSet *gs) |
| |
| virtual const GmCellGroupSet * | sequentialSet (const GmCellGroupSet *gs) |
| |
| virtual const QVector< GmCellGroupSet * > & | coloredHaloSets (const GmCellGroupSet *gs) |
| |
| virtual const GmCellGroupSet * | sequentialHaloSet (const GmCellGroupSet *gs) |
| |
| virtual bool | addColoringAsMeshAttribute (const GmCellGroupSet *gs, QString attrName) |
| |
| virtual bool | addColoringAsMeshAttribute (const QVector< const GmCellGroupSet * > &gsets, QString attrName) |
| |
| virtual void | printColoringStatistics (const GmLogCategory &logger) const |
| |
| virtual bool | nodesRenumbered () const |
| |
| virtual bool | cellsRenumbered () const |
| |
| virtual int | originalToLocalOrderNode (int originalNodeId) const |
| |
| virtual int | originalToLocalOrderGeomNode (int originalNodeId) const |
| |
| virtual int | originalToLocalOrderGhostNodeHighSet (int originalNodeId) const |
| |
| virtual int | originalToLocalOrderGhostNodeHighClear (int originalNodeId) const |
| |
| virtual int | localOrderToOriginalNode (int nodeId) const |
| |
| virtual int | localOrderToOriginalGeomNode (int nodeId) const |
| |
| virtual int | localOrderToOriginalGhostNodeHighSet (int nodeId) const |
| |
| virtual int | localOrderToOriginalGhostNodeHighClear (int nodeId) const |
| |
| virtual int | originalToLocalOrderCell (int originalCellId) const |
| |
| virtual int | localOrderToOriginalCell (int cellId) const |
| |
|
| MAKE_SR_FUNCTION (originalToLocalOrderNode, nodeClass, REMOTE_NODE) |
| |
|
| MAKE_SR_FUNCTION (originalToLocalOrderGeomNode, nodeClass, REMOTE_NODE) |
| |
|
| MAKE_SR_FUNCTION (originalToLocalOrderGhostNodeHighSet, nodeClass, REMOTE_NODE) |
| |
|
| MAKE_SR_FUNCTION (originalToLocalOrderGhostNodeHighClear, nodeClass, REMOTE_NODE) |
| |
|
| MAKE_SR_FUNCTION (originalToLocalOrderCell, cellClass, REMOTE_HALO_CELL) |
| |
| virtual int | originalNodeTraversalOrder (int i) const |
| |
| virtual int | originalCellTraversalOrder (int i) const |
| |
| virtual bool | initPartitions (int numPartitions, int partition) |
| |
| virtual bool | initNodeMapping (GmValueAccessor *ac, bool ghost, bool *renumbered, QMap< int, int > &partOrigToLocOrder) |
| |
| virtual bool | initCellMapping (bool *renumbered, QMap< int, int > &partOrigToLocOrder, QVector< int > &partLocToOrigOrder) |
| |
| virtual QStringList | cellMappingRequiredGroups () |
| |
| virtual bool | addNodes (int numNodes) |
| |
| virtual bool | addGhostNodes (int numGhostNodes) |
| |
| virtual bool | addCells (int numCells) |
| |
| virtual void | clear () |
| |
| virtual bool | addStateGeometryData (GmStateDump *state, int groupId) |
| |
|
virtual bool | fillDumpControlMapData (QVariantMap *map, const GmLogCategory &logger) |
| |
|
virtual bool | dumpControlMapDataLoaded (QVariantMap *map, const GmLogCategory &logger) |
| |
|
| GmPCR (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger) |
| |
| virtual const char * | pluginCategory () const |
| |
| virtual int | originalToLocalOrderNodeSR (int originalNodeId) const=0 |
| |
| virtual int | originalToLocalOrderGeomNodeSR (int originalNodeId) const=0 |
| |
| virtual int | originalToLocalOrderGhostNodeHighSetSR (int originalNodeId) const=0 |
| |
| virtual int | originalToLocalOrderGhostNodeHighClearSR (int originalNodeId) const=0 |
| |
| virtual int | originalToLocalOrderCellSR (int originalCellId) const=0 |
| |
|
| GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger) |
| |
|
QString | id () const |
| |
|
QString | description () const |
| |
|
QString | pluginTypeName () const |
| |
|
|
bool | initMappingFromPartition (const IntVector &cells, const IntVector &geomNodes, const IntVector &ghostNodes) |
| | Initializes the renumbering structures from the partition information given by the cells, geomNodes and ghostNodes parameters. They contain an ordered set of the cells and nodes from the original mesh that belong to the current partition.
|
| |
|
virtual size_t | nodeRenumberMemory () const |
| | Returns an estimate of the used memory by the node renumbering structures.
|
| |
|
virtual size_t | cellRenumberMemory () const |
| | Returns an estimate of the used memory by the cell renumbering structures.
|
| |
|
virtual size_t | colorMemory () const |
| | Returns an estimate of the used memory by cell group colorings.
|
| |
| virtual size_t | partitionMemory () const |
| |
|
GmValueAccessor * | addNodeAttributeToMesh (QString name, QString description, GmStorageType type) |
| | Adds to the mesh a new node attribute, with default value equal to -1 and the given name, description and data type. Returns an accessor for the new attribute or NULL on error.
|
| |
|
GmCellAccessor * | addCellAttributeToMesh (QString name, QString description, GmStorageType type) |
| | Like addNodeAttributeToMesh() but adding a cell attribute.
|
| |
|
virtual const GmLogCategory & | logger () const |
| |
|
GmSimulationData * | simulationData () const |
| |
|
|
QVariantMap | _options |
| | The set of user options.
|
| |
|
GmMesh * | _mesh |
| | The associated cell mesh.
|
| |
|
ColorType | _coloringType |
| | The type of coloring produced by this object.
|
| |
|
bool | _nodeRenumberRequested |
| | Is node renumbering requested by the user? Can be false even if Partition is true.
|
| |
|
bool | _cellRenumberRequested |
| | Is cell renumbering requested by the user? Can be false even if Partition is true.
|
| |
|
bool | _isNodeRenumbered |
| | Have we renumbered the set of nodes? Always true if the mesh was partitioned.
|
| |
|
bool | _isCellRenumbered |
| | Have we renumbered the set of cell? Always true if the mesh was partitioned.
|
| |
|
bool | _skipRemote |
| | A flag set to true by GmpGemaPCR if the mesh was partitioned, includes remote halo cells AND the keepRemote user option is false.
|
| |
|
QMap< const GmCellGroupSet *, GmpColorData * > | _gsColorMap |
| | Map storing coloring data for each registered group set.
|
| |
|
GmpColorData * | _noColorData |
| | The GmpColorData object if coloring is disabled.
|
| |
|
GmpColoringMethod * | _colorMethod |
| | The configured coloring object.
|
| |
|
GmpNodeRenumberingMethod< IntVector > * | _nodeRenumberMethod |
| | The configured node reordering object.
|
| |
|
GmpCellRenumberingMethod< IntVector > * | _cellRenumberMethod |
| | The configured cell reordering object.
|
| |
|
int | _numGeomNodes |
| | Cached value for _mesh->numNodes(). Updated whenever new geometry nodes are added to the mesh.
|
| |
|
int | _numOriginalGeomNodes |
| | Cached value for _mesh->numGlobalNodes(). If Partition is false, this is effectively equal to _numGeomNodes and is updated whenever new geometry nodes are added to the mesh. If Partition is true, this value is fixed since we are not currently assigning new global numbers to the nodes added to the mesh. See comments on the class documentation.
|
| |
|
IntVector | _localToOriginalGeomNode |
| | A vector mapping local geometry node numbers to original node numbers. Size equal to _mesh->numNodes(). For nodes added to the mesh at runtime, the stored original node index will be either equal to the local index (Partition = false) or -1 (Partition = true). See comments on the class documentation. Empty if node renumbering is disabled.
|
| |
|
IntVectorOrMap | _originalToLocalGeomNode |
| | If Partition is false, stores a vector indexed by original geometry node numbers, storing their local node numbers. Size equal to _mesh->numNodes(). If Partition is true, the vector is replaced by a map since the known set of original node numbers for this partition might not be continuous. Its contents includes both the geometry nodes owned by
this partition and halo geometry nodes owned by other partitions (shared with this one). Empty if node renumbering is disabled.
|
| |
|
IntVector | _localToOriginalCell |
| | A vector mapping local cell numbers to original cell numbers. Size equal to _mesh->numCells(). Empty if cell renumbering is disabled.
|
| |
|
IntVectorOrMap | _originalToLocalCell |
| | If Partition is false, stores a vector indexed by original cell numbers, storing their local cell numbers. Size equal to _mesh->numCells(). If Partition is true, the vector is replaced by a map since the known set of original cell
numbers for this partition might not be continuous. Its contents includes both the cells owned by this partition and halo cells owned by other partitions that are adjacent to this one. Empty if cell renumbering is disabled.
|
| |
|
PartitionT | _part |
| | Structure storing extra vectors needed when Partition is true, empty otherwise.
|
| |
|
|
const GmpColorData * | colorData (const GmCellGroupSet *gs) |
| | Returns the color data information for the given group set. If not available, it will be created. Check the state field on the returned structure for error cases.
|
| |
|
void | renumberColoredGroupSets (const QVector< int > &partLocToOrigOrder) |
| | Renumber ALL the colored group sets according to the current PCR cell mapping (assuming that all colorings that exist at the time of this method call where created by the renumbering and consumed by it). If partLocToOrigOrder is not empty (the mesh was partitioned), it gives the mapping from the partitioned index in the local cell vectors to the original model before partitioning. See further comments on the GmPCR::initCellMapping() documentation.
|
| |
|
int | originalToLocalOrderNodeImpl (int originalNodeId) const |
| |
|
int | originalToLocalOrderGeomNodeImpl (int originalNodeId) const |
| |
|
int | originalToLocalOrderGhostNodeHighSetImpl (int originalNodeId) const |
| |
|
int | originalToLocalOrderGhostNodeHighClearImpl (int originalNodeId) const |
| |
|
int | originalToLocalOrderCellImpl (int originalCellId) const |
| |
|
int | localOrderToOriginalNodeImpl (int nodeId) const |
| |
|
int | localOrderToOriginalGeomNodeImpl (int nodeId) const |
| |
|
int | localOrderToOriginalGhostNodeHighSetImpl (int nodeId) const |
| |
|
int | localOrderToOriginalGhostNodeHighClearImpl (int nodeId) const |
| |
|
int | localOrderToOriginalCellImpl (int cellId) const |
| |
|
int | originalNodeTraversalOrderImpl (int i) const |
| | See comments on the base class. When printing all the mesh local nodes, the correct order for printing can be provided by the original to sorted translation. This is only true for an unpartitioned mesh. For partitioned meshes, if the nodes where not renumbered again, the ordering is the identity mapping. Otherwise an ordering vector is used (it is filled with the "in-order" traversal of the original to sorted map).
|
| |
|
int | originalCellTraversalOrderImpl (int i) const |
| | See comments on the base class. When printing all the mesh local cells, the correct order for printing can be provided by the original to sorted translation. This is only true for an unpartitioned mesh. For partitioned meshes, if the cells where not renumbered again, the ordering is the identity mapping. Otherwise an ordering vector is used (it is filled with the "in-order" traversal of the original to sorted map).
|
| |
|
bool | initGeomNodeMapping (GmValueAccessor *ac, bool *renumbered) |
| | Initializes geometric node remapping vectors from the mesh geometry. Will set *renumbered to true if the nodes where renumbered by this call.
|
| |
| bool | initGhostNodeMapping (GmValueAccessor *ac, bool *renumbered) |
| | Initializes ghost node remapping vectors from the mesh set of ghost nodes. Will set *renumbered to true if the nodes where renumbered by this call.
|
| |
|
void | initReverseMapping (const IntVector &localToOriginal, IntVectorOrMap &originalToLocal) |
| | Initializes the originalToLocal vector or map from the localToOriginal vector contents. For Partition false, assumes that originalToLocal has the same size as localToOriginal. For Partition true, assumes that the originalToLocal map is either empty or filled with a set of keys equal to the contents of the localToOriginal vector.
|
| |
|
void | initOrdering (const IntVectorOrMap &originalToLocal, IntVector &orderVec) |
| | Initializes the order vector from the reverse mapping.
|
| |
|
bool | addVectors (size_t numAddedEntries, IntVector *localToOriginal, IntVectorOrMap *originalToLocal, IntVector *orderVec) |
| | Helper function to add the given number of entries to the given vectors without initializing them. Only localToOriginal is required. The others can be NULL and will be ignored. Notice that originalToLocal is only resized if it is indeed a vector and not a map (Partition == false).
|
| |
| bool | addAndInitVectors (size_t numAddedEntries, IntVector *localToOriginal, IntVectorOrMap *originalToLocal, IntVector *orderVec, int localToOriginalInit, int originalToLocalInit, int orderVecInit) |
| | Helper function to add the given number of entries to the given vectors and init the new entries following the instructions given by the xxxInit flags. Only localToOriginal is required. The others can be NULL and will be ignored. Notice that originalToLocal is only resized
if it is indeed a vector and not a map (Partition == false).
|
| |
|
template<class Ac , GmValueSetKind SetKind> |
| Ac * | addAttributeToMesh (QString name, QString description, GmStorageType type) |
| | Work horse for addNodeAttributeToMesh() and addCellAttributeToMesh(). Template parameters should be the accessor type matching the attribute kind, that should be either GM_NODE_ATTRIBUTE or GM_CELL_ATTRIBUTE.
|
| |
template<template< class > class Vector, bool Partition>
class GmpGemaCRBase< Vector, Partition >
An implementation of the CR (color and renumbering) object interface. The partition interface does nothing. The template parameters are the vector type (should be either GmSingleVector or GmDualVector and probably EQUAL to the type used by the mesh instantiation) and the Partition support. The later should be set to true when this class is being used as the base class for the GmpGemaPCR class.
When used without partition support, assumes that ghost nodes are NEVER renumbered. When compiled with partition support, ghost node renumbering is a necessity, but the renumbering data is kept in a different storage to allow for mesh growing (just like in the standard mesh storage).
For both nodes and cells, when the mesh has added nodes, ghost nodes or cells at run time, a new mapping must be created for local to original indices. When partition is false, this mapping is currently the identity. When partition is true in a distributed setting, creating this map is troublesome since we need to coordinate that with other processes. For the time being, we just map new local indices to -1. That might need to be reviewed on the future, but seems to be enough since added nodes are usually not referenced by the orchestration script.
The main reason for having the Partition parameter is the need for the "original to local" data, that is a vector for unpartitioned meshes, to become a map for partitioned meshes (the IntVectorOrMap type). If that was not the case, we could have a cleaner design (less if constexpr situations) with GmpGemCRBase handling unpartitioned cases and a derived class handling the differences for the partitioned case.
template<template< class > class Vector, bool Partition>
Parses configuration options given by the user to create this PCR object. IMPORTANT: This method is called BOFORE the call to setMesh().
Parsed fields: coloringType - Expected values: "fem", "fvm" or "no". Must be present. orderNodes - Boolean. Default when missing is the value of the orderNodes model option. orderCells - Boolean. Default when missing is the value of the orderCells model option.
If Partition is true, the orderNodes and orderCells options control whether nodes and cells will be further renumbered to achieve locality after the mesh partition. Remaining fields (like colorCheck) are interpreted by the coloring / renumber algorithms.
Implements GmPluginObject.
Reimplemented in GmpGemaPCRBase< Vector >.