19#ifdef DEAL_II_WITH_P4EST
56 template <
typename value_type>
59 const unsigned int dofs_per_cell)
83 template <
typename value_type>
84 std::vector<Vector<value_type>>
86 const boost::iterator_range<std::vector<char>::const_iterator> &
data_range,
87 const unsigned int dofs_per_cell)
96 for (
unsigned int i = 0; i < n_elements; ++i)
113 namespace distributed
115 template <
int dim,
typename VectorType,
int spacedim>
118 const bool average_values)
120 , average_values(average_values)
121 , handle(
numbers::invalid_unsigned_int)
128 "parallel::distributed::SolutionTransfer requires a parallel::distributed::Triangulation object."));
133 template <
int dim,
typename VectorType,
int spacedim>
137 const std::vector<const VectorType *> &
all_in)
139 for (
unsigned int i = 0; i <
all_in.
size(); ++i)
144 register_data_attach();
149 template <
int dim,
typename VectorType,
int spacedim>
157 &dof_handler->get_triangulation())));
161 ExcMessage(
"You can only add one solution per "
162 "SolutionTransfer object."));
164 handle =
tria->register_data_attach(
168 return this->pack_callback(
cell_, status);
170 dof_handler->has_hp_capabilities());
175 template <
int dim,
typename VectorType,
int spacedim>
180 std::vector<const VectorType *>
all_in(1, &in);
181 prepare_for_coarsening_and_refinement(
all_in);
186 template <
int dim,
typename VectorType,
int spacedim>
189 const VectorType &in)
191 std::vector<const VectorType *>
all_in(1, &in);
192 prepare_for_serialization(
all_in);
197 template <
int dim,
typename VectorType,
int spacedim>
200 const std::vector<const VectorType *> &
all_in)
202 prepare_for_coarsening_and_refinement(
all_in);
207 template <
int dim,
typename VectorType,
int spacedim>
211 std::vector<VectorType *>
all_in(1, &in);
217 template <
int dim,
typename VectorType,
int spacedim>
220 std::vector<VectorType *> &
all_in)
222 register_data_attach();
231 template <
int dim,
typename VectorType,
int spacedim>
234 std::vector<VectorType *> &
all_out)
246 &dof_handler->get_triangulation())));
259 tria->notify_ready_to_unpack(
264 const boost::iterator_range<std::vector<char>::const_iterator>
272 using Number =
typename VectorType::value_type;
274 for (
const auto i :
valence.locally_owned_elements())
277 (Number(1.0) /
static_cast<Number
>(
valence[i])));
293 input_vectors.clear();
299 template <
int dim,
typename VectorType,
int spacedim>
303 std::vector<VectorType *>
all_out(1, &out);
309 template <
int dim,
typename VectorType,
int spacedim>
319 std::vector<::Vector<typename VectorType::value_type>>
dof_values(
320 input_vectors.size());
322 unsigned int fe_index = 0;
323 if (dof_handler->has_hp_capabilities())
328 spacedim>::CELL_PERSIST:
330 spacedim>::CELL_REFINE:
332 fe_index = cell->future_fe_index();
337 spacedim>::CELL_COARSEN:
343 for (
const auto &child : cell->child_iterators())
344 Assert(child->is_active() && child->coarsen_flag_set(),
345 typename ::Triangulation<
346 dim>::ExcInconsistentCoarseningFlags());
349 fe_index = ::internal::hp::DoFHandlerImplementation::
350 dominated_future_fe_on_children<dim, spacedim>(cell);
360 const unsigned int dofs_per_cell =
361 dof_handler->get_fe(fe_index).n_dofs_per_cell();
363 if (dofs_per_cell == 0)
364 return std::vector<char>();
380 template <
int dim,
typename VectorType,
int spacedim>
385 const boost::iterator_range<std::vector<char>::const_iterator>
387 std::vector<VectorType *> &
all_out,
393 unsigned int fe_index = 0;
394 if (dof_handler->has_hp_capabilities())
399 spacedim>::CELL_PERSIST:
401 spacedim>::CELL_COARSEN:
403 fe_index = cell->active_fe_index();
408 spacedim>::CELL_REFINE:
415 fe_index = cell->child(0)->active_fe_index();
416 for (
unsigned int child_index = 1;
417 child_index < cell->n_children();
419 Assert(cell->child(child_index)->active_fe_index() ==
431 const unsigned int dofs_per_cell =
432 dof_handler->get_fe(fe_index).n_dofs_per_cell();
434 if (dofs_per_cell == 0)
437 const std::vector<::Vector<typename VectorType::value_type>>
453 "The transferred data was packed with a different number of dofs than the "
454 "currently registered FE object assigned to the DoFHandler has."));
461 cell->distribute_local_to_global_by_interpolation(*
it_input,
465 cell->set_dof_values_by_interpolation(*
it_input,
475 cell->distribute_local_to_global_by_interpolation(
ones,
485# include "solution_transfer.inst"
const_iterator cend() const
const_iterator cbegin() const
void reinit(value_type *starting_element, const std::size_t n_elements)
void unpack_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status, const boost::iterator_range< std::vector< char >::const_iterator > &data_range, std::vector< VectorType * > &all_out, VectorType &valence)
std::vector< char > pack_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status)
void register_data_attach()
SmartPointer< const DoFHandler< dim, spacedim >, SolutionTransfer< dim, VectorType, spacedim > > dof_handler
void deserialize(VectorType &in)
void prepare_for_coarsening_and_refinement(const std::vector< const VectorType * > &all_in)
void prepare_for_serialization(const VectorType &in)
void interpolate(std::vector< VectorType * > &all_out)
SolutionTransfer(const DoFHandler< dim, spacedim > &dof_handler, const bool average_values=false)
typename ::Triangulation< dim, spacedim >::CellStatus CellStatus
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
typename ::Triangulation< dim, spacedim >::cell_iterator cell_iterator
static const unsigned int invalid_unsigned_int
const ::Triangulation< dim, spacedim > & tria