Reference documentation for deal.II version 9.4.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
dof_objects.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2006 - 2021 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_dof_objects_h
17 #define dealii_dof_objects_h
18 
19 
20 #include <deal.II/base/config.h>
21 
23 
24 #include <vector>
25 
27 
28 // Forward declarations
29 #ifndef DOXYGEN
30 template <int, int>
31 class DoFHandler;
32 #endif
33 
34 namespace internal
35 {
36  namespace DoFHandlerImplementation
37  {
38 #ifndef DOXYGEN
39  template <int>
40  class DoFLevel;
41  template <int>
42  class DoFFaces;
43 #endif
44 
68  template <int dim>
69  class DoFObjects
70  {
71  public:
75  std::vector<types::global_dof_index> dofs;
76 
89  template <int dh_dim, int spacedim>
91  access_dof_index(const ::DoFHandler<dh_dim, spacedim> &dof_handler,
92  const unsigned int obj_index,
93  const unsigned int fe_index,
94  const unsigned int local_index);
95 
101  template <int dh_dim, int spacedim>
102  unsigned int
104  const ::DoFHandler<dh_dim, spacedim> &dof_handler,
105  const types::global_dof_index index) const;
106 
111  template <int dh_dim, int spacedim>
112  bool
114  const ::DoFHandler<dh_dim, spacedim> &dof_handler,
115  const types::global_dof_index index,
116  const unsigned int fe_index) const;
117 
122  std::size_t
123  memory_consumption() const;
124 
130  template <class Archive>
131  void
132  serialize(Archive &ar, const unsigned int version);
133 
134  // Declare the classes that store levels and faces of DoFs friends so
135  // that they can resize arrays.
136  template <int>
137  friend class DoFLevel;
138  template <int>
139  friend class DoFFaces;
140  };
141 
142 
143  // --------------------- template and inline functions ------------------
144 
145  template <int dim>
146  template <int dh_dim, int spacedim>
147  inline unsigned int
149  const ::DoFHandler<dh_dim, spacedim> &,
150  const types::global_dof_index) const
151  {
152  return 1;
153  }
154 
155 
156 
157  template <int dim>
158  template <int dh_dim, int spacedim>
159  inline bool
161  const ::DoFHandler<dh_dim, spacedim> &,
163  const unsigned int fe_index) const
164  {
165  (void)fe_index;
166  Assert((fe_index ==
168  ExcMessage("Only zero fe_index values are allowed for "
169  "non-hp-DoFHandlers."));
170  return true;
171  }
172 
173 
174 
175  template <int dim>
176  template <int dh_dim, int spacedim>
177  inline types::global_dof_index &
179  const ::DoFHandler<dh_dim, spacedim> &dof_handler,
180  const unsigned int obj_index,
181  const unsigned int fe_index,
182  const unsigned int local_index)
183  {
184  (void)fe_index;
185  Assert(
187  ExcMessage(
188  "Only the default FE index is allowed for non-hp-DoFHandler objects"));
189  Assert(
190  local_index < dof_handler.get_fe().template n_dofs_per_object<dim>(),
191  ExcIndexRange(local_index,
192  0,
193  dof_handler.get_fe().template n_dofs_per_object<dim>()));
194  Assert(obj_index *
195  dof_handler.get_fe().template n_dofs_per_object<dim>() +
196  local_index <
197  dofs.size(),
198  ExcInternalError());
199 
200  return dofs[obj_index *
201  dof_handler.get_fe().template n_dofs_per_object<dim>() +
202  local_index];
203  }
204 
205 
206  template <int dim>
207  template <class Archive>
208  void
209  DoFObjects<dim>::serialize(Archive &ar, const unsigned int)
210  {
211  ar &dofs;
212  }
213 
214  } // namespace DoFHandlerImplementation
215 } // namespace internal
216 
218 
219 #endif
unsigned int n_active_fe_indices(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const types::global_dof_index index) const
Definition: dof_objects.h:148
types::global_dof_index & access_dof_index(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index)
Definition: dof_objects.h:178
std::vector< types::global_dof_index > dofs
Definition: dof_objects.h:75
bool fe_index_is_active(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const types::global_dof_index index, const unsigned int fe_index) const
Definition: dof_objects.h:160
void serialize(Archive &ar, const unsigned int version)
Definition: dof_objects.h:209
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
Definition: exceptions.h:1473
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcMessage(std::string arg1)
unsigned int global_dof_index
Definition: types.h:76