00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __deal2__dof_objects_h
00013 #define __deal2__dof_objects_h
00014
00015
00016 #include <deal.II/base/config.h>
00017 #include <deal.II/base/exceptions.h>
00018 #include <vector>
00019
00020 DEAL_II_NAMESPACE_OPEN
00021
00022 template <int, int> class DoFHandler;
00023
00024 namespace internal
00025 {
00026 namespace DoFHandler
00027 {
00028 template <int> class DoFLevel;
00029 template <int> class DoFFaces;
00030
00031
00058 template <int dim>
00059 class DoFObjects
00060 {
00061 public:
00066 std::vector<unsigned int> dofs;
00067
00068 public:
00096 template <int dh_dim, int spacedim>
00097 void
00098 set_dof_index (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
00099 const unsigned int obj_index,
00100 const unsigned int fe_index,
00101 const unsigned int local_index,
00102 const unsigned int global_index);
00103
00129 template <int dh_dim, int spacedim>
00130 unsigned int
00131 get_dof_index (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
00132 const unsigned int obj_index,
00133 const unsigned int fe_index,
00134 const unsigned int local_index) const;
00135
00144 template <int dh_dim, int spacedim>
00145 unsigned int
00146 n_active_fe_indices (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
00147 const unsigned int index) const;
00148
00155 template <int dh_dim, int spacedim>
00156 bool
00157 fe_index_is_active (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
00158 const unsigned int index,
00159 const unsigned int fe_index) const;
00160
00166 std::size_t memory_consumption () const;
00167
00172 template <class Archive>
00173 void serialize(Archive & ar,
00174 const unsigned int version);
00175
00183 template <int> friend class DoFLevel;
00184 template <int> friend class DoFFaces;
00185 };
00186
00187
00188
00189
00190 template <int dim>
00191 template <int dh_dim, int spacedim>
00192 inline
00193 unsigned int
00194 DoFObjects<dim>::n_active_fe_indices (const ::DoFHandler<dh_dim,spacedim> &,
00195 const unsigned) const
00196 {
00197 return 1;
00198 }
00199
00200
00201
00202 template <int dim>
00203 template <int dh_dim, int spacedim>
00204 inline
00205 bool
00206 DoFObjects<dim>::fe_index_is_active (const ::DoFHandler<dh_dim,spacedim> &,
00207 const unsigned int,
00208 const unsigned int fe_index) const
00209 {
00210 Assert (fe_index == 0,
00211 ExcMessage ("Only zero fe_index values are allowed for "
00212 "non-hp DoFHandlers."));
00213 return true;
00214 }
00215
00216
00217
00218 template <int dim>
00219 template <int dh_dim, int spacedim>
00220 inline
00221 unsigned int
00222 DoFObjects<dim>::
00223 get_dof_index (const ::DoFHandler<dh_dim,spacedim> &dof_handler,
00224 const unsigned int obj_index,
00225 const unsigned int fe_index,
00226 const unsigned int local_index) const
00227 {
00228 Assert ((fe_index == ::DoFHandler<dh_dim,spacedim>::default_fe_index),
00229 ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects"));
00230 Assert (local_index<dof_handler.get_fe().template n_dofs_per_object<dim>(),
00231 ExcIndexRange (local_index, 0, dof_handler.get_fe().template n_dofs_per_object<dim>()));
00232 Assert (obj_index * dof_handler.get_fe().template n_dofs_per_object<dim>()+local_index
00233 <
00234 dofs.size(),
00235 ExcInternalError());
00236
00237 return dofs[obj_index * dof_handler.get_fe()
00238 .template n_dofs_per_object<dim>() + local_index];
00239 }
00240
00241
00242 template <int dim>
00243 template <class Archive>
00244 void DoFObjects<dim>::serialize(Archive & ar,
00245 const unsigned int)
00246 {
00247 ar & dofs;
00248 }
00249
00250 }
00251 }
00252
00253 DEAL_II_NAMESPACE_CLOSE
00254
00255 #endif
00256