* <dd>Each cell of a triangulation has associated with it a property called
* the "subdomain id" that can be queried using a call like
* <code>cell-@>subdomain_id()</code> and that can be set for example by using
- * <code>cell-@>set_subdomain_id(13)</code>. While in principle this property
+ * <code>cell-@>set_subdomain_id(13)</code>. (These calls resolve to
+ * CellAccessor::subdomain_id() and CellAccessor::set_subdomain_id(), respectively.)
+ * While in principle this property
* can be used in any way application programs deem useful (it is simply an
* integer associated with each cell that can indicate whatever you want), at
* least for programs that run in %parallel it usually denotes the processor a
* one refinement level. These cells are called "artificial" (see
* @ref GlossArtificialCell "here") and have the special subdomain id value
* types::artificial_subdomain_id.
+ *
+ * In addition to regular subdomain ids, there is a second, closely related set
+ * of flags that are associated with each cell: "level subdomain ids."
+ * These exist not only for active cells but, in fact, for every cell in
+ * a mesh hierarchy. Their meaning is entirely analogous to the regular
+ * subdomain ids, but they are read and written by the
+ * CellAccessor::level_subdomain_id() and CellAccessor::set_level_subdomain_id()
+ * functions.
* </dd>
*
*
<h3>Specific improvements</h3>
<ol>
+<li> New: In addition to the regular subdomain ids (see
+@ref GlossSubdomainId) there is now a second set of flags called
+"level subdomain ids" that also assigns a subdomain to every cell
+in a multigrid hierarchy.
+<br>
+(Timo Heister, 2012/11/04)
+
<li> Changed: GridOut::write_xfig has been improved in a number
of ways. In particular, one can now color cells based on a number
of different criteria that can be set in GridOutFlags::XFig.
*/
void set_subdomain_id (const types::subdomain_id new_subdomain_id) const;
+ /**
+ * Get the level subdomain id of this cell. This is used for parallel multigrid.
+ */
+ types::subdomain_id_t level_subdomain_id () const;
+
+ /**
+ * Set the level subdomain id of this cell. This is used for parallel multigrid.
+ */
+ void set_level_subdomain_id (const types::subdomain_id_t new_level_subdomain_id) const;
+
+
/**
* Set the subdomain id of this
* cell and all its children (and
*/
std::vector<types::subdomain_id> subdomain_ids;
+ /**
+ * for parallel multigrid
+ */
+ std::vector<types::subdomain_id_t> level_subdomain_ids;
+
/**
* One integer for every consecutive
* pair of cells to store which
std::vector<bool> coarsen_flags;
std::vector<std::pair<int,int> > neighbors;
std::vector<types::subdomain_id> subdomain_ids;
+ std::vector<types::subdomain_id_t> level_subdomain_ids;
std::vector<int> parents;
// The following is not used
ar & refine_flags & coarsen_flags;
ar & neighbors;
ar & subdomain_ids;
+ ar & level_subdomain_ids;
ar & parents;
ar & direction_flags;
ar & cells;
}
+template <int dim, int spacedim>
+types::subdomain_id_t CellAccessor<dim, spacedim>::level_subdomain_id () const
+{
+ Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
+ return this->tria->levels[this->present_level]->level_subdomain_ids[this->present_index];
+}
+
+
+
+template <int dim, int spacedim>
+void
+CellAccessor<dim, spacedim>::set_level_subdomain_id (const types::subdomain_id_t new_level_subdomain_id) const
+{
+ Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
+ this->tria->levels[this->present_level]->level_subdomain_ids[this->present_index]
+ = new_level_subdomain_id;
+}
+
+
template <int dim, int spacedim>
bool CellAccessor<dim, spacedim>::direction_flag () const
{
total_cells - subdomain_ids.size(),
0);
+ level_subdomain_ids.reserve (total_cells);
+ level_subdomain_ids.insert (level_subdomain_ids.end(),
+ total_cells - level_subdomain_ids.size(),
+ 0);
+
if (dimension < space_dimension)
{
direction_flags.reserve (total_cells);
MemoryConsumption::memory_consumption (coarsen_flags) +
MemoryConsumption::memory_consumption (neighbors) +
MemoryConsumption::memory_consumption (subdomain_ids) +
+ MemoryConsumption::memory_consumption (level_subdomain_ids) +
MemoryConsumption::memory_consumption (parents) +
MemoryConsumption::memory_consumption (direction_flags) +
MemoryConsumption::memory_consumption (cells));
total_cells - subdomain_ids.size(),
0);
+ level_subdomain_ids.reserve (total_cells);
+ level_subdomain_ids.insert (level_subdomain_ids.end(),
+ total_cells - level_subdomain_ids.size(),
+ 0);
+
if (dimension < space_dimension)
{
direction_flags.reserve (total_cells);