2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #ifndef simplefoamwriter_H
24 #define simplefoamwriter_H
26 class SimpleFoamWriter
;
28 #include "iooperation.h"
31 * Writer for OpenFOAM grids
33 class SimpleFoamWriter
: public IOOperation
36 protected: // data types
39 QVector
<vtkIdType
> node
;
40 vtkIdType owner
, neighbour
;
42 int operator[](int i
) { while(i
<0) i
+=node
.size(); while(i
>=node
.size()) i
-=node
.size(); return node
[i
]; }
43 bool operator<(const face_t
&F
) const;
44 vec3_t
normal(vtkUnstructuredGrid
*grid
);
46 face_t(int N
, int o
, int n
, int b
=0) { node
.resize(N
); owner
= o
; neighbour
= n
; bc
= b
; }
50 int bc
, startFace
, nFaces
;
51 bool operator<(const patch_t
&P
) const { return startFace
< P
.startFace
; }
54 protected: // attributes
57 QVector
<face_t
> m_Faces
;
58 QList
<face_t
> m_LFaces
;
65 vtkIdType
getNeigh(int i_cells
, int i_neigh
);
66 void addFace(face_t F
);
71 void writeNeighbour();
72 void writeBoundary(int faces_offset
= 0);
74 void operateOnGivenFileName();
75 virtual void operate();
80 virtual ~SimpleFoamWriter() {}