investigating a little logic pb
[engrid.git] / simplefoamwriter.h
blobb9030505827a72ce3df4a5f80b7421c560c28a1d
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 protected: // attributes
51 QString path;
52 QVector<face_t> faces;
53 QList<face_t> lfaces;
54 vtkIntArray *bc;
55 int Ncells;
56 QVector<int> eg2of;
58 protected: // methods
60 vtkIdType getNeigh(int i_cells, int i_neigh);
61 void addFace(face_t F);
62 void createFaces();
63 void writePoints();
64 void writeFaces();
65 void writeOwner();
66 void writeNeighbour();
67 void writeBoundary();
69 virtual void operate();
71 public: // methods
73 SimpleFoamWriter();
74 virtual ~SimpleFoamWriter() {};
78 #endif