DOLFIN
DOLFIN C++ interface
MeshDomains.h
1 // Copyright (C) 2011 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 // Modified by Garth N. Wells, 2012
19 //
20 // First added: 2011-08-29
21 // Last changed: 2012-04-03
22 
23 #ifndef __MESH_DOMAINS_H
24 #define __MESH_DOMAINS_H
25 
26 #include <map>
27 #include <vector>
28 
29 namespace dolfin
30 {
31 
40 
42  {
43  public:
44 
46  MeshDomains();
47 
49  ~MeshDomains();
50 
52  std::size_t max_dim() const;
53 
55  std::size_t num_marked(std::size_t dim) const;
56 
58  bool is_empty() const;
59 
62  std::map<std::size_t, std::size_t>& markers(std::size_t dim);
63 
66  const std::map<std::size_t, std::size_t>& markers(std::size_t dim) const;
67 
70  bool set_marker(std::pair<std::size_t, std::size_t> marker,
71  std::size_t dim);
72 
75  std::size_t get_marker(std::size_t entity_index, std::size_t dim) const;
76 
78  const MeshDomains& operator= (const MeshDomains& domains);
79 
81  void init(std::size_t dim);
82 
84  void clear();
85 
86  private:
87 
88  // Subdomain markers for each geometric dimension
89  std::vector<std::map<std::size_t, std::size_t> > _markers;
90 
91  };
92 
93 }
94 
95 #endif
std::size_t get_marker(std::size_t entity_index, std::size_t dim) const
Definition: MeshDomains.cpp:92
Definition: adapt.h:29
void init(std::size_t dim)
Initialize mesh domains for given topological dimension.
Definition: MeshDomains.cpp:116
Definition: MeshDomains.h:41
const MeshDomains & operator=(const MeshDomains &domains)
Assignment operator.
Definition: MeshDomains.cpp:108
bool set_marker(std::pair< std::size_t, std::size_t > marker, std::size_t dim)
Definition: MeshDomains.cpp:75
bool is_empty() const
Check whether domain data is empty.
Definition: MeshDomains.cpp:54
std::size_t max_dim() const
Return maximum topological dimension of stored markers.
Definition: MeshDomains.cpp:40
std::size_t num_marked(std::size_t dim) const
Return number of marked entities of given dimension.
Definition: MeshDomains.cpp:48
void clear()
Clear all data.
Definition: MeshDomains.cpp:125
~MeshDomains()
Destructor.
Definition: MeshDomains.cpp:35
MeshDomains()
Create empty mesh domains.
Definition: MeshDomains.cpp:30
std::map< std::size_t, std::size_t > & markers(std::size_t dim)
Definition: MeshDomains.cpp:62