1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef simplefoamwriter_H
22 #define simplefoamwriter_H
24 class SimpleFoamWriter
;
26 #include "iooperation.h"
29 * Writer for OpenFOAM grids
31 class SimpleFoamWriter
: public IOOperation
34 protected: // data types
37 QVector
<vtkIdType
> node
;
38 vtkIdType owner
, neighbour
;
40 int operator[](int i
) { while(i
<0) i
+=node
.size(); while(i
>=node
.size()) i
-=node
.size(); return node
[i
]; }
41 bool operator<(const face_t
&F
) const;
42 vec3_t
normal(vtkUnstructuredGrid
*grid
);
44 face_t(int N
, int o
, int n
, int b
=0) { node
.resize(N
); owner
= o
; neighbour
= n
; bc
= b
; }
48 int bc
, startFace
, nFaces
;
49 bool operator<(const patch_t
&P
) const { return startFace
< P
.startFace
; }
52 protected: // attributes
55 QVector
<face_t
> m_Faces
;
56 QList
<face_t
> m_LFaces
;
63 vtkIdType
getNeigh(int i_cells
, int i_neigh
);
64 void addFace(face_t F
);
69 void writeNeighbour();
70 void writeBoundary(int faces_offset
= 0);
72 void operateOnGivenFileName();
73 virtual void operate();
78 virtual ~SimpleFoamWriter() {}