various improvements to speed up surface meshing of BRL-CAD geometries
[engrid.git] / src / libengrid / simplefoamwriter.h
bloba6823f6d034e6c726640ca02e90085d415b9fade
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 #ifndef simplefoamwriter_H
24 #define simplefoamwriter_H
26 class SimpleFoamWriter;
28 #include "iooperation.h"
30 /**
31 * Writer for OpenFOAM grids
33 class SimpleFoamWriter : public IOOperation
36 protected: // data types
38 struct face_t {
39 QVector<vtkIdType> node;
40 vtkIdType owner, neighbour;
41 int bc;
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);
45 face_t() {}
46 face_t(int N, int o, int n, int b=0) { node.resize(N); owner = o; neighbour = n; bc = b; }
49 struct patch_t {
50 int bc, startFace, nFaces;
51 bool operator<(const patch_t &P) const { return startFace < P.startFace; }
54 protected: // attributes
56 QString m_Path;
57 QVector<face_t> m_Faces;
58 QList<face_t> m_LFaces;
59 vtkIntArray* m_BC;
60 int m_NumCells;
61 QVector<int> m_Eg2Of;
63 protected: // methods
65 vtkIdType getNeigh(int i_cells, int i_neigh);
66 void addFace(face_t F);
67 void createFaces();
68 void writePoints();
69 void writeFaces();
70 void writeOwner();
71 void writeNeighbour();
72 void writeBoundary(int faces_offset = 0);
74 void operateOnGivenFileName();
75 virtual void operate();
77 public: // methods
79 SimpleFoamWriter();
80 virtual ~SimpleFoamWriter() {}
84 #endif