OpenMEEG
Toggle main menu visibility
Loading...
Searching...
No Matches
OpenMEEG
include
interface.h
Go to the documentation of this file.
1
// Project Name: OpenMEEG (http://openmeeg.github.io)
2
// © INRIA and ENPC under the French open source license CeCILL-B.
3
// See full copyright notice in the file LICENSE.txt
4
// If you make a copy of this file, you must either:
5
// - provide also LICENSE.txt and modify this header to refer to it.
6
// - replace this header by the LICENSE.txt content.
7
8
#pragma once
9
10
#include <string>
11
#include <sstream>
12
#include <vector>
13
#include <cstdlib>
14
#include <ctime>
15
#include <
om_common.h
>
16
#include <
mesh.h
>
17
18
namespace
OpenMEEG
{
19
20
class
Mesh
;
21
23
24
class
OrientedMesh
{
25
public
:
26
27
typedef
enum
{
Normal
=1,
Opposite
=-1 }
Orientation
;
28
29
OrientedMesh
() {}
30
31
OrientedMesh
(
Mesh
& m,
const
Orientation
o): meshptr(&m),orient(o) { }
32
33
Mesh
&
mesh
() {
return
*meshptr; }
34
const
Mesh
&
mesh
()
const
{
return
*meshptr; }
35
36
int
orientation
()
const
{
return
orient; }
37
38
void
change_orientation
() { orient = -orient; }
39
40
private
:
41
42
Mesh
* meshptr;
43
int
orient;
44
};
45
48
49
class
OPENMEEG_EXPORT
Interface
{
50
public
:
51
52
// using OrientedMesh::Orientation;
53
54
typedef
std::vector<OrientedMesh>
OrientedMeshes
;
55
57
58
Interface
() { }
59
61
62
Interface
(
const
std::string& interfname): interface_name(interfname) { }
63
64
const
std::string&
name
()
const
{
return
interface_name; }
65
66
OrientedMeshes
&
oriented_meshes
() {
return
orientedmeshes; }
67
const
OrientedMeshes
&
oriented_meshes
()
const
{
return
orientedmeshes; }
68
69
bool
outermost
()
const
{
return
outermost_interface; }
70
void
set_to_outermost
();
71
72
bool
contains
(
const
Vect3
& p)
const
;
73
74
bool
is_mesh_orientations_coherent
(
const
bool
doublechecked=
false
);
75
77
78
size_t
nb_vertices
()
const
{
79
size_t
nb = 0;
80
for
(
const
auto
& omesh :
oriented_meshes
())
81
nb += omesh.mesh().vertices().size();
82
return
nb;
83
}
84
86
87
size_t
nb_triangles
()
const
{
88
size_t
nb = 0;
89
for
(
const
auto
& omesh :
oriented_meshes
())
90
nb += omesh.mesh().triangles().size();
91
return
nb;
92
}
93
95
96
TrianglesRefs
adjacent_triangles
(
const
Triangle
& t)
const
{
97
TrianglesRefs
triangles;
98
for
(
const
auto
& omesh :
oriented_meshes
()) {
99
const
TrianglesRefs
& tri = omesh.mesh().adjacent_triangles(t);
100
triangles.insert(triangles.end(),tri.begin(),tri.end());
101
}
102
return
triangles;
103
}
104
105
private
:
106
107
double
solid_angle(
const
Vect3
& p)
const
;
108
109
std::string interface_name =
""
;
110
bool
outermost_interface =
false
;
111
OrientedMeshes orientedmeshes;
112
};
113
115
116
typedef
std::vector<Interface>
Interfaces
;
117
}
OpenMEEG::Interface::oriented_meshes
const OrientedMeshes & oriented_meshes() const
Definition
interface.h:67
OpenMEEG::Interface::nb_triangles
size_t nb_triangles() const
Definition
interface.h:87
OpenMEEG::Interface::nb_vertices
size_t nb_vertices() const
Definition
interface.h:78
OpenMEEG::Interface::name
const std::string & name() const
Definition
interface.h:64
OpenMEEG::Interface::set_to_outermost
void set_to_outermost()
set all interface meshes to outermost state.
OpenMEEG::Interface::contains
bool contains(const Vect3 &p) const
OpenMEEG::Interface::is_mesh_orientations_coherent
bool is_mesh_orientations_coherent(const bool doublechecked=false)
Check the global orientation.
OpenMEEG::Interface::OrientedMeshes
std::vector< OrientedMesh > OrientedMeshes
Definition
interface.h:54
OpenMEEG::Interface::Interface
Interface(const std::string &interfname)
Constructor from a name.
Definition
interface.h:62
OpenMEEG::Interface::oriented_meshes
OrientedMeshes & oriented_meshes()
Definition
interface.h:66
OpenMEEG::Interface::Interface
Interface()
Default Constructor.
Definition
interface.h:58
OpenMEEG::Interface::outermost
bool outermost() const
Definition
interface.h:69
OpenMEEG::Interface::adjacent_triangles
TrianglesRefs adjacent_triangles(const Triangle &t) const
Definition
interface.h:96
OpenMEEG::Mesh
Definition
mesh.h:34
OpenMEEG::OrientedMesh::change_orientation
void change_orientation()
Definition
interface.h:38
OpenMEEG::OrientedMesh::Orientation
Orientation
Definition
interface.h:27
OpenMEEG::OrientedMesh::Opposite
@ Opposite
Definition
interface.h:27
OpenMEEG::OrientedMesh::Normal
@ Normal
Definition
interface.h:27
OpenMEEG::OrientedMesh::OrientedMesh
OrientedMesh()
Definition
interface.h:29
OpenMEEG::OrientedMesh::mesh
const Mesh & mesh() const
access mesh
Definition
interface.h:34
OpenMEEG::OrientedMesh::orientation
int orientation() const
orientation is +1 or -1 ?
Definition
interface.h:36
OpenMEEG::OrientedMesh::mesh
Mesh & mesh()
access mesh
Definition
interface.h:33
OpenMEEG::OrientedMesh::OrientedMesh
OrientedMesh(Mesh &m, const Orientation o)
Definition
interface.h:31
OpenMEEG::Triangle
Triangle Triangle class.
Definition
triangle.h:45
OpenMEEG::Vect3
Vect3.
Definition
vect3.h:28
mesh.h
OpenMEEG
Definition
analytics.h:14
OpenMEEG::TrianglesRefs
std::vector< Triangle * > TrianglesRefs
Definition
triangle.h:146
OpenMEEG::Interfaces
std::vector< Interface > Interfaces
A vector of Interface is called Interfaces.
Definition
interface.h:116
om_common.h
Generated by
1.17.0