1 #ifndef SM_MacroCellsDemagnetizedField_H
2 #define SM_MacroCellsDemagnetizedField_H
8 #include "SM_MacroCellsNetwork.h"
11 #include "SM_MacroCellsMagnetizationField.h"
14 #include "SM_PackedBlockSymmetricMatrix.h"
84 CORE_UniquePointer<SM_PackedBlockMatrix<tReal,SM_Constants::DIM>> mMatrix;
144 mem+=(mMatrix.get()==
null)?0:mMatrix->getContentsMemorySize();
151 virtual CORE_UniquePointer<SM_MacroCellsDemagnetizedField>
newInstance()
const=0;
186 return (mMatrix.get()!=
null);
191 mMatrix=std::move(matrix);
196 return *mMatrix.get();
201 return *mMatrix.get();
261 tInteger i,tInteger j,
262 const tReal *Xi,
const tReal* Xj,
264 tReal& rij,std::array<tReal,SM_Constants::DIM>& U) {
308 for(
auto& Ui:U) Ui/=rij;
310 const tReal *Ui=
null,*Uj=U.data();
351 tInteger i,tInteger j,
352 const tReal *Xi,
const tReal* Xj,
354 tReal& rij,std::array<tReal,SM_Constants::DIM>& U) {
390 for(
auto& Ui:U) Ui/=rij;
392 const tReal *Ui=
null,*Uj=U.data();
403 if (std::isnan(*vBij)) {
405 "SM_MacroCellsDemagnetizedField::BuildPackedSupBlockMatrix(Xi="+functions_array::toString(3,Xi-3)+
406 " Xj="+functions_array::toString(3,Xj-3)+
",LH="+std::to_string(lambdaH)+
" rij="+std::to_string(rij)+
" U:"+functions_array::toString(U),
434 const tReal& lambdaHs,
441 if (std::isnan(diag)) {
443 "SM_MacroCellsDemagnetizedField::BuildDiagonalBlockMatrix("+std::to_string(V)+
","+std::to_string(lambdaHs)+
")",
455 const tReal& lambdaHs,
461 const tReal &d=(*iDiag);
485 const tReal* vMCsVolume,
487 const tInteger& start,
const tInteger& end,
488 tReal *supBlocksValues,
489 tReal *diagBlocksValues)
const;
502 const tReal* vMCsVolumes,
503 const tInteger& nX,
const tReal *vX,
504 const tInteger& nP,
const tReal *vP,
505 tReal *supBlocksValues)
const;
534 const tReal *P,
const tReal *eP,
536 const tInteger& nMacroCells,
539 const tReal* iMCsVolume,
557 void computeFieldSliceInSeparatedNetworkStorage(
const tReal& lambdaH,
const tReal& lambdaHs,
558 const tReal *P,
const tReal *eP,
560 const tInteger& nMacroCells,
563 const tReal* iMCsVolume,
580 const tReal *P,
const tReal *eP,
582 const tInteger& nMacroCells,
595 std::stringstream ret;
597 ret<<
"\t storage of demagnetized field: "<<((int) mStorage)<<
"\n";
602 ret<<
"\t\t ["<<i<<
"]="<<functions_array::toString(
SM_Constants::DIM,mHdem(i))<<
"\n";
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:17
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
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 demagnetized operator.
Definition: SM_MacroCellsDemagnetizedField.h:50
SM_PackedBlockMatrix< tReal, SM_Constants::DIM > & getMatrix()
get matrix
Definition: SM_MacroCellsDemagnetizedField.h:195
static void BuildPackedSupBlockMatrix(tReal lambdaH, tInteger i, tInteger j, const tReal *Xi, const tReal *Xj, tReal *vBij, tReal &rij, std::array< tReal, SM_Constants::DIM > &U)
build the symmetric block element of the superior matrix in a packed storage
Definition: SM_MacroCellsDemagnetizedField.h:350
void computeBlocksGeneralMatrix(const tReal &lambdaH, const tReal &lambdaHs, const tReal *vMCsVolumes, const tInteger &nX, const tReal *vX, const tInteger &nP, const tReal *vP, tReal *supBlocksValues) const
compute the column blocks matrix (i,j) j in [start,end] and j in [0,i]
Definition: SM_MacroCellsDemagnetizedField.cpp:397
const tReal & getLambdaHs() const
get self lambda Hs
Definition: SM_MacroCellsDemagnetizedField.h:216
const tReal & getLambdaH() const
get lambda H
Definition: SM_MacroCellsDemagnetizedField.h:210
void computeSeparatedFieldSlice(const tReal &lambdaH, const tReal &lambdaHs, const tReal *P, const tReal *eP, const tReal *M_P, const tInteger &nMacroCells, const tReal *X, tReal *H) const
compute Hdem[X]=F_{P,M}(X)
Definition: SM_MacroCellsDemagnetizedField.cpp:245
static void BuildPackedDiagonalBlockMatrix(const tReal &V, const tReal &lambdaHs, tReal *iDiag)
build the diagonal block element of the matrix
Definition: SM_MacroCellsDemagnetizedField.h:454
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsDemagnetizedField.h:141
void setStorage(const tFlag &f)
set storage type
Definition: SM_MacroCellsDemagnetizedField.h:157
static constexpr tFlag PACKED_STORAGE
the storage if in a packed matrix
Definition: SM_MacroCellsDemagnetizedField.h:56
void computeFieldSlice(const tReal &lambdaH, const tReal &lambdaHs, const tReal *P, const tReal *eP, const tReal *M_P, const tInteger &nMacroCells, const tReal *X, const tReal *M_X, const tReal *iMCsVolume, tReal *H) const
compute Hdem[X]=F_{P,M}(X)
Definition: SM_MacroCellsDemagnetizedField.cpp:44
static void BuildPackedBlockMatrix(tReal lambdaH, const tReal &lambdaHs, const tReal &Wi, tInteger i, tInteger j, const tReal *Xi, const tReal *Xj, tReal *vBij, tReal &rij, std::array< tReal, SM_Constants::DIM > &U)
build the symmetric block element of the superior matrix in a packed storage
Definition: SM_MacroCellsDemagnetizedField.h:260
const tFlag & getStorage() const
yet storage type in {NO_STORAGE,PACKED_STORAGE}
Definition: SM_MacroCellsDemagnetizedField.h:162
void setMatrix(CORE_UniquePointer< SM_PackedBlockMatrix< tReal, SM_Constants::DIM >> matrix)
set matrix
Definition: SM_MacroCellsDemagnetizedField.h:190
static void BuildDiagonalBlockMatrix(const tReal &V, const tReal &lambdaHs, tReal &diag)
build the diagonal block element of the matrix
Definition: SM_MacroCellsDemagnetizedField.h:433
virtual tString toString() const override
return string representaton of the operator
Definition: SM_MacroCellsDemagnetizedField.h:594
virtual void discretize(const SM_Material &material, const SM_MacroCellsNetwork &network)
discretize the field
Definition: SM_MacroCellsDemagnetizedField.cpp:12
virtual CORE_UniquePointer< SM_MacroCellsDemagnetizedField > newInstance() const =0
create a New instance of this
static constexpr tFlag NO_STORAGE
no storage
Definition: SM_MacroCellsDemagnetizedField.h:60
virtual void computeField(const SM_MacroCellsNetwork &network, const SM_MacroCellsMagnetizationField &M)=0
compute the demagnetized field on macro cells network
tBoolean hasMatrix() const
return true if the matrix exists
Definition: SM_MacroCellsDemagnetizedField.h:185
const SM_RealField & getField() const
get the demagnetized field on macro cells
Definition: SM_MacroCellsDemagnetizedField.h:169
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_MacroCellsDemagnetizedField.h:129
virtual ~SM_MacroCellsDemagnetizedField(void)
destroy
Definition: SM_MacroCellsDemagnetizedField.h:106
SM_MacroCellsDemagnetizedField(void)
create a network class
Definition: SM_MacroCellsDemagnetizedField.h:96
virtual void computeMatrix(const SM_Material &material, const SM_MacroCellsNetwork &network)=0
compute the matrix ot he demagnetized operator
SM_RealField & getField()
get the demagnetized field on macro cells
Definition: SM_MacroCellsDemagnetizedField.h:175
const SM_PackedBlockMatrix< tReal, SM_Constants::DIM > & getMatrix() const
get matrix
Definition: SM_MacroCellsDemagnetizedField.h:200
void computeBlocksSymmetricMatrix(const tReal &lambdaH, const tReal &lambdaHs, const tReal *vMCsVolume, const tReal *vMCsX, const tInteger &start, const tInteger &end, tReal *supBlocksValues, tReal *diagBlocksValues) const
compute the column blocks matrix (i,j) j in [start,end] and j in [0,i]
Definition: SM_MacroCellsDemagnetizedField.cpp:322
This class is describes a Magnetization field.
Definition: SM_MacroCellsMagnetizationField.h:23
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
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36
This class described a matrix by packed block of size in a row storage.
Definition: SM_PackedBlockMatrix.h:18