Reference documentation for deal.II version GIT 29f9da0a34 2023-12-07 10:00:01+00:00
\(\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 - 2023 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 
24 
25 #include <vector>
26 
28 
29 // Forward declarations
30 #ifndef DOXYGEN
31 template <int dim, int spacedim>
32 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
33 class DoFHandler;
34 #endif
35 
36 namespace internal
37 {
38  namespace DoFHandlerImplementation
39  {
40 #ifndef DOXYGEN
41  template <int>
42  class DoFLevel;
43  template <int>
44  class DoFFaces;
45 #endif
46 
70  template <int dim>
71  class DoFObjects
72  {
73  public:
77  std::vector<types::global_dof_index> dofs;
78 
91  template <int dh_dim, int spacedim>
94  const unsigned int obj_index,
96  const unsigned int local_index);
97 
103  template <int dh_dim, int spacedim>
104  unsigned int
106  const types::global_dof_index index) const;
107 
112  template <int dh_dim, int spacedim>
113  bool
115  const types::global_dof_index index,
116  const types::fe_index 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 types::global_dof_index) const
150  {
151  return 1;
152  }
153 
154 
155 
156  template <int dim>
157  template <int dh_dim, int spacedim>
158  inline bool
161  const types::fe_index fe_index) const
162  {
163  (void)fe_index;
165  ExcMessage("Only zero fe_index values are allowed for "
166  "non-hp-DoFHandlers."));
167  return true;
168  }
169 
170 
171 
172  template <int dim>
173  template <int dh_dim, int spacedim>
174  inline types::global_dof_index &
176  const DoFHandler<dh_dim, spacedim> &dof_handler,
177  const unsigned int obj_index,
179  const unsigned int local_index)
180  {
181  (void)fe_index;
183  ExcMessage("Only the default FE index is allowed for DoFHandler "
184  "objects without hp capability"));
185  AssertIndexRange(local_index,
186  dof_handler.get_fe().template n_dofs_per_object<dim>());
188  obj_index * dof_handler.get_fe().template n_dofs_per_object<dim>() +
189  local_index,
190  dofs.size());
191 
192  return dofs[obj_index *
193  dof_handler.get_fe().template n_dofs_per_object<dim>() +
194  local_index];
195  }
196 
197 
198  template <int dim>
199  template <class Archive>
200  void
201  DoFObjects<dim>::serialize(Archive &ar, const unsigned int)
202  {
203  ar &dofs;
204  }
205 
206  } // namespace DoFHandlerImplementation
207 } // namespace internal
208 
210 
211 #endif
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
types::global_dof_index & access_dof_index(const DoFHandler< dh_dim, spacedim > &dof_handler, const unsigned int obj_index, const types::fe_index fe_index, const unsigned int local_index)
Definition: dof_objects.h:175
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
std::vector< types::global_dof_index > dofs
Definition: dof_objects.h:77
bool fe_index_is_active(const DoFHandler< dh_dim, spacedim > &dof_handler, const types::global_dof_index index, const types::fe_index fe_index) const
Definition: dof_objects.h:159
void serialize(Archive &ar, const unsigned int version)
Definition: dof_objects.h:201
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_CXX20_REQUIRES(condition)
Definition: config.h:166
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
#define Assert(cond, exc)
Definition: exceptions.h:1631
#define AssertIndexRange(index, range)
Definition: exceptions.h:1888
static ::ExceptionBase & ExcMessage(std::string arg1)
unsigned int global_dof_index
Definition: types.h:82
unsigned short int fe_index
Definition: types.h:60