Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dof_objects.h
1 // ---------------------------------------------------------------------
2 // @f$Id: dof_objects.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2006 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__dof_objects_h
18 #define __deal2__dof_objects_h
19 
20 
21 #include <deal.II/base/config.h>
23 #include <vector>
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 template <int, int> class DoFHandler;
28 
29 namespace internal
30 {
31  namespace DoFHandler
32  {
33  template <int> class DoFLevel;
34  template <int> class DoFFaces;
35 
36 
63  template <int dim>
64  class DoFObjects
65  {
66  public:
71  std::vector<types::global_dof_index> dofs;
72 
73  public:
101  template <int dh_dim, int spacedim>
102  void
103  set_dof_index (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
104  const unsigned int obj_index,
105  const unsigned int fe_index,
106  const unsigned int local_index,
107  const types::global_dof_index global_index);
108 
134  template <int dh_dim, int spacedim>
136  get_dof_index (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
137  const unsigned int obj_index,
138  const unsigned int fe_index,
139  const unsigned int local_index) const;
140 
149  template <int dh_dim, int spacedim>
150  unsigned int
151  n_active_fe_indices (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
152  const types::global_dof_index index) const;
153 
160  template <int dh_dim, int spacedim>
161  bool
162  fe_index_is_active (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
163  const types::global_dof_index index,
164  const unsigned int fe_index) const;
165 
171  std::size_t memory_consumption () const;
172 
177  template <class Archive>
178  void serialize(Archive &ar,
179  const unsigned int version);
180 
188  template <int> friend class DoFLevel;
189  template <int> friend class DoFFaces;
190  };
191 
192 
193 // --------------------- template and inline functions ------------------
194 
195  template <int dim>
196  template <int dh_dim, int spacedim>
197  inline
198  unsigned int
199  DoFObjects<dim>::n_active_fe_indices (const ::DoFHandler<dh_dim,spacedim> &,
200  const types::global_dof_index) const
201  {
202  return 1;
203  }
204 
205 
206 
207  template <int dim>
208  template <int dh_dim, int spacedim>
209  inline
210  bool
211  DoFObjects<dim>::fe_index_is_active (const ::DoFHandler<dh_dim,spacedim> &,
213  const unsigned int fe_index) const
214  {
215  Assert (fe_index == 0,
216  ExcMessage ("Only zero fe_index values are allowed for "
217  "non-hp DoFHandlers."));
218  return true;
219  }
220 
221 
222 
223  template <int dim>
224  template <int dh_dim, int spacedim>
225  inline
228  get_dof_index (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
229  const unsigned int obj_index,
230  const unsigned int fe_index,
231  const unsigned int local_index) const
232  {
234  ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects"));
235  Assert (local_index<dof_handler.get_fe().template n_dofs_per_object<dim>(),
236  ExcIndexRange (local_index, 0, dof_handler.get_fe().template n_dofs_per_object<dim>()));
237  Assert (obj_index * dof_handler.get_fe().template n_dofs_per_object<dim>()+local_index
238  <
239  dofs.size(),
240  ExcInternalError());
241 
242  return dofs[obj_index * dof_handler.get_fe()
243  .template n_dofs_per_object<dim>() + local_index];
244  }
245 
246 
247  template <int dim>
248  template <class Archive>
249  void DoFObjects<dim>::serialize(Archive &ar,
250  const unsigned int)
251  {
252  ar &dofs;
253  }
254 
255  }
256 }
257 
258 DEAL_II_NAMESPACE_CLOSE
259 
260 #endif
std::vector< types::global_dof_index > dofs
Definition: dof_objects.h:71
::ExceptionBase & ExcMessage(std::string arg1)
void serialize(Archive &ar, const unsigned int version)
Definition: dof_objects.h:249
unsigned int global_dof_index
Definition: types.h:100
unsigned int n_active_fe_indices(const ::DoFHandler< dh_dim, spacedim > &dof_handler, const types::global_dof_index index) const
Definition: dof_objects.h:199
#define Assert(cond, exc)
Definition: exceptions.h:299
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)
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:228
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
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:211
::ExceptionBase & ExcInternalError()
std::size_t memory_consumption() const