Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
tria_object.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_tria_object_h
17 #define dealii_tria_object_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/geometry_info.h>
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 namespace internal
28 {
29  namespace TriangulationImplementation
30  {
40  template <int structdim>
41  class TriaObject
42  {
43  public:
44  static const unsigned int dimension = structdim;
45 
49  TriaObject();
50 
56  TriaObject(const int i0, const int i1);
57 
64  TriaObject(const int i0, const int i1, const int i2, const int i3);
65 
72  TriaObject(const int i0,
73  const int i1,
74  const int i2,
75  const int i3,
76  const int i4,
77  const int i5);
78 
79 
83  int
84  face(const unsigned int i) const;
85 
89  void
90  set_face(const unsigned int i, const int index);
91 
96  static std::size_t
98 
103  template <class Archive>
104  void
105  serialize(Archive &ar, const unsigned int version);
106 
107  protected:
113  };
114 
115  //----------------------------------------------------------------------//
116 
117  template <int structdim>
119  {
120  for (unsigned int i = 0; i < GeometryInfo<structdim>::faces_per_cell; ++i)
121  faces[i] = -1;
122  }
123 
124 
125  template <int structdim>
126  inline TriaObject<structdim>::TriaObject(const int i0, const int i1)
127  {
128  Assert(structdim == 1, ExcImpossibleInDim(structdim));
129  faces[0] = i0;
130  faces[1] = i1;
131  }
132 
133 
134  template <int structdim>
136  const int i1,
137  const int i2,
138  const int i3)
139  {
140  Assert(structdim == 2, ExcImpossibleInDim(structdim));
141  faces[0] = i0;
142  faces[1] = i1;
143  faces[2] = i2;
144  faces[3] = i3;
145  }
146 
147 
148  template <int structdim>
150  const int i1,
151  const int i2,
152  const int i3,
153  const int i4,
154  const int i5)
155  {
156  Assert(structdim == 3, ExcImpossibleInDim(structdim));
157  faces[0] = i0;
158  faces[1] = i1;
159  faces[2] = i2;
160  faces[3] = i3;
161  faces[4] = i4;
162  faces[5] = i5;
163  }
164 
165 
166  template <int structdim>
167  inline int
168  TriaObject<structdim>::face(const unsigned int i) const
169  {
172  return faces[i];
173  }
174 
175 
176 
177  template <int structdim>
178  inline void
179  TriaObject<structdim>::set_face(const unsigned int i, const int index)
180  {
183  faces[i] = index;
184  }
185 
186 
187 
188  template <int structdim>
189  inline std::size_t
191  {
192  return sizeof(TriaObject<structdim>);
193  }
194 
195 
196  template <int structdim>
197  template <class Archive>
198  void
199  TriaObject<structdim>::serialize(Archive &ar, const unsigned int)
200  {
201  ar &faces;
202  }
203 
204 
205  } // namespace TriangulationImplementation
206 } // namespace internal
207 
208 
209 DEAL_II_NAMESPACE_CLOSE
210 
211 #endif
int face(const unsigned int i) const
Definition: tria_object.h:168
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define Assert(cond, exc)
Definition: exceptions.h:1407
int faces[GeometryInfo< structdim >::faces_per_cell]
Definition: tria_object.h:112
void serialize(Archive &ar, const unsigned int version)
Definition: tria_object.h:199
void set_face(const unsigned int i, const int index)
Definition: tria_object.h:179