28 template <
int dim,
int spacedim>
33 reinit(dof_handler, weighting_function);
38 template <
int dim,
int spacedim>
41 connection.disconnect();
46 template <
int dim,
int spacedim>
53 connection.disconnect();
55 make_weighting_callback(dof_handler, weighting_function));
64 template <
int dim,
int spacedim>
76 template <
int dim,
int spacedim>
79 const std::pair<float, float> &coefficients)
81 return [coefficients](
85 std::trunc(coefficients.first *
86 std::pow(future_fe.n_dofs_per_cell(), coefficients.second));
90 static_cast<float>(std::numeric_limits<unsigned int>::max()),
92 "Cannot cast determined weight for this cell to unsigned int!"));
94 return static_cast<unsigned int>(result);
100 template <
int dim,
int spacedim>
103 const std::vector<std::pair<float, float>> &coefficients)
105 return [coefficients](
109 for (
const auto &pair : coefficients)
111 pair.first *
std::pow(future_fe.n_dofs_per_cell(), pair.second);
112 result = std::trunc(result);
116 static_cast<float>(std::numeric_limits<unsigned int>::max()),
118 "Cannot cast determined weight for this cell to unsigned int!"));
120 return static_cast<unsigned int>(result);
128 template <
int dim,
int spacedim>
129 std::function<
unsigned int(
130 const typename ::Triangulation<dim, spacedim>::cell_iterator &cell,
131 const typename ::Triangulation<dim, spacedim>::CellStatus status)>
144 "parallel::CellWeights requires a parallel::TriangulationBase object."));
147 [&dof_handler,
tria, weighting_function](
148 const typename ::Triangulation<dim, spacedim>::cell_iterator
150 const typename ::Triangulation<dim, spacedim>::CellStatus status)
155 std::cref(dof_handler),
163 template <
int dim,
int spacedim>
166 const typename ::Triangulation<dim, spacedim>::cell_iterator &cell_,
167 const typename ::Triangulation<dim, spacedim>::CellStatus status,
177 "Triangulation associated with the DoFHandler has changed!"));
197 fe_index = cell->future_fe_index();
202 for (
const auto &child : cell->child_iterators())
203 Assert(child->is_active() && child->coarsen_flag_set(),
204 typename ::Triangulation<
205 dim>::ExcInconsistentCoarseningFlags());
208 fe_index = ::internal::hp::DoFHandlerImplementation::
209 dominated_future_fe_on_children<dim, spacedim>(cell);
218 return weighting_function(cell, dof_handler.
get_fe(fe_index));
224#include "cell_weights.inst"
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
const Triangulation< dim, spacedim > & get_triangulation() const
unsigned int size() const
static unsigned int weighting_callback(const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const typename ::Triangulation< dim, spacedim >::CellStatus status, const DoFHandler< dim, spacedim > &dof_handler, const parallel::TriangulationBase< dim, spacedim > &triangulation, const WeightingFunction &weighting_function)
static std::function< unsigned int(const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const typename ::Triangulation< dim, spacedim >::CellStatus status)> make_weighting_callback(const DoFHandler< dim, spacedim > &dof_handler, const WeightingFunction &weighting_function)
static WeightingFunction constant_weighting(const unsigned int factor=1)
std::function< unsigned int(const typename DoFHandler< dim, spacedim >::cell_iterator &, const FiniteElement< dim, spacedim > &)> WeightingFunction
static WeightingFunction ndofs_weighting(const std::pair< float, float > &coefficients)
void reinit(const DoFHandler< dim, spacedim > &dof_handler, const WeightingFunction &weighting_function)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
const ::Triangulation< dim, spacedim > & tria