C++ main module for emicrom Package  1.0
EMM_VTK.h
Go to the documentation of this file.
1 #ifndef EMM_VTK_H
2 #define EMM_VTK_H
3 
4 #include "CORE_Object.h"
5 
6 
25 class EMM_VTK : public virtual CORE_Object {
26 
28  // ATTRIBUTES
29 
30 
31 private:
33 
34 protected:
35  // METHODS
36 
37  // CONSTRUCTORS
38 
41  EMM_VTK(void);
42 
43 
44 
45  // DESTRUCTORS
46 
47 
50  virtual ~EMM_VTK(void);
51 
52 
53 
54 public:
58  inline static SP::EMM_VTK New() {
59  SP::EMM_VTK p(new EMM_VTK(),EMM_VTK::Delete());
60  p->setThis(p);
61  return p;
62  };
66  inline static void setIs32BitEnabled(const tBoolean& isEnabled) {
67  IS_32BIT_ENABLED=isEnabled;
68  }
69 
70 
71 
72 
75  template<class T>
76  inline tString getVTKType() const {
77  return getVTKType(CORE_Object::getTypeName<T>());
78  }
94  tString getVTKType(const tString& typeName) const;
95 
100  tBoolean writeHeader(ofstream& file) const;
105  tBoolean writeFooter(ofstream& file) const;
106 
125  tBoolean writeGrid3dHeader(ofstream& file,
126  const tReal& Px,const tReal& Py,const tReal& Pz,
127  const tUIndex& Nx,const tUIndex& Ny,const tUIndex& Nz,
128  const tReal& Dx,const tReal& Dy,const tReal& Dz) const;
129 
140  inline tBoolean writeGrid3dHeader(ofstream& file,
141  const tUIndex& nx,const tUIndex& ny,const tUIndex& nz,
142  const tReal& dx,const tReal& dy,const tReal& dz) const {
143  return writeGrid3dHeader(file,0.0,0.0,0.0,
144  nx,ny,nz,dx,dy,dz);
145  }
146 
147 
151  tBoolean writeGrid3dFooter(ofstream& file) const;
152 
160  tBoolean writeContentHeader(ofstream& file,
161  const tFlag& contentType,
162  const vector<tString>& vectorName,
163  const vector<tString>& scalarName) const;
167  tBoolean writeContentFooter(ofstream& file,
168  const tFlag& contentType) const;
169 
170 
171 
185  template<class T>
186  inline tBoolean writeField(ofstream& file,
187  const tString& name,
188  const tBoolean& isUniform,
189  const tUIndex& n,
190  const tUSInt& dim,
191  const tUIndex& startIndex,
192  const tUIndex& endIndex,
193  const tUIndex& inc,
194  const T* array) const {
195  return writeField<T>(file,name,isUniform,n,dim,startIndex,endIndex,inc,array,0,null);
196  }
197 
212  template<class T>
213  tBoolean writeField(ofstream& file,
214  const tString& name,
215  const tBoolean& isUniform,
216  const tUIndex& n,
217  const tUSInt& dim,
218  const tUIndex& startIndex,
219  const tUIndex& endIndex,
220  const tUIndex& inc,
221  const T* array,
222  const tUIndex& nWeight,
223  const T* weight) const;
224 
230  template<class T>
231  inline static T toVTKNumber(const tString& vtkType,const T& value) {
232  return value;
233  }
234 
235 
236 
237 };
238 
239 #include "EMM_VTK.hpp"
240 
241 #endif
tBoolean writeContentFooter(ofstream &file, const tFlag &contentType) const
write a cell content footer
Definition: EMM_VTK.cpp:117
tBoolean writeContentHeader(ofstream &file, const tFlag &contentType, const vector< tString > &vectorName, const vector< tString > &scalarName) const
write a content header
Definition: EMM_VTK.cpp:84
tBoolean writeField(ofstream &file, const tString &name, const tBoolean &isUniform, const tUIndex &n, const tUSInt &dim, const tUIndex &startIndex, const tUIndex &endIndex, const tUIndex &inc, const T *array) const
write an array of T type in file
Definition: EMM_VTK.h:186
tBoolean writeHeader(ofstream &file) const
write vtk file header
Definition: EMM_VTK.cpp:52
tBoolean writeGrid3dHeader(ofstream &file, const tReal &Px, const tReal &Py, const tReal &Pz, const tUIndex &Nx, const tUIndex &Ny, const tUIndex &Nz, const tReal &Dx, const tReal &Dy, const tReal &Dz) const
write grid image header
Definition: EMM_VTK.cpp:65
This class is a I/O output class for VTK / Paraviwe file.
Definition: EMM_VTK.h:25
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
DEFINE_SPTR(EMM_VTK)
static void setIs32BitEnabled(const tBoolean &isEnabled)
set if the 32 bit is enabled
Definition: EMM_VTK.h:66
#define null
Definition: types.h:144
static tBoolean IS_32BIT_ENABLED
Definition: EMM_VTK.h:32
tBoolean writeGrid3dFooter(ofstream &file) const
write grid image footer
Definition: EMM_VTK.cpp:76
tBoolean writeFooter(ofstream &file) const
write vtk file footer
Definition: EMM_VTK.cpp:59
tString getVTKType() const
return the VTK type of the template Type
Definition: EMM_VTK.h:76
#define tUIndex
Definition: types.h:126
static SP::EMM_VTK New()
create an VTK class
Definition: EMM_VTK.h:58
tBoolean writeGrid3dHeader(ofstream &file, const tUIndex &nx, const tUIndex &ny, const tUIndex &nz, const tReal &dx, const tReal &dy, const tReal &dz) const
write grid image header
Definition: EMM_VTK.h:140
abstract base class for most classes.
Definition: CORE_Object.h:53
#define tString
Definition: types.h:135
virtual ~EMM_VTK(void)
destroy
Definition: EMM_VTK.cpp:13
static T toVTKNumber(const tString &vtkType, const T &value)
turn the value into vtk type
Definition: EMM_VTK.h:231
EMM_VTK(void)
create
Definition: EMM_VTK.cpp:9
#define tReal
Definition: types.h:118
SP_OBJECT(EMM_VTK)
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
#define tFlag
Definition: types.h:74