17 #include <deal.II/base/config.h> 19 #ifdef DEAL_II_WITH_P4EST 21 #include <deal.II/lac/vector.h> 22 #include <deal.II/lac/block_vector.h> 23 #include <deal.II/lac/la_parallel_vector.h> 24 #include <deal.II/lac/la_parallel_block_vector.h> 25 #include <deal.II/lac/petsc_vector.h> 26 #include <deal.II/lac/petsc_block_vector.h> 27 #include <deal.II/lac/trilinos_vector.h> 28 #include <deal.II/lac/trilinos_block_vector.h> 30 #include <deal.II/distributed/solution_transfer.h> 31 #include <deal.II/distributed/tria.h> 32 #include <deal.II/dofs/dof_tools.h> 33 #include <deal.II/dofs/dof_accessor.h> 34 #include <deal.II/grid/tria_accessor.h> 35 #include <deal.II/grid/tria_iterator.h> 37 #include <deal.II/base/std_cxx11/bind.h> 39 DEAL_II_NAMESPACE_OPEN
46 template<
int dim,
typename VectorType,
typename DoFHandlerType>
49 dof_handler(&dof, typeid(*this).name()),
50 offset (
numbers::invalid_unsigned_int)
54 ExcMessage(
"parallel::distributed::SolutionTransfer requires a parallel::distributed::Triangulation object."));
59 template<
int dim,
typename VectorType,
typename DoFHandlerType>
65 template<
int dim,
typename VectorType,
typename DoFHandlerType>
76 template<
int dim,
typename VectorType,
typename DoFHandlerType>
102 template<
int dim,
typename VectorType,
typename DoFHandlerType>
107 std::vector<const VectorType *> all_in(1, &in);
113 template<
int dim,
typename VectorType,
typename DoFHandlerType>
117 std::vector<const VectorType *> all_in(1, &in);
123 template<
int dim,
typename VectorType,
typename DoFHandlerType>
126 (
const std::vector<const VectorType *> &all_in)
133 template<
int dim,
typename VectorType,
typename DoFHandlerType>
137 std::vector<VectorType *> all_in(1, &in);
143 template<
int dim,
typename VectorType,
typename DoFHandlerType>
156 template<
int dim,
typename VectorType,
typename DoFHandlerType>
177 std_cxx11::ref(all_out)));
180 for (
typename std::vector<VectorType *>::iterator it=all_out.begin();
190 template<
int dim,
typename VectorType,
typename DoFHandlerType>
194 std::vector<VectorType *> all_out(1, &out);
200 template<
int dim,
typename VectorType,
typename DoFHandlerType>
204 return sizeof(
typename VectorType::value_type)* DoFTools::max_dofs_per_cell(*
dof_handler);
208 template<
int dim,
typename VectorType,
typename DoFHandlerType>
212 const typename Triangulation<dim,DoFHandlerType::space_dimension>::CellStatus ,
215 typename VectorType::value_type *data_store =
reinterpret_cast<typename VectorType::value_type *
>(data);
217 typename DoFHandlerType::cell_iterator cell(*cell_,
dof_handler);
219 const unsigned int dofs_per_cell=cell->get_fe().dofs_per_cell;
221 for (
typename std::vector<const VectorType *>::iterator it=
input_vectors.begin();
225 cell->get_interpolated_dof_values(*(*it), dofvalues);
226 std::memcpy(data_store, &dofvalues(0),
sizeof(
typename VectorType::value_type)*dofs_per_cell);
227 data_store += dofs_per_cell;
232 template<
int dim,
typename VectorType,
typename DoFHandlerType>
236 const typename Triangulation<dim,DoFHandlerType::space_dimension>::CellStatus ,
238 std::vector<VectorType *> &all_out)
240 typename DoFHandlerType::cell_iterator
243 const unsigned int dofs_per_cell=cell->get_fe().dofs_per_cell;
245 const typename VectorType::value_type *data_store =
reinterpret_cast<const typename VectorType::value_type *
>(data);
247 for (
typename std::vector<VectorType *>::iterator it = all_out.begin();
251 std::memcpy(&dofvalues(0), data_store,
sizeof(
typename VectorType::value_type)*dofs_per_cell);
252 cell->set_dof_values_by_interpolation(dofvalues, *(*it));
253 data_store += dofs_per_cell;
263 #include "solution_transfer.inst" 265 DEAL_II_NAMESPACE_CLOSE
unsigned int register_data_attach(const std::size_t size, const std_cxx11::function< void(const cell_iterator &, const CellStatus, void *)> &pack_callback)
void deserialize(VectorType &in)
SolutionTransfer(const DoFHandlerType &dof)
void pack_callback(const typename Triangulation< dim, DoFHandlerType::space_dimension >::cell_iterator &cell, const typename Triangulation< dim, DoFHandlerType::space_dimension >::CellStatus status, void *data)
void notify_ready_to_unpack(const unsigned int offset, const std_cxx11::function< void(const cell_iterator &, const CellStatus, const void *)> &unpack_callback)
void unpack_callback(const typename Triangulation< dim, DoFHandlerType::space_dimension >::cell_iterator &cell, const typename Triangulation< dim, DoFHandlerType::space_dimension >::CellStatus status, const void *data, std::vector< VectorType * > &all_out)
void interpolate(std::vector< VectorType * > &all_out)
static::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
static::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
SmartPointer< const DoFHandlerType, SolutionTransfer< dim, VectorType, DoFHandlerType > > dof_handler
void prepare_serialization(const VectorType &in)
void prepare_for_coarsening_and_refinement(const std::vector< const VectorType * > &all_in)
unsigned int get_data_size() const
std::vector< const VectorType * > input_vectors
::Triangulation< dim, spacedim >::cell_iterator cell_iterator
static::ExceptionBase & ExcInternalError()