DOLFIN
DOLFIN C++ interface
SubDomain.h
1 // Copyright (C) 2007-2013 Anders Logg
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // First added: 2007-04-10
19 // Last changed: 2013-04-12
20 
21 #ifndef __SUB_DOMAIN_H
22 #define __SUB_DOMAIN_H
23 
24 #include <cstddef>
25 #include <map>
26 #include <dolfin/common/constants.h>
27 #include <Eigen/Dense>
28 
29 namespace dolfin
30 {
31 
32  // Forward declarations
33  class Mesh;
34  template <typename T> class MeshFunction;
35  template <typename T> class MeshValueCollection;
36  template <typename T> class Array;
37 
41 
42  class SubDomain
43  {
44  public:
45 
51  SubDomain(const double map_tol=1.0e-10);
52 
54  virtual ~SubDomain();
55 
65  virtual bool inside(const Array<double>& x, bool on_boundary) const;
66 
76  virtual bool inside(Eigen::Ref<const Eigen::VectorXd> x, bool on_boundary) const;
77 
85  virtual void map(const Array<double>& x, Array<double>& y) const;
86 
87 
95  virtual void map(Eigen::Ref<const Eigen::VectorXd> x, Eigen::Ref<Eigen::VectorXd> y) const;
96 
97 
102  virtual void snap(Array<double>& x) const;
103 
108  virtual void snap(Eigen::Ref<Eigen::VectorXd> x) const;
109 
110  //--- Marking of Mesh ---
111