50 #define NonlocalMaterialWTP_DEBUG_PRINT 0 59 std :: set< int >relems;
60 std :: set< int > :: const_iterator relemsIter;
72 answer.
resize( relems.size() );
74 for (
int relem: relems ) {
75 answer.
at(_i++) = relem;
94 for (
auto &intdom: *lir ) {
95 remoteElemNum = ( intdom.nearGp )->giveElement()->giveGlobalNumber();
96 s.insert(remoteElemNum);
121 for ( ie = 1; ie <= nelem; ie++ ) {
160 std :: set< int >domainElementDepSet;
162 for ( ie = 1; ie <= nelems; ie++ ) {
168 for ( _i = 1; _i <= _size; _i++ ) {
169 domainElementDepSet.insert( iedep.
at(_i) );
172 #if NonlocalMaterialWTP_DEBUG_PRINT 173 fprintf(stderr,
"[%d] element %d dependency:", myrank, _globnum);
174 for ( _i = 1; _i <= _size; _i++ ) {
175 fprintf( stderr,
"%d ", iedep.
at(_i) );
178 fprintf(stderr,
"\n");
183 #if NonlocalMaterialWTP_DEBUG_PRINT 184 fprintf(stderr,
"[%d] nonlocal domain dependency:", myrank);
185 for (
int eldep: domainElementDepSet ) {
186 fprintf(stderr,
"%d ", eldep);
189 fprintf(stderr,
"\n");
193 for ( _i = 1; _i <= nelems; _i++ ) {
200 #if NonlocalMaterialWTP_DEBUG_PRINT 201 fprintf(stderr,
"[%d] remote elem wish list:", myrank);
202 for (
int eldep: domainElementDepSet ) {
203 fprintf(stderr,
"%d ", eldep);
206 fprintf(stderr,
"\n");
210 _locsize = domainElementDepSet.size() + 1;
211 result = MPI_Allreduce(& _locsize, & _globsize, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
212 if ( result != MPI_SUCCESS ) {
213 OOFEM_ERROR(
"MPI_Allreduce to determine broadcast buffer size failed");
218 std :: set< int >remoteWishSet;
221 for ( i = 0; i < nproc; i++ ) {
226 commBuff.
write(_locsize);
227 for (
int eldep: domainElementDepSet ) {
228 commBuff.
write(eldep);
231 result = commBuff.
bcast(i);
234 remoteWishSet.clear();
235 result = commBuff.
bcast(i);
237 commBuff.
read(_size);
238 for ( _i = 1; _i < _size; _i++ ) {
240 remoteWishSet.insert(_val);
244 for ( _i = 1; _i <= nelems; _i++ ) {
247 if ( remoteWishSet.find( elem->
giveGlobalNumber() ) != remoteWishSet.end() ) {
256 #if NonlocalMaterialWTP_DEBUG_PRINT 257 for ( i = 0; i < nproc; i++ ) {
259 fprintf(stderr,
"[%d] elements scheduled for mirroring at [%d]:",
265 fprintf(stderr,
"\n");
281 #ifdef __VERBOSE_PARALLEL 306 if ( iproc == myrank ) {
317 for ( ielem = 1; ielem <= nelem; ielem++ ) {
324 pcbuff->
write(_globnum);
341 if ( iproc == myrank ) {
350 pcbuff->
read(_globnum);
369 if ( iproc == myrank ) {
379 std :: set< int >nodesToSend;
384 for (
int i = 1; i <= nnodes; i++ ) {
394 for (
int in: nodesToSend ) {
426 if ( iproc == myrank ) {
436 if ( _type.size() == 0 ) {
456 _partitions.
at(1) = iproc;
459 if ( _type.size() == 0 ) {
493 for ( ie = 1; ie <= nelem; ie++ ) {
500 localElementDep.
resize(n);
501 for ( i = 1; i <= n; i++ ) {
bool contains(int value) const
int addDofManTransaction(DomainTransactionType, int, DofManager *)
int initExchange(int tag)
Initializes data exchange with all problems.
DofManager in active domain is shared only by remote elements (these are only introduced for nonlocal...
int addElementTransaction(DomainTransactionType, int, Element *)
Abstract base class for all nonlocal materials.
int giveGlobalNumber() const
int packAllData(T *ptr, int(T::*packFunc)(ProcessCommunicator &))
Pack all problemCommunicators data to their send buffers.
void init(Domain *d)
Initializes receiver; should be called before any work transfer.
int giveGlobalNumber() const
int commitTransactions(DomainTransactionManager *tm)
Commits transactions recorded in transaction manager.
virtual const char * giveInputRecordName() const =0
const IntArray * givePartitionList()
Returns partition list of receiver.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
int elementGlobal2Local(int _globnum)
Abstract base class for all finite elements.
DofManager * createDofManager(const char *name, int num, Domain *domain)
Creates new instance of Dof manager corresponding to given keyword.
Base class for dof managers.
int giveNumberOfProcesses() const
Returns the number of collaborating processes.
Element * giveElement()
Returns corresponding element to receiver.
Abstract base class for all nonlocal constitutive model statuses.
std::vector< localIntegrationRecord > * giveIntegrationDomainList()
Returns integration list of receiver.
int giveNumberOfElements() const
Returns number of elements in domain.
The ProcessCommunicator and corresponding buffers (represented by this class) are separated in order ...
int giveRank()
Returns corresponding rank of associated partition.
std::map< int, IntArray > nonlocElementDependencyMap
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual int giveNumberOfDofManagers() const
void setParallelMode(dofManagerParallelMode _mode)
Sets parallel mode of receiver.
int finishExchange()
Finishes the exchange.
void setParallelMode(elementParallelMode _mode)
Sets parallel mode of element.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
#define MIGRATE_REMOTE_ELEMENTS_TAG
int unpackMigratingElementDependencies(Domain *d, ProcessCommunicator &pc)
#define MIGRATE_NONLOCALDEP_TAG
int unpackRemoteElements(Domain *d, ProcessCommunicator &pc)
DomainTransactionManager * giveTransactionManager()
Returns domain transaction manager.
Element * giveElement(int n)
Service for accessing particular domain fe element.
virtual int write(const int *data, int count)
Writes count integer values from array pointed by data.
virtual int givePackSizeOfInt(int count)
virtual int resize(int newSize)
Resizes buffer to given size.
void clear()
Clears the array (zero size).
ProcessCommunicatorBuff * giveProcessCommunicatorBuff()
Returns communication buffer.
#define VERBOSEPARALLEL_PRINT(service, str, rank)
virtual void init()
Initializes buffer to empty state.
Class representing process communicator for engineering model.
int packRemoteElements(Domain *d, ProcessCommunicator &pc)
virtual int read(int *dest, int n)
Reads count integer values into array pointed by data.
void resize(int n)
Checks size of receiver towards requested bounds.
(Dynamic) In this case the communication pattern and the amount of data sent between nodes is not kno...
int unpackAllData(T *ptr, int(T::*unpackFunc)(ProcessCommunicator &))
Unpack all problemCommuncators data from recv buffers.
std::vector< std::list< int > > toSendList
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
int dofmanGlobal2Local(int _globnum)
void rebuildNonlocalPointTable(GaussPoint *gp, IntArray *contributingElems)
Rebuild list of integration points which take part in nonlocal average in given integration point...
void giveElementNonlocalDepArry(IntArray &answer, Domain *d, int num)
Element is local, there are no contributions from other domains to this element.
void giveNonlocalDepArryElementPlugin(GaussPoint *gp, std::set< int > &s)
Plugin for Element::ipEvaluator service to compile nonlocal dependency array for given element (in ca...
void migrate()
Migrates necessary local elements to remote processors, where they become remote elements needed to e...
IntegrationPointStatus * giveMaterialStatus()
Returns reference to associated material status (NULL if not defined).
Class representing communicator.
int packMigratingElementDependencies(Domain *d, ProcessCommunicator &pc)
#define CM_DefinitionGlobal
virtual int giveElementPartition(int ielem)=0
Returns the new partition number assigned to local element after LB.
void setPartitionList(IntArray &pl)
Sets partition list of receiver.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
virtual int bcast(int root)
Initializes broadcast over collaborating processes.
int giveRank() const
Returns domain rank in a group of collaborating processes (0..groupSize-1)
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
ClassFactory & classFactory
virtual int write(const int *src, int n)
Writes count integer values from array pointed by data.
Element in active domain is only mirror of some remote element.
virtual int read(int *data, int count)
Reads count integer values into array pointed by data.
void ipEvaluator(T *src, void(T::*f)(GaussPoint *gp))
Integration point evaluator, loops over receiver IP's and calls given function (passed as f parameter...
The Communicator and corresponding buffers (represented by this class) are separated in order to allo...
Abstract base class representing the "problem" under consideration.
Domain * giveDomain()
Returns reference to its domain.
void fastElementIPNonlocTableUpdater(GaussPoint *gp, IntArray &map)
Element plugin for ipEvaluator service to update nonlocal tables of its integration points from given...
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
void update()
Called after all wtps migrated their data.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
void fastRebuildNonlocalTables()
Rebuilds nonlocal integration tables in element gauss points using information in nonlocElementDepend...
Element * createElement(const char *name, int num, Domain *domain)
Creates new instance of element corresponding to given keyword.
bool isShared()
Returns true if receiver is shared.
#define NonlocalMaterialWTP_END_DATA
End-of-data marker, used to identify end of data stream received.
DofManager is local, there are no contribution from other domains to this DofManager.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
#define CM_UnknownDictState
Class representing integration point in finite element program.
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
virtual Material * giveMaterial()