OpenMEEG
domain.h
Go to the documentation of this file.
1 /*
2 Project Name : OpenMEEG
3 
4 © INRIA and ENPC (contributors: Geoffray ADDE, Maureen CLERC, Alexandre
5 GRAMFORT, Renaud KERIVEN, Jan KYBIC, Perrine LANDREAU, Théodore PAPADOPOULO,
6 Emmanuel OLIVI
7 Maureen.Clerc.AT.inria.fr, keriven.AT.certis.enpc.fr,
8 kybic.AT.fel.cvut.cz, papadop.AT.inria.fr)
9 
10 The OpenMEEG software is a C++ package for solving the forward/inverse
11 problems of electroencephalography and magnetoencephalography.
12 
13 This software is governed by the CeCILL-B license under French law and
14 abiding by the rules of distribution of free software. You can use,
15 modify and/ or redistribute the software under the terms of the CeCILL-B
16 license as circulated by CEA, CNRS and INRIA at the following URL
17 "http://www.cecill.info".
18 
19 As a counterpart to the access to the source code and rights to copy,
20 modify and redistribute granted by the license, users are provided only
21 with a limited warranty and the software's authors, the holders of the
22 economic rights, and the successive licensors have only limited
23 liability.
24 
25 In this respect, the user's attention is drawn to the risks associated
26 with loading, using, modifying and/or developing or reproducing the
27 software by the user in light of its specific status of free software,
28 that may mean that it is complicated to manipulate, and that also
29 therefore means that it is reserved for developers and experienced
30 professionals having in-depth computer knowledge. Users are therefore
31 encouraged to load and test the software's suitability as regards their
32 requirements in conditions enabling the security of their systems and/or
33 data to be ensured and, more generally, to use and operate it in the
34 same conditions as regards security.
35 
36 The fact that you are presently reading this means that you have had
37 knowledge of the CeCILL-B license and that you accept its terms.
38 */
39 
40 #pragma once
41 
48 
49 #include <string>
50 #include <interface.h>
51 
52 namespace OpenMEEG {
53 
57 
58  class HalfSpace: public std::pair<Interface,bool> {
59 
60  typedef std::pair<Interface,bool> base;
61 
62  public:
63 
64  HalfSpace() { }
65 
66  HalfSpace(Interface& _interface,const bool _inside): base(_interface,_inside) { }
67 
68  ~HalfSpace() { }
69 
70  Interface& interface() { return this->first; }
71  const Interface& interface() const { return this->first; }
72  const bool & inside() const { return this->second; }
73  };
74 
78 
79  class OPENMEEG_EXPORT Domain: public std::vector<HalfSpace> {
80 
81  typedef std::vector<HalfSpace> base;
82 
83  public:
84 
85  Domain(): name_(""), sigma_(-1.), outermost_(false) { }
86 
87  ~Domain() { }
88 
90 
91  std::string& name() { return name_; }
92  const std::string& name() const { return name_; }
93 
95 
96  double& sigma() { return sigma_; }
97  const double& sigma() const { return sigma_; }
98 
100 
101  bool& outermost() { return outermost_; }
102  const bool& outermost() const { return outermost_; }
103 
104  void info() const;
105 
106  bool contains_point(const Vect3&) const;
107 
112  int mesh_orientation(const Mesh& m) const {
113  for (Domain::const_iterator hit = begin();hit!=end();++hit)
114  for (Interface::const_iterator omit = hit->interface().begin();omit!=hit->interface().end();++omit)
115  if (&omit->mesh()==&m)
116  return ((hit->inside()) ? omit->orientation() : -omit->orientation());
117  return 0;
118  }
119 
120  private:
121 
122  std::string name_;
123  double sigma_;
124  bool outermost_;
125  };
126 
128 
129  typedef std::vector<Domain> Domains;
130 }
std::string & name()
The name of the domain.
Definition: domain.h:91
double & sigma()
The conductivity of the domain.
Definition: domain.h:96
bool outermost_
Is it an outermost domain.
Definition: domain.h:124
const std::string & name() const
Definition: domain.h:92
const double & sigma() const
Definition: domain.h:97
std::string name_
Name of the domain.
Definition: domain.h:122
double sigma_
Conductivity of the domain.
Definition: domain.h:123
std::vector< Domain > Domains
A vector of Domain is called Domains.
Definition: domain.h:129
HalfSpace(Interface &_interface, const bool _inside)
Definition: domain.h:66
std::pair< Interface, bool > base
Definition: domain.h:60
Mesh class.
Definition: mesh.h:85
const Interface & interface() const
Definition: domain.h:71
a HalfSpace is a pair of Interface and boolean A simple domain (HalfSpace) is given by an interface (...
Definition: domain.h:58
Vect3.
Definition: vect3.h:62
const bool & inside() const
Definition: domain.h:72
const bool & outermost() const
Definition: domain.h:102
a Domain is a vector of HalfSpace A Domain is the intersection of simple domains (of type HalfSpace)...
Definition: domain.h:79
Interface class An interface is a closed-shape composed of oriented meshes (here pointer to meshes) ...
Definition: interface.h:72
bool & outermost()
Returns the outermost state of the domain.
Definition: domain.h:101
std::vector< HalfSpace > base
Definition: domain.h:81
int mesh_orientation(const Mesh &m) const
Definition: domain.h:112
Interface & interface()
Definition: domain.h:70