|
OOFEM
2.1
|
Class representing communicator for engng model. More...
#include <problemcomm.h>
Inheritance diagram for oofem::ProblemCommunicator:
Collaboration diagram for oofem::ProblemCommunicator:Public Member Functions | |
| ProblemCommunicator (EngngModel *emodel, CommunicatorBuff *b, int rank, int size, ProblemCommunicatorMode mode) | |
| Constructor. | |
| virtual | ~ProblemCommunicator () |
| Destructor. | |
| void | setUpCommunicationMaps (EngngModel *emodel, bool excludeSelfCommFlag, bool forceReinit=false) |
| Service for setting up the communication patterns with other remote process. | |
| int | setProcessCommunicatorToSendArry (ProcessCommunicator *processComm, IntArray &map) |
| Assigns given map to given process communicator. | |
| int | setProcessCommunicatorToRecvArry (ProcessCommunicator *processComm, IntArray &map) |
| Assigns given map to given process communicator. | |
Protected Attributes | |
| ProblemCommunicatorMode | mode |
| Mode. | |
| bool | initialized |
Private Member Functions | |
| void | sortCommMap (IntArray &map, int(ProblemCommunicator::*cmp)(int, int)) |
| Sorts given communication map, containing local DofManager numbers according to their corresponding global numbers. | |
| void | quickSortCommMap (IntArray &map, int l, int r, int(ProblemCommunicator::*cmp)(int, int)) |
| Implementation of quicksort algorithm. | |
| int | quickSortPartition (IntArray &map, int l, int r, int(ProblemCommunicator::*cmp)(int, int)) |
| Partitioning used in quicksort. | |
| int | DofManCmp (int, int) |
| Global dofManager number comparison function. | |
| int | ElemCmp (int, int) |
| Global element comparison function. | |
| void | setUpCommunicationMapsForNodeCut (EngngModel *emodel, bool excludeSelfCommFlag) |
| Service for setting up the receiver for node cut communication patterns with other remote process. | |
| void | setUpCommunicationMapsForElementCut (EngngModel *emodel, bool excludeSelfCommFlag) |
| Service for setting up the receiver for element cut communication patterns with other remote process. | |
| void | setUpCommunicationMapsForRemoteElementMode (EngngModel *emodel, bool excludeSelfCommFlag) |
| Service for setting up the receiver for remote element communication patterns with other remote process. | |
Class representing communicator for engng model.
It is assumed to be an attribute of an engineering model. The communicator provides all services for communication with associated remote partitions. It manages several process communicators.
Definition at line 52 of file problemcomm.h.
| oofem::ProblemCommunicator::ProblemCommunicator | ( | EngngModel * | emodel, |
| CommunicatorBuff * | b, | ||
| int | rank, | ||
| int | size, | ||
| ProblemCommunicatorMode | mode | ||
| ) |
Constructor.
| emodel | Associated engineering model. |
| b | Buffer object. |
| rank | Rank of associated partition. |
| size | Number of collaborating processes. |
| mode | Communicator mode. |
Definition at line 47 of file problemcomm.C.
References initialized, and mode.
| oofem::ProblemCommunicator::~ProblemCommunicator | ( | ) | [virtual] |
Destructor.
Definition at line 56 of file problemcomm.C.
| int oofem::ProblemCommunicator::DofManCmp | ( | int | i, |
| int | j | ||
| ) | [private] |
Global dofManager number comparison function.
Definition at line 1003 of file problemcomm.C.
References oofem::Communicator::engngModel, oofem::Domain::giveDofManager(), oofem::EngngModel::giveDomain(), and oofem::DofManager::giveGlobalNumber().
Referenced by setProcessCommunicatorToRecvArry(), and setProcessCommunicatorToSendArry().
| int oofem::ProblemCommunicator::ElemCmp | ( | int | i, |
| int | j | ||
| ) | [private] |
Global element comparison function.
Definition at line 1009 of file problemcomm.C.
References oofem::Communicator::engngModel, oofem::EngngModel::giveDomain(), oofem::Domain::giveElement(), and oofem::Element::giveGlobalNumber().
Referenced by setProcessCommunicatorToRecvArry(), and setProcessCommunicatorToSendArry().
| void oofem::ProblemCommunicator::quickSortCommMap | ( | IntArray & | map, |
| int | l, | ||
| int | r, | ||
| int(ProblemCommunicator::*)(int, int) | cmp | ||
| ) | [private] |
Implementation of quicksort algorithm.
Definition at line 953 of file problemcomm.C.
References quickSortPartition().
Referenced by sortCommMap().
| int oofem::ProblemCommunicator::quickSortPartition | ( | IntArray & | map, |
| int | l, | ||
| int | r, | ||
| int(ProblemCommunicator::*)(int, int) | cmp | ||
| ) | [private] |
Partitioning used in quicksort.
Definition at line 968 of file problemcomm.C.
References oofem::IntArray::at().
Referenced by quickSortCommMap().
| int oofem::ProblemCommunicator::setProcessCommunicatorToRecvArry | ( | ProcessCommunicator * | processComm, |
| IntArray & | map | ||
| ) |
Assigns given map to given process communicator.
Sorts map according to global entity (dofmanagers or element) numbers to ensure, that local and corresponding remote process have the identical map with same ordering. This will ensure proper packing/unpacking order. The corresponding processCommunicator buffer takes care about resizing itself accordingly to hold all outgoing/incoming data using engngModel->estimateMaxPackSize service.
| processComm | Process comm which received map will be set. |
| map | Received map. |
Definition at line 928 of file problemcomm.C.
References _error, DofManCmp(), ElemCmp(), oofem::Communicator::engngModel, mode, oofem::ProblemCommMode__ELEMENT_CUT, oofem::ProblemCommMode__NODE_CUT, oofem::ProblemCommMode__REMOTE_ELEMENT_MODE, oofem::ProcessCommunicator::setToRecvArry(), and sortCommMap().
Referenced by setUpCommunicationMapsForElementCut(), setUpCommunicationMapsForNodeCut(), and setUpCommunicationMapsForRemoteElementMode().
| int oofem::ProblemCommunicator::setProcessCommunicatorToSendArry | ( | ProcessCommunicator * | processComm, |
| IntArray & | map | ||
| ) |
Assigns given map to given process communicator.
Sorts map according to global entity (dofmanagers or element) numbers to ensure, that local and corresponding remote process have the identical map with same ordering. This will ensure proper packing/unpacking order. The corresponding processCommunicator buffer takes care about resizing itself accordingly to hold all outgoing/incoming data using engngModel->estimateMaxPackSize service.
| processComm | Domain comm which send map will be set. |
| map | Send map. |
Definition at line 912 of file problemcomm.C.
References _error, DofManCmp(), ElemCmp(), oofem::Communicator::engngModel, mode, oofem::ProblemCommMode__ELEMENT_CUT, oofem::ProblemCommMode__NODE_CUT, oofem::ProblemCommMode__REMOTE_ELEMENT_MODE, oofem::ProcessCommunicator::setToSendArry(), and sortCommMap().
Referenced by setUpCommunicationMapsForElementCut(), setUpCommunicationMapsForNodeCut(), and setUpCommunicationMapsForRemoteElementMode().
| void oofem::ProblemCommunicator::setUpCommunicationMaps | ( | EngngModel * | emodel, |
| bool | excludeSelfCommFlag, | ||
| bool | forceReinit = false |
||
| ) |
Service for setting up the communication patterns with other remote process.
Sets up the toSend and toRecv attributes in associated process communicators.
| emodel | Associated engineering model. |
| excludeSelfCommFlag | If set to true, the communication map of receiver with itself will be forced to be empty, otherwise it will be assembled. |
| forceReinit | Forces reinitilaization. |
Definition at line 582 of file problemcomm.C.
References _error, initialized, mode, oofem::ProblemCommMode__ELEMENT_CUT, oofem::ProblemCommMode__NODE_CUT, oofem::ProblemCommMode__REMOTE_ELEMENT_MODE, oofem::Communicator::rank, setUpCommunicationMapsForElementCut(), setUpCommunicationMapsForNodeCut(), setUpCommunicationMapsForRemoteElementMode(), and VERBOSEPARALLEL_PRINT.
Referenced by oofem::DirectErrorIndicatorRC::estimateMeshDensities(), oofem::NonLinearDynamic::initializeCommMaps(), oofem::EngngModel::initializeCommMaps(), oofem::LinearStatic::solveYourself(), and oofem::NlDEIDynamic::solveYourself().
| void oofem::ProblemCommunicator::setUpCommunicationMapsForElementCut | ( | EngngModel * | emodel, |
| bool | excludeSelfCommFlag | ||
| ) | [private] |
Service for setting up the receiver for element cut communication patterns with other remote process.
Sets up the toSend and toRecv attributes in associated process communicators.
| emodel | Associated engineering model. |
| excludeSelfCommFlag | If set to true, the communication map of receiver with itself will be forced to be empty, otherwise it will be assembled. |
Definition at line 129 of file problemcomm.C.
References _error, oofem::IntArray::at(), oofem::StaticCommunicationBuffer::bcast(), oofem::DofManager_remote, oofem::IntArray::findFirstIndexOf(), oofem::Domain::giveDofManager(), oofem::EngngModel::giveDomain(), oofem::DofManager::giveGlobalNumber(), oofem::Domain::giveNumberOfDofManagers(), oofem::IntArray::givePackSize(), oofem::DofManager::giveParallelMode(), oofem::DofManager::givePartitionList(), oofem::Communicator::giveProcessCommunicator(), oofem::IntArray::giveSize(), oofem::StaticCommunicationBuffer::init(), mode, oofem::OOFEM_LOG_DEBUG(), oofem::CommunicationBuffer::packIntArray(), oofem::ProblemCommMode__ELEMENT_CUT, oofem::Communicator::rank, oofem::IntArray::resize(), oofem::StaticCommunicationBuffer::resize(), setProcessCommunicatorToRecvArry(), setProcessCommunicatorToSendArry(), oofem::Communicator::size, oofem::CommunicationBuffer::unpackIntArray(), and VERBOSEPARALLEL_PRINT.
Referenced by setUpCommunicationMaps().
| void oofem::ProblemCommunicator::setUpCommunicationMapsForNodeCut | ( | EngngModel * | emodel, |
| bool | excludeSelfCommFlag | ||
| ) | [private] |
Service for setting up the receiver for node cut communication patterns with other remote process.
Sets up the toSend and toRecv attributes in associated process communicators.
| emodel | Associated engineering model. |
| excludeSelfCommFlag | If set to true, the communication map of receiver with itself will be forced to be empty, otherwise it will be assembled. |
Definition at line 61 of file problemcomm.C.
References _error, oofem::IntArray::at(), oofem::DofManager_shared, oofem::Domain::giveDofManager(), oofem::EngngModel::giveDomain(), oofem::Domain::giveNumberOfDofManagers(), oofem::DofManager::giveParallelMode(), oofem::DofManager::givePartitionList(), oofem::Communicator::giveProcessCommunicator(), oofem::IntArray::giveSize(), mode, oofem::ProblemCommMode__NODE_CUT, oofem::Communicator::rank, setProcessCommunicatorToRecvArry(), setProcessCommunicatorToSendArry(), and oofem::Communicator::size.
Referenced by setUpCommunicationMaps().
| void oofem::ProblemCommunicator::setUpCommunicationMapsForRemoteElementMode | ( | EngngModel * | emodel, |
| bool | excludeSelfCommFlag | ||
| ) | [private] |
Service for setting up the receiver for remote element communication patterns with other remote process.
Sets up the toSend and toRecv attributes in associated process communicators.
| emodel | Associated engineering model. |
| excludeSelfCommFlag | If set to true, the communication map of receiver with itself will be forced to be empty, otherwise it will be assembled. |
Definition at line 343 of file problemcomm.C.
References _error, oofem::IntArray::at(), oofem::StaticCommunicationBuffer::bcast(), oofem::Element_local, oofem::Element_remote, oofem::IntArray::findFirstIndexOf(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElement(), oofem::Element::giveGlobalNumber(), oofem::Domain::giveNumberOfElements(), oofem::IntArray::givePackSize(), oofem::Element::giveParallelMode(), oofem::Element::givePartitionList(), oofem::Communicator::giveProcessCommunicator(), oofem::IntArray::giveSize(), oofem::StaticCommunicationBuffer::init(), mode, oofem::OOFEM_LOG_DEBUG(), oofem::CommunicationBuffer::packIntArray(), oofem::ProblemCommMode__REMOTE_ELEMENT_MODE, oofem::Communicator::rank, oofem::IntArray::resize(), oofem::StaticCommunicationBuffer::resize(), setProcessCommunicatorToRecvArry(), setProcessCommunicatorToSendArry(), oofem::Communicator::size, oofem::CommunicationBuffer::unpackIntArray(), and VERBOSEPARALLEL_PRINT.
Referenced by setUpCommunicationMaps().
| void oofem::ProblemCommunicator::sortCommMap | ( | IntArray & | map, |
| int(ProblemCommunicator::*)(int, int) | cmp | ||
| ) | [private] |
Sorts given communication map, containing local DofManager numbers according to their corresponding global numbers.
It could not be sorted by standard techniques, because it is necessary to ask DofMAnager form domain and determine its global Number.
| map | Map to sort. |
| cmp | Comparison function must return a negative value if first argument is less than the second, zero if the arguments are equal, and a positive number otherwise. |
Definition at line 946 of file problemcomm.C.
References oofem::IntArray::giveSize(), and quickSortCommMap().
Referenced by setProcessCommunicatorToRecvArry(), and setProcessCommunicatorToSendArry().
bool oofem::ProblemCommunicator::initialized [protected] |
Definition at line 57 of file problemcomm.h.
Referenced by ProblemCommunicator(), and setUpCommunicationMaps().
Mode.
Reimplemented from oofem::Communicator.
Definition at line 56 of file problemcomm.h.
Referenced by ProblemCommunicator(), setProcessCommunicatorToRecvArry(), setProcessCommunicatorToSendArry(), setUpCommunicationMaps(), setUpCommunicationMapsForElementCut(), setUpCommunicationMapsForNodeCut(), and setUpCommunicationMapsForRemoteElementMode().