DSC
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
simplex.h
1 //
2 // Deformabel Simplicial Complex (DSC) method
3 // Copyright (C) 2013 Technical University of Denmark
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU 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 // This program 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 General Public License for more details.
14 //
15 // See licence.txt for a copy of the GNU General Public License.
16 
17 #pragma once
18 
19 #include "simplex_set.h"
20 #include "util.h"
21 
22 namespace is_mesh
23 {
24  class ISMesh;
25 
27  // S I M P L E X B A S E C L A S S
29 
32  template<typename boundary_key_type, typename co_boundary_key_type>
33  class Simplex
34  {
37  protected:
38  ISMesh *m_mesh = nullptr;
39  public:
40  friend class ISMesh;
41 
42  Simplex(ISMesh * owner) noexcept
43  : m_mesh {owner}
44  {
45  }
46 
47  Simplex(const Simplex& s) noexcept
48  :m_mesh {s.m_mesh }, m_boundary(s.m_boundary), m_co_boundary(s.m_co_boundary)
49  {
50  }
51 
52  Simplex(Simplex&& s) noexcept
53  {
54  std::swap(m_boundary, s.m_boundary);
55  std::swap(m_co_boundary, s.m_co_boundary);
56  std::swap(m_mesh, s.m_mesh );
57  }
58 
60  {
61  if (this != &other){
62  std::swap(m_boundary, other.m_boundary);
63  std::swap(m_co_boundary, other.m_co_boundary);
64  std::swap(m_mesh , other.m_mesh );
65  }
66  return *this;
67  }
68 
69  ~Simplex()
70  {
71  }
72 
73  public:
74 
75  const SimplexSet<co_boundary_key_type>& get_co_boundary() const noexcept
76  {
77  return m_co_boundary;
78  }
79  const SimplexSet<boundary_key_type>& get_boundary() const noexcept
80  {
81  return m_boundary;
82  }
83 
84  void add_co_face(co_boundary_key_type key)
85  {
86  m_co_boundary += key;
87  }
88 
89  void add_face(boundary_key_type key)
90  {
91  m_boundary += key;
92  }
93 
94  void remove_co_face(co_boundary_key_type key)
95  {
96  m_co_boundary -= key;
97  }
98 
99  void remove_face(boundary_key_type key)
100  {
101  m_boundary -= key;
102  }
103  };
104 }
Definition: simplex.h:33
Definition: is_mesh.h:40