#include <vector>
+
+namespace
+{
+ template <int dim>
+ inline
+ void
+ set_hp_vertex_dof_index (const hp::FECollection<dim> &fe,
+ const unsigned int fe_index,
+ const unsigned int *start_of_list,
+ const unsigned int local_index,
+ const unsigned int global_index)
+ {
+ Assert (fe_index != hp::DoFHandler<1>::default_fe_index,
+ ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
+ abort ();
+ }
+
+
+ template <int dim>
+ inline
+ unsigned int
+ get_hp_vertex_dof_index (const hp::FECollection<dim> &fe,
+ const unsigned int fe_index,
+ const unsigned int *start_of_list,
+ const unsigned int local_index)
+ {
+ Assert (fe_index != hp::DoFHandler<1>::default_fe_index,
+ ExcMessage ("You need to specify a FE index when working with hp DoFHandlers"));
+ Assert (local_index < fe[fe_index].dofs_per_vertex,
+ ExcIndexRange(local_index, 0, fe[fe_index].dofs_per_vertex));
+ // hop along the list of index
+ // sets until we find the one
+ // with the correct fe_index, and
+ // then poke into that
+ // part. trigger an exception if
+ // we can't find a set for this
+ // particular fe_index
+ const unsigned int *pointer = start_of_list;
+ while (true)
+ {
+ Assert (*pointer != deal_II_numbers::invalid_unsigned_int,
+ ExcInternalError());
+ if (*pointer == fe_index)
+ return *(pointer + 1 + local_index);
+ else
+ pointer += fe[*pointer].dofs_per_vertex;
+ }
+ }
+}
+
+
+
/*------------------------- Functions: DoFAccessor ---------------------------*/
Assert (this->dof_handler != 0, DoFAccessor<hp::DoFHandler<1> >::ExcInvalidObject());
Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<hp::DoFHandler<1> >::ExcInvalidObject());
Assert (vertex<2, ExcIndexRange (i,0,2));
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_vertex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_vertex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
- const unsigned int dof_number = (this->vertex_index(vertex) *
- this->dof_handler->get_fe()[0].dofs_per_vertex +
- i);
- return this->dof_handler->vertex_dofs[dof_number];
+ const unsigned int starting_offset
+ = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
+
+ return get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+ fe_index,
+ &this->dof_handler->vertex_dofs[starting_offset],
+ i);
}
Assert (this->dof_handler != 0, DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
Assert (vertex<2, ExcIndexRange (i,0,2));
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_vertex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_vertex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
- const unsigned int dof_number = (this->vertex_index(vertex) *
- this->dof_handler->get_fe()[0].dofs_per_vertex +
- i);
- return this->dof_handler->vertex_dofs[dof_number];
+ const unsigned int starting_offset
+ = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
+
+ return get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+ fe_index,
+ &this->dof_handler->vertex_dofs[starting_offset],
+ i);
}
Assert (this->dof_handler != 0, DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
Assert (&this->dof_handler->get_fe() != 0, DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
Assert (vertex<2, ExcIndexRange (i,0,2));
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_vertex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_vertex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
- const unsigned int dof_number = (this->vertex_index(vertex) *
- this->dof_handler->get_fe()[0].dofs_per_vertex +
- i);
- return this->dof_handler->vertex_dofs[dof_number];
+ const unsigned int starting_offset
+ = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
+
+ return get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+ fe_index,
+ &this->dof_handler->vertex_dofs[starting_offset],
+ i);
}
Assert (&this->dof_handler->get_fe() != 0,
DoFAccessor<hp::DoFHandler<2> >::ExcInvalidObject());
Assert (vertex<4, ExcIndexRange (i,0,4));
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_vertex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_vertex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
ExcMessage ("hp::DoFHandler not initialized"));
- const unsigned int dof_number = (this->vertex_index(vertex) *
- this->dof_handler->get_fe()[0].dofs_per_vertex +
- i);
- return this->dof_handler->vertex_dofs[dof_number];
+ const unsigned int starting_offset
+ = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
+
+ return get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+ fe_index,
+ &this->dof_handler->vertex_dofs[starting_offset],
+ i);
}
Assert (&this->dof_handler->get_fe() != 0,
DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
Assert (vertex<4, ExcIndexRange (i,0,4));
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_vertex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_vertex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
ExcMessage ("hp::DoFHandler not initialized"));
- const unsigned int dof_number = (this->vertex_index(vertex) *
- this->dof_handler->get_fe()[0].dofs_per_vertex +
- i);
- return this->dof_handler->vertex_dofs[dof_number];
+ const unsigned int starting_offset
+ = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
+
+ return get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+ fe_index,
+ &this->dof_handler->vertex_dofs[starting_offset],
+ i);
}
Assert (&this->dof_handler->get_fe() != 0,
DoFAccessor<hp::DoFHandler<3> >::ExcInvalidObject());
Assert (vertex<4, ExcIndexRange (i,0,4));
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_vertex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_vertex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_vertex));
Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
ExcMessage ("hp::DoFHandler not initialized"));
- const unsigned int dof_number = (this->vertex_index(vertex) *
- this->dof_handler->get_fe()[0].dofs_per_vertex +
- i);
- return this->dof_handler->vertex_dofs[dof_number];
+ const unsigned int starting_offset
+ = this->dof_handler->vertex_dofs_offsets[this->vertex_index(vertex)];
+
+ return get_hp_vertex_dof_index (this->dof_handler->get_fe(),
+ fe_index,
+ &this->dof_handler->vertex_dofs[starting_offset],
+ i);
}
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0, BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_line,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_line));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_line,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_line));
// for lines in 1d, we only have to
// take care of the offset, no
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0, BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_line,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_line));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_line,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_line));
const unsigned int offset = this->dof_handler->levels[this->present_level]
->dof_line_index_offset[this->present_index];
// make sure a FE has been selected
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0, BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_line,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_line));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_line,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_line));
const unsigned int offset = this->dof_handler->levels[this->present_level]
->dof_line_index_offset[this->present_index];
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_line,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_line));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_line,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_line));
// for lines in 1d, we only have to
// take care of the offset, no
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_line,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_line));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_line,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_line));
//TODO:[?] In two dimension it could happen that we have different active_fe_indices
// on a line between to cells. Hence we have to differentiate between these two cases.
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_line,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_line));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_line,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_line));
const unsigned int offset = this->dof_handler->levels[this->present_level]
->dof_line_index_offset[this->present_index];
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_quad,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_quad));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_quad,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_quad));
// for quads in 2d, we only have to
// take care of the offset, no
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_quad,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_quad));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_quad,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_quad));
const unsigned int offset = this->dof_handler->levels[this->present_level]
->dof_quad_index_offset[this->present_index];
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_quad,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_quad));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_quad,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_quad));
// for quads in 2d, we only have to
// take care of the offset, no
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_quad,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_quad));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_quad,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_quad));
const unsigned int offset = this->dof_handler->levels[this->present_level]
->dof_quad_index_offset[this->present_index];
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_hex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_hex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_hex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_hex));
// for hexes in 3d, we only have to
// take care of the offset, no
// and enough room was reserved
Assert (&this->dof_handler->get_fe() != 0,
BaseClass::ExcInvalidObject());
- Assert (i<this->dof_handler->get_fe()[0].dofs_per_hex,
- ExcIndexRange (i, 0, this->dof_handler->get_fe()[0].dofs_per_hex));
+ Assert (i<this->dof_handler->get_fe()[fe_index].dofs_per_hex,
+ ExcIndexRange (i, 0, this->dof_handler->get_fe()[fe_index].dofs_per_hex));
// for hexes in 3d, we only have to
// take care of the offset, no