Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/geometry_info.h>
23 
24 DEAL_II_NAMESPACE_OPEN
25 
26 namespace internal
27 {
28  namespace TriangulationImplementation
29  {
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,
65  const int i2, const int i3);
66 
73  TriaObject (const int i0, const int i1,
74  const int i2, const int i3,
75  const int i4, const int i5);
76 
77 
81  int face (const unsigned int i) const;
82 
86  void set_face (const unsigned int i, const int index);
87 
92  static std::size_t memory_consumption ();
93 
98  template <class Archive>
99  void serialize(Archive &ar,
100  const unsigned int version);
101 
102  protected:
108  };
109 
110 //----------------------------------------------------------------------//
111 
112  template <int structdim>
113  inline
115  {
116  for (unsigned int i=0; i<GeometryInfo<structdim>::faces_per_cell; ++i)
117  faces[i] = -1;
118  }
119 
120 
121  template <int structdim>
122  inline
124  const int i1)
125  {
126  Assert (structdim==1, ExcImpossibleInDim(structdim));
127  faces[0] = i0;
128  faces[1] = i1;
129  }
130 
131 
132  template <int structdim>
133  inline
135  const int i1,
136  const int i2,
137  const int i3)
138  {
139  Assert (structdim==2, ExcImpossibleInDim(structdim));
140  faces[0] = i0;
141  faces[1] = i1;
142  faces[2] = i2;
143  faces[3] = i3;
144  }
145 
146 
147  template <int structdim>
148  inline
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
168  int TriaObject<structdim>::face (const unsigned int i) const
169  {
172  return faces[i];
173  }
174 
175 
176 
177  template <int structdim>
178  inline
179  void 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
190  std::size_t
192  {
193  return sizeof(TriaObject<structdim>);
194  }
195 
196 
197  template <int structdim>
198  template <class Archive>
200  const unsigned int)
201  {
202  ar &faces;
203  }
204 
205 
206  }
207 }
208 
209 
210 DEAL_II_NAMESPACE_CLOSE
211 
212 #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:1142
int faces[GeometryInfo< structdim >::faces_per_cell]
Definition: tria_object.h:107
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