![]() |
v0.16.3 |
Managing BitRefLevels. More...
#include "src/interfaces/CommInterface.hpp"
Public Member Functions | |
| MoFEMErrorCode | query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const |
| CommInterface (const MoFEM::Core &core) | |
| ~CommInterface ()=default | |
| Destructor. | |
Public Member Functions inherited from MoFEM::UnknownInterface | |
| template<class IFACE > | |
| MoFEMErrorCode | registerInterface (bool error_if_registration_failed=true) |
| Register interface. | |
| template<class IFACE > | |
| MoFEMErrorCode | getInterface (IFACE *&iface) const |
| Get interface reference to pointer of interface. | |
| template<class IFACE > | |
| MoFEMErrorCode | getInterface (IFACE **const iface) const |
| Get interface pointer to pointer of interface. | |
| template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0> | |
| IFACE | getInterface () const |
| Get interface pointer to pointer of interface. | |
| template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0> | |
| IFACE | getInterface () const |
| Get reference to interface. | |
| template<class IFACE > | |
| IFACE * | getInterface () const |
| Function returning pointer to interface. | |
| virtual | ~UnknownInterface ()=default |
Public Attributes | |
| MoFEM::Core & | cOre |
| bool | dEbug |
Static Public Attributes | |
| static bool | debug = false |
| static Sev | sev = Sev::verbose |
Load file | |
| using | LoadFileFun = std::function< std::array< Range, 4 >(std::array< Range, 4 > &&, std::vector< const CubitMeshSets * > &&)> |
| static std::array< Range, 4 > | defaultProcSkinFun (std::array< Range, 4 > &&proc_ents_skin, std::vector< const CubitMeshSets * > &&) |
| static MoFEMErrorCode | loadFileRootProcAllRestDistributed (moab::Interface &moab, const char *file_name, int dim, LoadFileFun proc_skin_fun=defaultProcSkinFun, const char *options="PARALLEL=BCAST;PARTITION=") |
| Root proc has whole mesh, other procs only part of it. | |
| static Range | getPartEntities (moab::Interface &moab, int part) |
| static MoFEMErrorCode | removeMeshsetFromPartition (moab::Interface &moab, const EntityHandle meshset, const int pcomm_id=MYPCOMM_INDEX) |
| Remove a meshset from all partition sets before it is deleted. | |
Functions when root proc has all entities | |
@ | |
| using | EntitiesPetscVector = std::pair< std::pair< Range, Range >, SmartPetscObj< Vec > > |
| using | UpdateGhosts = std::function< MoFEMErrorCode(Vec vec)> |
| static EntitiesPetscVector | createEntitiesPetscVector (MPI_Comm comm, moab::Interface &moab, std::function< Range(Range)> get_entities_fun, const int nb_coeffs, Sev sev=Sev::verbose, int root_rank=0, bool get_vertices=true) |
| Create a ghost vector for exchanging data. | |
| static EntitiesPetscVector | createEntitiesPetscVector (MPI_Comm comm, moab::Interface &moab, int dim, const int nb_coeffs, Sev sev=Sev::verbose, int root_rank=0) |
| Create a ghost vector for exchanging data. | |
| static MoFEMErrorCode | defaultUpdateGhosts (Vec v) |
| static MoFEMErrorCode | setVectorFromTag (moab::Interface &moab, EntitiesPetscVector &vec, Tag tag) |
| Set the Vector From Tag object. | |
| static MoFEMErrorCode | setTagFromVector (moab::Interface &moab, EntitiesPetscVector &vec, Tag tag) |
| Set the Tag From Vector object. | |
| static MoFEMErrorCode | updateEntitiesPetscVector (moab::Interface &moab, EntitiesPetscVector &vec, Tag tag, UpdateGhosts update_gosts=defaultUpdateGhosts) |
| Exchange data between vector and data. | |
Parent-child and connectivity mesh synchronisation | |
Examples use a MoFEM::Interface reference named m_field and entity ranges prepared according to each operation's contract. | |
| MoFEMErrorCode | synchroniseByParentChild (const BitRefLevel &parent_bit, const BitRefLevel &child_bit, int verb=DEFAULT_VERBOSITY) |
| MoFEMErrorCode | gatherMesh (const Range &cells, TetMeshData &data, int root=0) |
| MoFEMErrorCode | broadcastMesh (TetMeshData &data, int root=0) |
| MoFEMErrorCode | inheritPartitions (const Range &source_entities, const Range &child_entities) |
| MoFEMErrorCode | retainPartition (Range &entities, const BitRefLevel &active_bit, const Range &preserve={}) |
| MoFEMErrorCode | synchroniseByConnectivity (const Range &entities, int complete_mesh_rank=-1) |
Make elements multishared | |
| MoFEMErrorCode | resolveSharedFiniteElements (const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY) |
| resolve shared entities for finite elements in the problem | |
| MoFEMErrorCode | resolveSharedFiniteElements (const std::string name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY) |
| resolve shared entities for finite elements in the problem | |
Make entities multishared | |
| MoFEMErrorCode | makeEntitiesMultishared (const EntityHandle *entities, const int num_entities, const int owner_proc=0, int verb=DEFAULT_VERBOSITY) |
| make entities from proc 0 shared on all proc | |
| MoFEMErrorCode | makeEntitiesMultishared (Range &entities, const int owner_proc=0, int verb=DEFAULT_VERBOSITY) |
| make entities from proc 0 shared on all proc | |
| MoFEMErrorCode | makeFieldEntitiesMultishared (const std::string field_name, const int owner_proc=0, int verb=DEFAULT_VERBOSITY) |
| make field entities multi shared | |
| MoFEMErrorCode | exchangeFieldData (const std::string field_name, int verb=DEFAULT_VERBOSITY) |
| Exchange field data. | |
Synchronize entities (Following functions in future will be | |
deprecated) | |
| MoFEMErrorCode | synchroniseEntities (Range &ent, std::map< int, Range > *received_ents, int verb=DEFAULT_VERBOSITY) |
| synchronize entity range on processors (collective) | |
| MoFEMErrorCode | synchroniseEntities (Range &ent, int verb=DEFAULT_VERBOSITY) |
| synchronize entity range on processors (collective) | |
| MoFEMErrorCode | synchroniseFieldEntities (const std::string name, int verb=DEFAULT_VERBOSITY) |
| MoFEMErrorCode | resolveParentEntities (const Range &ent, int verb=DEFAULT_VERBOSITY) |
| Synchronise parent entities. | |
Read, load and broadcast | |
@ | |
| MoFEMErrorCode | partitionMesh (const Range &ents, const int dim, const int adj_dim, const int n_parts, Tag *th_vertex_weights=nullptr, Tag *th_edge_weights=nullptr, Tag *th_part_weights=nullptr, int verb=VERBOSE, const bool debug=false, const bool preserve_vertex_ids=false) |
| Set partition tag to each finite element in the problem. | |
Additional Inherited Members | |
Static Public Member Functions inherited from MoFEM::UnknownInterface | |
| static MoFEMErrorCode | getLibVersion (Version &version) |
| Get library version. | |
| static MoFEMErrorCode | getFileVersion (moab::Interface &moab, Version &version) |
| Get database major version. | |
| static MoFEMErrorCode | setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD)) |
| Get database major version. | |
| static MoFEMErrorCode | getInterfaceVersion (Version &version) |
| Get database major version. | |
Managing BitRefLevels.
Definition at line 68 of file CommInterface.hpp.
| using MoFEM::CommInterface::EntitiesPetscVector = std::pair<std::pair<Range, Range>, SmartPetscObj<Vec> > |
Definition at line 474 of file CommInterface.hpp.
| using MoFEM::CommInterface::LoadFileFun = std::function<std::array<Range, 4>( std::array<Range, 4> &&, std::vector<const CubitMeshSets *> &&)> |
Definition at line 423 of file CommInterface.hpp.
| using MoFEM::CommInterface::UpdateGhosts = std::function<MoFEMErrorCode(Vec vec)> |
Definition at line 539 of file CommInterface.hpp.
| MoFEM::CommInterface::CommInterface | ( | const MoFEM::Core & | core | ) |
Definition at line 18 of file CommInterface.cpp.
|
default |
Destructor.
| MoFEMErrorCode MoFEM::CommInterface::broadcastMesh | ( | TetMeshData & | data, |
| int | root = 0 |
||
| ) |
Collectively broadcast indexed mesh data from root to every rank. Sends coordinates, vertex IDs, connectivity, labels and partitions. Non-root input data is replaced by root's data.
Definition at line 275 of file CommInterface.cpp.
|
static |
Create a ghost vector for exchanging data.
| comm | |
| moab | |
| dim | dimension of partition entities |
| adj_dim | dimension of adjacent entities |
| nb_coeffs | number of coefficients |
| sev | |
| root_rank |
Definition at line 2542 of file CommInterface.cpp.
|
static |
Create a ghost vector for exchanging data.
With one MPI rank, all selected entities are local, even when the input mesh contains partition labels from a parallel run.
| comm | |
| moab | |
| get_entities_fun | function to get entities to partition |
| dim | dimension of partition entities |
| adj_dim | dimension of adjacent entities |
| nb_coeffs | number of coefficients |
| sev | |
| root_rank | |
| get_vertices | whether to get vertices along with entities |
Definition at line 2277 of file CommInterface.cpp.
|
inlinestatic |
Definition at line 427 of file CommInterface.hpp.
|
inlinestatic |
Definition at line 541 of file CommInterface.hpp.
| MoFEMErrorCode MoFEM::CommInterface::exchangeFieldData | ( | const std::string | field_name, |
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
Exchange field data.
Exchange field for all shared and ghosted entities. This function should be called collectively over the communicator for this ParallelComm. If the entities vector is empty, all shared entities participate in the exchange. If a proc has no owned entities this function must still be called since it is collective.
| verb | |
| field_name |
Definition at line 1581 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::gatherMesh | ( | const Range & | cells, |
| TetMeshData & | data, | ||
| int | root = 0 |
||
| ) |
Collective indexed-mesh transport for small global reconstruction jobs. gatherMesh merges selected cell closures by positive vertex IDs on root; cell copies must agree on partition. Vertex coordinates come from the owning rank when it contributes; otherwise use the lowest contributing rank. Without registered sharing, the lowest rank claiming ownership wins.
Definition at line 305 of file CommInterface.cpp.
|
static |
Definition at line 2183 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::inheritPartitions | ( | const Range & | source_entities, |
| const Range & | child_entities | ||
| ) |
Initialise cell partitions from representative parent tags. No BC, material, field or geometric transfer is performed.
Definition at line 414 of file CommInterface.cpp.
|
static |
Root proc has whole mesh, other procs only part of it.
| moab | |
| file_name | |
| dim | |
| proc_skin_fun | |
| options |
< cubit meshsets
Definition at line 1970 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::makeEntitiesMultishared | ( | const EntityHandle * | entities, |
| const int | num_entities, | ||
| const int | owner_proc = 0, |
||
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
make entities from proc 0 shared on all proc
| entities | |
| num_entities | |
| my_proc | default proc id to share from |
| verb |
Definition at line 1410 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::makeEntitiesMultishared | ( | Range & | entities, |
| const int | owner_proc = 0, |
||
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
make entities from proc 0 shared on all proc
| entities | |
| my_proc | default proc id to share from |
| verb |
Definition at line 1550 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::makeFieldEntitiesMultishared | ( | const std::string | field_name, |
| const int | owner_proc = 0, |
||
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
make field entities multi shared
| field_name | |
| owner_proc | |
| verb |
Definition at line 1566 of file CommInterface.cpp.
|
virtual |
Implements MoFEM::UnknownInterface.
Definition at line 11 of file CommInterface.cpp.
|
static |
Remove a meshset from all partition sets before it is deleted.
Field, finite element and problem meshsets are added to the partition set of their rank when created. MOAB does not remove a deleted handle from plain sets, so deleting such a meshset alone leaves a stale handle in the partition set, and recursive queries of that set, e.g. getPartEntities, fail with MB_ENTITY_NOT_FOUND. Call this before deleting the meshset. Does nothing when there is no ParallelComm or no partition set.
| moab | MOAB instance |
| meshset | meshset about to be deleted |
| pcomm_id | ParallelComm index |
Definition at line 2255 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::resolveParentEntities | ( | const Range & | ent, |
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
Synchronise parent entities.
Exchange parent entity tag and bitref of entity. Note thar parent handle can be different on each processor.
| ent | |
| verb |
Definition at line 1013 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::retainPartition | ( | Range & | entities, |
| const BitRefLevel & | active_bit, | ||
| const Range & | preserve = {} |
||
| ) |
Keep this rank's cells and closure; delete other selected entities except preserve (e.g. source lineage). Use before registering output sharing.
Definition at line 434 of file CommInterface.cpp.
|
static |
Set the Tag From Vector object.
| moab | |
| vec | |
| tag |
Definition at line 2512 of file CommInterface.cpp.
|
static |
Set the Vector From Tag object.
| moab | |
| vec | |
| tag |
Definition at line 2482 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::synchroniseByConnectivity | ( | const Range & | entities, |
| int | complete_mesh_rank = -1 |
||
| ) |
Establish sharing of an agreed, already distributed cell closure by vertex IDs/connectivity. Input has no previously registered output sharing. Coordinates are neither compared nor updated. Parent partition tags seed ownership; incident cells determine residence. Builds the local partition set and registers actual handles through MOAB. By default each tetrahedron must reside only on its partition owner. With complete_mesh_rank >= 0, that rank must hold every selected cell; other ranks may also retain halo cells. All cell owners must be resident. Non-owned cell copies are registered as ghosts, and local partition sets contain only owned cells and their closure. No mesh payload is transferred. The complete_mesh_rank argument must agree across ranks.
Definition at line 487 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::synchroniseByParentChild | ( | const BitRefLevel & | parent_bit, |
| const BitRefLevel & | child_bit, | ||
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
Synchronise a linear simplicial subdivision using existing ancestry. Collective on the mesh ParallelComm, including empty ranks. The parent level must already have consistent ownership, sharing and resident copies. Child vertices require consistent positive GLOBAL_ID values; copies must have matching connectivity and ancestry. Coordinates are not compared; geometry synchronisation is a separate caller operation. Each producer supplies a complete subdivision of the parent carriers it refines, including bounding entities. Children may be created concurrently or on a single, arbitrary rank. Missing children are transferred through MOAB; existing copies are reused. Children inherit their parent's owner and resident ranks, with local parent handles, refinement indices and partition/BC membership updated afterwards. Field/DOF numbering and additional ghost layers are caller responsibilities.
Definition at line 606 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::synchroniseEntities | ( | Range & | ent, |
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
synchronize entity range on processors (collective)
| ent | ents to send and received |
| verb |
Definition at line 997 of file CommInterface.cpp.
| MoFEMErrorCode MoFEM::CommInterface::synchroniseEntities | ( | Range & | ent, |
| std::map< int, Range > * | received_ents, | ||
| int | verb = DEFAULT_VERBOSITY |
||
| ) |
synchronize entity range on processors (collective)
synchronize entity range on processors (collective)
| ent | ents to send and received |
| received_ents | pointer to map with received entities |
| verb |
Definition at line 783 of file CommInterface.cpp.
|
static |
Exchange data between vector and data.
| tag |
This reads values from the tag, exchanges ghost values, and writes the exchanged values back to the tag.
Definition at line 2555 of file CommInterface.cpp.
| MoFEM::Core& MoFEM::CommInterface::cOre |
Definition at line 76 of file CommInterface.hpp.
|
inlinestatic |
Definition at line 70 of file CommInterface.hpp.
| bool MoFEM::CommInterface::dEbug |
Definition at line 77 of file CommInterface.hpp.
|
inlinestatic |
Definition at line 71 of file CommInterface.hpp.