-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmesh.h
More file actions
86 lines (74 loc) · 2.24 KB
/
mesh.h
File metadata and controls
86 lines (74 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef __MESH3D__MESH_H__
#define __MESH3D__MESH_H__
#include "common.h"
#include "vertex.h"
#include "face.h"
#include "tetrahedron.h"
#include "simple_mesh.h"
#ifdef USE_METIS
# include "mesh_graph.h"
#endif
#include <vector>
#include <ostream>
namespace mesh3d {
class mesh {
ptr_vector<vertex> _vertices;
ptr_vector<face> _faces;
ptr_vector<tetrahedron> _tets;
index _domain;
index _domains;
bool checkVertexIndices(index &wrong) const;
bool checkTetIndices(index &wrong) const;
bool checkFaceIndices(index &wrong) const;
bool checkFlippedFace(index &wrong) const;
bool checkFlippedOrient(index &wrong) const;
bool checkFaceSurface(index &wrong) const;
bool checkTetVolume(index &wrong) const;
bool checkTetFaceNormals(index &wrong, int &faceno) const;
bool checkVertexFaceList(index &wrong, index &faceno, int &vertno, index &cnt) const;
bool checkVertexTetList(index &wrong, index &tetno, int &vertno, index &cnt) const;
void log(std::ostream *o, const std::string &msg) const;
mesh(const mesh &);
mesh &operator=(const mesh &);
public:
/** Construct mesh from simple mesh */
mesh(const simple_mesh &sm, index dom = 0, index domains = 1);
#ifdef USE_METIS
/** Construct mesh in domain from global mesh and tet_graph */
mesh(const mesh &sm, index dom, const tet_graph &tg);
#endif
/** Construct from binary stream */
mesh(std::istream &i);
/** Export to binary stream */
void serialize(std::ostream &o) const;
/** Dump to text stream */
void dump(std::ostream &o) const;
/** Destroy mesh */
~mesh();
/** Return domain id */
index domain() const { return _domain; }
/** Return domain count */
index domains() const { return _domains; }
/** Run various checks on mesh */
bool check(std::ostream *o = 0) const;
/** Return mesh vertices as array */
const ptr_vector<vertex> &vertices() const;
/** Return mesh vertex */
const vertex &vertices(index i) const {
return vertices()[i];
}
/** Return mesh faces as array */
const ptr_vector<face> &faces() const;
/** Return mesh face */
const face &faces(index i) const {
return faces()[i];
}
/** Return mesh tetrahedrons as array */
const ptr_vector<tetrahedron> &tets() const;
/** Return mesh face */
const tetrahedron &tets(index i) const {
return tets()[i];
}
};
}
#endif