Reference documentation for deal.II version 9.0.0
dof_accessor.cc
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 #include <deal.II/dofs/dof_accessor.h>
17 #include <deal.II/dofs/dof_handler.h>
18 #include <deal.II/dofs/dof_levels.h>
19 #include <deal.II/hp/dof_handler.h>
20 #include <deal.II/grid/tria_boundary.h>
21 #include <deal.II/grid/tria_iterator.h>
22 #include <deal.II/grid/tria_iterator.templates.h>
23 #include <deal.II/fe/fe.h>
24 
25 #include <vector>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
29 /*------------------------- Static variables: DoFAccessor -----------------------*/
30 
31 template <int structdim, typename DoFHandlerType, bool level_dof_access>
33 
34 template <int structdim, typename DoFHandlerType, bool level_dof_access>
36 
37 
38 
39 /*------------------------ Functions: DoFInvalidAccessor ---------------------------*/
40 
41 template <int structdim, int dim, int spacedim>
44  const int,
45  const int,
46  const AccessorData *)
47 {
48  Assert (false,
49  ExcMessage ("You are attempting an illegal conversion between "
50  "iterator/accessor types. The constructor you call "
51  "only exists to make certain template constructs "
52  "easier to write as dimension independent code but "
53  "the conversion is not valid in the current context."));
54 }
55 
56 
57 
58 template <int structdim, int dim, int spacedim>
61  :
62  InvalidAccessor<structdim,dim,spacedim> (static_cast<const InvalidAccessor<structdim,dim,spacedim>&>(i))
63 {
64  Assert (false,
65  ExcMessage ("You are attempting an illegal conversion between "
66  "iterator/accessor types. The constructor you call "
67  "only exists to make certain template constructs "
68  "easier to write as dimension independent code but "
69  "the conversion is not valid in the current context."));
70 }
71 
72 
73 
74 template <int structdim, int dim, int spacedim>
75 void
77 set_dof_index (const unsigned int,
79  const unsigned int) const
80 {
81  Assert (false, ExcInternalError());
82 }
83 
84 
85 
86 /*------------------------- Functions: DoFCellAccessor -----------------------*/
87 
88 
89 
90 
91 template <typename DoFHandlerType, bool lda>
92 void
94 {
95  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
96  ExcMessage ("DoFHandler not initialized"));
97 
98  Assert (this->dof_handler != nullptr, typename BaseClass::ExcInvalidObject());
99 
100  internal::DoFCellAccessorImplementation::Implementation::
101  update_cell_dof_indices_cache (*this);
102 }
103 
104 
105 
106 template <typename DoFHandlerType, bool lda>
107 void
108 DoFCellAccessor<DoFHandlerType,lda>::set_dof_indices (const std::vector<types::global_dof_index> &local_dof_indices)
109 {
110  Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
111  ExcMessage ("DoFHandler not initialized"));
112 
113  Assert (this->dof_handler != nullptr, typename BaseClass::ExcInvalidObject());
114 
115  internal::DoFCellAccessorImplementation::Implementation::
116  set_dof_indices (*this, local_dof_indices);
117 }
118 
119 
120 
121 
122 template <typename DoFHandlerType, bool lda>
125  const unsigned int subface) const
126 {
129  return TriaIterator<DoFCellAccessor<DoFHandlerType,lda> > (*q, this->dof_handler);
130 }
131 
132 
133 
134 template <typename DoFHandlerType, bool lda>
137  const unsigned int subface) const
138 {
141  return TriaIterator<DoFCellAccessor<DoFHandlerType,lda> > (*q, this->dof_handler);
142 }
143 
144 
145 
146 template <typename DoFHandlerType, bool lda>
147 inline
150 {
153  return TriaIterator<DoFCellAccessor<DoFHandlerType,lda> > (*q, this->dof_handler);
154 }
155 
156 
157 
158 template <typename DoFHandlerType, bool lda>
159 inline
162 {
165  return TriaIterator<DoFCellAccessor<DoFHandlerType,lda> > (*q, this->dof_handler);
166 }
167 
168 
169 
170 
171 // --------------------------------------------------------------------------
172 // explicit instantiations
173 #include "dof_accessor.inst"
174 
175 DEAL_II_NAMESPACE_CLOSE
void set_dof_index(const unsigned int i, const types::global_dof_index index, const unsigned int fe_index=DoFHandler< dim, spacedim >::default_fe_index) const
Definition: dof_accessor.cc:77
TriaIterator< CellAccessor< dim, spacedim > > neighbor_or_periodic_neighbor(const unsigned int i) const
TriaIterator< DoFCellAccessor< DoFHandlerType, level_dof_access > > periodic_neighbor(const unsigned int i) const
TriaIterator< CellAccessor< dim, spacedim > > neighbor_child_on_subface(const unsigned int face_no, const unsigned int subface_no) const
void update_cell_dof_indices_cache() const
Definition: dof_accessor.cc:93
static ::ExceptionBase & ExcMessage(std::string arg1)
unsigned int global_dof_index
Definition: types.h:88
#define Assert(cond, exc)
Definition: exceptions.h:1142
TriaIterator< DoFCellAccessor< DoFHandlerType, level_dof_access > > neighbor_child_on_subface(const unsigned int face_no, const unsigned int subface_no) const
void set_dof_indices(const std::vector< types::global_dof_index > &dof_indices)
TriaIterator< DoFCellAccessor< DoFHandlerType, level_dof_access > > neighbor_or_periodic_neighbor(const unsigned int i) const
TriaIterator< CellAccessor< dim, spacedim > > periodic_neighbor_child_on_subface(const unsigned int face_no, const unsigned int subface_no) const
InvalidAccessor< structdim, dim, spacedim >::AccessorData AccessorData
DoFInvalidAccessor(const Triangulation< dim, spacedim > *parent=0, const int level=-1, const int index=-1, const AccessorData *local_data=0)
Definition: dof_accessor.cc:43
TriaIterator< CellAccessor< dim, spacedim > > periodic_neighbor(const unsigned int i) const
TriaIterator< DoFCellAccessor< DoFHandlerType, level_dof_access > > periodic_neighbor_child_on_subface(const unsigned int face_no, const unsigned int subface_no) const
static ::ExceptionBase & ExcInternalError()