C++ mpi module for stochmagnet_main Package
SMOMPI_AllMasterMacroCellsMagnetizationField.h
1 #ifndef SMOMPI_AllMasterMacroCellsMagnetizationField_H
2 #define SMOMPI_AllMasterMacroCellsMagnetizationField_H
3 
4 //base classes
5 #include "SM_MacroCellsMagnetizationField.h"
6 
7 //network header
8 #include "SMOMPI_AllMasterMacroCellsNetwork.h"
9 
10 
22 
23 private :
24 
27 
28 
29 
30 protected:
31  // CONSTRUCTORS
35 
36  }
37 
38  // DESTRUCTORS
42  }
43 
44 
45 public :
46 
47  //Instance building
48  //=================
49 
50 
54  inline static CORE_UniquePointer<SelfClass> New() {
55  return CORE_UniquePointer<SelfClass>(new SelfClass(),
57  }
58 
62  virtual CORE_UniquePointer<SM_MacroCellsMagnetizationField> newInstance() const override {
63  return New();
64  }
65 
79  virtual tMemSize getMemorySize() const {
80  return sizeof(*this)+this->getContentsMemorySize();
81  }
82 
91  virtual tMemSize getContentsMemorySize() const {
92  tMemSize mem=SuperClass::getContentsMemorySize();
93  return mem;
94  }
95 
96 public:
97 
98 
99 
100 public:
109  virtual void computeField(const SM_Material& material,
110  const SM_MacroCellsNetwork& network,
111  const SM_RealField& S,
112  SM_RealField& M) final {
113  //compute M on the network of the core This
114  SuperClass::computeField(material,network,S,M);
115  //MPI environment
117  MPI_WorldToWorldMessage::AllReduce(mpiEnv,M.getValues(),M.getSize(),MPI_SUM);
118 
119  }
120 
121 
122 
123 };
124 
125 
126 #endif
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
static MPI_Environment & GetEnvironment()
get the environment
Definition: MPI_Run.h:114
static tBoolean AllReduce(const MPI_Environment &env, T &data, const tMPIOperation &op)
compute a data from data of others cores and to data of core 0 and copy the values to all cores
Definition: MPI_WorldToWorldMessage.h:703
This class describes an OpenMP/MPI implementation of the magnetization field for all core considered ...
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:21
static CORE_UniquePointer< SelfClass > New()
build a new instance of the operator
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:54
SMOMPI_AllMasterMacroCellsMagnetizationField(void)
create a network class
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:34
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:79
virtual CORE_UniquePointer< SM_MacroCellsMagnetizationField > newInstance() const override
create a New instance of this
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:62
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:91
virtual void computeField(const SM_Material &material, const SM_MacroCellsNetwork &network, const SM_RealField &S, SM_RealField &M) final
compute the magnetization field from S
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:109
virtual ~SMOMPI_AllMasterMacroCellsMagnetizationField(void)
destroy
Definition: SMOMPI_AllMasterMacroCellsMagnetizationField.h:41
This class is describes a Magnetization field.
Definition: SM_MacroCellsMagnetizationField.h:23
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsMagnetizationField.h:101
void computeField(const tIndex &stepIndex, const SM_Material &material, const SM_MacroCellsNetwork &network, const SM_RealField &S)
compute the magnetization field from S
Definition: SM_MacroCellsMagnetizationField.h:173
This class is describes a macro cell network.
Definition: SM_MacroCellsNetwork.h:25
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61