DeleteSetOfPoints function working
[engrid.git] / simplefoamwriter.h
blobea9114a956482369682ea1d7f028c09608240f06
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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 path;
57 QVector<face_t> faces;
58 QList<face_t> lfaces;
59 vtkIntArray *bc;
60 int Ncells;
61 QVector<int> 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();
74 virtual void operate();
76 public: // methods
78 SimpleFoamWriter();
79 virtual ~SimpleFoamWriter() {}
83 #endif