Construction of ghost layers. More...
#include <arcane/mesh/FaceUniqueIdBuilder.h>
Public Types | |
| using | BoundaryInfosMap = HashTableMapT<Int32, SharedArray<Int64>> |
| using | BoundaryInfosMapEnumerator = HashTableMapEnumeratorT<Int32, SharedArray<Int64>> |
Public Member Functions | |
| FaceUniqueIdBuilder (DynamicMeshIncrementalBuilder *mesh_builder) | |
| Constructs an instance for the mesh. | |
| void | computeFacesUniqueIds () |
| Public Member Functions inherited from Arcane::TraceAccessor | |
| TraceAccessor (ITraceMng *m) | |
| Constructs an accessor via the trace manager m. | |
| TraceAccessor (const TraceAccessor &rhs) | |
| Copy constructor. | |
| TraceAccessor & | operator= (const TraceAccessor &rhs) |
| Copy assignment operator. | |
| virtual | ~TraceAccessor () |
| Frees resources. | |
| ITraceMng * | traceMng () const |
| Trace manager. | |
| TraceMessage | info () const |
| Flow for an information message. | |
| TraceMessage | pinfo () const |
| Flow for a parallel information message. | |
| TraceMessage | info (char category) const |
| Flow for an information message of a given category. | |
| TraceMessage | pinfo (char category) const |
| Flow for a parallel information message of a given category. | |
| TraceMessage | info (bool v) const |
| Flow for an information message. | |
| TraceMessage | warning () const |
| Flow for a warning message. | |
| TraceMessage | pwarning () const |
| TraceMessage | error () const |
| Flow for an error message. | |
| TraceMessage | perror () const |
| TraceMessage | log () const |
| Flow for a log message. | |
| TraceMessage | plog () const |
| Flow for a log message. | |
| TraceMessage | logdate () const |
| Flow for a log message preceded by the date. | |
| TraceMessage | fatal () const |
| Flow for a fatal error message. | |
| TraceMessage | pfatal () const |
| Flow for a parallel fatal error message. | |
| TraceMessageDbg | debug (Trace::eDebugLevel=Trace::Medium) const |
| Flow for a debug message. | |
| Trace::eDebugLevel | configDbgLevel () const |
| Debug level of the configuration file. | |
| TraceMessage | info (Int32 verbose_level) const |
| Flow for an information message of a given level. | |
| TraceMessage | linfo () const |
| Flow for an information message with the local information level of this instance. | |
| TraceMessage | linfo (Int32 relative_level) const |
| Flow for an information message with the local information level of this instance. | |
| void | fatalMessage (const StandaloneTraceMessage &o) const |
Private Member Functions | |
| void | _computeFacesUniqueIdsSequential () |
| Calculates the unique IDs for each face sequentially. | |
| void | _computeFacesUniqueIdsParallelV1 () |
| Calculates the unique numbers for each face in parallel. | |
| void | _v1Distributed () |
| Distributed computation of the face numbering of version 1. | |
| void | _v1CheckAndDump (Int64ConstArrayView faces_new_uid, Int64ConstArrayView faces_opposite_cell_uid) |
| Checks that every face has been numbered and, in verbose mode, writes one line per (cell, face) to faces_uid.<rank>. | |
| void | _v1CellBlockSizes (Int64ConstArrayView faces_opposite_cell_uid, IntegerArray &my_cells_nb_back_face, Array< T_CellFaceInfo > &my_cells_faces_info) |
| Sizes every cell's block of face ids: its back faces plus its faces of the domain boundary. | |
| void | _v1ByAllGather (Int64ArrayView faces_opposite_cell_uid, IntegerArrayView faces_opposite_cell_index, IntegerArrayView faces_opposite_cell_owner, HashTableMapT< Int64, Int64 > &cells_first_face_uid, IntegerArray &my_cells_nb_back_face, Array< T_CellFaceInfo > &my_cells_faces_info) |
| The all-gather: every rank receives every boundary face, then every cell of the mesh, and keeps what concerns it. | |
| void | _v1AssignFaceUniqueIds (Int64ConstArrayView faces_opposite_cell_uid, IntegerConstArrayView faces_opposite_cell_index, IntegerConstArrayView faces_opposite_cell_owner, HashTableMapT< Int64, Int64 > &cells_first_face_uid, IntegerConstArrayView my_cells_nb_back_face) |
| Gives every face its uniqueId and its owner from the block starts. | |
| void | _computeFacesUniqueIdsParallelV2 () |
| Calculates the unique IDs for each face in parallel V2. | |
| void | _exchangeData (IParallelExchanger *exchanger, BoundaryInfosMap &boundary_infos_to_send) |
| void | _checkNoDuplicate () |
| Checks that there are no duplicate uniqueIds. | |
Private Attributes | |
| DynamicMesh * | m_mesh = nullptr |
| DynamicMeshIncrementalBuilder * | m_mesh_builder = nullptr |
| bool | m_is_v1_distributed = false |
| Distribute the face numbering of version 1 (ARCANE_DISTRIBUTED_FACE_NUMBERING=1). | |
Additional Inherited Members | |
| Protected Member Functions inherited from Arcane::TraceAccessor | |
| void | _setLocalVerboseLevel (Int32 v) |
| Int32 | _localVerboseLevel () const |
Construction of ghost layers.
Definition at line 38 of file FaceUniqueIdBuilder.h.
| using Arcane::mesh::FaceUniqueIdBuilder::BoundaryInfosMap = HashTableMapT<Int32, SharedArray<Int64>> |
Definition at line 43 of file FaceUniqueIdBuilder.h.
| using Arcane::mesh::FaceUniqueIdBuilder::BoundaryInfosMapEnumerator = HashTableMapEnumeratorT<Int32, SharedArray<Int64>> |
Definition at line 44 of file FaceUniqueIdBuilder.h.
|
explicit |
Constructs an instance for the mesh.
Definition at line 61 of file FaceUniqueIdBuilder.cc.
References m_is_v1_distributed, Arcane::TraceAccessor::TraceAccessor(), and Arcane::TraceAccessor::traceMng().
|
private |
Checks that there are no duplicate uniqueIds.
Definition at line 150 of file FaceUniqueIdBuilder.cc.
References ARCANE_FATAL, Arcane::mesh::ItemInternalMap::eachItem(), Arcane::TraceAccessor::info(), Arcane::TraceAccessor::pwarning(), and Arcane::Item::uniqueId().
|
private |
Calculates the unique numbers for each face in parallel.
In addition to numbering, it determines the owning sub-domain of each face, considering that a face belongs to the same sub-domain as the cell behind it (or to the current sub-domain for a boundary cell).
A face is numbered from its back cell: the cells, in increasing uniqueId, each own a contiguous block of face ids, one per face they are behind plus one per face of the domain boundary they hold, and a face takes its position in the block. This is a global computation: a face's uniqueId depends on the cells of every sub-domain with a smaller uniqueId.
By default every rank performs that computation whole: it gathers the sub-domain boundary faces and then the cells of the entire mesh, and numbers the mesh sequentially to keep its own share (_v1ByAllGather()). With ARCANE_DISTRIBUTED_FACE_NUMBERING=1 the computation itself is distributed over the ranks (_v1Distributed()), with the same uniqueIds.
Definition at line 349 of file FaceUniqueIdBuilder.cc.
References _v1AssignFaceUniqueIds(), _v1ByAllGather(), _v1Distributed(), Arcane::Array< T >::fill(), and m_is_v1_distributed.
|
private |
Calculates the unique IDs for each face in parallel V2.
Definition at line 1393 of file FaceUniqueIdBuilder.cc.
References _exchangeData(), Arcane::Array< T >::add(), ARCANE_FATAL, Arcane::Face::backCell(), Arcane::IParallelMng::barrier(), Arcane::Array< T >::clear(), Arcane::IParallelMng::commRank(), Arcane::IParallelMng::commSize(), Arcane::ParallelMngUtils::createExchangerRef(), Arcane::TraceAccessor::debug(), Arcane::mesh::ItemInternalMap::eachItem(), Arcane::Array< T >::fill(), Arcane::ITraceMng::flush(), Arcane::Face::frontCell(), Arcane::RefImpl< InstanceType, RefClassType, ImplTagId >::get(), Arcane::ISerializer::getInt64(), Arcane::ISerializer::getSpan(), Arcane::TraceAccessor::info(), Arcane::Item::localId(), Arcane::HashTableMapT< KeyType, ValueType, KeyTraitsType >::lookupAdd(), Arcane::math::max(), Arcane::IItemFamily::maxLocalId(), Arcane::ISerializer::ModeGet, Arcane::Face::nbCell(), Arcane::ItemTypeInfo::nbLocalNode(), Arcane::ItemWithNodes::nbNode(), Arcane::ItemWithNodes::node(), Arcane::ItemWithNodes::nodes(), Arcane::Item::null(), Arcane::ItemBase::null(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceMax, Arcane::Array< T >::reserve(), Arcane::Array< T >::resize(), Arcane::MessagePassing::ISerializeMessage::serializer(), Arcane::ISerializer::setMode(), Arcane::MutableItemBase::setOwner(), Arcane::TraceAccessor::traceMng(), Arcane::mesh::ItemInternalMap::tryFind(), Arcane::Item::type(), Arcane::ItemTypeMng::typeFromId(), and Arcane::Item::uniqueId().
|
private |
Calculates the unique IDs for each face sequentially.
Definition at line 1629 of file FaceUniqueIdBuilder.cc.
References Arcane::mesh::ItemInternalMap::eachItem(), Arcane::Cell::faces(), Arcane::TraceAccessor::info(), and Arcane::Item::uniqueId().
|
private |
//COPY FROM GhostLayerBuilder. Make a unique class.
Definition at line 1303 of file FaceUniqueIdBuilder.cc.
References Arcane::IParallelExchanger::addSender(), Arcane::ISerializer::allocateBuffer(), Arcane::TraceAccessor::debug(), Arcane::MessagePassing::ISerializeMessage::destination(), Arcane::TraceAccessor::info(), Arcane::IParallelExchanger::initializeCommunicationsMessages(), Arcane::Int64, Arcane::IParallelExchanger::messageToSend(), Arcane::ISerializer::ModePut, Arcane::IParallelExchanger::nbReceiver(), Arcane::IParallelExchanger::nbSender(), Arcane::IParallelExchanger::processExchange(), Arcane::ISerializer::putInt64(), Arcane::ISerializer::putSpan(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceSum, Arcane::ISerializer::reserveInt64(), Arcane::ISerializer::reserveSpan(), Arcane::MessagePassing::ISerializeMessage::serializer(), Arcane::ISerializer::setMode(), Arcane::ConstArrayView< T >::size(), and Arcane::MessagePassing::MessageRank::value().
Referenced by _computeFacesUniqueIdsParallelV2().
|
private |
Gives every face its uniqueId and its owner from the block starts.
Definition at line 998 of file FaceUniqueIdBuilder.cc.
References _v1CheckAndDump(), Arcane::IParallelMng::commRank(), Arcane::mesh::ItemInternalMap::eachItem(), Arcane::Cell::faces(), Arcane::TraceAccessor::fatal(), Arcane::Array< T >::fill(), Arcane::HashTableMapT< KeyType, ValueType, KeyTraitsType >::hasKey(), Arcane::Item::localId(), and Arcane::Item::uniqueId().
Referenced by _computeFacesUniqueIdsParallelV1().
|
private |
The all-gather: every rank receives every boundary face, then every cell of the mesh, and keeps what concerns it.
Definition at line 1067 of file FaceUniqueIdBuilder.cc.
References _v1CellBlockSizes(), Arcane::Array< T >::add(), Arcane::HashTableMapT< KeyType, ValueType, KeyTraitsType >::add(), Arcane::MutableItemBase::addFlags(), Arcane::IParallelMng::allGatherVariable(), Arcane::Face::cell(), Arcane::Array< T >::clear(), Arcane::IParallelMng::commRank(), Arcane::IParallelMng::commSize(), Arcane::Array< T >::data(), Arcane::TraceAccessor::debug(), Arcane::mesh::ItemInternalMap::eachItem(), Arcane::Cell::faces(), Arcane::mesh::ItemTools::findFaceInNode2(), Arcane::ItemBase::flags(), Arcane::HashTableMapT< KeyType, ValueType, KeyTraitsType >::hasKey(), Arcane::mesh::ItemInternalMap::hasKey(), Arcane::ItemFlags::II_HasBackCell, Arcane::ItemFlags::II_Shared, Arcane::ItemFlags::II_SubDomainBoundary, Arcane::TraceAccessor::info(), Arcane::Face::isSubDomainBoundary(), Arcane::Item::itemBase(), Arcane::Item::localId(), Arcane::Item::mutableItemBase(), Arcane::ItemTypeInfo::nbLocalNode(), Arcane::ItemWithNodes::nodes(), Arcane::Item::null(), Arcane::Item::owner(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceMax, Arcane::MessagePassing::ReduceSum, Arcane::Array< T >::reserve(), Arcane::AbstractArray< T >::size(), Arcane::mesh::ItemInternalMap::tryFind(), Arcane::Item::type(), Arcane::ItemTypeMng::typeFromId(), and Arcane::Item::uniqueId().
Referenced by _computeFacesUniqueIdsParallelV1().
|
private |
Sizes every cell's block of face ids: its back faces plus its faces of the domain boundary.
Definition at line 875 of file FaceUniqueIdBuilder.cc.
References Arcane::Array< T >::add(), Arcane::Array< T >::clear(), Arcane::mesh::ItemInternalMap::eachItem(), Arcane::Array< T >::fill(), Arcane::Item::localId(), Arcane::Array< T >::reserve(), Arcane::Array< T >::resize(), and Arcane::Item::uniqueId().
Referenced by _v1ByAllGather().
|
private |
Checks that every face has been numbered and, in verbose mode, writes one line per (cell, face) to faces_uid.<rank>.
faces_opposite_cell_uid is NULL_ITEM_ID for a face of the domain boundary, the cell on the other side for a shared face, or a negative value when that cell is not known here (it is then not written).
Definition at line 919 of file FaceUniqueIdBuilder.cc.
References ARCANE_FATAL, Arcane::mesh::ItemInternalMap::eachItem(), Arcane::TraceAccessor::error(), Arcane::Cell::faces(), Arcane::TraceAccessor::info(), Arcane::String::localstr(), and Arcane::Item::uniqueId().
Referenced by _v1AssignFaceUniqueIds(), and _v1Distributed().
|
private |
Distributed computation of the face numbering of version 1.
Each rank computes a share of the numbering instead of all of it, and holds O(N/P + B) data instead of O(N), for N cells, P ranks and B faces on the boundary of its sub-domain; the number of collectives does not depend on N.
Two facts come from the other sub-domains: for a face with one cell here, whether a cell is on the other side and on which rank (if not, the face is on the boundary of the domain); and where every cell's block starts, which is the sum of the block sizes of all the cells of smaller uniqueId, a prefix sum over the whole mesh. Only the rank in front of a shared face needs both: the rank behind it numbers it from its own cell's block.
Step 2 is sent while step 1 travels. A mesh the numbering cannot describe (a face held by more than two sub-domains or behind on both, a cell held by two ranks or by none) is a fatal error: the gathering version numbers it inconsistently without a word.
Step 1 is inspired by the rendezvous algorithm of Plimpton, Hendrickson and Stewart (J. Parallel Distrib. Comput., 2004).
Definition at line 418 of file FaceUniqueIdBuilder.cc.
References _v1CheckAndDump(), Arcane::Array< T >::add(), Arcane::MutableItemBase::addFlags(), Arcane::IParallelNonBlockingCollective::allReduce(), ARCANE_FATAL, Arcane::Face::backCell(), Arcane::Array< T >::begin(), Arcane::Array< T >::clear(), Arcane::IParallelMng::commRank(), Arcane::IParallelMng::commSize(), Arcane::Array< T >::copy(), Arcane::mesh::ItemInternalMap::count(), Arcane::Array< T >::data(), Arcane::SpanImpl< T, SizeType, Extent >::data(), Arcane::mesh::ItemInternalMap::eachItem(), Arcane::Array< T >::end(), Arcane::mesh::Int64AllToAll::exchangeCounts(), Arcane::Cell::faces(), Arcane::Array< T >::fill(), Arcane::mesh::Int64AllToAll::from(), Arcane::ItemFlags::II_HasBackCell, Arcane::ItemFlags::II_Shared, Arcane::ItemFlags::II_SubDomainBoundary, Arcane::TraceAccessor::info(), Arcane::Face::isSubDomainBoundary(), Arcane::Item::localId(), Arcane::Item::mutableItemBase(), Arcane::Face::nbCell(), Arcane::ItemWithNodes::nbNode(), Arcane::ItemWithNodes::nodes(), Arcane::IParallelMng::nonBlockingCollective(), Arcane::Item::owner(), Arcane::mesh::Int64AllToAll::received(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceMax, Arcane::MessagePassing::ReduceSum, Arcane::Array< T >::reserve(), Arcane::Array< T >::resize(), Arcane::MutableItemBase::setOwner(), Arcane::AbstractArray< T >::size(), Arcane::SpanImpl< T, SizeType, Extent >::size(), Arcane::mesh::Int64AllToAll::start(), Arcane::Array< T >::subConstView(), Arcane::Item::uniqueId(), Arcane::mesh::Int64AllToAll::wait(), and Arcane::IParallelMng::waitAllRequests().
Referenced by _computeFacesUniqueIdsParallelV1().
| void Arcane::mesh::FaceUniqueIdBuilder::computeFacesUniqueIds | ( | ) |
Definition at line 76 of file FaceUniqueIdBuilder.cc.
|
private |
Distribute the face numbering of version 1 (ARCANE_DISTRIBUTED_FACE_NUMBERING=1).
Definition at line 60 of file FaceUniqueIdBuilder.h.
Referenced by _computeFacesUniqueIdsParallelV1(), and FaceUniqueIdBuilder().
|
private |
Definition at line 57 of file FaceUniqueIdBuilder.h.
|
private |
Definition at line 58 of file FaceUniqueIdBuilder.h.