16 #ifndef dealii_hp_dof_level_h 17 #define dealii_hp_dof_level_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 27 DEAL_II_NAMESPACE_OPEN
42 namespace DoFHandlerImplementation
44 struct Implementation;
47 namespace DoFCellAccessorImplementation
49 struct Implementation;
221 set_dof_index(
const unsigned int obj_index,
222 const unsigned int fe_index,
223 const unsigned int local_index,
238 get_dof_index(
const unsigned int obj_index,
239 const unsigned int fe_index,
240 const unsigned int local_index)
const;
246 active_fe_index(
const unsigned int obj_index)
const;
253 fe_index_is_active(
const unsigned int obj_index,
254 const unsigned int fe_index)
const;
260 set_active_fe_index(
const unsigned int obj_index,
261 const unsigned int fe_index);
268 future_fe_index(
const unsigned int obj_index)
const;
274 set_future_fe_index(
const unsigned int obj_index,
275 const unsigned int fe_index);
281 future_fe_index_set(
const unsigned int obj_index)
const;
287 clear_future_fe_index(
const unsigned int obj_index);
301 get_cell_cache_start(
const unsigned int obj_index,
302 const unsigned int dofs_per_cell)
const;
309 memory_consumption()
const;
315 template <
class Archive>
317 serialize(Archive &ar,
const unsigned int version);
328 template <
int dim,
int spacedim>
331 const ::hp::FECollection<dim, spacedim> &fe_collection);
341 template <
int dim,
int spacedim>
344 const ::hp::FECollection<dim, spacedim> &fe_collection);
365 normalize_active_fe_indices();
373 friend class ::hp::DoFHandler;
374 friend struct ::internal::hp::DoFHandlerImplementation::
376 friend struct ::internal::DoFCellAccessorImplementation::
387 return (static_cast<signed_active_fe_index_type>(active_fe_index) < 0);
393 DoFLevel::get_toggled_compression_state(
405 DoFLevel::get_dof_index(
const unsigned int obj_index,
406 const unsigned int fe_index,
407 const unsigned int local_index)
const 410 Assert(obj_index < dof_offsets.size(),
415 Assert(dof_offsets[obj_index] != static_cast<offset_type>(-1),
416 ExcMessage(
"You are trying to access degree of freedom " 417 "information for an object on which no such " 418 "information is available"));
421 (is_compressed_entry(active_fe_indices[obj_index]) ==
false ?
422 active_fe_indices[obj_index] :
423 get_toggled_compression_state(active_fe_indices[obj_index])),
424 ExcMessage(
"FE index does not match that of the present cell"));
428 if (is_compressed_entry(active_fe_indices[obj_index]) ==
false)
429 return dof_indices[dof_offsets[obj_index] + local_index];
431 return dof_indices[dof_offsets[obj_index]] + local_index;
437 DoFLevel::set_dof_index(
const unsigned int obj_index,
438 const unsigned int fe_index,
439 const unsigned int local_index,
443 Assert(obj_index < dof_offsets.size(),
449 Assert(dof_offsets[obj_index] != static_cast<offset_type>(-1),
450 ExcMessage(
"You are trying to access degree of freedom " 451 "information for an object on which no such " 452 "information is available"));
454 is_compressed_entry(active_fe_indices[obj_index]) ==
false,
456 "This function can no longer be called after compressing the dof_indices array"));
457 Assert(fe_index == active_fe_indices[obj_index],
458 ExcMessage(
"FE index does not match that of the present cell"));
459 dof_indices[dof_offsets[obj_index] + local_index] = global_index;
465 DoFLevel::active_fe_index(
const unsigned int obj_index)
const 467 Assert(obj_index < active_fe_indices.size(),
470 if (is_compressed_entry(active_fe_indices[obj_index]) ==
false)
471 return active_fe_indices[obj_index];
473 return get_toggled_compression_state(active_fe_indices[obj_index]);
479 DoFLevel::fe_index_is_active(
const unsigned int obj_index,
480 const unsigned int fe_index)
const 482 return (fe_index == active_fe_index(obj_index));
488 DoFLevel::set_active_fe_index(
const unsigned int obj_index,
489 const unsigned int fe_index)
491 Assert(obj_index < active_fe_indices.size(),
499 Assert(is_compressed_entry(fe_index) ==
false,
501 "You are using an active_fe_index that is larger than an " 502 "internal limitation for these objects. Try to work with " 503 "hp::FECollection objects that have a more modest size."));
504 Assert(fe_index != invalid_active_fe_index,
506 "You are using an active_fe_index that is reserved for " 507 "internal purposes for these objects. Try to work with " 508 "hp::FECollection objects that have a more modest size."));
510 active_fe_indices[obj_index] = fe_index;
516 DoFLevel::future_fe_index(
const unsigned int obj_index)
const 518 Assert(obj_index < future_fe_indices.size(),
521 if (future_fe_index_set(obj_index))
522 return future_fe_indices[obj_index];
524 return active_fe_index(obj_index);
530 DoFLevel::set_future_fe_index(
const unsigned int obj_index,
531 const unsigned int fe_index)
533 Assert(obj_index < future_fe_indices.size(),
541 Assert(is_compressed_entry(fe_index) ==
false,
543 "You are using a future_fe_index that is larger than an " 544 "internal limitation for these objects. Try to work with " 545 "hp::FECollection objects that have a more modest size."));
546 Assert(fe_index != invalid_active_fe_index,
548 "You are using a future_fe_index that is reserved for " 549 "internal purposes for these objects. Try to work with " 550 "hp::FECollection objects that have a more modest size."));
552 future_fe_indices[obj_index] = fe_index;
558 DoFLevel::future_fe_index_set(
const unsigned int obj_index)
const 560 Assert(obj_index < future_fe_indices.size(),
563 return (future_fe_indices[obj_index] != invalid_active_fe_index);
569 DoFLevel::clear_future_fe_index(
const unsigned int obj_index)
571 Assert(obj_index < future_fe_indices.size(),
574 future_fe_indices[obj_index] = invalid_active_fe_index;
580 DoFLevel::get_cell_cache_start(
const unsigned int obj_index,
581 const unsigned int dofs_per_cell)
const 585 (obj_index < cell_cache_offsets.size()) &&
586 (cell_cache_offsets[obj_index] + dofs_per_cell <=
587 cell_dof_indices_cache.size()),
589 "You are trying to access an element of the cache that stores " 590 "the indices of all degrees of freedom that live on one cell. " 591 "However, this element does not exist. Did you forget to call " 592 "DoFHandler::distribute_dofs(), or did you forget to call it " 593 "again after changing the active_fe_index of one of the cells?"));
595 return &cell_dof_indices_cache[cell_cache_offsets[obj_index]];
600 template <
class Archive>
602 DoFLevel::serialize(Archive &ar,
const unsigned int)
604 ar & this->active_fe_indices;
605 ar & this->cell_cache_offsets;
606 ar & this->cell_dof_indices_cache;
607 ar & this->dof_indices;
608 ar & this->dof_offsets;
609 ar & this->future_fe_indices;
615 DEAL_II_NAMESPACE_CLOSE
std::vector< offset_type > cell_cache_offsets
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
unsigned short int active_fe_index_type
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
std::vector< offset_type > dof_offsets
unsigned int global_dof_index
std::vector< types::global_dof_index > dof_indices
signed short int signed_active_fe_index_type
std::vector< types::global_dof_index > cell_dof_indices_cache
static const active_fe_index_type invalid_active_fe_index
std::vector< active_fe_index_type > future_fe_indices
std::vector< active_fe_index_type > active_fe_indices