5 #include "CORE_Object.h"
10 #include "SM_Network.h"
20 template<
class VTK_Impl>
40 std::vector<tString> mScalarFieldOnCellNames;
41 std::vector<tString> mVectorFieldOnCellNames;
44 std::vector<tString> mScalarFieldOnPointNames;
45 std::vector<tString> mVectorFieldOnPointNames;
48 tBoolean mIsFileOpened;
104 mem+=mFileName.size();
105 for(
const auto& name: mScalarFieldOnPointNames) mem+=name.size()*
sizeof(
unsigned char);
106 for(
const auto& name: mScalarFieldOnCellNames) mem+=name.size()*
sizeof(
unsigned char);
107 for(
const auto& name: mVectorFieldOnPointNames) mem+=name.size()*
sizeof(
unsigned char);
108 for(
const auto& name: mVectorFieldOnCellNames) mem+=name.size()*
sizeof(
unsigned char);
123 return getVTKType(functions_type::getTypeName<T>());
140 tString
getVTKType(
const tString& typeName)
const;
147 tIndex iPt=fn.rfind(
".");
148 if (iPt!=tString::npos) {
149 mFileName=fn.substr(0,iPt);
168 const tFlag& support,
169 const std::vector<tString>& names) {
174 mScalarFieldOnPointNames.clear();
175 for(
const auto& name : names) {
176 mScalarFieldOnPointNames.push_back(name);
180 mScalarFieldOnCellNames.clear();
181 for(
const auto& name : names) {
182 mScalarFieldOnCellNames.push_back(name);
190 mVectorFieldOnPointNames.clear();
191 for(
const auto& name : names) {
192 mVectorFieldOnPointNames.push_back(name);
196 mVectorFieldOnCellNames.clear();
197 for(
const auto& name : names) {
198 mVectorFieldOnCellNames.push_back(name);
211 return mIsFileOpened;
228 inline tBoolean
save(
const SM_Network& network,
const tIndex& it,
const tReal& time) {
264 inline tBoolean
save(
const SM_System& system,
const tIndex& it,
const tReal& time) {
274 inline tBoolean
save(
const tString& vtkFileName,
276 const tString& Sname,
const tReal& alpha,
SM_RealField& S) {
281 ok=ok &&
save(network,Sname,alpha,S,0,0);
294 inline tBoolean
save(
const SM_Network& network,
const tString& Sname,
const tReal& alpha,
295 const SM_RealField& S,
const tIndex& it,
const tReal& time) {
339 return static_cast<VTK_Impl*
>(
this)->
open();
346 inline tBoolean
open(
const tIndex& t) {
347 return static_cast<VTK_Impl*
>(
this)->
open(t);
376 const tFlag& support,
377 const std::vector<tString>& scalarNames,
378 const std::vector<tString>& vectorNames) {
379 return static_cast<VTK_Impl*
>(
this)->
writeContentHeader(t,support,scalarNames,vectorNames);
394 const tFlag& support,
395 const tString& name,
const tReal& alpha,
397 return static_cast<VTK_Impl*
>(
this)->
writeContentData(t,network,support,name,alpha,f);
422 inline tBoolean
close(
const tIndex& t) {
423 return static_cast<VTK_Impl*
>(
this)->
close(t);
430 return static_cast<VTK_Impl*
>(
this)->
close();
435 #include "SM_VTK.hpp"
const T * getValues() const
get the values of the array for reading
Definition: CORE_Field.h:323
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
This class is describes a network composed by.
Definition: SM_Network.h:66
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36
This class is a one simulation of a beam for Stoch Magnet package.
Definition: SM_System.h:53
const SM_RealField & getMagneticMomentDirections() const
get the unit direction of spins at time
Definition: SM_System.h:267
const SM_Network & getNetwork() const
get the network
Definition: SM_System.h:170
This class is a beam output interface for VTK / Paraview software.
Definition: SM_VTK.h:21
tBoolean writeContentHeader(const tIndex &t, const tFlag &support, const std::vector< tString > &scalarNames, const std::vector< tString > &vectorNames)
write a content header
Definition: SM_VTK.h:375
tString getVTKType() const
return the VTK type of the template Type
Definition: SM_VTK.h:122
tBoolean writeGeometryHeader(const tIndex &t, const SM_Network &network)
write the geometry header corresponding to the network
Definition: SM_VTK.h:355
void setFileName(const tString &fn)
set the file name without extension
Definition: SM_VTK.h:146
tBoolean save(const tString &vtkFileName, const SM_Network &network, const tString &Sname, const tReal &alpha, SM_RealField &S)
save the system at time
Definition: SM_VTK.h:274
const tString & getFileName() const
get the file name without extension
Definition: SM_VTK.h:158
tBoolean writeContentFooter(const tIndex &t, const tFlag &support)
write a content footer
Definition: SM_VTK.h:405
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_VTK.h:90
tBoolean writeGeometryData(const tIndex &t, const SM_Network &network)
write the geometry data of the network
Definition: SM_VTK.h:364
tBoolean writeGeometryFooter(const tIndex &t)
write the geometry footer
Definition: SM_VTK.h:414
tBoolean open()
open the vtkfile
Definition: SM_VTK.h:338
void setFields(const tUCInt &dim, const tFlag &support, const std::vector< tString > &names)
initialize fields
Definition: SM_VTK.h:167
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_VTK.h:102
tBoolean close()
close the file
Definition: SM_VTK.h:429
tBoolean save(const SM_Network &network, const tString &Sname, const tReal &alpha, const SM_RealField &S, const tIndex &it, const tReal &time)
save the system at time
Definition: SM_VTK.h:294
virtual ~SM_VTK(void)
destroy
Definition: SM_VTK.h:68
tBoolean writeContentData(const tReal &t, const SM_Network &network, const tFlag &support, const tString &name, const tReal &alpha, const tReal *f)
write a content data
Definition: SM_VTK.h:392
static const tFlag POINT
point tag
Definition: SM_VTK.h:30
tBoolean close(const tIndex &t)
close the file for the time step t
Definition: SM_VTK.h:422
void setIsFileOpened(const tBoolean &v)
set true is the file is opened
Definition: SM_VTK.h:217
static const tFlag CELL
cell tag
Definition: SM_VTK.h:27
const tBoolean & isFileOpened() const
return true if the file is open
Definition: SM_VTK.h:210
tBoolean open(const tIndex &t)
open the vtk field for writing or appending at the time step
Definition: SM_VTK.h:346
tBoolean save(const SM_Network &network, const tIndex &it, const tReal &time)
save the system at time
Definition: SM_VTK.h:228
tBoolean save(const SM_System &system, const tIndex &it, const tReal &time)
save the system at time
Definition: SM_VTK.h:264
SM_VTK(void)
create
Definition: SM_VTK.h:56