17 #include <deal.II/base/config.h> 19 #ifdef DEAL_II_WITH_P4EST 21 # include <deal.II/distributed/solution_transfer.h> 22 # include <deal.II/distributed/tria.h> 24 # include <deal.II/dofs/dof_accessor.h> 25 # include <deal.II/dofs/dof_tools.h> 27 # include <deal.II/grid/tria_accessor.h> 28 # include <deal.II/grid/tria_iterator.h> 30 # include <deal.II/lac/block_vector.h> 31 # include <deal.II/lac/la_parallel_block_vector.h> 32 # include <deal.II/lac/la_parallel_vector.h> 33 # include <deal.II/lac/petsc_block_vector.h> 34 # include <deal.II/lac/petsc_vector.h> 35 # include <deal.II/lac/trilinos_parallel_block_vector.h> 36 # include <deal.II/lac/trilinos_vector.h> 37 # include <deal.II/lac/vector.h> 39 # include <functional> 41 DEAL_II_NAMESPACE_OPEN
47 template <
int dim,
typename VectorType,
typename DoFHandlerType>
49 const DoFHandlerType &dof)
50 : dof_handler(&dof, typeid(*this).name())
51 , handle(
numbers::invalid_unsigned_int)
58 "parallel::distributed::SolutionTransfer requires a parallel::distributed::Triangulation object."));
63 template <
int dim,
typename VectorType,
typename DoFHandlerType>
67 const std::vector<const VectorType *> &all_in)
75 template <
int dim,
typename VectorType,
typename DoFHandlerType>
83 DoFHandlerType::space_dimension
> *>(
92 std::placeholders::_1,
93 std::placeholders::_2),
99 template <
int dim,
typename VectorType,
typename DoFHandlerType>
104 std::vector<const VectorType *> all_in(1, &in);
110 template <
int dim,
typename VectorType,
typename DoFHandlerType>
113 const VectorType &in)
115 std::vector<const VectorType *> all_in(1, &in);
121 template <
int dim,
typename VectorType,
typename DoFHandlerType>
124 const std::vector<const VectorType *> &all_in)
131 template <
int dim,
typename VectorType,
typename DoFHandlerType>
136 std::vector<VectorType *> all_in(1, &in);
142 template <
int dim,
typename VectorType,
typename DoFHandlerType>
145 std::vector<VectorType *> &all_in)
156 template <
int dim,
typename VectorType,
typename DoFHandlerType>
159 std::vector<VectorType *> &all_out)
168 DoFHandlerType::space_dimension
> *>(
178 std::placeholders::_1,
179 std::placeholders::_2,
180 std::placeholders::_3,
184 for (
typename std::vector<VectorType *>::iterator it = all_out.begin();
194 template <
int dim,
typename VectorType,
typename DoFHandlerType>
199 std::vector<VectorType *> all_out(1, &out);
205 template <
int dim,
typename VectorType,
typename DoFHandlerType>
209 cell_iterator &cell_,
213 typename DoFHandlerType::cell_iterator cell(*cell_,
dof_handler);
216 std::vector<::Vector<typename VectorType::value_type>> dofvalues(
220 auto it_output = dofvalues.begin();
221 for (; cit_input !=
input_vectors.cend(); ++cit_input, ++it_output)
223 it_output->reinit(cell->get_fe().dofs_per_cell);
224 cell->get_interpolated_dof_values(*(*cit_input), *it_output);
234 template <
int dim,
typename VectorType,
typename DoFHandlerType>
238 cell_iterator &cell_,
241 const boost::iterator_range<std::vector<char>::const_iterator>
243 std::vector<VectorType *> &all_out)
245 typename DoFHandlerType::cell_iterator cell(*cell_,
dof_handler);
247 const std::vector<::Vector<typename VectorType::value_type>>
249 std::vector<::Vector<typename VectorType::value_type>>>(
250 data_range.begin(), data_range.end(),
false);
257 for (
auto it_dofvalues = dofvalues.begin();
258 it_dofvalues != dofvalues.end();
261 cell->get_fe().dofs_per_cell == it_dofvalues->size(),
263 "The transferred data was packed with a different number of dofs than the" 264 "currently registered FE object assigned to the DoFHandler has."));
267 auto it_input = dofvalues.cbegin();
268 auto it_output = all_out.begin();
269 for (; it_input != dofvalues.cend(); ++it_input, ++it_output)
270 cell->set_dof_values_by_interpolation(*it_input, *(*it_output));
279 # include "solution_transfer.inst" 281 DEAL_II_NAMESPACE_CLOSE
unsigned int register_data_attach(const std::function< std::vector< char >(const cell_iterator &, const CellStatus)> &pack_callback, const bool returns_variable_size_data)
std::vector< char > pack_callback(const typename Triangulation< dim, DoFHandlerType::space_dimension >::cell_iterator &cell, const typename Triangulation< dim, DoFHandlerType::space_dimension >::CellStatus status)
void deserialize(VectorType &in)
SolutionTransfer(const DoFHandlerType &dof)
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)
void notify_ready_to_unpack(const unsigned int handle, const std::function< void(const cell_iterator &, const CellStatus, const boost::iterator_range< std::vector< char >::const_iterator > &)> &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 boost::iterator_range< std::vector< char >::const_iterator > &data_range, std::vector< VectorType * > &all_out)
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
void prepare_serialization(const VectorType &in)
void prepare_for_coarsening_and_refinement(const std::vector< const VectorType * > &all_in)
std::vector< const VectorType * > input_vectors
SmartPointer< const DoFHandlerType, SolutionTransfer< dim, VectorType, DoFHandlerType > > dof_handler
void register_data_attach()
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
static::ExceptionBase & ExcInternalError()