45 #ifdef __PARALLEL_MODE 67 IntArray patchElems, dofManToDetermine, pap;
76 #ifdef __PARALLEL_MODE 95 dofManPatchCount.
resize(regionDofMans);
96 dofManPatchCount.
zero();
103 for (
int ipap = 1; ipap <= npap; ipap++ ) {
104 int papNumber = pap.
at(ipap);
105 int oldSize = regionValSize;
107 this->
initPatch(patchElems, dofManToDetermine, pap, papNumber, elementSet);
108 this->
computePatch(a, patchElems, regionValSize, regType, type, tStep);
109 if ( oldSize == 0 ) {
110 dofManValues.
resize(regionDofMans * regionValSize);
114 dofManToDetermine, a, regType);
117 #ifdef __PARALLEL_MODE 122 bool abortFlag =
false;
123 for (
int i = 1; i <= nnodes; i++ ) {
124 if ( regionNodalNumbers.
at(i) &&
127 int eq = ( regionNodalNumbers.
at(i) - 1 ) * regionValSize;
128 if ( dofManPatchCount.
at( regionNodalNumbers.
at(i) ) ) {
129 for (
int j = 1; j <= regionValSize; j++ ) {
130 dofManValues.
at(eq + j) /= dofManPatchCount.
at( regionNodalNumbers.
at(i) );
135 for (
int j = 1; j <= regionValSize; j++ ) {
136 dofManValues.
at(eq + j) = 0.0;
160 int npap, ipap, count, neq, nip;
165 const IntArray *papDofManConnectivity;
166 enum { papStatus_noPap, papStatus_regular, papStatus_boundary, papStatus_littleNIPs };
169 for ( idofMan = 1; idofMan <= ndofMan; idofMan++ ) {
170 dofManFlags.
at(idofMan) = papStatus_noPap;
175 for (
int i = 1; i <= elements.
giveSize(); i++ ) {
176 ielem = elements.
at(i);
186 for ( ipap = 1; ipap <= npap; ipap++ ) {
187 dofManFlags.
at( elemPap.
at(ipap) ) = papStatus_regular;
199 for ( idofMan = 1; idofMan <= ndofMan; idofMan++ ) {
202 dofManFlags.
at(idofMan) = papStatus_boundary;
206 if ( dofManFlags.
at(idofMan) != papStatus_noPap ) {
208 for ( ielem = 1; ielem <= papDofManConnectivity->
giveSize(); ielem++ ) {
225 dofManFlags.
at(idofMan) = papStatus_littleNIPs;
240 bool foundRegularPap, foundBoundaryPap, abort_flag =
false;
242 for ( idofMan = 1; idofMan <= ndofMan; idofMan++ ) {
243 foundRegularPap = foundBoundaryPap =
false;
244 if ( dofManFlags.
at(idofMan) == papStatus_littleNIPs ) {
246 for ( ielem = 1; ielem <= papDofManConnectivity->
giveSize(); ielem++ ) {
261 for ( ipap = 1; ipap <= npap; ipap++ ) {
263 if ( dofManFlags.
at( elemPap.
at(ipap) ) == papStatus_littleNIPs ) {
267 if ( dofManFlags.
at( elemPap.
at(ipap) ) == papStatus_regular ) {
268 foundRegularPap =
true;
269 }
else if ( dofManFlags.
at( elemPap.
at(ipap) ) == papStatus_boundary ) {
270 foundBoundaryPap =
true;
276 if ( foundRegularPap ) {
281 if ( foundBoundaryPap ) {
284 for ( ielem = 1; ielem <= papDofManConnectivity->
giveSize(); ielem++ ) {
293 for ( ipap = 1; ipap <= npap; ipap++ ) {
294 if ( dofManFlags.
at( elemPap.
at(ipap) ) == papStatus_boundary ) {
296 dofManFlags.
at( elemPap.
at(ipap) ) = papStatus_regular;
304 if ( dofManFlags.
at(idofMan) == papStatus_littleNIPs ) {
319 for ( idofMan = 1; idofMan <= ndofMan; idofMan++ ) {
320 if ( dofManFlags.
at(idofMan) == papStatus_regular ) {
327 for ( idofMan = 1; idofMan <= ndofMan; idofMan++ ) {
328 if ( dofManFlags.
at(idofMan) == papStatus_regular ) {
329 pap.
at(++count) = idofMan;
339 int nelem, ndofman, count, patchElements, j, includes, npap, ipap;
341 std :: list< int >dofManToDetermineList;
343 IntArray toDetermine, toDetermine2, elemPap, papInv;
351 nelem = papDofManConnectivity->
giveSize();
353 for (
int ielem = 1; ielem <= nelem; ielem++ ) {
358 if ( elementSet.
hasElement(papDofManConnectivity->
at(ielem)) ) {
366 for (
int ielem = 1; ielem <= nelem; ielem++ ) {
373 if ( elementSet.
hasElement(papDofManConnectivity->
at(ielem)) ) {
374 patchElems.
at(++patchElements) = papDofManConnectivity->
at(ielem);
382 for (
int i = 1; i <= pap.
giveSize(); ++i ) {
383 papInv.
at( pap.
at(i) ) = 1;
388 dofManToDetermine.
clear();
389 for (
int ielem = 1; ielem <= patchElements; ielem++ ) {
399 for (
int i = 1; i <= toDetermine.
giveSize(); i++ ) {
402 for (
int dman: dofManToDetermineList ) {
403 if ( dman == toDetermine.
at(i) ) {
409 dofManToDetermineList.push_back( toDetermine.
at(i) );
417 for ( ipap = 1; ipap <= npap; ipap++ ) {
420 if ( papInv.
at( elemPap.
at(ipap) ) == 0 ) {
423 for (
int dman: dofManToDetermineList ) {
424 if ( dman == elemPap.
at(ipap) ) {
430 dofManToDetermineList.push_back( elemPap.
at(ipap) );
435 for ( j = 1; j <= toDetermine2.
giveSize(); j++ ) {
438 for (
int dman: dofManToDetermineList ) {
439 if ( dman == toDetermine2.
at(j) ) {
445 dofManToDetermineList.push_back( toDetermine2.
at(j) );
455 count = (int)dofManToDetermineList.size();
457 dofManToDetermine.
resize(count);
460 for (
int dman: dofManToDetermineList ) {
461 dofManToDetermine.
at(++count) = dman;
476 rhs.
resize(neq, regionValSize);
483 for (
int ielem = 1; ielem <= nelem; ielem++ ) {
488 int hasVal = element->
giveIPValue(ipVal, gp, type, tStep);
490 ipVal.
resize(regionValSize);
492 }
else if ( regionValSize == 0 ) {
494 rhs.
resize(neq, regionValSize);
501 for (
int j = 1; j <= neq; j++ ) {
502 for (
int k = 1; k <= regionValSize; k++ ) {
503 rhs.
at(j, k) += P.
at(j) * ipVal.
at(k);
506 for (
int k = 1; k <= neq; k++ ) {
507 A.
at(j, k) += P.
at(j) * P.
at(k);
522 int ndofMan = dofManToDetermine.
giveSize();
525 for (
int dofMan = 1; dofMan <= ndofMan; dofMan++ ) {
531 int eq = ( regionNodalNumbers.
at( dofManToDetermine.
at(dofMan) ) - 1 ) * vals.
giveSize();
532 for (
int i = 1; i <= vals.
giveSize(); i++ ) {
533 dofManValues.
at(eq + i) += vals.
at(i);
536 dofManCount.
at( regionNodalNumbers.
at( dofManToDetermine.
at(dofMan) ) )++;
546 P.
at(2) = coords.
at(1);
547 P.
at(3) = coords.
at(2);
551 P.
at(2) = coords.
at(1);
552 P.
at(3) = coords.
at(2);
553 P.
at(4) = coords.
at(3);
557 P.
at(2) = coords.
at(1);
558 P.
at(3) = coords.
at(2);
559 P.
at(4) = coords.
at(1) * coords.
at(2);
560 P.
at(5) = coords.
at(1) * coords.
at(1);
561 P.
at(6) = coords.
at(2) * coords.
at(2);
565 P.
at(2) = coords.
at(1);
566 P.
at(3) = coords.
at(2);
567 P.
at(4) = coords.
at(3);
568 P.
at(5) = coords.
at(1) * coords.
at(1);
569 P.
at(6) = coords.
at(1) * coords.
at(2);
570 P.
at(7) = coords.
at(1) * coords.
at(3);
571 P.
at(8) = coords.
at(2) * coords.
at(2);
572 P.
at(9) = coords.
at(2) * coords.
at(3);
573 P.
at(10) = coords.
at(3) * coords.
at(3);
604 OOFEM_ERROR(
"unable to determine region patchtype");
614 #ifdef __PARALLEL_MODE 619 #ifdef __PARALLEL_MODE 626 OOFEM_LOG_INFO(
"SPRNodalRecoveryModel :: initCommMaps: initialized comm maps");
635 IntArray ®ionNodalNumbers,
int regionValSize)
637 parallelStruct ls( &dofManValues, &dofManPatchCount, ®ionNodalNumbers, regionValSize);
649 int result = 1, i, j, indx, eq, size;
654 for ( i = 1; i <= size; i++ ) {
660 result &= pcbuff->
write(1);
667 result &= pcbuff->
write(0);
678 int i, j, eq, indx, size, flag;
684 for ( i = 1; i <= size; i++ ) {
688 result &= pcbuff->
read(flag);
693 result &= pcbuff->
read(value);
IntArray * regionNodalNumbers
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
void determineValuesFromPatch(FloatArray &dofManValues, IntArray &dofManCount, IntArray ®ionNodalNumbers, IntArray &dofManToDetermine, FloatMatrix &a, SPRPatchType type)
int initExchange(int tag)
Initializes data exchange with all problems.
The element interface required by ZZNodalRecoveryModel.
void exchangeDofManValues(FloatArray &dofManValues, IntArray &dofManPatchCount, IntArray ®ionNodalNumbers, int regionValSize)
virtual int SPRNodalRecoveryMI_giveNumberOfIP()=0
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
virtual int recoverValues(Set elementSet, InternalStateType type, TimeStep *tStep)
Recovers the nodal values for all regions.
void computePolynomialTerms(FloatArray &P, FloatArray &coords, SPRPatchType type)
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
IntArray * dofManPatchCount
Helper structure to pass required arguments to packing/unpacking functions needed in parallel mode...
int initRegionNodeNumbering(IntArray ®ionNodalNumbers, int ®ionDofMans, Set ®ion)
Determine local region node numbering and determine and check nodal values size.
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
Solves the system of linear equations .
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
int packSharedDofManData(parallelStruct *s, ProcessCommunicator &processComm)
int packAllData(T *ptr, int(T::*packFunc)(ProcessCommunicator &))
Pack all problemCommunicators data to their send buffers.
void zero()
Sets all component to zero.
void initPatch(IntArray &patchElems, IntArray &dofManToDetermine, IntArray &pap, int papNumber, Set &elementList)
double & at(int i)
Coefficient access function.
int giveNumberOfUnknownPolynomialCoefficients(SPRPatchType regType)
ConnectivityTable * giveConnectivityTable()
Returns receiver's associated connectivity table.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Abstract base class for all finite elements.
int giveNumberOfProcesses() const
Returns the number of collaborating processes.
int updateRegionRecoveredValues(const IntArray ®ionNodalNumbers, int regionValSize, const FloatArray &rhs)
Update the nodal table according to recovered solution for given region.
The ProcessCommunicator and corresponding buffers (represented by this class) are separated in order ...
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)=0
Abstract base class representing integration rule.
int finishExchange()
Finishes the exchange.
REGISTER_NodalRecoveryModel(NodalAveragingRecoveryModel, NodalRecoveryModel::NRM_NodalAveraging)
const IntArray * giveToSendMap()
Returns receiver to send map.
void computePatch(FloatMatrix &a, IntArray &patchElems, int ®ionValSize, SPRPatchType regType, InternalStateType type, TimeStep *tStep)
int unpackSharedDofManData(parallelStruct *s, ProcessCommunicator &processComm)
#define OOFEM_LOG_INFO(...)
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.
StateCounterType giveSolutionStateCounter()
Returns current solution state counter.
void clear()
Clears the array (zero size).
SPRPatchType determinePatchType(Set &elementList)
ProcessCommunicatorBuff * giveProcessCommunicatorBuff()
Returns communication buffer.
const IntArray * giveToRecvMap()
Returns receiver to receive map.
Set of elements, boundaries, edges and/or nodes.
FloatArray * dofManValues
void determinePatchAssemblyPoints(IntArray &pap, SPRPatchType regType, Set &elemset)
virtual ~SPRNodalRecoveryModel()
Destructor.
Class representing process communicator for engineering model.
CommunicatorBuff * commBuff
Common Communicator buffer.
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()=0
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
double at(int i, int j) const
Coefficient access function.
void resize(int n)
Checks size of receiver towards requested bounds.
SPRNodalRecoveryModel(Domain *d)
Constructor.
ProblemCommunicator * communicator
Communicator.
StateCounterType stateCounter
Time stamp of recovered values.
virtual int clear()
Clears the receiver's nodal table.
Class representing vector of real numbers.
int unpackAllData(T *ptr, int(T::*unpackFunc)(ProcessCommunicator &))
Unpack all problemCommuncators data from recv buffers.
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
Element is local, there are no contributions from other domains to this element.
Implementation of matrix containing floating point numbers.
const IntArray * giveDofManConnectivityArray(int dofman)
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
void zero()
Zeroes all coefficients of receiver.
int giveRank() const
Returns domain rank in a group of collaborating processes (0..groupSize-1)
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
void zero()
Zeroes all coefficient of receiver.
virtual int read(int *data, int count)
Reads count integer values into array pointed by data.
The Communicator and corresponding buffers (represented by this class) are separated in order to allo...
const char * __InternalStateTypeToString(InternalStateType _value)
Abstract base class representing the "problem" under consideration.
int giveSize() const
Returns the size of receiver.
Node * giveNode(int n)
Service for accessing particular domain node.
the oofem namespace is to define a context or scope in which all oofem names are defined.
bool initCommMap
Communication init flag.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
The base class for all recovery models, which perform nodal averaging or projection processes for int...
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)=0
DofManager is local, there are no contribution from other domains to this DofManager.
Class representing integration point in finite element program.
#define OOFEM_WARNING(...)
bool hasElement(int elem) const
Return True if given element is contained.
InternalStateType valType
Determines the type of recovered values.
Class representing solution step.
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element's local coordinates.
const IntArray & giveElementList()
Returns list of elements within set.
DofManager is shared by neighboring partitions, it is necessary to sum contributions from all contrib...
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
void resize(int s)
Resizes receiver towards requested size.