16#ifndef dealii_portable_matrix_free_h
17#define dealii_portable_matrix_free_h
38#include <Kokkos_Core.hpp>
47 namespace MatrixFreeFunctions
59 template <
int dim,
typename Number>
88 template <
int dim,
typename Number =
double>
114#ifndef DEAL_II_MPI_WITH_DEVICE_SUPPORT
118 "Overlapping communication and computation requires device-aware MPI."));
124 "Overlapping communication and coloring are incompatible options. Only one of them can be enabled."));
160 Kokkos::View<point_type **, MemorySpace::Default::kokkos_space>
q_points;
173 Kokkos::View<Number **[dim][dim], MemorySpace::Default::kokkos_space>
179 Kokkos::View<Number **, MemorySpace::Default::kokkos_space>
JxW;
191 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
shape_values;
196 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
202 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
208 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
243 const unsigned int n_q_points,
244 const unsigned int q_point)
const
256 const unsigned int q_point)
const
283 template <
typename IteratorFiltersType>
289 const IteratorFiltersType &iterator_filter,
336 template <
typename Functor,
typename VectorType>
339 const VectorType &src,
340 VectorType &dst)
const;
357 template <
typename Functor>
365 template <
typename VectorType>
374 template <
typename VectorType>
383 template <
typename MemorySpaceType>
391 const std::vector<std::vector<CellFilter>> &
404 const std::shared_ptr<const Utilities::MPI::Partitioner> &
423 template <
typename IteratorFiltersType>
429 const IteratorFiltersType &iterator_filter,
430 const std::shared_ptr<const MPI_Comm> &
comm,
437 template <
typename Functor,
typename VectorType>
440 const VectorType &src,
441 VectorType &dst)
const;
447 template <
typename Functor>
523 std::vector<Kokkos::View<point_type **, MemorySpace::Default::kokkos_space>>
539 Kokkos::View<Number **[dim][dim], MemorySpace::Default::kokkos_space>>
546 std::vector<Kokkos::View<Number **, MemorySpace::Default::kokkos_space>>
552 Kokkos::View<types::global_dof_index *, MemorySpace::Default::kokkos_space>
566 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
shape_values;
576 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
582 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
611 std::vector<std::vector<CellFilter>>
graph;
613 friend class internal::ReinitHelper<dim, Number>;
618 template <
int dim,
typename Number>
622 MemorySpace::Default::kokkos_space::execution_space>::member_type;
626 MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space,
627 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
630 MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space,
631 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
664 template <
int dim,
typename Number>
670 typename Kokkos::View<Point<dim, Number> **,
685 typename Kokkos::View<Number **[dim][dim],
692 typename Kokkos::View<Number **,
713 typename Kokkos::View<
730 const unsigned int n_q_points,
731 const unsigned int q_point)
const
743 const unsigned int q_point)
const
757 template <
int dim,
typename Number>
758 DataHost<dim, Number>
760 const typename ::Portable::MatrixFree<dim, Number>::Data &
data,
772 data_host.
q_points = Kokkos::create_mirror(
data.q_points);
787 data_host.
JxW = Kokkos::create_mirror(
data.JxW);
788 Kokkos::deep_copy(data_host.
JxW,
data.JxW);
802 template <
int dim,
typename Number>
803 inline const std::vector<std::vector<
812 template <
int dim,
typename Number>
813 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
821 template <
int dim,
typename Number>
Abstract base class for mapping classes.
const std::vector< std::vector< CellFilter > > & get_colored_graph() const
std::vector< std::vector< CellFilter > > graph
void reinit(const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const AdditionalData &additional_data=AdditionalData())
void internal_reinit(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const IteratorFiltersType &iterator_filter, const std::shared_ptr< const MPI_Comm > &comm, const AdditionalData additional_data)
unsigned int n_components
std::vector< Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space > > constraint_mask
unsigned int padding_length
unsigned int get_padding_length() const
unsigned int dofs_per_cell
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > constraint_weights
const DoFHandler< dim > * dof_handler
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_gradients
void initialize_dof_vector(LinearAlgebra::distributed::Vector< Number, MemorySpaceType > &vec) const
void reinit(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const IteratorFiltersType &iterator_filter, const AdditionalData &additional_data=AdditionalData())
std::vector< Kokkos::View< Number **[dim][dim], MemorySpace::Default::kokkos_space > > inv_jacobian
Kokkos::View< types::global_dof_index *, MemorySpace::Default::kokkos_space > constrained_dofs
std::vector< Kokkos::View< point_type **, MemorySpace::Default::kokkos_space > > q_points
types::global_dof_index n_dofs
unsigned int q_points_per_cell
void distributed_cell_loop(const Functor &func, const LinearAlgebra::distributed::Vector< Number, MemorySpace::Default > &src, LinearAlgebra::distributed::Vector< Number, MemorySpace::Default > &dst) const
std::vector< unsigned int > row_start
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > co_shape_gradients
std::vector< Kokkos::View< types::global_dof_index **, MemorySpace::Default::kokkos_space > > local_to_global
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_values
std::size_t memory_consumption() const
void set_constrained_values(const Number val, VectorType &dst) const
unsigned int scalar_dofs_per_cell
unsigned int n_constrained_dofs
void copy_constrained_values(const VectorType &src, VectorType &dst) const
std::vector< Kokkos::View< Number **, MemorySpace::Default::kokkos_space > > JxW
bool overlap_communication_computation
Data get_data(unsigned int color) const
const DoFHandler< dim > & get_dof_handler() const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner
void serial_cell_loop(const Functor &func, const VectorType &src, VectorType &dst) const
void evaluate_coefficients(Functor func) const
void reinit(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const AdditionalData &additional_data=AdditionalData())
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_vector_partitioner() const
DataHost< dim, Number > copy_mf_data_to_host(const typename::Portable::MatrixFree< dim, Number >::Data &data, const UpdateFlags &update_flags)
std::vector< unsigned int > n_cells
void cell_loop(const Functor &func, const VectorType &src, VectorType &dst) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
@ update_JxW_values
Transformed quadrature weights.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
std::vector< index_type > data
#define DEAL_II_HOST_DEVICE
::Kokkos::DefaultExecutionSpace::memory_space kokkos_space
Kokkos::View< types::global_dof_index **, MemorySpace::Default::kokkos_space >::HostMirror local_to_global
Kokkos::View< Number **, MemorySpace::Default::kokkos_space >::HostMirror JxW
Point< dim, Number > get_quadrature_point(const unsigned int cell, const unsigned int q_point) const
unsigned int padding_length
Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space >::HostMirror constraint_mask
Kokkos::View< Number **[dim][dim], MemorySpace::Default::kokkos_space >::HostMirror inv_jacobian
Kokkos::View< Point< dim, Number > **, MemorySpace::Default::kokkos_space >::HostMirror q_points
unsigned int local_q_point_id(const unsigned int cell, const unsigned int n_q_points, const unsigned int q_point) const
AdditionalData(const UpdateFlags mapping_update_flags=update_gradients|update_JxW_values|update_quadrature_points, const bool use_coloring=false, const bool overlap_communication_computation=false)
bool overlap_communication_computation
UpdateFlags mapping_update_flags
Kokkos::View< Number **, MemorySpace::Default::kokkos_space > JxW
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > constraint_weights
unsigned int local_q_point_id(const unsigned int cell, const unsigned int n_q_points, const unsigned int q_point) const
Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space > constraint_mask
unsigned int n_components
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_values
unsigned int padding_length
Kokkos::View< Number **[dim][dim], MemorySpace::Default::kokkos_space > inv_jacobian
Kokkos::View< point_type **, MemorySpace::Default::kokkos_space > q_points
Kokkos::View< types::global_dof_index **, MemorySpace::Default::kokkos_space > local_to_global
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_gradients
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > co_shape_gradients
Portable::MatrixFree< dim, Number >::point_type & get_quadrature_point(const unsigned int cell, const unsigned int q_point) const
Kokkos::View< Number ***, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewGradients
SharedData(const TeamHandle &team_member, const SharedViewValues &values, const SharedViewGradients &gradients)
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle
Kokkos::View< Number **, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewValues
SharedViewGradients gradients