// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* This class has not yet been implemented for the use in the codimension
* one case (<tt>spacedim != dim </tt>).
*
-//TODO:[WB] Extend MGDoFHandler doc
+//TODO:[WB] Extend MGDoFHandler doc
*
* @author Wolfgang Bangerth, 1998, 1999
*/
* Destructor
*/
virtual ~MGDoFHandler ();
-
+
/**
* Go through the triangulation
* and distribute the degrees of
* name, see above.
*/
void renumber_dofs (const std::vector<unsigned int> &new_numbers);
-
+
/*--------------------------------------*/
-
+
/**
* @name Cell iterator functions
*/
* <tt>end()</tt>.
*/
cell_iterator end (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is
* the first iterator not on
* past-the-end or
* before-the-beginning states.
*
- * This is the same as
+ * This is the same as
* <tt>end_face()</tt>.
*/
raw_face_iterator end_raw_face () const;
* past-the-end or
* before-the-beginning states.
*
- * This is the same as
+ * This is the same as
* <tt>end_face()</tt>.
*/
active_face_iterator end_active_face () const;
* <tt>end()</tt>.
*/
line_iterator end_line (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is
* the first iterator not on
* @p level.
*/
active_line_iterator last_active_line (const unsigned int level) const;
- /*@}*/
+ /*@}*/
/*---------------------------------------*/
* <tt>end()</tt>.
*/
quad_iterator end_quad (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is
* the first iterator not on
* <tt>end()</tt>.
*/
hex_iterator end_hex (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is
* the first iterator not on
/*---------------------------------------*/
-
+
/**
* Return the number of degrees
* of freedom on the specified
* name, see above.
*/
unsigned int n_dofs () const;
-
+
/**
* Determine an estimate for the
* memory consumption (in bytes)
int,
<< "You tried to do something on level " << arg1
<< ", but this level is empty.");
-
+
private:
/**
class MGVertexDoFs
{
public:
-
+
/**
* Constructor. This one is
* empty because it is
* @p init is supposed to do.
*/
MGVertexDoFs & operator = (const MGVertexDoFs &vertex);
-
+
/**
* Set the index with number
* @p dof_number of this
const unsigned int dof_number,
const unsigned int dofs_per_vertex,
const unsigned int index);
-
+
/**
* Return the index with
* number @p dof_number of
* lives on.
*/
unsigned int get_finest_level () const;
-
+
/**
* Exception.
*/
int,
<< "The given level number " << arg1 << " is outside "
<< "the range of levels this vertex lives on.");
-
+
private:
/**
* Store the coarsest level
};
- /**
- * Distribute dofs on the given
- * cell, with new dofs starting
- * with index
- * @p next_free_dof. Return the
- * next unused index number. The
- * finite element used is the one
- * given to @p distribute_dofs,
- * which is copied to
- * @p selected_fe.
- *
- * This function is excluded from
- * the @p distribute_dofs
- * function since it can not be
- * implemented dimension
- * independent.
- *
- * Note that unlike for the usual
- * dofs, here all cells and not
- * only active ones are allowed.
- */
- unsigned int distribute_dofs_on_cell (cell_iterator &cell,
- unsigned int next_free_dof);
/**
* Return the @p i-th dof-index. This function calls
* the respective function of DoFObjects.
const unsigned int fe_index,
const unsigned int local_index,
const unsigned int global_index) const;
-
-
+
+
/**
* Reserve enough space for the
* MG dof indices for a given
* Free all used memory.
*/
void clear_space ();
-
+
/**
* Space to store the DoF numbers
* for the different
* zero on each level.
*/
std::vector<internal::DoFHandler::DoFLevel<dim>*> mg_levels;
-
+
/**
* Space to store the DoF numbers
* for the faces.
* and which are these levels.
*/
std::vector<MGVertexDoFs> mg_vertex_dofs;
-
+
/**
* Vectors storing the number of
* degrees of freedom on each
ExcInvalidLevel(level));
Assert (dof_number < dofs_per_vertex,
ExcIndexRange(dof_number, 0, dofs_per_vertex));
-
+
indices[(level-coarsest_level)*dofs_per_vertex + dof_number] = index;
}
ExcInvalidLevel(level));
Assert (dof_number < dofs_per_vertex,
ExcIndexRange (dof_number, 0, dofs_per_vertex));
-
+
return indices[(level-coarsest_level)*dofs_per_vertex + dof_number];
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
//make the general case happen it should undergo a similar transformation as
//the ::DoFHandler class, i.e. much of the functions here that are dimension
//dependent should be moved into a local Implementation class.
+// Some of the following already goes in the right direction
+namespace internal
+{
+ namespace MGDoFHandler
+ {
+ // access class
+ // dealii::MGDoFHandler instead
+ // of namespace
+ // internal::MGDoFHandler. same
+ // for dealii::DoFHandler
+ using dealii::MGDoFHandler;
+ using dealii::DoFHandler;
+
+/**
+ * A class with the same purpose as the similarly named class of the
+ * Triangulation class. See there for more information.
+ */
+ struct Implementation
+ {
+
+ /**
+ * Distribute dofs on the given
+ * cell, with new dofs starting
+ * with index
+ * @p next_free_dof. Return the
+ * next unused index number.
+ *
+ * This function is excluded from
+ * the @p distribute_dofs
+ * function since it can not be
+ * implemented dimension
+ * independent.
+ *
+ * Note that unlike for the usual
+ * dofs, here all cells and not
+ * only active ones are allowed.
+ */
+ template <int spacedim>
+ static
+ unsigned int
+ distribute_dofs_on_cell (typename MGDoFHandler<1,spacedim>::cell_iterator &cell,
+ unsigned int next_free_dof)
+ {
+ const unsigned int dim = 1;
+
+ // distribute dofs of vertices
+ if (cell->get_fe().dofs_per_vertex > 0)
+ for (unsigned int v=0; v<GeometryInfo<1>::vertices_per_cell; ++v)
+ {
+ typename MGDoFHandler<dim,spacedim>::cell_iterator neighbor = cell->neighbor(v);
+
+ if (neighbor.state() == IteratorState::valid)
+ {
+ // has neighbor already been processed?
+ if (neighbor->user_flag_set() &&
+ (neighbor->level() == cell->level()))
+ // copy dofs if the neighbor is on
+ // the same level (only then are
+ // mg dofs the same)
+ {
+ if (v==0)
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_vertex; ++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<cell->get_fe().dofs_per_vertex; ++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<cell->get_fe().dofs_per_vertex; ++d)
+ cell->set_mg_vertex_dof_index (cell->level(), v, d, next_free_dof++);
+ };
+
+ // dofs of line
+ if (cell->get_fe().dofs_per_line > 0)
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_line; ++d)
+ cell->set_mg_dof_index (cell->level(), d, next_free_dof++);
+
+ // note that this cell has been processed
+ cell->set_user_flag ();
+
+ return next_free_dof;
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ distribute_dofs_on_cell (typename MGDoFHandler<2,spacedim>::cell_iterator &cell,
+ unsigned int next_free_dof)
+ {
+ const unsigned int dim = 2;
+ if (cell->get_fe().dofs_per_vertex > 0)
+ // number dofs on vertices
+ for (unsigned int vertex=0; vertex<GeometryInfo<2>::vertices_per_cell; ++vertex)
+ // check whether dofs for this
+ // vertex have been distributed
+ // (only check the first dof)
+ if (cell->mg_vertex_dof_index(cell->level(), vertex, 0) == DoFHandler<2>::invalid_dof_index)
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_vertex; ++d)
+ cell->set_mg_vertex_dof_index (cell->level(), vertex, d, next_free_dof++);
+
+ // for the four sides
+ if (cell->get_fe().dofs_per_line > 0)
+ for (unsigned int side=0; side<GeometryInfo<2>::faces_per_cell; ++side)
+ {
+ typename MGDoFHandler<dim,spacedim>::line_iterator line = cell->line(side);
+
+ // distribute dofs if necessary:
+ // check whether line dof is already
+ // numbered (check only first dof)
+ if (line->mg_dof_index(cell->level(), 0) == DoFHandler<2>::invalid_dof_index)
+ // if not: distribute dofs
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_line; ++d)
+ line->set_mg_dof_index (cell->level(), d, next_free_dof++);
+ };
+
+
+ // dofs of quad
+ if (cell->get_fe().dofs_per_quad > 0)
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_quad; ++d)
+ cell->set_mg_dof_index (cell->level(), d, next_free_dof++);
+
+
+ // note that this cell has been processed
+ cell->set_user_flag ();
+
+ return next_free_dof;
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ distribute_dofs_on_cell (typename MGDoFHandler<3,spacedim>::cell_iterator &cell,
+ unsigned int next_free_dof)
+ {
+ const unsigned int dim = 3;
+ if (cell->get_fe().dofs_per_vertex > 0)
+ // number dofs on vertices
+ for (unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
+ // check whether dofs for this
+ // vertex have been distributed
+ // (only check the first dof)
+ if (cell->mg_vertex_dof_index(cell->level(), vertex, 0) == DoFHandler<3>::invalid_dof_index)
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_vertex; ++d)
+ cell->set_mg_vertex_dof_index (cell->level(), vertex, d, next_free_dof++);
+
+ // for the lines
+ if (cell->get_fe().dofs_per_line > 0)
+ for (unsigned int l=0; l<GeometryInfo<3>::lines_per_cell; ++l)
+ {
+ typename MGDoFHandler<dim,spacedim>::line_iterator line = cell->line(l);
+
+ // distribute dofs if necessary:
+ // check whether line dof is already
+ // numbered (check only first dof)
+ if (line->mg_dof_index(cell->level(), 0) == DoFHandler<3>::invalid_dof_index)
+ // if not: distribute dofs
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_line; ++d)
+ line->set_mg_dof_index (cell->level(), d, next_free_dof++);
+ };
+
+ // for the quads
+ if (cell->get_fe().dofs_per_quad > 0)
+ for (unsigned int q=0; q<GeometryInfo<3>::quads_per_cell; ++q)
+ {
+ typename MGDoFHandler<dim,spacedim>::quad_iterator quad = cell->quad(q);
+
+ // distribute dofs if necessary:
+ // check whether line dof is already
+ // numbered (check only first dof)
+ if (quad->mg_dof_index(cell->level(), 0) == DoFHandler<3>::invalid_dof_index)
+ // if not: distribute dofs
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_quad; ++d)
+ quad->set_mg_dof_index (cell->level(), d, next_free_dof++);
+ };
+
+
+ // dofs of cell
+ if (cell->get_fe().dofs_per_hex > 0)
+ for (unsigned int d=0; d<cell->get_fe().dofs_per_hex; ++d)
+ cell->set_mg_dof_index (cell->level(), d, next_free_dof++);
+
+
+ // note that this cell has
+ // been processed
+ cell->set_user_flag ();
+
+ return next_free_dof;
+ }
+ };
+ }
+}
+
+
/* ------------------------ MGVertexDoFs ----------------------------------- */
// everything else alone
if (cl > fl)
return;
-
+
const unsigned int n_levels = finest_level-coarsest_level + 1;
-
+
indices = new unsigned int[n_levels * dofs_per_vertex];
Assert (indices != 0, ExcNoMemory ());
unsigned int mem = DoFHandler<dim,spacedim>::memory_consumption();
for (unsigned int l=0;l<mg_levels.size();++l)
mem += mg_levels[l]->memory_consumption();
-
+
mem += MemoryConsumption::memory_consumption(*mg_faces);
-
+
for (unsigned int l=0;l<mg_vertex_dofs.size();++l)
mem += sizeof(MGVertexDoFs)
+ (1+mg_vertex_dofs[l].get_finest_level()-mg_vertex_dofs[l].get_coarsest_level())
if (this->tria->n_raw_quads(level) == 0)
return end_quad();
-
+
return raw_quad_iterator (this->tria,
level,
0,
0,
this);
}
-
-
+
+
default:
Assert (false, ExcNotImplemented());
- return raw_hex_iterator();
+ return raw_hex_iterator();
}
}
quad_iterator(end_quad()) :
begin_quad (level+1));
else
- return quad_iterator(end_quad());
+ return quad_iterator(end_quad());
}
default:
Assert (false, ExcNotImplemented());
return raw_quad_iterator();
- }
+ }
}
if (this->tria->n_raw_hexs(level) == 0)
return end_hex();
-
+
return raw_hex_iterator (this->tria,
level,
0,
this);
}
-
+
default:
Assert (false, ExcNotImplemented());
- return raw_hex_iterator();
+ return raw_hex_iterator();
}
}
}
-
+
template <int dim, int spacedim>
typename MGDoFHandler<dim, spacedim>::active_hex_iterator
MGDoFHandler<dim, spacedim>::last_active_hex (const unsigned int level) const
//---------------------------------------------------------------------------
-#if deal_II_dimension == 1
+#if deal_II_dimension == 1
template <>
template <>
unsigned int
fe_index,
local_index,
global_index);
-
+
}
#endif
fe_index,
local_index,
global_index);
-
+
}
fe_index,
local_index,
global_index);
-
+
}
#endif
fe_index,
local_index,
global_index);
-
+
}
fe_index,
local_index,
global_index);
-
+
}
fe_index,
local_index,
global_index);
-
+
}
#endif
cell_iterator cell = begin(level),
endc = end(level);
- for (; cell != endc; ++cell)
- next_free_dof = distribute_dofs_on_cell (cell, next_free_dof);
-
- mg_used_dofs[level] = next_free_dof;
- };
-
- // finally restore the user flags
- const_cast<Triangulation<dim,spacedim> &>(*(this->tria)).load_user_flags(user_flags);
-}
-
-
-#if deal_II_dimension == 1
-
-template <>
-unsigned int
-MGDoFHandler<1>::distribute_dofs_on_cell (cell_iterator &cell,
- unsigned int next_free_dof)
-{
-
- // distribute dofs of vertices
- if (this->selected_fe->dofs_per_vertex > 0)
- for (unsigned int v=0; v<GeometryInfo<1>::vertices_per_cell; ++v)
- {
- cell_iterator neighbor = cell->neighbor(v);
-
- if (neighbor.state() == IteratorState::valid)
- {
- // has neighbor already been processed?
- if (neighbor->user_flag_set() &&
- (neighbor->level() == cell->level()))
- // copy dofs if the neighbor is on
- // the same level (only then are
- // mg dofs the same)
- {
- if (v==0)
- for (unsigned int d=0; d<this->selected_fe->dofs_per_vertex; ++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 (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 (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 (cell->level(), d, next_free_dof++);
-
- // note that this cell has been processed
- cell->set_user_flag ();
-
- return next_free_dof;
-}
-
-#endif
-
-
-#if deal_II_dimension == 2
-
-template <>
-unsigned int
-MGDoFHandler<2>::distribute_dofs_on_cell (cell_iterator &cell,
- unsigned int next_free_dof) {
- if (this->selected_fe->dofs_per_vertex > 0)
- // number dofs on vertices
- for (unsigned int vertex=0; vertex<GeometryInfo<2>::vertices_per_cell; ++vertex)
- // check whether dofs for this
- // vertex have been distributed
- // (only check the first dof)
- 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 (cell->level(), vertex, d, next_free_dof++);
-
- // for the four sides
- if (this->selected_fe->dofs_per_line > 0)
- for (unsigned int side=0; side<GeometryInfo<2>::faces_per_cell; ++side)
- {
- line_iterator line = cell->line(side);
-
- // distribute dofs if necessary:
- // check whether line dof is already
- // numbered (check only first dof)
- 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 (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 (cell->level(), d, next_free_dof++);
-
-
- // note that this cell has been processed
- cell->set_user_flag ();
-
- return next_free_dof;
-}
-
-#endif
-
-
-#if deal_II_dimension == 3
-
-template <>
-unsigned int
-MGDoFHandler<3>::distribute_dofs_on_cell (cell_iterator &cell,
- unsigned int next_free_dof) {
- if (this->selected_fe->dofs_per_vertex > 0)
- // number dofs on vertices
- for (unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
- // check whether dofs for this
- // vertex have been distributed
- // (only check the first dof)
- 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 (cell->level(), vertex, d, next_free_dof++);
-
- // for the lines
- if (this->selected_fe->dofs_per_line > 0)
- for (unsigned int l=0; l<GeometryInfo<3>::lines_per_cell; ++l)
- {
- line_iterator line = cell->line(l);
-
- // distribute dofs if necessary:
- // check whether line dof is already
- // numbered (check only first dof)
- 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 (cell->level(), d, next_free_dof++);
- };
-
- // for the quads
- if (this->selected_fe->dofs_per_quad > 0)
- for (unsigned int q=0; q<GeometryInfo<3>::quads_per_cell; ++q)
- {
- quad_iterator quad = cell->quad(q);
-
- // distribute dofs if necessary:
- // check whether line dof is already
- // numbered (check only first dof)
- 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 (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 (cell->level(), d, next_free_dof++);
+ for (; cell != endc; ++cell)
+ next_free_dof = internal::MGDoFHandler::Implementation::distribute_dofs_on_cell<spacedim> (cell, next_free_dof);
+ mg_used_dofs[level] = next_free_dof;
+ }
- // note that this cell has been processed
- cell->set_user_flag ();
-
- return next_free_dof;
+ // finally restore the user flags
+ const_cast<Triangulation<dim,spacedim> &>(*(this->tria))
+ .load_user_flags(user_flags);
}
-#endif
-
-
template <int dim, int spacedim>
void
MGDoFHandler<dim,spacedim>::clear ()
// let base class release its mem
// as well
- DoFHandler<dim,spacedim>::clear ();
+ DoFHandler<dim,spacedim>::clear ();
}
template <int dim, int spacedim>
unsigned int MGDoFHandler<dim,spacedim>::n_dofs (const unsigned int level) const {
Assert (level < mg_used_dofs.size(), ExcInvalidLevel(level));
-
+
return mg_used_dofs[level];
}
void MGDoFHandler<1>::renumber_dofs (const unsigned int level,
const std::vector<unsigned int> &new_numbers) {
Assert (new_numbers.size() == n_dofs(level), DoFHandler<1>::ExcRenumberingIncomplete());
-
+
// note that we can not use cell iterators
// in this function since then we would
// renumber the dofs on the interface of
this->selected_fe->dofs_per_vertex)]);
for (std::vector<unsigned int>::iterator i=mg_levels[level]->lines.dofs.begin();
- i!=mg_levels[level]->lines.dofs.end(); ++i)
+ i!=mg_levels[level]->lines.dofs.end(); ++i)
{
if (*i != DoFHandler<1>::invalid_dof_index)
{
template <>
void MGDoFHandler<2>::renumber_dofs (const unsigned int level,
const std::vector<unsigned int> &new_numbers) {
- Assert (new_numbers.size() == n_dofs(level),
+ Assert (new_numbers.size() == n_dofs(level),
DoFHandler<2>::ExcRenumberingIncomplete());
-
+
for (std::vector<MGVertexDoFs>::iterator i=mg_vertex_dofs.begin();
i!=mg_vertex_dofs.end(); ++i)
// if the present vertex lives on
std::vector<bool> user_flags;
this->tria->save_user_flags(user_flags);
const_cast<Triangulation<2> &>(*(this->tria)).clear_user_flags ();
-
+
// flag all lines adjacent to cells of the current
// level, as those lines logically belong to the same
// level as the cell, at least for for isotropic
for ( ; cell != endcell; ++cell)
for (unsigned int line=0; line < GeometryInfo<2>::faces_per_cell; ++line)
cell->face(line)->set_user_flag();
-
+
line_iterator line = begin_line(),
endline = end_line();
-
+
for( ; line != endline; ++line)
if (line->user_flag_set())
{
const std::vector<unsigned int> &new_numbers) {
Assert (new_numbers.size() == n_dofs(level),
DoFHandler<3>::ExcRenumberingIncomplete());
-
+
for (std::vector<MGVertexDoFs>::iterator i=mg_vertex_dofs.begin();
i!=mg_vertex_dofs.end(); ++i)
// if the present vertex lives on
std::vector<bool> user_flags;
this->tria->save_user_flags(user_flags);
const_cast<Triangulation<3> &>(*(this->tria)).clear_user_flags ();
-
+
// flag all lines adjacent to cells of the current
// level, as those lines logically belong to the same
// level as the cell, at least for for isotropic
// refinement
-
+
cell_iterator cell = begin(level),
endcell = end(level);
for ( ; cell != endcell ; ++cell)
for (unsigned int line=0; line < GeometryInfo<3>::lines_per_cell; ++line)
cell->line(line)->set_user_flag();
-
+
line_iterator line = begin_line(),
endline = end_line();
-
+
for( ; line != endline; ++line)
if (line->user_flag_set())
{
std::vector<bool> user_flags;
this->tria->save_user_flags(user_flags);
const_cast<Triangulation<3> &>(*(this->tria)).clear_user_flags ();
-
+
// flag all quads adjacent to cells of the current
// level, as those lines logically belong to the same
// level as the cell, at least for for isotropic
for ( ; cell != endcell ; ++cell)
for (unsigned int quad=0; quad < GeometryInfo<3>::faces_per_cell; ++quad)
cell->face(quad)->set_user_flag();
-
+
quad_iterator quad = begin_quad(),
endline = end_quad();
-
+
for( ; quad != endline; ++quad)
if (quad->user_flag_set())
{
void MGDoFHandler<1>::reserve_space () {
const unsigned int dim = 1;
const unsigned int spacedim = 1;
-
+
Assert (this->selected_fe != 0, DoFHandler<dim>::ExcNoFESelected());
Assert (this->tria->n_levels() > 0, DoFHandler<dim>::ExcInvalidTriangulation());
////////////////////////////
// CONSTRUCTION
-
+
// first allocate space for the
// lines on each level
- for (unsigned int i=0; i<this->tria->n_levels(); ++i)
+ for (unsigned int i=0; i<this->tria->n_levels(); ++i)
{
mg_levels.push_back (new internal::DoFHandler::DoFLevel<1>);
{
Assert (min_level[vertex] < this->tria->n_levels(), ExcInternalError());
Assert (max_level[vertex] >= min_level[vertex], ExcInternalError());
-
+
mg_vertex_dofs[vertex].init (min_level[vertex],
max_level[vertex],
this->get_fe().dofs_per_vertex);
{
Assert (min_level[vertex] == this->tria->n_levels(), ExcInternalError());
Assert (max_level[vertex] == 0, ExcInternalError());
-
+
// reset to original state
mg_vertex_dofs[vertex].init (1, 0, 0);
}
void MGDoFHandler<2>::reserve_space () {
const unsigned int dim = 2;
const unsigned int spacedim = 2;
-
+
Assert (this->selected_fe != 0, DoFHandler<dim>::ExcNoFESelected());
Assert (this->tria->n_levels() > 0, DoFHandler<2>::ExcInvalidTriangulation());
-
+
////////////////////////////
// DESTRUCTION
clear_space ();
////////////////////////////
// CONSTRUCTION
-
+
// first allocate space for the
// lines and quads on each level
- for (unsigned int i=0; i<this->tria->n_levels(); ++i)
+ for (unsigned int i=0; i<this->tria->n_levels(); ++i)
{
mg_levels.push_back (new internal::DoFHandler::DoFLevel<2>);
this->selected_fe->dofs_per_quad,
DoFHandler<2>::invalid_dof_index);
};
-
+
mg_faces = new internal::DoFHandler::DoFFaces<2>;
mg_faces->lines.dofs = std::vector<unsigned int> (this->tria->n_raw_lines() *
this->selected_fe->dofs_per_line,
const unsigned int dim = 3;
const unsigned int spacedim = 3;
-
+
Assert (this->selected_fe != 0, DoFHandler<3>::ExcNoFESelected());
Assert (this->tria->n_levels() > 0, DoFHandler<3>::ExcInvalidTriangulation());
-
+
////////////////////////////
// DESTRUCTION
clear_space ();
////////////////////////////
// CONSTRUCTION
-
+
// first allocate space for the
// lines and quads on each level
- for (unsigned int i=0; i<this->tria->n_levels(); ++i)
+ for (unsigned int i=0; i<this->tria->n_levels(); ++i)
{
mg_levels.push_back (new internal::DoFHandler::DoFLevel<3>);
{
Assert (min_level[vertex] < this->tria->n_levels(), ExcInternalError());
Assert (max_level[vertex] >= min_level[vertex], ExcInternalError());
-
+
mg_vertex_dofs[vertex].init (min_level[vertex],
max_level[vertex],
this->get_fe().dofs_per_vertex);
{
Assert (min_level[vertex] == this->tria->n_levels(), ExcInternalError());
Assert (max_level[vertex] == 0, ExcInternalError());
-
+
// reset to original state
mg_vertex_dofs[vertex].init (1, 0, 0);
}