1 #ifndef SMOMPI_OneMasterMacroCellsNetwork_H
2 #define SMOMPI_OneMasterMacroCellsNetwork_H
5 #include "SM_MacroCellsNetwork.h"
9 #include "MPI_WorldToWorldMessage.h"
30 tMPICoreId mMasterCoreId;
34 std::valarray<tInteger> mBoundingBoxMacroCellsIndex;
39 std::valarray<tReal> mDomainVolumes;
42 std::valarray<tInteger> mCoreBBMacroCellsIndex;
43 std::valarray<tReal> mCorePC;
44 std::valarray<tInteger> mCorePW;
47 static const tMPITag TAG_IS;
48 static const tMPITag TAG_IB;
49 static const tMPITag TAG_IR;
51 static const tMPITag TAG_CREDUCE;
52 static const tMPITag TAG_CSCATTER;
79 inline static CORE_UniquePointer<SelfClass>
New() {
86 virtual CORE_UniquePointer<SM_MacroCellsNetwork>
newInstance()
const override {
116 mem+=mDomainC.
getSize()*
sizeof(tReal);
117 mem+=mDomainVolumes.size()*
sizeof(tReal);
118 mem+=mBoundingBoxMacroCellsIndex.size()*
sizeof(tInteger);
120 mem+=
sizeof(tInteger)*mCoreBBMacroCellsIndex.size();
121 mem+=
sizeof(tReal)*mCorePC.size();
122 mem+=
sizeof(tInteger)*mCorePW.size();
141 return mMasterCoreId;
147 mMasterCoreId=coreId;
154 return mBoundingBoxMacroCellsIndex;
175 return mDomainVolumes;
205 const std::array<tReal,SM_Constants::DIM>& P,
206 const std::array<tReal,SM_Constants::DIM>& Q)
override;
222 const tMPITag& tag,tMPICount& nValues,
223 std::valarray<tInteger>& boundingBoxMacroCellsIndex,
224 tMPIBoolean& isAvaliable,tMPIStatus& status,
225 std::map<tMPICoreId,tBoolean>& isDataReceivedFromCore) ;
247 const tMPITag& tagIndices,tMPICount& nIndices,
248 std::valarray<tInteger>& boundingBoxMacroCellsIndex,
249 const tMPITag& tagX,tMPICount& sX, std::valarray<tReal>& X,
250 const tMPITag& tagW,tMPICount& nW, std::valarray<tInteger>& W,
251 tMPIBoolean& isAvaliable,tMPIStatus& status,std::array<tMPIRequest,3>& requests,
252 std::map<tMPICoreId,tBoolean>& isDataReceivedFromCore);
269 const tMPITag& tagIndices,tMPICount& nIndices,
270 std::valarray<tInteger>& boundingBoxMacroCellsIndex,
271 const tMPITag& tagX,tMPICount& sX, std::valarray<tReal>& X,
272 tMPIBoolean& isAvaliable,tMPIStatus& status,std::array<tMPIRequest,2>& requests,
273 std::map<tMPICoreId,tBoolean>& isDataReceivedFromCore);
289 const std::valarray<tInteger>& BBMacroCellsIndexMap,
const SM_RealField& Xc,
const std::valarray<tInteger>& Wc,
291 std::valarray<tInteger>& coreBBMacroCellsIndex,std::valarray<tReal>& corePX,std::valarray<tInteger>& corePW);
306 const std::valarray<tInteger>& BBMacroCellsIndexMap,
const SM_RealField& Xc,
308 std::valarray<tInteger>& coreBBMacroCellsIndex,std::valarray<tReal>& corePX);
324 const std::valarray<tInteger>& BBMacroCellsIndexMap,
SM_RealField& Xc,
325 std::valarray<tInteger>& coreBBMacroCellsIndex,
326 std::valarray<tReal>& coreX);
339 const tMPICount& nMCs,
340 const tInteger* BBMacroCellsIndexMap,
342 const tMPITag& tagX,tMPIRequest& request,
352 const tInteger* BBMacroCellsIndexMap,
363 std::stringstream ret;
tIndex getElementsNumber() const
return the number values of the container
Definition: CORE_Field.h:135
tIndex getSize() const
return the number values of the container
Definition: CORE_Field.h:161
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is a Environment class to define MPI world.
Definition: MPI_Environment.h:36
This class describes a macro cell network for one master core implementation.
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:19
virtual void computeBoundingBoxMacroCells(const SM_Material &material, const SM_Network &network, const std::array< tReal, SM_Constants::DIM > &P, const std::array< tReal, SM_Constants::DIM > &Q) override
compute the macro cells of the network
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:43
static CORE_UniquePointer< SelfClass > New()
return a new unique instnace of class This
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:79
virtual tString toString() const override
return string representaton of the operator
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:362
static tBoolean WaitForWeightFieldFromNeighborCore(const MPI_Environment &mpiEnv, tMPICoreId &c, const tMPITag &tagIndices, tMPICount &nIndices, std::valarray< tInteger > &boundingBoxMacroCellsIndex, const tMPITag &tagX, tMPICount &sX, std::valarray< tReal > &X, const tMPITag &tagW, tMPICount &nW, std::valarray< tInteger > &W, tMPIBoolean &isAvaliable, tMPIStatus &status, std::array< tMPIRequest, 3 > &requests, std::map< tMPICoreId, tBoolean > &isDataReceivedFromCore)
wait for receiving the map boundingBoxMacroCellsIndex [0,nMCs[ -> [0,nBBMCs[ and fields (W,...
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:395
static void ScatterField(const MPI_Environment &mpiEnv, const tMPICoreId &masterCoreId, const tMPITag &tagX, const SM_RealField &X, const std::valarray< tInteger > &BBMacroCellsIndexMap, SM_RealField &Xc, std::valarray< tInteger > &coreBBMacroCellsIndex, std::valarray< tReal > &coreX)
scatter he field X into Xc with the map BBMacroCellsIndexMap
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:845
virtual CORE_UniquePointer< SM_MacroCellsNetwork > newInstance() const override
create a New instance of this
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:86
const std::valarray< tInteger > & getBoundingBoxMacroCellsIndex() const
return the index of the macro cell within the not empty macro cells list of the boundig box
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:153
void setMasterCoreId(const tMPICoreId &coreId)
set the master core id
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:146
const SM_RealField & getBoundingBoxMacroCellsMassCenter() const
get the mass center on all not empty macro cells of the bouding box of macro cells
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:167
static tBoolean WaitForBoundingBoxMacroCellsIndexFromNeighborCore(const MPI_Environment &mpiEnv, tMPICoreId &c, const tMPITag &tag, tMPICount &nValues, std::valarray< tInteger > &boundingBoxMacroCellsIndex, tMPIBoolean &isAvaliable, tMPIStatus &status, std::map< tMPICoreId, tBoolean > &isDataReceivedFromCore)
wait for receiveing the map boundingBoxMacroCellsIndex [0,nMCs[ -> [0,nBBMCs[ from the core c with ta...
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:373
virtual void computeMacroCells(const SM_Material &material, const SM_Network &network) override
compute the macro cells of the network
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:16
SMOMPI_OneMasterMacroCellsNetwork(void)
create a network class
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:60
static void SelectFieldValues(const tMPICount &nMCs, const tInteger *BBMacroCellsIndexMap, const SM_RealField &X, tReal *Xs)
selected value from X with map BBMacroCellsIndex,
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:973
static void ISendFieldToCore(const MPI_Environment &mpiEnv, const tMPICoreId &c, const tMPICount &nMCs, const tInteger *BBMacroCellsIndexMap, const SM_RealField &X, const tMPITag &tagX, tMPIRequest &request, tReal *vXc)
non blocking end message to send selected values of X with the map BMacroCellsIndexMap to values of X...
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:948
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:102
tInteger getBoundingBoxMacroCellsNumber() const
return the number of not empty macro cells of the bouning box
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:160
virtual ~SMOMPI_OneMasterMacroCellsNetwork(void)
destroy
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:67
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:114
const std::valarray< tReal > & getBoundingBoxMacroCellsVolume() const
get the volume on all not empty macro cells of the bouding box of macro cells
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:174
virtual void computeMacroCellsMassCenter(const SM_Material &material, const SM_Network &network) override
compute the macro cells of the network
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:292
const tMPICoreId & getMasterCoreId() const
get the master core id
Definition: SMOMPI_OneMasterMacroCellsNetwork.h:140
static tBoolean WaitForFieldFromNeighborCore(const MPI_Environment &mpiEnv, tMPICoreId &c, const tMPITag &tagIndices, tMPICount &nIndices, std::valarray< tInteger > &boundingBoxMacroCellsIndex, const tMPITag &tagX, tMPICount &sX, std::valarray< tReal > &X, tMPIBoolean &isAvaliable, tMPIStatus &status, std::array< tMPIRequest, 2 > &requests, std::map< tMPICoreId, tBoolean > &isDataReceivedFromCore)
wait for receiving the map boundingBoxMacroCellsIndex [0,nMCs[ -> [0,nBBMCs[ and fields X from the co...
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:442
static void SumReduceField(const MPI_Environment &mpiEnv, const tMPICoreId &masterCoreId, const tMPITag &tagX, const std::valarray< tInteger > &BBMacroCellsIndexMap, const SM_RealField &Xc, const std::valarray< tInteger > &Wc, SM_RealField &X, std::valarray< tInteger > &W, std::valarray< tInteger > &coreBBMacroCellsIndex, std::valarray< tReal > &corePX, std::valarray< tInteger > &corePW)
make the sum reduction of the field Xc into X (Wc into W) with the map BBMacroCellsIndexMap
Definition: SMOMPI_OneMasterMacroCellsNetwork.cpp:481
This class is describes a macro cell network.
Definition: SM_MacroCellsNetwork.h:25
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsNetwork.h:117
virtual tString toString() const override
return string representaton of the operator
Definition: SM_MacroCellsNetwork.h:440
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61
This class is describes a network composed by.
Definition: SM_Network.h:66