1 #ifndef SM_MacroCellsNetwork_H
2 #define SM_MacroCellsNetwork_H
11 #include "SM_Network.h"
15 #include "SM_Material.h"
46 tInteger mMacroCellsNumber;
49 std::array<tReal,SM_Constants::DIM> mMacroCellSize;
54 std::valarray<tInteger> mMacroCellsList;
57 std::valarray<tReal> mMacroCellsVolume;
120 mem+=mMacroCellsList.size()*
sizeof(tInteger);
121 mem+=mMacroCellSize.size()*
sizeof(tReal);
123 mem+=mMacroCellsVolume.size()*
sizeof(tReal);
132 virtual CORE_UniquePointer<SM_MacroCellsNetwork>
newInstance()
const=0;
141 mMargin=std::max(w,(tReal)1.e-12);
161 const auto eH=H.cend();
162 for(
auto& Hk:mMacroCellSize) {
174 return mMacroCellSize;
189 return mMacroCellsNumber;
209 return mMacroCellsList;
214 return mMacroCellsList;
219 return mMacroCellsVolume;
224 return mMacroCellsVolume;
230 return mMacroCellsVolume[m];
243 return mMacroCellsList[p];
269 functions_array::add(bbMaxPoint,bbMinPoint);
285 const std::array<tReal,SM_Constants::DIM>& P,
286 const std::array<tReal,SM_Constants::DIM>& Q);
321 const std::array<tReal,SM_Constants::DIM>& P,
322 const std::array<tReal,SM_Constants::DIM>& Q,
323 const std::array<tReal,SM_Constants::DIM>& macroCellSize,
326 std::valarray<tReal> & MCsVolume,
327 std::valarray<tInteger>& macroCellsList);
336 std::valarray<tReal>& gMCVolume,
337 std::valarray<tReal>& lMCVolume,
338 std::valarray<tInteger>& gMCLocalIndices);
348 const tInteger& nMacroCells,
349 const std::valarray<tInteger>& macroCellsPList,
350 std::valarray<tInteger>& particlesMCList,
351 std::valarray<tInteger>& particlesMCListOffset);
357 inline static void ConvertIndices(
const std::valarray<tInteger>& indicesConverter,
358 std::valarray<tInteger>& indicesList) {
359 for(
auto& i:indicesList) {
360 i=indicesConverter[i];
368 inline static void ConvertIndices(
const std::valarray<tInteger>& indicesConverter,
369 const tInteger& n,tInteger* iIndicesList) {
370 const tInteger *eIndicesList=iIndicesList;
372 while (iIndicesList!=eIndicesList) {
373 (*iIndicesList)=indicesConverter[(*iIndicesList)];
386 const tInteger* iMacroCellsList,
388 std::valarray<tInteger>& nMCParticles);
395 inline static void MeanX(
const tInteger& n,
405 const tReal *eX_d=iX;
441 std::stringstream ret;
443 ret<<
"\t macro cell size:"<<functions_array::toString(mMacroCellSize)<<
"\n";
445 ret<<
"\t margin of macro cells: "<<mMargin<<
"\n";
446 ret<<
"\t mass centers: C:\n";
virtual tMemSize getContentsMemorySize() const override
return the memory size of the included associations
Definition: CORE_Field.h:102
tIndex getElementsNumber() const
return the number values of the container
Definition: CORE_Field.h:135
void setElementsNumber(const tInteger &n)
set the number of element of the container
Definition: CORE_Field.h:121
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
virtual tString toString() const
return the string representation of the object node
Definition: CORE_Object.h:333
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class is describes a macro cell network.
Definition: SM_MacroCellsNetwork.h:25
const tReal & getMacroCellVolume(const tInteger &m) const
get volume of macro cell at index m in Angstrom
Definition: SM_MacroCellsNetwork.h:229
const std::valarray< tInteger > & getMacroCellsList() const
get the index of macro cell containing each particle p
Definition: SM_MacroCellsNetwork.h:208
static void EliminateEmptyMacroCells(const tReal &epsVM, std::valarray< tReal > &gMCVolume, std::valarray< tReal > &lMCVolume, std::valarray< tInteger > &gMCLocalIndices)
eliminate empty macro cells form lists
Definition: SM_MacroCellsNetwork.cpp:195
SM_MacroCellsNetwork(void)
create a network class
Definition: SM_MacroCellsNetwork.h:75
static tInteger ComputeMacroCells(const SM_Material &material, const SM_Network &network, const std::array< tReal, SM_Constants::DIM > &P, const std::array< tReal, SM_Constants::DIM > &Q, const std::array< tReal, SM_Constants::DIM > ¯oCellSize, const tReal &margin, const tReal &epsVW, std::valarray< tReal > &MCsVolume, std::valarray< tInteger > ¯oCellsList)
compute the macro cells points and magnetization
Definition: SM_MacroCellsNetwork.cpp:64
std::valarray< tReal > & getMacroCellsVolume()
get volume of macro cells in Angstrom
Definition: SM_MacroCellsNetwork.h:223
void setMacroCellSize(const std::vector< tReal > &H)
set the macro cell size in angstrom
Definition: SM_MacroCellsNetwork.h:159
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)
compute the macro cells of the network
Definition: SM_MacroCellsNetwork.cpp:6
void setMacroCellSize(const std::array< tReal, SM_Constants::DIM > &H)
set the macro cell size in angstrom
Definition: SM_MacroCellsNetwork.h:153
static void BuildParticlesListOrderedPerMacroCells(const SM_Network &network, const tInteger &nMacroCells, const std::valarray< tInteger > ¯oCellsPList, std::valarray< tInteger > &particlesMCList, std::valarray< tInteger > &particlesMCListOffset)
build the particles list for all not empty macro cells
Definition: SM_MacroCellsNetwork.cpp:256
const tInteger & getMacroCellsNumber() const
get the number of macro cells
Definition: SM_MacroCellsNetwork.h:188
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsNetwork.h:117
SM_RealField & getMacroCellsMassCenter()
get the mass center of the macro cells for writing
Definition: SM_MacroCellsNetwork.h:201
const std::array< tReal, SM_Constants::DIM > & getMacroCellSize() const
get the macro cell size
Definition: SM_MacroCellsNetwork.h:173
const std::valarray< tReal > & getMacroCellsVolume() const
get volume of macro cells in Angstrom
Definition: SM_MacroCellsNetwork.h:218
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_MacroCellsNetwork.h:105
static void ComputeMacroCellX(const tInteger &nParticles, const tReal *iX, const tInteger *iMacroCellsList, SM_RealField &C, std::valarray< tInteger > &nMCParticles)
compute the sum of coordinantes of the particles in each macro cell
Definition: SM_MacroCellsNetwork.cpp:313
std::valarray< tInteger > & getMacroCellsList()
get the index of macro cell containing each particle p
Definition: SM_MacroCellsNetwork.h:213
static void ConvertIndices(const std::valarray< tInteger > &indicesConverter, const tInteger &n, tInteger *iIndicesList)
convert indices
Definition: SM_MacroCellsNetwork.h:368
virtual CORE_UniquePointer< SM_MacroCellsNetwork > newInstance() const =0
create a New instance of this
void setMacroCellsNumber(const tInteger &n)
set the number of macro cells
Definition: SM_MacroCellsNetwork.h:181
const tInteger & getMacroCellIndex(const tInteger &p) const
get the local index of the macro cell containing particle p
Definition: SM_MacroCellsNetwork.h:242
virtual ~SM_MacroCellsNetwork(void)
destroy
Definition: SM_MacroCellsNetwork.h:82
virtual tString toString() const override
return string representaton of the operator
Definition: SM_MacroCellsNetwork.h:440
virtual void computeMacroCellsMassCenter(const SM_Material &material, const SM_Network &network)
compute the macro cells of the network
Definition: SM_MacroCellsNetwork.cpp:47
const tReal & getMacroCellMargin() const
get margin
Definition: SM_MacroCellsNetwork.h:146
virtual void computeMacroCells(const SM_Material &material, const SM_Network &network)
compute the macro cells of the network
Definition: SM_MacroCellsNetwork.h:262
void setMacroCellMargin(const tReal &w)
set margin
Definition: SM_MacroCellsNetwork.h:140
static void MeanX(const tInteger &n, const tInteger *iNs, tReal *iX)
compute the macro cells points and magnetization
Definition: SM_MacroCellsNetwork.h:395
const SM_RealField & getMacroCellsMassCenter() const
get the mass center of the macro cells for reading
Definition: SM_MacroCellsNetwork.h:195
static void ConvertIndices(const std::valarray< tInteger > &indicesConverter, std::valarray< tInteger > &indicesList)
convert indices
Definition: SM_MacroCellsNetwork.h:357
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
const std::array< tReal, SM_Constants::DIM > & getBoundingBoxMinPoint() const
get the min point of the boudning box
Definition: SM_Network.h:629
const std::array< tReal, SM_Constants::DIM > & getBoundingBoxSize() const
get the size of the boudning box
Definition: SM_Network.h:635
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36