C++ main module for stochmagnet Package  1.0
SM_VTK.h
Go to the documentation of this file.
1 #ifndef SM_VTK_H
2 #define SM_VTK_H
3 
4 //base header class
5 #include "CORE_Object.h"
6 
7 //beam header
8 #include "SM_Beam.h"
9 
10 //network header
11 #include "SM_Network.h"
12 
22 class SM_VTK : public SM_Object {
23 
24  // ATTRIBUTES
25 public:
26  static const tFlag CELL;
27  static const tFlag POINT;
28 
29 
30 private:
31 
32  //the absolute file name without extension
34 
35 
36 protected:
37  // METHODS
38 
39  // CONSTRUCTORS
40 
43  SM_VTK(void);
44 
45 
46 
47  // DESTRUCTORS
48 
49 
52  virtual ~SM_VTK(void);
53 
54 
55 
56 public:
57 
58  //MEMORY
59 
73  virtual tMemSize getMemorySize() const {
74  return sizeof(*this)+getContentsMemorySize();
75  }
76 
85  virtual tMemSize getContentsMemorySize() const {
87  mem+=mFileName.size();
88  return mem;
89 
90  }
91 
99  template<class T>
100  tString getVTKType() const {
101  return getVTKType(core_functions::getTypeName<T>());
102  }
118  tString getVTKType(const tString& typeName) const;
119 
120 
124  inline void setFileName(const tString& fn) {
125  mFileName=fn;
126  }
127 
131  inline const tString& getFileName() const {
132  return mFileName;
133  }
134 
135 
136 
142  virtual tBoolean save(const SM_Beam& beam,const tIndex& s);
143 
144 
145  //Virtual classes for writing VTK files
146  //======================================
147 
151  virtual tBoolean open()=0;
152 
157  virtual tBoolean open(const tIndex& t)=0;
158 
164  virtual tBoolean writeGeometryHeader(const tIndex&t,const SM_Network& network)=0;
165 
171  virtual tBoolean writeGeometryData(const tIndex& t,const SM_Network& network)=0;
172 
181  const tFlag& support,
182  const std::vector<tString>& scalarNames,
183  const std::vector<tString>& vectorNames)=0;
184 
194  virtual tBoolean writeContentData(const tIndex& t,
195  const SM_Network& network,
196  const tFlag& support,
197  const tString& name,
198  const tReal* f)=0;
199 
205  virtual tBoolean writeContentFooter(const tIndex& t,const tFlag& support)=0;
206 
207 
212  virtual tBoolean writeGeometryFooter(const tIndex& t)=0;
213 
218  virtual tBoolean close(const tIndex& t)=0;
219 
223  virtual tBoolean close()=0;
224 
225 
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 };
238 
239 
240 #endif
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:259
This class is a simulation of a beam of trajectories class for Stoch Microm package.
Definition: SM_Beam.h:46
This class is describes a a network.
Definition: SM_Network.h:18
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:19
This class is a beam output interface for VTK / Paraview software.
Definition: SM_VTK.h:22
void setFileName(const tString &fn)
set the file name without extension
Definition: SM_VTK.h:124
virtual tBoolean writeGeometryHeader(const tIndex &t, const SM_Network &network)=0
write the geometry header corresponding to the network
virtual tBoolean close(const tIndex &t)=0
close the file for the time step t
virtual tBoolean writeContentFooter(const tIndex &t, const tFlag &support)=0
write a content footer
virtual tBoolean save(const SM_Beam &beam, const tIndex &s)
save the s-th trajectory of the beam
Definition: SM_VTK.cpp:50
virtual tBoolean writeGeometryData(const tIndex &t, const SM_Network &network)=0
write the geometry data of the network
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_VTK.h:73
static const tFlag POINT
Definition: SM_VTK.h:27
virtual tBoolean open()=0
open the vtkfile
virtual ~SM_VTK(void)
destroy
Definition: SM_VTK.cpp:16
const tString & getFileName() const
get the file name without extension
Definition: SM_VTK.h:131
virtual tBoolean writeGeometryFooter(const tIndex &t)=0
write the geometry footer
static const tFlag CELL
Definition: SM_VTK.h:26
tString mFileName
Definition: SM_VTK.h:33
virtual tBoolean writeContentData(const tIndex &t, const SM_Network &network, const tFlag &support, const tString &name, const tReal *f)=0
write a content data
SM_VTK(void)
create
Definition: SM_VTK.cpp:12
virtual tBoolean writeContentHeader(const tIndex &t, const tFlag &support, const std::vector< tString > &scalarNames, const std::vector< tString > &vectorNames)=0
write a content header
virtual tBoolean close()=0
close the file
virtual tBoolean open(const tIndex &t)=0
open the vtk field for writing or appending at the time step
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_VTK.h:85
tString getVTKType() const
return the VTK type of the template Type
Definition: SM_VTK.h:100
#define tFlag
Definition: types.h:91
#define tIndex
Definition: types.h:157
#define tString
Definition: types.h:147
#define tMemSize
Definition: types.h:166
#define tBoolean
Definition: types.h:151
#define tReal
Definition: types.h:137