OpenMEEG
Loading...
Searching...
No Matches
domain.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
16
17#include <string>
18#include <interface.h>
19
20namespace OpenMEEG {
21
26
28 public:
29
30 typedef enum { Inside, Outside } Side;
31
33 SimpleDomain(Interface& i,const Side s): interf(i),side(s) { }
35
36 Interface& interface() { return interf; }
37 const Interface& interface() const { return interf; }
38
39 bool inside() const { return (side==Inside); }
40
41 // omesh must belong to the interface.
42
43 int mesh_orientation(const OrientedMesh& omesh) const {
44 return (inside()) ? omesh.orientation() : -omesh.orientation();
45 }
46
47 private:
48
49 Interface interf;
50 Side side;
51 };
52
56
57 class OPENMEEG_EXPORT Domain {
58 public:
59
60 typedef std::vector<SimpleDomain> Boundaries;
61
62 Domain(const std::string& dname=""): domain_name(dname) { }
63 ~Domain() { }
64
66
67 Boundaries& boundaries() { return bounds; }
68 const Boundaries& boundaries() const { return bounds; }
69
71
72 std::string& name() { return domain_name; }
73 const std::string& name() const { return domain_name; }
74
76
77 void set_conductivity(const double c) { cond = c; }
78 bool has_conductivity() const { return cond != -1.0; }
79 const double& conductivity() const { return cond; }
80
84
85 void info(const bool outermost=false) const;
86
87 bool contains(const Mesh& m) const { return mesh_orientation(m)!=0; }
88
89 bool contains(const Vect3& point) const;
90
94
95 int mesh_orientation(const Mesh& m) const {
96 for (const auto& boundary : boundaries())
97 for (const auto& omesh : boundary.interface().oriented_meshes())
98 if (&omesh.mesh()==&m)
99 return boundary.mesh_orientation(omesh);
100 return 0;
101 }
102
103 private:
104
105 Boundaries bounds;
106 std::string domain_name = "";
107 double cond = -1.0;
108 };
109
111
112 typedef std::vector<Domain> Domains;
113}
a Domain is a vector of SimpleDomain A Domain is the intersection of simple domains (of type SimpleDo...
Definition: domain.h:57
const Boundaries & boundaries() const
Definition: domain.h:68
int mesh_orientation(const Mesh &m) const
Definition: domain.h:95
std::string & name()
The name of the domain.
Definition: domain.h:72
Boundaries & boundaries()
Boundaries of the domain.
Definition: domain.h:67
const std::string & name() const
Definition: domain.h:73
Domain(const std::string &dname="")
Definition: domain.h:62
bool has_conductivity() const
Definition: domain.h:78
std::vector< SimpleDomain > Boundaries
Definition: domain.h:60
void info(const bool outermost=false) const
Print information about the domain.
bool contains(const Mesh &m) const
Definition: domain.h:87
void set_conductivity(const double c)
The conductivity of the domain.
Definition: domain.h:77
bool contains(const Vect3 &point) const
Does this point belongs to the domain ?
const double & conductivity() const
Definition: domain.h:79
Interface class An interface is a closed-shape composed of oriented meshes (vector of oriented meshes...
Definition: interface.h:49
An Oriented Mesh is a mesh associated with a boolean stating if it is well oriented.
Definition: interface.h:24
int orientation() const
orientation is +1 or -1 ?
Definition: interface.h:36
a SimpleDomain is a pair of an Interface and a boolean.
Definition: domain.h:27
SimpleDomain(Interface &i, const Side s)
Definition: domain.h:33
const Interface & interface() const
Definition: domain.h:37
bool inside() const
Definition: domain.h:39
int mesh_orientation(const OrientedMesh &omesh) const
Definition: domain.h:43
Interface & interface()
Definition: domain.h:36
Vect3.
Definition: vect3.h:28
std::vector< Domain > Domains
A vector of Domain is called Domains.
Definition: domain.h:112