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>
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.dofs_per_cell, coefficients.second));
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)
110 result += pair.first * std::pow(future_fe.dofs_per_cell, pair.second);
111 result = std::trunc(result);
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(
143 "parallel::CellWeights requires a parallel::TriangulationBase object."));
145 return [&dof_handler, tria, weighting_function](
160 template <
int dim,
int spacedim>
174 "Triangulation associated with the DoFHandler has changed!"));
179 *cell_, &dof_handler);
189 fe_index = cell->future_fe_index();
194 std::set<unsigned int> fe_indices_children;
195 for (
unsigned int child_index = 0; child_index < cell->n_children();
198 const auto &child = cell->child(child_index);
199 Assert(child->is_active() && child->coarsen_flag_set(),
201 dim>::ExcInconsistentCoarseningFlags());
203 fe_indices_children.insert(child->future_fe_index());
209 fe_indices_children, 0);
212 typename ::hp::FECollection<
213 dim>::ExcNoDominatedFiniteElementAmongstChildren());
223 return weighting_function(cell, dof_handler.
get_fe(fe_index));
230 template <
int dim,
int spacedim>
233 : dof_handler(&dof_handler)
236 &(dof_handler.get_triangulation())))
241 "parallel::CellWeights requires a parallel::TriangulationBase object."));
248 template <
int dim,
int spacedim>
251 const unsigned int factor)
270 template <
int dim,
int spacedim>
273 const unsigned int factor)
292 template <
int dim,
int spacedim>
295 const unsigned int factor)
314 template <
int dim,
int spacedim>
317 const std::function<
unsigned int(
324 const std::function<
unsigned int(
331 return custom_function(future_fe, cell);
335 [
this, converted_function](
350 #include "cell_weights.inst"
static const unsigned int invalid_unsigned_int
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
boost::signals2::connection connection
void register_ndofs_weighting(const unsigned int factor=1000)
#define AssertThrow(cond, exc)
void reinit(const hp::DoFHandler< dim, spacedim > &dof_handler, const WeightingFunction &weighting_function)
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
#define Assert(cond, exc)
#define DEAL_II_NAMESPACE_CLOSE
CellWeights(const hp::DoFHandler< dim, spacedim > &dof_handler, const WeightingFunction &weighting_function)
static unsigned int weighting_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status, const hp::DoFHandler< dim, spacedim > &dof_handler, const parallel::TriangulationBase< dim, spacedim > &triangulation, const WeightingFunction &weighting_function)
TriangulationBase< dim, spacedim > Triangulation
static std::function< unsigned int(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status)> make_weighting_callback(const hp::DoFHandler< dim, spacedim > &dof_handler, const WeightingFunction &weighting_function)
const hp::FECollection< dim, spacedim > & get_fe_collection() const
void register_ndofs_squared_weighting(const unsigned int factor=1000)
static WeightingFunction ndofs_weighting(const std::pair< float, float > &coefficients)
SmartPointer< const parallel::TriangulationBase< dim, spacedim >, CellWeights > triangulation
#define DEAL_II_NAMESPACE_OPEN
const Triangulation< dim, spacedim > & get_triangulation() const
SmartPointer< const ::hp::DoFHandler< dim, spacedim >, CellWeights > dof_handler
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index) const
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
void register_constant_weighting(const unsigned int factor=1000)
std::function< unsigned int(const typename hp::DoFHandler< dim, spacedim >::cell_iterator &, const FiniteElement< dim, spacedim > &)> WeightingFunction
T max(const T &t, const MPI_Comm &mpi_communicator)
static WeightingFunction constant_weighting(const unsigned int factor=1000)
void register_custom_weighting(const std::function< unsigned int(const FiniteElement< dim, spacedim > &, const typename hp::DoFHandler< dim, spacedim >::cell_iterator &)> custom_function)
static ::ExceptionBase & ExcInternalError()