C++ main module for stochmagnet Package  1.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
SM_Network Class Reference

This class is describes a a network. More...

#include <SM_Network.h>

Inheritance diagram for SM_Network:
Inheritance graph
[legend]
Collaboration diagram for SM_Network:
Collaboration graph
[legend]

Public Member Functions

 SM_Network (void)
 create a network class More...
 
virtual ~SM_Network (void)
 destroy More...
 
virtual tMemSize getMemorySize () const
 return the memory size of the class and the memory size of all its attributes/associations More...
 
virtual tMemSize getContentsMemorySize () const
 return the memory size of the included associations More...
 
void copy (const SM_Network &network)
 copy the network More...
 
tDimension getDimension () const
 return the dimension More...
 
void setParticlesNumber (const tInteger &nParticles)
 set the particles number More...
 
tInteger getParticlesNumber () const
 return the particles number More...
 
tIndex computeAloneParticlesNumber () const
 return the particles number More...
 
void setParticlesCoordinates (std::initializer_list< tReal > &&coords)
 void set particles 3D-coordinates More...
 
void setParticlesCoordinates (const std::initializer_list< tReal > &coords)
 void set particles 3D-coordinates More...
 
void setParticlesCoordinates (const SM_RealField &coords)
 void set particles coordinates More...
 
const SM_RealFieldgetParticlesCoordinates () const
 void get particles coordinates More...
 
SM_RealFieldgetParticlesCoordinates ()
 void get particles coordinates More...
 
void setLambda (const tReal &L)
 set the lambda value More...
 
const tRealgetLambda () const
 get the lambda value More...
 
void setNeighbors (std::valarray< tUInt > &&neighborsNumber, std::valarray< tIndex > &&neighborsIndices, std::valarray< tReal > &&Js)
 set the neighbors by moving More...
 
void setNeighbors (const std::valarray< tUInt > &neighborsNumber, const std::vector< tIndex > &neighborsIndices, const std::vector< tReal > &Js)
 set the neighbors by copy More...
 
tIndex getConnectionsNumber () const
 get the number of connections More...
 
const std::valarray< tUInt > & getNeighborsNumber () const
 get the neighbors number More...
 
std::valarray< tUInt > & getNeighborsNumber ()
 get the neighbors number More...
 
const std::valarray< tIndex > & getNeighborsIndices () const
 
std::valarray< tIndex > & getNeighborsIndices ()
 
const std::valarray< tReal > & getHeissenbergCoefficients () const
 get the Heissenberg coefficients More...
 
std::valarray< tReal > & getHeissenbergCoefficients ()
 get the Heissenberg coefficients More...
 
void create3DGrid (const tIndex &Nx, const tIndex Ny, const tIndex Nz, const tReal &Hx, const tReal &Hy, const tReal &Hz, const tReal &J, const tBoolean &hasSelfInteraction)
 create a grid 3D of size Nx x Ny x Nz with distance between particles is hx x hy x hz the interaction between particles is modelized by J More...
 
virtual tString toString () const override
 turn the class into a string representation More...
 
template<class T >
std::shared_ptr< T > getSharedPointer ()
 return the shared pointer for this More...
 
template<class T >
std::shared_ptr< const T > getConstSharedPointer () const
 return a const shared pointer for this More...
 
template<class T >
tBoolean isInstanceOf () const
 test if the clas T is an instance of this class More...
 
tString getClassName () const
 return the name of the class More...
 
tString getPointerString () const
 retrun the pointer of the class as a string More...
 
tString getIdentityString () const
 retrun the string identification of the class More...
 

Static Public Member Functions

static CORE_UniquePointer< SM_NetworkNew ()
 build a new instance of a Network More...
 
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack More...
 
static void DisableMemoryStack ()
 disable the memory stack More...
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled More...
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Private Member Functions

template<class T >
std::shared_ptr< T > setThis (std::unique_ptr< T, CORE_Object::Delete > &up)
 set the shared pointer from an unique pointer More...
 

Private Attributes

tReal mLambda
 
SM_RealField mPoints
 
std::valarray< tUIntmNeighborsNumber
 
std::valarray< tIndexmNeighborsIndices
 
std::valarray< tRealmJs
 
std::weak_ptr< CORE_ObjectmThis
 

Detailed Description

This class is describes a a network.

Author
Stephane Despreaux
Version
2.0

Constructor & Destructor Documentation

◆ SM_Network()

SM_Network::SM_Network ( void  )
inline

create a network class

References mLambda, mNeighborsNumber, mPoints, and CORE_Field< T, K, D, S, I >::setElementsNumber().

Referenced by New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~SM_Network()

virtual SM_Network::~SM_Network ( void  )
inlinevirtual

destroy

Member Function Documentation

◆ computeAloneParticlesNumber()

tIndex SM_Network::computeAloneParticlesNumber ( ) const
inline

return the particles number

Returns
the number of particles without any connections

References mNeighborsNumber, and tIndex.

Referenced by SM_XDMF::writeGeometryHeader().

Here is the caller graph for this function:

◆ copy()

void SM_Network::copy ( const SM_Network network)
inline

copy the network

Parameters
[in]network: the network to copy

References CORE_Field< T, K, D, S, I >::copy(), getHeissenbergCoefficients(), getLambda(), getNeighborsIndices(), getNeighborsNumber(), getParticlesCoordinates(), mJs, mLambda, mNeighborsIndices, mNeighborsNumber, and mPoints.

Here is the call graph for this function:

◆ create3DGrid()

void SM_Network::create3DGrid ( const tIndex Nx,
const tIndex  Ny,
const tIndex  Nz,
const tReal Hx,
const tReal Hy,
const tReal Hz,
const tReal J,
const tBoolean hasSelfInteraction 
)

create a grid 3D of size Nx x Ny x Nz with distance between particles is hx x hy x hz the interaction between particles is modelized by J

Parameters
[in]Nxnumber of particles in the x-direction
[in]Nynumber of particles in the y-direction
[in]Nznumber of particles in the z-direction
[in]Hxdistance between 2 particles in the x-direction
[in]Hydistance between 2 particles in the y-direction
[in]Hzdistance between 2 particles in the z-direction
[in]Jinteraction factor of 2 particles
[in]hasSelfInteraction: true to make an interaction between each particle and itself

References CORE_Field< T, K, D, S, I >::getValues(), mPoints, CORE_Field< T, K, D, S, I >::setElementsNumber(), setNeighbors(), tIndex, tReal, tRelativeIndex, tSInt, tUInt, and tUSInt.

Referenced by SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadNetworkFromOptions(), SM_Test::testEnergyOperatorsDerivatives(), and SM_Test::testVirtualMethods().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisableMemoryStack()

static void CORE_Object::DisableMemoryStack ( )
inlinestaticinherited

disable the memory stack

Referenced by CORE_Object::EnableMemoryStack().

Here is the caller graph for this function:

◆ EnableMemoryStack() [1/2]

static void CORE_Object::EnableMemoryStack ( )
inlinestaticinherited

enable the memory stack

Referenced by CORE_Object::EnableMemoryStack(), and CORE_Run::SetDebugOptions().

Here is the caller graph for this function:

◆ EnableMemoryStack() [2/2]

static tBoolean CORE_Object::EnableMemoryStack ( const tBoolean isMemoryChecked)
inlinestaticinherited

enable the memory stack

Parameters
[in]isMemoryChecked: true to verify memory allocation of CORE_Object classes
Returns
true if the memroy is checked

References CORE_Object::DisableMemoryStack(), CORE_Object::EnableMemoryStack(), and CORE_Object::IsMemoryStackEnabled().

Here is the call graph for this function:

◆ getClassName()

tString CORE_Object::getClassName ( ) const
inlineinherited

return the name of the class

Returns
the string name of the class

Referenced by CORE_Object::getIdentityString(), and CORE_Test::testTypes().

Here is the caller graph for this function:

◆ getConnectionsNumber()

tIndex SM_Network::getConnectionsNumber ( ) const
inline

get the number of connections

Returns
the number of connections

References mNeighborsIndices.

Referenced by SM_XDMF::writeGeometryHeader().

Here is the caller graph for this function:

◆ getConstSharedPointer()

template<class T >
std::shared_ptr<const T> CORE_Object::getConstSharedPointer ( ) const
inlineinherited

return a const shared pointer for this

Returns
the shared pointer as a type T

References CORE_Object::mThis.

◆ getContentsMemorySize()

virtual tMemSize SM_Network::getContentsMemorySize ( ) const
inlinevirtual

return the memory size of the included associations

Returns
the memory size of the storage in bytes 1 Kb = 1024 bytes 1 Mb = 1024 Kb 1 Gb = 1024 Mb 1 Tb = 1024 Gb 1 Hb = 1024 Tb

Reimplemented from CORE_Object.

References CORE_Object::getContentsMemorySize(), CORE_Field< T, K, D, S, I >::getContentsMemorySize(), mJs, mNeighborsIndices, mNeighborsNumber, mPoints, tIndex, tMemSize, tReal, and tUInt.

Referenced by SM_System::getContentsMemorySize(), and getMemorySize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDimension()

tDimension SM_Network::getDimension ( ) const
inline

◆ getHeissenbergCoefficients() [1/2]

std::valarray<tReal>& SM_Network::getHeissenbergCoefficients ( )
inline

get the Heissenberg coefficients

Returns
Js as heissenberg coefficient for each link between 2 particles of size mNeighborsIndices.sum()

References mJs.

◆ getHeissenbergCoefficients() [2/2]

const std::valarray<tReal>& SM_Network::getHeissenbergCoefficients ( ) const
inline

get the Heissenberg coefficients

Returns
Js as heissenberg coefficient for each link between 2 particles of size mNeighborsIndices.sum()

References mJs.

Referenced by SM_HeissenbergOperator::computeTemplatedEnergy(), SM_HeissenbergOperator::computeTemplatedMagneticFieldAndEnergy(), and copy().

Here is the caller graph for this function:

◆ getIdentityString()

tString CORE_Object::getIdentityString ( ) const
inlineinherited

retrun the string identification of the class

Returns
the string identity of the class

References CORE_Object::getClassName(), and core_functions::pointerToString().

Referenced by CORE_Test::testArray(), CORE_Test::testField(), CORE_Test::testTypes(), CORE_Object::toString(), CORE_ClassFactory::toString(), and CORE_Field< T, K, D, S, I >::toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLambda()

const tReal& SM_Network::getLambda ( ) const
inline

◆ getMemorySize()

virtual tMemSize SM_Network::getMemorySize ( ) const
inlinevirtual

return the memory size of the class and the memory size of all its attributes/associations

Returns
the memory size of the class and the memory size of its attributes/associations in bytes The mamory size is :
  • the added size of the base classes which contains:
    • the primary attributes size depends on the order: (first delare the smallest attributes size
    • all virtual functions costs <pointer-size> (4 32xor 8 64x) bytes by virtual function
    • virtual inherihtance will increase of (4 or 8) bytes
  • we add the size of the contains values of the attributes : for example the size of a string is the length of the string 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from SM_Object.

References getContentsMemorySize().

Here is the call graph for this function:

◆ getNeighborsIndices() [1/2]

std::valarray<tIndex>& SM_Network::getNeighborsIndices ( )
inline

References mNeighborsIndices.

◆ getNeighborsIndices() [2/2]

const std::valarray<tIndex>& SM_Network::getNeighborsIndices ( ) const
inline

◆ getNeighborsNumber() [1/2]

std::valarray<tUInt>& SM_Network::getNeighborsNumber ( )
inline

get the neighbors number

Returns
the neighborsNumber as number of neighbors for each particle of size mParticlesNumber

References mNeighborsNumber.

◆ getNeighborsNumber() [2/2]

const std::valarray<tUInt>& SM_Network::getNeighborsNumber ( ) const
inline

get the neighbors number

Returns
the neighborsNumber as number of neighbors for each particle of size mParticlesNumber

References mNeighborsNumber.

Referenced by SM_HeissenbergOperator::computeTemplatedEnergy(), SM_HeissenbergOperator::computeTemplatedMagneticFieldAndEnergy(), copy(), and SM_XDMF::writeGeometryHeader().

Here is the caller graph for this function:

◆ getParticlesCoordinates() [1/2]

SM_RealField& SM_Network::getParticlesCoordinates ( )
inline

void get particles coordinates

Returns
coordinates of the particles

References mPoints.

◆ getParticlesCoordinates() [2/2]

const SM_RealField& SM_Network::getParticlesCoordinates ( ) const
inline

void get particles coordinates

Returns
coordinates of the particles

References mPoints.

Referenced by SM_DemagnetizedOperator::computeTemplatedEnergy(), SM_DemagnetizedOperator::computeTemplatedMagneticFieldAndEnergy(), copy(), and SM_XDMF::writeVertices().

Here is the caller graph for this function:

◆ getParticlesNumber()

tInteger SM_Network::getParticlesNumber ( ) const
inline

◆ getPointerString()

tString CORE_Object::getPointerString ( ) const
inlineinherited

retrun the pointer of the class as a string

Returns
the pointer of the calss as a string

References core_functions::pointerToString().

Here is the call graph for this function:

◆ GetRegisteredClassesNumber()

static tIndex CORE_Object::GetRegisteredClassesNumber ( )
inlinestaticinherited

get the memory stack in string

Returns
the string representation of the memory stack

◆ getSharedPointer()

template<class T >
std::shared_ptr<T> CORE_Object::getSharedPointer ( )
inlineinherited

return the shared pointer for this

Returns
the shared pointer as a type T

References CORE_Object::mThis.

◆ isInstanceOf()

template<class T >
tBoolean CORE_Object::isInstanceOf ( ) const
inlineinherited

test if the clas T is an instance of this class

Returns
true if the object is an instance of T

Referenced by SM_Beam::templatedSimulate().

Here is the caller graph for this function:

◆ IsMemoryStackEnabled()

static tBoolean CORE_Object::IsMemoryStackEnabled ( )
inlinestaticinherited

return trur if the memory stack is enabled

Referenced by CORE_Object::EnableMemoryStack(), and main().

Here is the caller graph for this function:

◆ MemoryStackToString()

static tString CORE_Object::MemoryStackToString ( )
inlinestaticinherited

get the memory stack in string

Returns
the string representation of the memory stack

Referenced by main().

Here is the caller graph for this function:

◆ New()

static CORE_UniquePointer<SM_Network> SM_Network::New ( )
inlinestatic

build a new instance of a Network

Returns
an unique pointer of Network

References SM_Network().

Referenced by SM_Run::createMagneticDipolarMap(), and SM_ClassFactory::NewInstance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLambda()

void SM_Network::setLambda ( const tReal L)
inline

set the lambda value

Parameters
[in]L:lambda value

References mLambda.

◆ setNeighbors() [1/2]

void SM_Network::setNeighbors ( const std::valarray< tUInt > &  neighborsNumber,
const std::vector< tIndex > &  neighborsIndices,
const std::vector< tReal > &  Js 
)
inline

set the neighbors by copy

Parameters
[in]neighborsNumbernumber of neighbors for each particle of size mParticlesNumber
[in]neighborsIndicesindices of neighbors for each particle of size mParticlesNumber x sum of neighborsNumber[i]
[in]Jsheissenberg coefficient for each link between 2 particles

References mJs, mNeighborsIndices, mNeighborsNumber, tIndex, and tReal.

◆ setNeighbors() [2/2]

void SM_Network::setNeighbors ( std::valarray< tUInt > &&  neighborsNumber,
std::valarray< tIndex > &&  neighborsIndices,
std::valarray< tReal > &&  Js 
)
inline

set the neighbors by moving

Parameters
[in]neighborsNumbernumber of neighbors for each particle of size mParticlesNumber
[in]neighborsIndicesindices of neighbors for each particle of size mParticlesNumber x sum of neighborsNumber[i]
[in]Jsheissenberg coefficient for each link between 2 particles

References mJs, mNeighborsIndices, and mNeighborsNumber.

Referenced by create3DGrid().

Here is the caller graph for this function:

◆ setParticlesCoordinates() [1/3]

void SM_Network::setParticlesCoordinates ( const SM_RealField coords)
inline

void set particles coordinates

Parameters
[in]coords: coordinates of the particles

References mPoints.

◆ setParticlesCoordinates() [2/3]

void SM_Network::setParticlesCoordinates ( const std::initializer_list< tReal > &  coords)
inline

void set particles 3D-coordinates

Parameters
[in]coordslist of 3D-coordinates

References mPoints.

◆ setParticlesCoordinates() [3/3]

void SM_Network::setParticlesCoordinates ( std::initializer_list< tReal > &&  coords)
inline

void set particles 3D-coordinates

Parameters
[in]coordslist of 3D-coordinates

References mPoints.

◆ setParticlesNumber()

void SM_Network::setParticlesNumber ( const tInteger nParticles)
inline

set the particles number

Parameters
[in]nParticles: number of particles

References mPoints, and CORE_Field< T, K, D, S, I >::setElementsNumber().

Here is the call graph for this function:

◆ setThis()

template<class T >
std::shared_ptr<T> CORE_Object::setThis ( std::unique_ptr< T, CORE_Object::Delete > &  up)
inlineprivateinherited

set the shared pointer from an unique pointer

Parameters
[in,out]upunique pointer of the class at input, points to null pointer at output
Returns
the shared pointer of the class

Method only calledby the friend class CORE_ClassFactory::NewSharedInstance()

References CORE_Object::mThis.

◆ toString()

tString SM_Network::toString ( ) const
overridevirtual

turn the class into a string representation

Returns
a string representation of the class

Reimplemented from CORE_Object.

References CORE_Field< T, K, D, S, I >::getDimension(), getDimension(), CORE_Field< T, K, D, S, I >::getElementsNumber(), getParticlesNumber(), mJs, mLambda, mNeighborsIndices, mNeighborsNumber, mPoints, tIndex, CORE_Object::toString(), tReal, and tUInt.

Referenced by SM_System::toString().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mJs

std::valarray<tReal> SM_Network::mJs
private

◆ mLambda

tReal SM_Network::mLambda
private

◆ mNeighborsIndices

std::valarray<tIndex> SM_Network::mNeighborsIndices
private

◆ mNeighborsNumber

std::valarray<tUInt> SM_Network::mNeighborsNumber
private

◆ mPoints

SM_RealField SM_Network::mPoints
private

◆ mThis

std::weak_ptr<CORE_Object> CORE_Object::mThis
privateinherited

The documentation for this class was generated from the following files: