27 template <
int dim,
int spacedim>
32 reinit(dof_handler, weighting_function);
37 template <
int dim,
int spacedim>
40 connection.disconnect();
45 template <
int dim,
int spacedim>
52 connection.disconnect();
54 make_weighting_callback(dof_handler, weighting_function));
63 template <
int dim,
int spacedim>
75 template <
int dim,
int spacedim>
78 const std::pair<float, float> &coefficients)
80 return [coefficients](
84 std::trunc(coefficients.first *
85 std::pow(future_fe.n_dofs_per_cell(), coefficients.second));
89 static_cast<float>(std::numeric_limits<unsigned int>::max()),
91 "Cannot cast determined weight for this cell to unsigned int!"));
93 return static_cast<unsigned int>(result);
99 template <
int dim,
int spacedim>
102 const std::vector<std::pair<float, float>> &coefficients)
104 return [coefficients](
108 for (
const auto &pair : coefficients)
110 pair.first *
std::pow(future_fe.n_dofs_per_cell(), pair.second);
111 result = std::trunc(result);
115 static_cast<float>(std::numeric_limits<unsigned int>::max()),
117 "Cannot cast determined weight for this cell to unsigned int!"));
119 return static_cast<unsigned int>(result);
127 template <
int dim,
int spacedim>
128 std::function<
unsigned int(
129 const typename ::Triangulation<dim, spacedim>::cell_iterator &cell,
143 "parallel::CellWeights requires a parallel::TriangulationBase object."));
145 return [&dof_handler, tria, weighting_function](
146 const typename ::Triangulation<dim, spacedim>::cell_iterator
160 template <
int dim,
int spacedim>
163 const typename ::Triangulation<dim, spacedim>::cell_iterator &cell_,
174 "Triangulation associated with the DoFHandler has changed!"));
194 fe_index = cell->future_fe_index();
199 for (
const auto &child : cell->child_iterators())
200 Assert(child->is_active() && child->coarsen_flag_set(),
201 typename ::Triangulation<
202 dim>::ExcInconsistentCoarseningFlags());
205 fe_index = ::internal::hp::DoFHandlerImplementation::
206 dominated_future_fe_on_children<dim, spacedim>(cell);
215 return weighting_function(cell, dof_handler.
get_fe(fe_index));
221#include "cell_weights.inst"
@ children_will_be_coarsened
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
static unsigned int weighting_callback(const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const CellStatus status, const DoFHandler< dim, spacedim > &dof_handler, const parallel::TriangulationBase< dim, spacedim > &triangulation, 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)
static std::function< unsigned int(const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const CellStatus status)> make_weighting_callback(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 & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
#define DEAL_II_ASSERT_UNREACHABLE()
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