* vertex for the level this
* object lives on.
*/
- unsigned int mg_vertex_dof_index (const unsigned int vertex,
+ unsigned int mg_vertex_dof_index (const int level,
+ const unsigned int vertex,
const unsigned int i) const;
/**
* on the @p vertexth vertex to @p index
* for the level this object lives on.
*/
- void set_mg_vertex_dof_index (const unsigned int vertex,
+ void set_mg_vertex_dof_index (const int level,
+ const unsigned int vertex,
const unsigned int i,
const unsigned int index) const;
* on the level this line lives
* on.
*/
- unsigned int mg_dof_index (const unsigned int i) const;
+ unsigned int mg_dof_index (const int level,
+ const unsigned int i) const;
/**
* Set the index of the @p ith degree
* of freedom of this line on the
* level this line lives on to @p index.
*/
- void set_mg_dof_index (const unsigned int i,
+ void set_mg_dof_index (const int level,
+ const unsigned int i,
const unsigned int index) const;
/**
* indices refer to the local numbering
* for the level this line lives on.
*/
- void get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const;
+ void get_mg_dof_indices (const int level,
+ std::vector<unsigned int> &dof_indices) const;
/**
* Return the value of the given vector
* freedom on this level.
*/
template <typename number>
- void get_mg_dof_values (const Vector<number> &values,
+ void get_mg_dof_values (const int level,
+ const Vector<number> &values,
Vector<number> &dof_values) const;
};
* indices refer to the local numbering
* for the level this quad lives on.
*/
- void get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const;
+ void get_mg_dof_indices (const int level,
+ std::vector<unsigned int> &dof_indices) const;
/**
* Return the value of the given vector
* freedom on this level.
*/
template <typename number>
- void get_mg_dof_values (const Vector<number> &values,
+ void get_mg_dof_values (const int level,
+ const Vector<number> &values,
Vector<number> &dof_values) const;
/**
* indices refer to the local numbering
* for the level this hex lives on.
*/
- void get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const;
+ void get_mg_dof_indices (const int level,
+ std::vector<unsigned int> &dof_indices) const;
/**
* Return the value of the given vector
* freedom on this level.
*/
template <typename number>
- void get_mg_dof_values (const Vector<number> &values,
+ void get_mg_dof_values (const int level,
+ const Vector<number> &values,
Vector<number> &dof_values) const;
/**
const int index,
const AccessorData *local_data);
+ /**
+ * Return the indices of the dofs of this
+ * hex in the standard ordering: dofs
+ * on vertex 0, dofs on vertex 1, etc,
+ * dofs on line 0, dofs on line 1, etc,
+ * dofs on quad 0, etc.
+ *
+ * It is assumed that the vector already
+ * has the right size beforehand. The
+ * indices refer to the local numbering
+ * for the level this hex lives on.
+ */
+ void get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const;
+
+ /**
+ * Return the value of the given vector
+ * restricted to the dofs of this
+ * cell in the standard ordering: dofs
+ * on vertex 0, dofs on vertex 1, etc,
+ * dofs on line 0, dofs on line 1, etc,
+ * dofs on quad 0, etc.
+ *
+ * It is assumed that the vector already
+ * has the right size beforehand. The
+ * indices refer to the multilevel
+ * numbering local to the present
+ * level of this cell. The vector shall
+ * therefore have the same number of
+ * entries as there are degrees of
+ * freedom on this level.
+ */
+ template <typename number>
+ void get_mg_dof_values (const Vector<number> &values,
+ Vector<number> &dof_values) const;
+
/**
* Return the @p ith neighbor as a MGDoF cell
* iterator. This function is needed since
template <int structdim,int dim>
unsigned int
-MGDoFAccessor<structdim, dim>::mg_vertex_dof_index (const unsigned int vertex,
+MGDoFAccessor<structdim, dim>::mg_vertex_dof_index (const int level,
+ const unsigned int vertex,
const unsigned int i) const
{
Assert (this->dof_handler != 0,
ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
return (this->mg_dof_handler->mg_vertex_dofs[this->vertex_index(vertex)]
- .get_index (this->present_level, i, this->dof_handler->get_fe().dofs_per_vertex));
+ .get_index (level, i, this->dof_handler->get_fe().dofs_per_vertex));
}
template <int structdim, int dim>
void
-MGDoFAccessor<structdim, dim>::set_mg_vertex_dof_index (const unsigned int vertex,
+MGDoFAccessor<structdim, dim>::set_mg_vertex_dof_index (const int level,
+ const unsigned int vertex,
const unsigned int i,
const unsigned int index) const
{
ExcIndexRange (i, 0, this->dof_handler->get_fe().dofs_per_vertex));
this->mg_dof_handler->mg_vertex_dofs[this->vertex_index(vertex)]
- .set_index (this->present_level, i, this->dof_handler->get_fe().dofs_per_vertex, index);
+ .set_index (level, i, this->dof_handler->get_fe().dofs_per_vertex, index);
}
template <int structdim, int dim>
unsigned int
-MGDoFAccessor<structdim, dim>::mg_dof_index (const unsigned int i) const
+MGDoFAccessor<structdim, dim>::mg_dof_index (const int level,
+ const unsigned int i) const
{
return this->mg_dof_handler
- ->template get_dof_index<structdim>(this->present_level,
+ ->template get_dof_index<structdim>(level,
this->present_index,
0,
i);
template <int structdim, int dim>
-void MGDoFAccessor<structdim, dim>::set_mg_dof_index (const unsigned int i,
- const unsigned int index) const
+void MGDoFAccessor<structdim, dim>::set_mg_dof_index (const int level,
+ const unsigned int i,
+ const unsigned int index) const
{
this->mg_dof_handler
- ->template set_dof_index<structdim>(this->present_level,
+ ->template set_dof_index<structdim>(level,
this->present_index,
0,
i,
template <int dim>
void
-MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
+MGDoFObjectAccessor<1, dim>::get_mg_dof_indices (const int level,
+ std::vector<unsigned int> &dof_indices) const
{
Assert (this->dof_handler != 0,
typename BaseClass::ExcInvalidObject());
std::vector<unsigned int>::iterator next = dof_indices.begin();
for (unsigned int vertex=0; vertex<2; ++vertex)
for (unsigned int d=0; d<dofs_per_vertex; ++d)
- *next++ = this->mg_vertex_dof_index(vertex,d);
+ *next++ = this->mg_vertex_dof_index(level,vertex,d);
for (unsigned int d=0; d<dofs_per_line; ++d)
- *next++ = this->mg_dof_index(d);
+ *next++ = this->mg_dof_index(level,d);
Assert (next == dof_indices.end(),
ExcInternalError());
template <int dim>
template <typename number>
void
-MGDoFObjectAccessor<1,dim>::get_mg_dof_values (const Vector<number> &values,
+MGDoFObjectAccessor<1,dim>::get_mg_dof_values (const int level,
+ const Vector<number> &values,
Vector<number> &dof_values) const
{
Assert (this->dof_handler != 0,
typename Vector<number>::iterator next_dof_value=dof_values.begin();
for (unsigned int vertex=0; vertex<2; ++vertex)
for (unsigned int d=0; d<dofs_per_vertex; ++d)
- *next_dof_value++ = values(this->mg_vertex_dof_index(vertex,d));
+ *next_dof_value++ = values(this->mg_vertex_dof_index(level,vertex,d));
for (unsigned int d=0; d<dofs_per_line; ++d)
- *next_dof_value++ = values(this->mg_dof_index(d));
+ *next_dof_value++ = values(this->mg_dof_index(level,d));
Assert (next_dof_value == dof_values.end(),
ExcInternalError());
template <int dim>
void
-MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
+MGDoFObjectAccessor<2, dim>::get_mg_dof_indices (const int level,
+ std::vector<unsigned int> &dof_indices) const
{
Assert (this->dof_handler != 0,
typename BaseClass::ExcInvalidObject());
std::vector<unsigned int>::iterator next = dof_indices.begin();
for (unsigned int vertex=0; vertex<4; ++vertex)
for (unsigned int d=0; d<dofs_per_vertex; ++d)
- *next++ = this->mg_vertex_dof_index(vertex,d);
+ *next++ = this->mg_vertex_dof_index(level,vertex,d);
for (unsigned int line=0; line<4; ++line)
for (unsigned int d=0; d<dofs_per_line; ++d)
- *next++ = this->line(line)->mg_dof_index(d);
+ *next++ = this->line(line)->mg_dof_index(level,d);
for (unsigned int d=0; d<dofs_per_quad; ++d)
- *next++ = this->mg_dof_index(d);
+ *next++ = this->mg_dof_index(level,d);
Assert (next == dof_indices.end(),
ExcInternalError());
template <int dim>
template <typename number>
void
-MGDoFObjectAccessor<2,dim>::get_mg_dof_values (const Vector<number> &values,
+MGDoFObjectAccessor<2,dim>::get_mg_dof_values (const int level,
+ const Vector<number> &values,
Vector<number> &dof_values) const
{
Assert (this->dof_handler != 0,
typename BaseClass::ExcInvalidObject());
Assert (dof_values.size() == this->dof_handler->get_fe().dofs_per_cell,
typename BaseClass::ExcVectorDoesNotMatch());
- Assert (values.size() == this->mg_dof_handler->n_dofs(this->present_level),
+ Assert (values.size() == this->mg_dof_handler->n_dofs(level),
typename BaseClass::ExcVectorDoesNotMatch());
const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
typename Vector<number>::iterator next_dof_value=dof_values.begin();
for (unsigned int vertex=0; vertex<4; ++vertex)
for (unsigned int d=0; d<dofs_per_vertex; ++d)
- *next_dof_value++ = values(this->mg_vertex_dof_index(vertex,d));
+ *next_dof_value++ = values(this->mg_vertex_dof_index(level,vertex,d));
for (unsigned int line=0; line<4; ++line)
for (unsigned int d=0; d<dofs_per_line; ++d)
- *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
+ *next_dof_value++ = values(this->line(line)->mg_dof_index(level,d));
for (unsigned int d=0; d<dofs_per_quad; ++d)
- *next_dof_value++ = values(this->mg_dof_index(d));
+ *next_dof_value++ = values(this->mg_dof_index(level,d));
Assert (next_dof_value == dof_values.end(),
ExcInternalError());
template <int dim>
void
-MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
+MGDoFObjectAccessor<3, dim>::get_mg_dof_indices (const int level,
+ std::vector<unsigned int> &dof_indices) const
{
Assert (this->dof_handler != 0,
typename BaseClass::ExcInvalidObject());
std::vector<unsigned int>::iterator next = dof_indices.begin();
for (unsigned int vertex=0; vertex<8; ++vertex)
for (unsigned int d=0; d<dofs_per_vertex; ++d)
- *next++ = this->mg_vertex_dof_index(vertex,d);
+ *next++ = this->mg_vertex_dof_index(level,vertex,d);
for (unsigned int line=0; line<12; ++line)
for (unsigned int d=0; d<dofs_per_line; ++d)
- *next++ = this->line(line)->mg_dof_index(d);
+ *next++ = this->line(line)->mg_dof_index(level,d);
for (unsigned int quad=0; quad<6; ++quad)
for (unsigned int d=0; d<dofs_per_quad; ++d)
- *next++ = this->quad(quad)->mg_dof_index(d);
+ *next++ = this->quad(quad)->mg_dof_index(level,d);
for (unsigned int d=0; d<dofs_per_hex; ++d)
- *next++ = this->mg_dof_index(d);
+ *next++ = this->mg_dof_index(level,d);
Assert (next == dof_indices.end(),
ExcInternalError());
template <int dim>
template <typename number>
void
-MGDoFObjectAccessor<3,dim>::get_mg_dof_values (const Vector<number> &values,
+MGDoFObjectAccessor<3,dim>::get_mg_dof_values (const int level,
+ const Vector<number> &values,
Vector<number> &dof_values) const
{
Assert (this->dof_handler != 0,
typename BaseClass::ExcInvalidObject());
Assert (dof_values.size() == this->dof_handler->get_fe().dofs_per_cell,
typename BaseClass::ExcVectorDoesNotMatch());
- Assert (values.size() == this->mg_dof_handler->n_dofs(this->present_level),
+ Assert (values.size() == this->mg_dof_handler->n_dofs(level),
typename BaseClass::ExcVectorDoesNotMatch());
const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex,
typename Vector<number>::iterator next_dof_value=dof_values.begin();
for (unsigned int vertex=0; vertex<8; ++vertex)
for (unsigned int d=0; d<dofs_per_vertex; ++d)
- *next_dof_value++ = values(this->mg_vertex_dof_index(vertex,d));
+ *next_dof_value++ = values(this->mg_vertex_dof_index(level,vertex,d));
for (unsigned int line=0; line<12; ++line)
for (unsigned int d=0; d<dofs_per_line; ++d)
- *next_dof_value++ = values(this->line(line)->mg_dof_index(d));
+ *next_dof_value++ = values(this->line(line)->mg_dof_index(level,d));
for (unsigned int quad=0; quad<6; ++quad)
for (unsigned int d=0; d<dofs_per_quad; ++d)
- *next_dof_value++ = values(this->quad(quad)->mg_dof_index(d));
+ *next_dof_value++ = values(this->quad(quad)->mg_dof_index(level,d));
for (unsigned int d=0; d<dofs_per_hex; ++d)
*next_dof_value++ = values(this->dof_index(d));
{}
+template <int dim>
+void
+MGDoFCellAccessor<dim>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const
+{
+ MGDoFObjectAccessor<dim, dim>::get_mg_dof_indices (this->level(), dof_indices);
+}
+
+
+template <int dim>
+template <typename number>
+void
+MGDoFCellAccessor<dim>::get_mg_dof_values (const Vector<number> &values,
+ Vector<number> &dof_values) const
+{
+ MGDoFObjectAccessor<dim, dim>::get_mg_dof_values (this->level(), values, dof_values);
+}
+
+
+
template <int dim>
TriaIterator<dim,MGDoFCellAccessor<dim> >
MGDoFCellAccessor<dim>::neighbor (const unsigned int i) const
template
void
MGDoFObjectAccessor<1,deal_II_dimension>::
-get_mg_dof_values (const Vector<double> &values,
+get_mg_dof_values (const int level,
+ const Vector<double> &values,
Vector<double> &dof_values) const;
template
void
MGDoFObjectAccessor<1,deal_II_dimension>::
-get_mg_dof_values (const Vector<float> &values,
+get_mg_dof_values (const int level,
+ const Vector<float> &values,
Vector<float> &dof_values) const;
template
void
MGDoFObjectAccessor<2,deal_II_dimension>::
-get_mg_dof_values (const Vector<double> &values,
+get_mg_dof_values (const int level,
+ const Vector<double> &values,
Vector<double> &dof_values) const;
template
void
MGDoFObjectAccessor<2,deal_II_dimension>::
-get_mg_dof_values (const Vector<float> &values,
+get_mg_dof_values (const int level,
+ const Vector<float> &values,
Vector<float> &dof_values) const;
#endif
template
void
MGDoFObjectAccessor<3,deal_II_dimension>::
-get_mg_dof_values (const Vector<double> &values,
+get_mg_dof_values (const int level,
+ const Vector<double> &values,
Vector<double> &dof_values) const;
template
void
MGDoFObjectAccessor<3,deal_II_dimension>::
-get_mg_dof_values (const Vector<float> &values,
+get_mg_dof_values (const int level,
+ const Vector<float> &values,
Vector<float> &dof_values) const;
#endif
+template
+void
+MGDoFCellAccessor<deal_II_dimension>::
+get_mg_dof_values (const Vector<double> &values,
+ Vector<double> &dof_values) const;
+
+template
+void
+MGDoFCellAccessor<deal_II_dimension>::
+get_mg_dof_values (const Vector<float> &values,
+ Vector<float> &dof_values) const;
+
#if deal_II_dimension == 1
{
if (v==0)
for (unsigned int d=0; d<this->selected_fe->dofs_per_vertex; ++d)
- cell->set_mg_vertex_dof_index (0, d,
- neighbor->mg_vertex_dof_index (1, d));
+ cell->set_mg_vertex_dof_index (cell->level(), 0, d,
+ neighbor->mg_vertex_dof_index (cell->level(), 1, d));
else
for (unsigned int d=0; d<this->selected_fe->dofs_per_vertex; ++d)
- cell->set_mg_vertex_dof_index (1, d,
- neighbor->mg_vertex_dof_index (0, d));
+ cell->set_mg_vertex_dof_index (cell->level(), 1, d,
+ neighbor->mg_vertex_dof_index (cell->level(), 0, d));
// next neighbor
continue;
// otherwise: create dofs newly
for (unsigned int d=0; d<this->selected_fe->dofs_per_vertex; ++d)
- cell->set_mg_vertex_dof_index (v, d, next_free_dof++);
+ cell->set_mg_vertex_dof_index (cell->level(), v, d, next_free_dof++);
};
// dofs of line
if (this->selected_fe->dofs_per_line > 0)
for (unsigned int d=0; d<this->selected_fe->dofs_per_line; ++d)
- cell->set_mg_dof_index (d, next_free_dof++);
+ cell->set_mg_dof_index (cell->level(), d, next_free_dof++);
// note that this cell has been processed
cell->set_user_flag ();
// check whether dofs for this
// vertex have been distributed
// (only check the first dof)
- if (cell->mg_vertex_dof_index(vertex, 0) == DoFHandler<2>::invalid_dof_index)
+ if (cell->mg_vertex_dof_index(cell->level(), vertex, 0) == DoFHandler<2>::invalid_dof_index)
for (unsigned int d=0; d<this->selected_fe->dofs_per_vertex; ++d)
- cell->set_mg_vertex_dof_index (vertex, d, next_free_dof++);
+ cell->set_mg_vertex_dof_index (cell->level(), vertex, d, next_free_dof++);
// for the four sides
if (this->selected_fe->dofs_per_line > 0)
// distribute dofs if necessary:
// check whether line dof is already
// numbered (check only first dof)
- if (line->mg_dof_index(0) == DoFHandler<2>::invalid_dof_index)
+ if (line->mg_dof_index(cell->level(), 0) == DoFHandler<2>::invalid_dof_index)
// if not: distribute dofs
for (unsigned int d=0; d<this->selected_fe->dofs_per_line; ++d)
- line->set_mg_dof_index (d, next_free_dof++);
+ line->set_mg_dof_index (cell->level(), d, next_free_dof++);
};
// dofs of quad
if (this->selected_fe->dofs_per_quad > 0)
for (unsigned int d=0; d<this->selected_fe->dofs_per_quad; ++d)
- cell->set_mg_dof_index (d, next_free_dof++);
+ cell->set_mg_dof_index (cell->level(), d, next_free_dof++);
// note that this cell has been processed
// check whether dofs for this
// vertex have been distributed
// (only check the first dof)
- if (cell->mg_vertex_dof_index(vertex, 0) == DoFHandler<3>::invalid_dof_index)
+ if (cell->mg_vertex_dof_index(cell->level(), vertex, 0) == DoFHandler<3>::invalid_dof_index)
for (unsigned int d=0; d<this->selected_fe->dofs_per_vertex; ++d)
- cell->set_mg_vertex_dof_index (vertex, d, next_free_dof++);
+ cell->set_mg_vertex_dof_index (cell->level(), vertex, d, next_free_dof++);
// for the lines
if (this->selected_fe->dofs_per_line > 0)
// distribute dofs if necessary:
// check whether line dof is already
// numbered (check only first dof)
- if (line->mg_dof_index(0) == DoFHandler<3>::invalid_dof_index)
+ if (line->mg_dof_index(cell->level(), 0) == DoFHandler<3>::invalid_dof_index)
// if not: distribute dofs
for (unsigned int d=0; d<this->selected_fe->dofs_per_line; ++d)
- line->set_mg_dof_index (d, next_free_dof++);
+ line->set_mg_dof_index (cell->level(), d, next_free_dof++);
};
// for the quads
// distribute dofs if necessary:
// check whether line dof is already
// numbered (check only first dof)
- if (quad->mg_dof_index(0) == DoFHandler<3>::invalid_dof_index)
+ if (quad->mg_dof_index(cell->level(), 0) == DoFHandler<3>::invalid_dof_index)
// if not: distribute dofs
for (unsigned int d=0; d<this->selected_fe->dofs_per_quad; ++d)
- quad->set_mg_dof_index (d, next_free_dof++);
+ quad->set_mg_dof_index (cell->level(), d, next_free_dof++);
};
// dofs of cell
if (this->selected_fe->dofs_per_hex > 0)
for (unsigned int d=0; d<this->selected_fe->dofs_per_hex; ++d)
- cell->set_mg_dof_index (d, next_free_dof++);
+ cell->set_mg_dof_index (cell->level(), d, next_free_dof++);
// note that this cell has been processed
if (line->user_flag_set())
{
for (unsigned int d=0; d<this->selected_fe->dofs_per_line; ++d)
- line->set_mg_dof_index (d, new_numbers[line->mg_dof_index(d)]);
+ line->set_mg_dof_index (level, d, new_numbers[line->mg_dof_index(level, d)]);
line->clear_user_flag();
}
// finally, restore user flags
if (line->user_flag_set())
{
for (unsigned int d=0; d<this->selected_fe->dofs_per_line; ++d)
- line->set_mg_dof_index (d, new_numbers[line->mg_dof_index(d)]);
+ line->set_mg_dof_index (level, d, new_numbers[line->mg_dof_index(level, d)]);
line->clear_user_flag();
}
// finally, restore user flags
if (quad->user_flag_set())
{
for (unsigned int d=0; d<this->selected_fe->dofs_per_quad; ++d)
- quad->set_mg_dof_index (d, new_numbers[quad->mg_dof_index(d)]);
+ quad->set_mg_dof_index (level, d, new_numbers[quad->mg_dof_index(level, d)]);
quad->clear_user_flag();
}
// finally, restore user flags