Reference documentation for deal.II version 9.2.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 - 2019 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 
69  template <int dim>
70  class DoFObjects
71  {
72  public:
76  std::vector<types::global_dof_index> dofs;
77 
78  public:
92  template <int dh_dim, int spacedim>
93  void
94  set_dof_index(const ::DoFHandler<dh_dim, spacedim> &dof_handler,
95  const unsigned int obj_index,
96  const unsigned int fe_index,
97  const unsigned int local_index,
99 
112  template <int dh_dim, int spacedim>
114  get_dof_index(const ::DoFHandler<dh_dim, spacedim> &dof_handler,
115  const unsigned int obj_index,
116  const unsigned int fe_index,
117  const unsigned int local_index) const;
118 
124  template <int dh_dim, int spacedim>
125  unsigned int
127  const ::DoFHandler<dh_dim, spacedim> &dof_handler,
128  const types::global_dof_index index) const;
129 
134  template <int dh_dim, int spacedim>
135  bool
137  const ::DoFHandler<dh_dim, spacedim> &dof_handler,
138  const types::global_dof_index index,
139  const unsigned int fe_index) const;
140 
145  std::size_t
146  memory_consumption() const;
147 
152  template <class Archive>
153  void
154  serialize(Archive &ar, const unsigned int version);
155 
156  // Declare the classes that store levels and faces of DoFs friends so
157  // that they can resize arrays.
158  template <int>
159  friend class DoFLevel;
160  template <int>
161  friend class DoFFaces;
162  };
163 
164 
165  // --------------------- template and inline functions ------------------
166 
167  template <int dim>
168  template <int dh_dim, int spacedim>
169  inline unsigned int
171  const ::DoFHandler<dh_dim, spacedim> &,
172  const types::global_dof_index) const
173  {
174  return 1;
175  }
176 
177 
178 
179  template <int dim>
180  template <int dh_dim, int spacedim>
181  inline bool
183  const ::DoFHandler<dh_dim, spacedim> &,
185  const unsigned int fe_index) const
186  {
187  (void)fe_index;
188  Assert(fe_index == 0,
189  ExcMessage("Only zero fe_index values are allowed for "
190  "non-hp DoFHandlers."));
191  return true;
192  }
193 
194 
195 
196  template <int dim>
197  template <int dh_dim, int spacedim>
200  const ::DoFHandler<dh_dim, spacedim> &dof_handler,
201  const unsigned int obj_index,
202  const unsigned int fe_index,
203  const unsigned int local_index) const
204  {
205  (void)fe_index;
206  Assert(
208  ExcMessage(
209  "Only the default FE index is allowed for non-hp DoFHandler objects"));
210  Assert(
211  local_index < dof_handler.get_fe().template n_dofs_per_object<dim>(),
212  ExcIndexRange(local_index,
213  0,
214  dof_handler.get_fe().template n_dofs_per_object<dim>()));
215  Assert(obj_index *
216  dof_handler.get_fe().template n_dofs_per_object<dim>() +
217  local_index <
218  dofs.size(),
219  ExcInternalError());
220 
221  return dofs[obj_index *
222  dof_handler.get_fe().template n_dofs_per_object<dim>() +
223  local_index];
224  }
225 
226 
227  template <int dim>
228  template <class Archive>
229  void
230  DoFObjects<dim>::serialize(Archive &ar, const unsigned int)
231  {
232  ar &dofs;
233  }
234 
235  } // namespace DoFHandlerImplementation
236 } // namespace internal
237 
239 
240 #endif
internal::DoFHandlerImplementation::DoFObjects::n_active_fe_indices
unsigned int n_active_fe_indices(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const types::global_dof_index index) const
Definition: dof_objects.h:170
internal::DoFHandlerImplementation::DoFLevel
Definition: dof_levels.h:71
internal::DoFHandlerImplementation::DoFObjects::memory_consumption
std::size_t memory_consumption() const
Definition: dof_objects.cc:32
DoFHandler
Definition: dof_handler.h:205
internal::DoFHandlerImplementation::DoFObjects::fe_index_is_active
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:182
StandardExceptions::ExcIndexRange
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
StandardExceptions::ExcMessage
static ::ExceptionBase & ExcMessage(std::string arg1)
internal::DoFHandlerImplementation::DoFObjects::set_dof_index
void set_dof_index(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index)
Definition: dof_objects.cc:42
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
internal::DoFHandlerImplementation::DoFObjects::get_dof_index
types::global_dof_index get_dof_index(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const
Definition: dof_objects.h:199
exceptions.h
unsigned int
StandardExceptions::ExcInternalError
static ::ExceptionBase & ExcInternalError()
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
internal::DoFHandlerImplementation::DoFObjects
Definition: dof_objects.h:70
config.h
internal
Definition: aligned_vector.h:369
internal::DoFHandlerImplementation::DoFFaces
Definition: dof_faces.h:70
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
internal::DoFHandlerImplementation::DoFObjects::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: dof_objects.h:230
TrilinosWrappers::global_index
TrilinosWrappers::types::int_type global_index(const Epetra_BlockMap &map, const ::types::global_dof_index i)
Definition: trilinos_index_access.h:82
internal::DoFHandlerImplementation::DoFObjects::dofs
std::vector< types::global_dof_index > dofs
Definition: dof_objects.h:76