* Return the indices of dofs for each level that lie on the
* boundary of the domain.
*/
-// TODO: remove
const std::vector<std::set<types::global_dof_index> > &
get_boundary_indices () const;
* refinement edge (i.e. are on faces between cells of this level
* and cells on the level below).
*/
- // TODO: remove
const std::vector<std::vector<bool> > &
- get_refinement_edge_indices () const;
+ get_refinement_edge_indices () const DEAL_II_DEPRECATED;
+
+ /**
+ * Return the indices of dofs on the given level that lie on an
+ * refinement edge (dofs on faces to neighbors that are coarser)
+ */
+ const IndexSet &
+ get_refinement_edge_indices (unsigned int level) const;
/**
* Return the indices of dofs for each level that are in the
* intersection of the sets returned by get_boundary_indices() and
* get_refinement_edge_indices().
*/
- // TODO: remove
const std::vector<std::vector<bool> > &
- get_refinement_edge_boundary_indices () const;
+ get_refinement_edge_boundary_indices () const DEAL_II_DEPRECATED;
/**
- * Return if boundary_indices need to be set or not.
+ * Return indices of all dofs that are on boundary faces on the given level
+ * if the cell has refinement edge indices (i.e. has a coarser neighbor).
*/
+ const IndexSet &
+ get_refinement_edge_boundary_indices (unsigned int level) const;
+ /**
+ * Return if boundary_indices need to be set or not.
+ */
+//TODO: remove?
bool set_boundary_values () const;
private:
* The degrees of freedom on the refinement edge between a level and
* coarser cells.
*/
- std::vector<std::vector<bool> > refinement_edge_indices;
+ std::vector<IndexSet> refinement_edge_indices;
/**
* The degrees of freedom on the refinement edge between a level and
*
* This is a subset of #refinement_edge_indices.
*/
- std::vector<std::vector<bool> > refinement_edge_boundary_indices;
+ std::vector<IndexSet> refinement_edge_boundary_indices;
+
+ /**
+ * old data structure only filled on demand
+ */
+ mutable std::vector<std::vector<bool> > refinement_edge_boundary_indices_old;
+
+ /**
+ * old data structure only filled on demand
+ */
+ mutable std::vector<std::vector<bool> > refinement_edge_indices_old;
};
const unsigned int nlevels = dof.get_tria().n_global_levels();
refinement_edge_indices.resize(nlevels);
refinement_edge_boundary_indices.resize(nlevels);
+ refinement_edge_indices_old.clear();
+ refinement_edge_boundary_indices_old.clear();
for (unsigned int l=0; l<nlevels; ++l)
{
- refinement_edge_indices[l].resize(dof.n_dofs(l));
- refinement_edge_boundary_indices[l].resize(dof.n_dofs(l));
+ refinement_edge_indices[l] = IndexSet(dof.n_dofs(l));
+ refinement_edge_boundary_indices[l] = IndexSet(dof.n_dofs(l));
}
MGTools::extract_inner_interface_dofs (dof, refinement_edge_indices,
refinement_edge_boundary_indices);
boundary_indices.resize(nlevels);
refinement_edge_indices.resize(nlevels);
refinement_edge_boundary_indices.resize(nlevels);
+ refinement_edge_indices_old.clear();
+ refinement_edge_boundary_indices_old.clear();
for (unsigned int l=0; l<nlevels; ++l)
{
boundary_indices[l].clear();
- refinement_edge_indices[l].resize(dof.n_dofs(l));
- refinement_edge_boundary_indices[l].resize(dof.n_dofs(l));
+ refinement_edge_indices[l] = IndexSet(dof.n_dofs(l));
+ refinement_edge_boundary_indices[l] = IndexSet(dof.n_dofs(l));
}
MGTools::make_boundary_list (dof, function_map, boundary_indices, component_mask);
for (unsigned int l=0; l<refinement_edge_boundary_indices.size(); ++l)
refinement_edge_boundary_indices[l].clear();
+
+ refinement_edge_indices_old.clear();
+ refinement_edge_boundary_indices_old.clear();
}
return false;
AssertIndexRange(level, boundary_indices.size());
- if (boundary_indices[level].find(index) != boundary_indices[level].end())
- return true;
- else
- return false;
+ return (boundary_indices[level].find(index) != boundary_indices[level].end());
}
inline
const types::global_dof_index index) const
{
AssertIndexRange(level, refinement_edge_indices.size());
- AssertIndexRange(index, refinement_edge_indices[level].size());
- return refinement_edge_indices[level][index];
+ return refinement_edge_indices[level].is_element(index);
}
const types::global_dof_index index) const
{
AssertIndexRange(level, refinement_edge_boundary_indices.size());
- AssertIndexRange(index, refinement_edge_boundary_indices[level].size());
- return refinement_edge_boundary_indices[level][index];
+ return refinement_edge_boundary_indices[level].is_element(index);
}
inline
const std::vector<std::vector<bool> > &
MGConstrainedDoFs::get_refinement_edge_indices () const
{
- return refinement_edge_indices;
+ if (refinement_edge_indices_old.size()!=refinement_edge_indices.size())
+ {
+ unsigned int n_levels = refinement_edge_indices.size();
+ refinement_edge_indices_old.resize(n_levels);
+ for (unsigned int l=0;l<n_levels;++l)
+ {
+ refinement_edge_indices_old[l].resize(refinement_edge_indices[l].size(), false);
+ refinement_edge_indices[l].fill_binary_vector(refinement_edge_indices_old[l]);
+ }
+ }
+
+ return refinement_edge_indices_old;
+}
+
+inline
+const IndexSet &
+MGConstrainedDoFs::get_refinement_edge_indices (unsigned int level) const
+{
+ AssertIndexRange(level, refinement_edge_indices.size());
+ return refinement_edge_indices[level];
}
inline
const std::vector<std::vector<bool> > &
MGConstrainedDoFs::get_refinement_edge_boundary_indices () const
{
- return refinement_edge_boundary_indices;
+ if (refinement_edge_boundary_indices_old.size()!=refinement_edge_boundary_indices.size())
+ {
+ unsigned int n_levels = refinement_edge_boundary_indices.size();
+ refinement_edge_boundary_indices_old.resize(n_levels);
+ for (unsigned int l=0;l<n_levels;++l)
+ {
+ refinement_edge_boundary_indices_old[l].resize(refinement_edge_boundary_indices[l].size(), false);
+ refinement_edge_boundary_indices[l].fill_binary_vector(refinement_edge_boundary_indices_old[l]);
+ }
+ }
+
+ return refinement_edge_boundary_indices_old;
+}
+
+inline
+const IndexSet &
+MGConstrainedDoFs::get_refinement_edge_boundary_indices (unsigned int level) const
+{
+ return refinement_edge_boundary_indices[level];
}
inline
template <int dim, int spacedim>
void
extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
- std::vector<std::vector<bool> > &interface_dofs,
- std::vector<std::vector<bool> > &boundary_interface_dofs);
+ std::vector<IndexSet> &interface_dofs,
+ std::vector<IndexSet> &boundary_interface_dofs);
/**
* Does the same as the function above,
template <int dim, int spacedim>
void
extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
- std::vector<std::vector<bool> > &interface_dofs);
+ std::vector<IndexSet> &interface_dofs);
+
+ /**
+ * As above but with a deprecated data structure. This makes one additional copy.
+ */
+ template <int dim, int spacedim>
+ void
+ extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
+ std::vector<std::vector<bool> > &interface_dofs) DEAL_II_DEPRECATED;
+
template <int dim, int spacedim>
void
template <int dim, int spacedim>
void
extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
- std::vector<std::vector<bool> > &interface_dofs)
+ std::vector<IndexSet> &interface_dofs)
{
Assert (interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(),
ExcDimensionMismatch (interface_dofs.size(),
Assert (interface_dofs[l].size() == mg_dof_handler.n_dofs(l),
ExcDimensionMismatch (interface_dofs[l].size(),
mg_dof_handler.n_dofs(l)));
-
- std::fill (interface_dofs[l].begin(),
- interface_dofs[l].end(),
- false);
+ interface_dofs[l].clear();
}
const FiniteElement<dim,spacedim> &fe = mg_dof_handler.get_fe();
for (unsigned int i=0; i<dofs_per_cell; ++i)
if (cell_dofs[i])
- interface_dofs[level][local_dof_indices[i]] = true;
+ interface_dofs[level].add_index(local_dof_indices[i]);
+ }
+ }
+
+ template <int dim, int spacedim>
+ void
+ extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
+ std::vector<std::vector<bool> > &interface_dofs)
+ {
+ std::vector<IndexSet> temp;
+ temp.resize(interface_dofs.size());
+ for (unsigned int l=0;l<interface_dofs.size();++l)
+ temp[l] = IndexSet(interface_dofs[l].size());
+
+ extract_inner_interface_dofs(mg_dof_handler, temp);
+
+ for (unsigned int l=0;l<interface_dofs.size();++l)
+ {
+ Assert (interface_dofs[l].size() == mg_dof_handler.n_dofs(l),
+ ExcDimensionMismatch (interface_dofs[l].size(),
+ mg_dof_handler.n_dofs(l)));
+
+ temp[l].fill_binary_vector(interface_dofs[l]);
}
}
template <int dim, int spacedim>
void
extract_non_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
- std::vector<std::set<types::global_dof_index> > &non_interface_dofs)
+ std::vector<std::set<unsigned int> > &non_interface_dofs)
{
Assert (non_interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(),
ExcDimensionMismatch (non_interface_dofs.size(),
template <int dim, int spacedim>
void
extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler,
- std::vector<std::vector<bool> > &interface_dofs,
- std::vector<std::vector<bool> > &boundary_interface_dofs)
+ std::vector<IndexSet> &interface_dofs,
+ std::vector<IndexSet> &boundary_interface_dofs)
{
Assert (interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(),
ExcDimensionMismatch (interface_dofs.size(),
for (unsigned int l=0; l<mg_dof_handler.get_tria().n_global_levels(); ++l)
{
- Assert (interface_dofs[l].size() == mg_dof_handler.n_dofs(l),
- ExcDimensionMismatch (interface_dofs[l].size(),
- mg_dof_handler.n_dofs(l)));
- Assert (boundary_interface_dofs[l].size() == mg_dof_handler.n_dofs(l),
- ExcDimensionMismatch (boundary_interface_dofs[l].size(),
- mg_dof_handler.n_dofs(l)));
-
- std::fill (interface_dofs[l].begin(),
- interface_dofs[l].end(),
- false);
- std::fill (boundary_interface_dofs[l].begin(),
- boundary_interface_dofs[l].end(),
- false);
+ interface_dofs[l].clear();
+ boundary_interface_dofs[l].clear();
}
const FiniteElement<dim,spacedim> &fe = mg_dof_handler.get_fe();
for (unsigned int i=0; i<dofs_per_cell; ++i)
{
if (cell_dofs[i])
- interface_dofs[level][local_dof_indices[i]] = true;
+ interface_dofs[level].add_index(local_dof_indices[i]);
if (boundary_cell_dofs[i])
- boundary_interface_dofs[level][local_dof_indices[i]] = true;
+ boundary_interface_dofs[level].add_index(local_dof_indices[i]);
}
}
}
template
void
extract_inner_interface_dofs (const DoFHandler<deal_II_dimension> &mg_dof_handler,
- std::vector<std::vector<bool> > &interface_dofs,
- std::vector<std::vector<bool> > &boundary_interface_dofs);
+ std::vector<IndexSet> &interface_dofs,
+ std::vector<IndexSet> &boundary_interface_dofs);
+ template
+ void
+ extract_inner_interface_dofs (const DoFHandler<deal_II_dimension> &mg_dof_handler,
+ std::vector<IndexSet> &interface_dofs);
template
void
extract_inner_interface_dofs (const DoFHandler<deal_II_dimension> &mg_dof_handler,
std::vector<std::vector<bool> > &interface_dofs);
+
template
void
extract_non_interface_dofs (const DoFHandler<deal_II_dimension> & mg_dof_handler,