1 #ifndef SMOMPI_Network_H
2 #define SMOMPI_Network_H
5 #include "SM_Network.h"
60 std::valarray<tMPICoreId> mConnectedCores;
75 std::valarray<tMPIInteger> mHaloParticlesOffset;
83 std::valarray<tIndex> mBoundParticles;
90 std::valarray<tMPIInteger> mBoundParticlesOffset;
93 std::vector<tMPITag> mHaloConnectionsTag;
112 std::valarray<tReal> mBoundFieldValues;
113 std::valarray<tMPIRequest> mRequests;
170 mem+=
sizeof(tMPIInteger)*mConnectedCores.size();
172 mem+=
sizeof(tMPIInteger)*mHaloParticlesOffset.size();
173 mem+=
sizeof(tIndex)*mBoundParticles.size();
174 mem+=
sizeof(tMPIInteger)*mBoundParticlesOffset.size();
175 mem+=
sizeof(tMPITag)*mHaloConnectionsTag.capacity();
176 mem+=
sizeof(tReal)*mBoundFieldValues.size();
177 mem+=
sizeof(tMPIRequest)*mRequests.size();
188 inline static CORE_UniquePointer<SelfClass>
New() {
189 return CORE_UniquePointer<SelfClass>(
new SelfClass(),
200 mConnectedCores.resize(nConnectedCores);
201 mHaloParticlesOffset.resize(nConnectedCores+1);
202 mBoundParticlesOffset.resize(nConnectedCores+1);
203 mRequests.resize(2*nConnectedCores);
205 functions_array::reset(mHaloParticlesOffset);
206 functions_array::reset(mBoundParticlesOffset);
211 return mConnectedCores;
216 return mConnectedCores;
222 mBoundParticles.resize(n);
229 return mBoundParticles;
234 return mBoundParticles;
240 return mBoundParticlesOffset;
245 return mBoundParticlesOffset;
250 return mHaloParticlesOffset;
255 return mHaloParticlesOffset;
260 return mHaloConnectionsTag;
265 return mHaloConnectionsTag;
277 std::array<tReal,SM_Constants::DIM>& bbSize)
const final;
317 virtual void loadStatesFromFile(std::ifstream& file,tInteger& version,tDimension& d)
override;
335 const std::function<
void(
const tReal&,
const tReal& ,
const tReal&,tReal& )>& F)
final;
358 virtual tString
toString()
const override;
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class describes an MPI implementation of interface class SM_Network . It implements the abstract...
Definition: SMOMPI_Network.h:37
const std::valarray< tMPIInteger > & getBoundParticlesOffset() const
get bound particles list offset
Definition: SMOMPI_Network.h:239
const std::valarray< tIndex > & getBoundParticles() const
get bound particles list
Definition: SMOMPI_Network.h:228
void setConnectedCoresNumber(const tMPIInteger &nConnectedCores)
set connected cores number
Definition: SMOMPI_Network.h:198
void setBoundParticlesNumber(const tIndex &n)
set the bound particles number
Definition: SMOMPI_Network.h:221
virtual void saveStatesToFile(std::ofstream &file) const override
save the state of the network
Definition: SMOMPI_Network.cpp:352
virtual void loadStatesFromFile(std::ifstream &file, tInteger &version, tDimension &d) override
load the state of the network
Definition: SMOMPI_Network.cpp:434
virtual ~SMOMPI_Network(void)
destroy
Definition: SMOMPI_Network.h:130
virtual tString toString() const override
return the string representation of the class
Definition: SMOMPI_Network.cpp:630
std::vector< tMPIInteger > & getHaloConnectionsTag()
get halo connections tag
Definition: SMOMPI_Network.h:264
virtual void updateState() override
compute the network stae
Definition: SMOMPI_Network.cpp:227
std::valarray< tMPICoreId > & getConnectedCores()
get the connected cores
Definition: SMOMPI_Network.h:215
tBoolean mpiExchangeFieldValues(SM_RealField &F)
exchange the data of F between connected cores
Definition: SMOMPI_Network.cpp:87
virtual void computeBoundingBox(std::array< tReal, SM_Constants::DIM > &bbMinPoint, std::array< tReal, SM_Constants::DIM > &bbSize) const final
get the min point and size of the bunding box depend on X
Definition: SMOMPI_Network.cpp:19
const std::valarray< tMPICoreId > & getConnectedCores() const
get the connected cores
Definition: SMOMPI_Network.h:210
std::valarray< tMPIInteger > & getBoundParticlesOffset()
get bound particles list offset
Definition: SMOMPI_Network.h:244
std::valarray< tMPIInteger > & getHaloParticlesOffset()
get halo particles list offset
Definition: SMOMPI_Network.h:254
static CORE_UniquePointer< SelfClass > New()
build a new instance of a BCC structure
Definition: SMOMPI_Network.h:188
const std::vector< tMPIInteger > & getHaloConnectionsTag() const
get halo connections tag
Definition: SMOMPI_Network.h:259
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMOMPI_Network.h:156
std::valarray< tIndex > & getBoundParticles()
get bound particles list
Definition: SMOMPI_Network.h:233
const std::valarray< tMPIInteger > & getHaloParticlesOffset() const
get halo particles list offset
Definition: SMOMPI_Network.h:249
static void ComputeConnectionTag(const tIndex &p, const tIndex &q, tMPITag &tag)
compute the connection tag between particle (p,q)
Definition: SMOMPI_Network.h:343
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMOMPI_Network.h:168
virtual void updateConnectionValues(const tReal &noiseRate, SM_StochasticFunctionsInterface &randomF, const tReal &J, const std::function< void(const tReal &, const tReal &, const tReal &, tReal &)> &F) final
compute the connection values of the particles
Definition: SMOMPI_Network.cpp:238
SMOMPI_Network(void)
create a network class
Definition: SMOMPI_Network.h:121
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class is describes a network composed by.
Definition: SM_Network.h:66
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_Network.h:181
This class describes a stochastic functions based on same random number generator which implement ran...
Definition: SM_StochasticFunctionsInterface.h:18