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

This class is a beam interface output for XMF format for paraview visualization software. More...

#include <SM_XDMF.h>

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

Public Member Functions

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...
 
virtual tBoolean open () override
 open the vtkfile More...
 
virtual tBoolean open (const tIndex &t) override
 open the vtk field for writing or appending at the time step More...
 
virtual tBoolean writeGeometryHeader (const tIndex &t, const SM_Network &network) override
 write the geometry header corresponding to the network More...
 
virtual tBoolean writeGeometryData (const tIndex &t, const SM_Network &network) override
 write the geometry data of the network More...
 
virtual tBoolean writeContentHeader (const tIndex &t, const tFlag &support, const std::vector< tString > &scalarNames, const std::vector< tString > &vectorNames) override
 write a content header More...
 
virtual tBoolean writeContentData (const tIndex &t, const SM_Network &network, const tFlag &support, const tString &name, const tReal *f) override
 write a content data More...
 
virtual tBoolean writeContentFooter (const tIndex &t, const tFlag &support) override
 write a content footer More...
 
virtual tBoolean writeGeometryFooter (const tIndex &t) override
 write the geometry footer More...
 
virtual tBoolean close (const tIndex &t) override
 close the file for the time step t More...
 
virtual tBoolean close () override
 close the file More...
 
void setExternalFileName (const tString &f)
 set the external file to find the vector data More...
 
void setFormat (const tString &f)
 set the format of the data More...
 
template<class T >
tString getVTKType () const
 return the VTK type of the template Type More...
 
tString getVTKType (const tString &typeName) const
 return the VTK type of tthe type name More...
 
void setFileName (const tString &fn)
 set the file name without extension More...
 
const tStringgetFileName () const
 get the file name without extension More...
 
virtual tBoolean save (const SM_Beam &beam, const tIndex &s)
 save the s-th trajectory of the beam 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...
 
virtual tString toString () const
 return the string representation of the object node More...
 

Static Public Member Functions

static CORE_UniquePointer< SM_XDMFNew ()
 create an XDMF class More...
 
static CORE_UniquePointer< SM_XDMFNew (const tString &format)
 create an XDMF class 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...
 

Static Public Attributes

static const tFlag CELL =0
 
static const tFlag POINT =1
 

Protected Member Functions

 SM_XDMF (void)
 create More...
 
virtual ~SM_XDMF (void)
 destroy More...
 
const tStringgetFormat () const
 get the format of the data More...
 
const tStringgetExternalFileName () const
 get the external file name to find data More...
 
virtual tBoolean writeVertices (CORE_OutputFile &file, const SM_Network &mesh, const tString &tag) const
 write the vertices coordinates More...
 
virtual tBoolean writeVertices (CORE_OutputFile &file, const SM_Network &mesh)
 write the vertices coordinates More...
 
virtual tBoolean writeConnectivity (CORE_OutputFile &file, const tIndex &nVertexCells, const tIndex &nEdgeCells, const std::valarray< tUInt > &neighborsNumber, const std::valarray< tIndex > &neighborIndices, const tString &tagN) const
 write the connectivity between vertices More...
 
virtual tBoolean writeConnectivity (CORE_OutputFile &file, const tIndex &nVertexCells, const tIndex &nEdgeCells, const std::valarray< tUInt > &neighbors, const std::valarray< tIndex > &neighborIndices) const
 write the connectivity between vertices More...
 
virtual tBoolean writeField (CORE_OutputFile &file, const tIndex &t, const tFlag &contentType, const tString &name, const tString &tagName, const tIndex &n, const tDimension &dim, const tReal *f) const
 write a field with name More...
 
virtual tBoolean writeField (CORE_OutputFile &file, const tIndex &t, const tFlag &contentType, const tString &name, const tIndex &n, const tDimension &dim, const tReal *f) const
 write a field with name 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

tString mFormat
 
tString mName
 
tString mExternalFileName
 
CORE_UniquePointer< CORE_OutputFilemFile
 
tString mFileName
 
std::weak_ptr< CORE_ObjectmThis
 

Detailed Description

This class is a beam interface output for XMF format for paraview visualization software.

Author
Stephane Despreaux
Version
1.0

Constructor & Destructor Documentation

◆ SM_XDMF()

SM_XDMF::SM_XDMF ( void  )
protected

create

References mExternalFileName, mFile, mFormat, mName, and CORE_OutputFile::New().

Referenced by New().

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

◆ ~SM_XDMF()

SM_XDMF::~SM_XDMF ( void  )
protectedvirtual

destroy

Member Function Documentation

◆ close() [1/2]

tBoolean SM_XDMF::close ( )
overridevirtual

close the file

Returns
true if the footer writting has succceeded false otherwise

Implements SM_VTK.

References CORE_OutputFile::close(), and mFile.

Here is the call graph for this function:

◆ close() [2/2]

virtual tBoolean SM_XDMF::close ( const tIndex t)
inlineoverridevirtual

close the file for the time step t

Parameters
[in]tthe time step
Returns
true if the header writting has succceeded false otherwise

Implements SM_VTK.

◆ 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:

◆ 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_XDMF::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 SM_VTK.

References SM_VTK::getContentsMemorySize(), mExternalFileName, mFile, mFormat, mName, and tMemSize.

Referenced by getMemorySize().

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

◆ getExternalFileName()

const tString& SM_XDMF::getExternalFileName ( ) const
inlineprotected

get the external file name to find data

Returns
the complete external file name

References mExternalFileName.

Referenced by writeConnectivity(), writeField(), and writeVertices().

Here is the caller graph for this function:

◆ getFileName()

const tString& SM_VTK::getFileName ( ) const
inlineinherited

get the file name without extension

Returns
the absolute file name without extension

References SM_VTK::mFileName.

Referenced by open().

Here is the caller graph for this function:

◆ getFormat()

const tString& SM_XDMF::getFormat ( ) const
inlineprotected

get the format of the data

Returns
the format of the data in "XML" "HDF"

References mFormat.

Referenced by writeConnectivity(), writeField(), and writeVertices().

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:

◆ getMemorySize()

virtual tMemSize SM_XDMF::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_VTK.

References getContentsMemorySize().

Here is the call graph for this function:

◆ 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.

◆ getVTKType() [1/2]

template<class T >
tString SM_VTK::getVTKType ( ) const
inlineinherited

return the VTK type of the template Type

Returns
the VTK type of templated type T in
  • Int8,16,32,64
  • UInt8,16,32,64
  • Float32,64

◆ getVTKType() [2/2]

tString SM_VTK::getVTKType ( const tString typeName) const
inherited

return the VTK type of tthe type name

return the VTK type of the template Type

Parameters
[in]typeNamethe name of the type:
  • unsigned char
  • unsigned short
  • unsigned int
  • unsigned long
  • unsigned long long
  • float
  • double
  • long double
Returns
the VTK string type in
  • Int8,16,32,64
  • UInt8,16,32,64
  • Float32,64

References CORE_Run::Is64Architecture(), and tString.

Here is the call graph for this function:

◆ 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() [1/2]

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

create an XDMF class

Returns
a shared pointer of the XDMF class

References SM_XDMF().

Referenced by SM_Output::generateOutput(), and New().

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

◆ New() [2/2]

static CORE_UniquePointer<SM_XDMF> SM_XDMF::New ( const tString format)
inlinestatic

create an XDMF class

Parameters
[in]formatthe format of the data in the XML file in {"XML","HDF"}
Returns
a shared pointer of the XDMF class

References New().

Here is the call graph for this function:

◆ open() [1/2]

tBoolean SM_XDMF::open ( )
overridevirtual

open the vtkfile

Returns
true if the header writting has succceeded false otherwise

Implements SM_VTK.

References SM_VTK::getFileName(), mFile, and tString.

Here is the call graph for this function:

◆ open() [2/2]

virtual tBoolean SM_XDMF::open ( const tIndex t)
inlineoverridevirtual

open the vtk field for writing or appending at the time step

Parameters
[in]tthe time step
Returns
true if the header writting has succceeded false otherwise

Implements SM_VTK.

◆ save()

tBoolean SM_VTK::save ( const SM_Beam beam,
const tIndex s 
)
virtualinherited

◆ setExternalFileName()

void SM_XDMF::setExternalFileName ( const tString f)
inline

set the external file to find the vector data

Parameters
[in]fthe aboslute file name with extension

References mExternalFileName.

◆ setFileName()

void SM_VTK::setFileName ( const tString fn)
inlineinherited

set the file name without extension

Parameters
fn: the absolute file name without extension

References SM_VTK::mFileName.

◆ setFormat()

void SM_XDMF::setFormat ( const tString f)
inline

set the format of the data

Parameters
[in]fthe format of the data in "XML","HDF"

References mFormat.

◆ 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()

virtual tString CORE_Object::toString ( ) const
inlinevirtualinherited

◆ writeConnectivity() [1/2]

virtual tBoolean SM_XDMF::writeConnectivity ( CORE_OutputFile file,
const tIndex nVertexCells,
const tIndex nEdgeCells,
const std::valarray< tUInt > &  neighbors,
const std::valarray< tIndex > &  neighborIndices 
) const
inlineprotectedvirtual

write the connectivity between vertices

Parameters
[in]filethe output stream
[in]nVertexCellsnumber of points without any connection
[in]nEdgeCells: number of points with at least one connection
[in]neighborsthe index of all neighbors of all points
[in]neighborIndices: the index of the first neighbor of point i in [0,neighborIndices.getSize()-1[
Returns
true if vertices writting has succceeded

References writeConnectivity().

Here is the call graph for this function:

◆ writeConnectivity() [2/2]

tBoolean SM_XDMF::writeConnectivity ( CORE_OutputFile file,
const tIndex nVertexCells,
const tIndex nEdgeCells,
const std::valarray< tUInt > &  neighborsNumber,
const std::valarray< tIndex > &  neighborIndices,
const tString tagN 
) const
protectedvirtual

write the connectivity between vertices

Parameters
[in]filethe output stream
[in]nVertexCellsnumber of points without any connection
[in]nEdgeCells: number of points with at least one connection
[in]neighborsNumberthe number of neighbors by particle
[in]neighborIndices: the index of the first neighbor of point i in [0,neighborIndices.getSize()-1[
[in]tagNthe tag for finding the vector neighbors in external file if any
Returns
true if vertices writting has succceeded

References getExternalFileName(), getFormat(), mFormat, tBoolean, tIndex, tString, and tUInt.

Referenced by writeConnectivity(), and writeGeometryHeader().

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

◆ writeContentData()

tBoolean SM_XDMF::writeContentData ( const tIndex t,
const SM_Network network,
const tFlag support,
const tString name,
const tReal f 
)
overridevirtual

write a content data

Parameters
[in]tthe time step for the content data
[in]networkthe mesh of the field
[in]supporttype of support of the field in {SM_VTP::CELL,SM_VTP::POINT}
[in]namename of the field
[in]fthe field to write
Returns
true if the writing succeeds false otherwise

Implements SM_VTK.

References SM_Network::getDimension(), SM_Network::getParticlesNumber(), mFile, tBoolean, tString, and writeField().

Here is the call graph for this function:

◆ writeContentFooter()

tBoolean SM_XDMF::writeContentFooter ( const tIndex t,
const tFlag support 
)
overridevirtual

write a content footer

Parameters
[in]tthe time step for the content header
[in]supporttype of support in {SM_VTP::CELL,SM_VTP::POINT}
Returns
true if the content footer writting has succceeded false otherwise

Implements SM_VTK.

◆ writeContentHeader()

tBoolean SM_XDMF::writeContentHeader ( const tIndex t,
const tFlag support,
const std::vector< tString > &  scalarNames,
const std::vector< tString > &  vectorNames 
)
overridevirtual

write a content header

Parameters
[in]tthe time step for the content header
[in]supporttype of support in {SM_VTP::CELL,SM_VTP::POINT}
[in]scalarNamesthe names of the scalar field to save on support
[in]vectorNamesthe names of the vector field to save on support
Returns
true if the content header writting has succceeded false otherwise

Implements SM_VTK.

◆ writeField() [1/2]

virtual tBoolean SM_XDMF::writeField ( CORE_OutputFile file,
const tIndex t,
const tFlag contentType,
const tString name,
const tIndex n,
const tDimension dim,
const tReal f 
) const
inlineprotectedvirtual

write a field with name

Parameters
[in]filethe output stream
[in]tthe time step index
[in]contentType;the type of content in {CELL,POINT}
[in]namethe name of the field
[in]nsize of the field
[in]dimdimension of the field
[in]fthe field to save
Returns
true if content footer writting has succceeded

References writeField().

Here is the call graph for this function:

◆ writeField() [2/2]

tBoolean SM_XDMF::writeField ( CORE_OutputFile file,
const tIndex t,
const tFlag contentType,
const tString name,
const tString tagName,
const tIndex n,
const tDimension dim,
const tReal f 
) const
protectedvirtual

write a field with name

Parameters
[in]filethe output stream
[in]tthe time step index
[in]contentType;the type of content in {CELL,POINT}
[in]namethe name of the field
[in]tagNamethe tag to get the field
[in]nsize of the field
[in]dimdimension of the field
[in]fthe field to save
Returns
true if content footer writting has succceeded

References SM_VTK::CELL, getExternalFileName(), getFormat(), mFormat, tBoolean, tIndex, tReal, tString, and tUSInt.

Referenced by writeContentData(), and writeField().

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

◆ writeGeometryData()

tBoolean SM_XDMF::writeGeometryData ( const tIndex t,
const SM_Network network 
)
overridevirtual

write the geometry data of the network

Parameters
[in]tthe time step for the geometry data
[in]networkthe geometry data
Returns
true if the geometry data writting has succceeded false otherwise

Implements SM_VTK.

References mFile, tBoolean, tString, and writeVertices().

Here is the call graph for this function:

◆ writeGeometryFooter()

tBoolean SM_XDMF::writeGeometryFooter ( const tIndex t)
overridevirtual

write the geometry footer

Parameters
[in]tthe time step for the geometry footer
Returns
true if the geometry footer writting has succceeded false otherwise

Implements SM_VTK.

◆ writeGeometryHeader()

tBoolean SM_XDMF::writeGeometryHeader ( const tIndex t,
const SM_Network network 
)
overridevirtual

write the geometry header corresponding to the network

Parameters
[in]tthe time step for the geometry header
[in]networkthe network to take information for building the header
Returns
true if the geometry header writting has succceeded false otherwise

Implements SM_VTK.

References SM_Network::computeAloneParticlesNumber(), SM_Network::getConnectionsNumber(), SM_Network::getNeighborsIndices(), SM_Network::getNeighborsNumber(), mFile, tBoolean, tIndex, tString, and writeConnectivity().

Here is the call graph for this function:

◆ writeVertices() [1/2]

virtual tBoolean SM_XDMF::writeVertices ( CORE_OutputFile file,
const SM_Network mesh 
)
inlineprotectedvirtual

write the vertices coordinates

Parameters
[in]filethe output stream
[in]meshthe mesh
Returns
true if vertices writting has succceeded

References writeVertices().

Here is the call graph for this function:

◆ writeVertices() [2/2]

tBoolean SM_XDMF::writeVertices ( CORE_OutputFile file,
const SM_Network mesh,
const tString tag 
) const
protectedvirtual

write the vertices coordinates

Parameters
[in]filethe output stream
[in]meshthe mesh
[in]tagthe tag for finding the vector in external file if any
Returns
true if vertices writting has succceeded

References CORE_Collection< T, I >::getDataTypeName(), CORE_Field< T, K, D, S, I >::getDimension(), CORE_Field< T, K, D, S, I >::getElementsNumber(), getExternalFileName(), getFormat(), SM_Network::getParticlesCoordinates(), CORE_Field< T, K, D, S, I >::getValues(), mFormat, tBoolean, tIndex, tReal, tString, and tUSInt.

Referenced by writeGeometryData(), and writeVertices().

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

Member Data Documentation

◆ CELL

const tFlag SM_VTK::CELL =0
staticinherited

Referenced by SM_VTK::save(), and writeField().

◆ mExternalFileName

tString SM_XDMF::mExternalFileName
private

◆ mFile

CORE_UniquePointer<CORE_OutputFile> SM_XDMF::mFile
private

◆ mFileName

tString SM_VTK::mFileName
privateinherited

◆ mFormat

tString SM_XDMF::mFormat
private

◆ mName

tString SM_XDMF::mName
private

Referenced by getContentsMemorySize(), and SM_XDMF().

◆ mThis

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

◆ POINT

const tFlag SM_VTK::POINT =1
staticinherited

Referenced by SM_VTK::save().


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