fixed edge display for volume cells
[engrid-github.git] / src / libengrid / simplefoamwriter.h
blob0a9d703f103050f9d1db0e853d7b7e79bf92c891
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
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. +
11 // + +
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. +
16 // + +
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/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef simplefoamwriter_H
22 #define simplefoamwriter_H
24 class SimpleFoamWriter;
26 #include "iooperation.h"
28 /**
29 * Writer for OpenFOAM grids
31 class SimpleFoamWriter : public IOOperation
34 protected: // data types
36 struct face_t {
37 QVector<vtkIdType> node;
38 vtkIdType owner, neighbour;
39 int bc;
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);
43 face_t() {}
44 face_t(int N, int o, int n, int b=0) { node.resize(N); owner = o; neighbour = n; bc = b; }
47 struct patch_t {
48 int bc, startFace, nFaces;
49 bool operator<(const patch_t &P) const { return startFace < P.startFace; }
52 protected: // attributes
54 QString m_Path;
55 QVector<face_t> m_Faces;
56 QList<face_t> m_LFaces;
57 vtkIntArray* m_BC;
58 int m_NumCells;
59 QVector<int> m_Eg2Of;
61 protected: // methods
63 vtkIdType getNeigh(int i_cells, int i_neigh);
64 void addFace(face_t F);
65 void createFaces();
66 void writePoints();
67 void writeFaces();
68 void writeOwner();
69 void writeNeighbour();
70 void writeBoundary(int faces_offset = 0);
72 void operateOnGivenFileName();
73 virtual void operate();
75 public: // methods
77 SimpleFoamWriter();
78 virtual ~SimpleFoamWriter() {}
82 #endif