ScratchData< dim, spacedim, number > Class Template Reference

Developer Documentation: MeltPoolDG::ScratchData< dim, spacedim, number > Class Template Reference
Developer Documentation
MeltPoolDG::ScratchData< dim, spacedim, number > Class Template Reference

Container for shared scratch data between operations/operators. More...

#include <scratch_data.hpp>

Public Member Functions

 ScratchData (const MPI_Comm mpi_communicator, const unsigned int verbosity_level_in, const bool do_matrix_free)
 Construct a scratch data container.
 
void reinit (const dealii::Mapping< dim, spacedim > &mapping, const std::vector< const dealii::DoFHandler< dim, spacedim > * > &dof_handler, const std::vector< const dealii::AffineConstraints< number > * > &constraint, const std::vector< dealii::Quadrature< dim > > &quad, const bool enable_boundary_face_loops, const bool enable_inner_face_loops, const bool enable_normal_vector_update=false)
 Set up mapping, DoFHandlers, constraints, quadrature rules and matrix-free data in a single call.
 
void set_mapping (const dealii::Mapping< dim, spacedim > &mapping)
 Set the mapping by value.
 
void set_mapping (const std::shared_ptr< dealii::Mapping< dim, spacedim > > mapping)
 Set the mapping from a shared pointer.
 
unsigned int attach_dof_handler (const dealii::DoFHandler< dim, spacedim > &dof_handler)
 Attach a DoFHandler and return its index.
 
unsigned int attach_constraint_matrix (const dealii::AffineConstraints< number > &constraint)
 Attach a constraint matrix and return its index.
 
unsigned int attach_dof_handler_and_constraint (const dealii::DoFHandler< dim, spacedim > &dof_handler, const dealii::AffineConstraints< number > &constraint)
 Attach a DoFHandler and its corresponding constraint matrix.
 
unsigned int attach_quadrature (const dealii::Quadrature< dim > &quadrature)
 Attach a cell quadrature rule and create a corresponding face rule.
 
void create_partitioning ()
 Build partitioning and cell-size information for all attached DoFHandlers.
 
void build (const bool enable_boundary_face_loops, const bool enable_inner_face_loops, const bool enable_normal_vector_update=false, const bool enable_inner_face_hessians_update=false)
 Build matrix-free and mapping-related data structures.
 
void initialize_dof_vector (VectorType &vec, const unsigned int dof_idx) const
 Initialize a distributed vector for a given DoF index.
 
void initialize_dof_vector (BlockVectorType &vec, const unsigned int dof_idx) const
 Initialize a block vector with dim components for a given DoF index.
 
void initialize_dof_vector (BlockVectorType &vec, const std::array< unsigned int, dim > &dof_indices_per_block) const
 Initialize DoFs vectors with a per block DoF index.
 
void initialize_bc_vector (VectorType &vec, const unsigned int dof_idx) const
 Initialize a vector and distribute constraints for a given DoF index.
 
void initialize_bc_vector (BlockVectorType &vec, const unsigned int dof_idx) const
 Initialize all blocks of a block vector and distribute constraints.
 
void clear ()
 Clear all attached data and reset to the default-constructed state.
 
void create_remote_point_evaluation (const unsigned int dof_idx, const std::function< std::vector< bool >()> &marked_vertices={})
 Create a dealii::Utilities::MPI::RemotePointEvaluation object for a given DoF index, if it does not already exist.
 
const dealii::Mapping< dim, spacedim > & get_mapping () const
 Access the stored mapping.
 
const dealii::FiniteElement< dim, spacedim > & get_fe (const unsigned int fe_index) const
 Get the finite element associated with a given DoF index.
 
const dealii::AffineConstraints< number > & get_constraint (const unsigned int constraint_index) const
 Get a constraint object by index (const overload).
 
dealii::AffineConstraints< number > & get_constraint (const unsigned int constraint_index)
 Get a constraint object by index (non-const overload).
 
const std::vector< const dealii::AffineConstraints< number > * > & get_constraints () const
 Get the list of all attached constraint matrices.
 
const dealii::Quadrature< dim > & get_quadrature (const unsigned int quad_index) const
 Get a cell quadrature rule by index.
 
const std::vector< dealii::Quadrature< dim > > & get_quadratures () const
 Get all stored cell quadrature rules.
 
const dealii::Quadrature< dim - 1 > & get_face_quadrature (const unsigned int quad_index) const
 Get a face quadrature rule corresponding to a given cell rule.
 
const std::vector< dealii::Quadrature< dim - 1 > > & get_face_quadratures () const
 Get all stored face quadrature rules.
 
dealii::MatrixFree< dim, number, VectorizedArrayType > & get_matrix_free ()
 Access the internal MatrixFree object (non-const).
 
const dealii::MatrixFree< dim, number, VectorizedArrayType > & get_matrix_free () const
 Access the internal MatrixFree object (const).
 
const dealii::DoFHandler< dim, spacedim > & get_dof_handler (const unsigned int dof_idx) const
 Get a DoFHandler by index (const overload).
 
dealii::DoFHandler< dim, spacedim > & get_dof_handler (const unsigned int dof_idx)
 Get a DoFHandler by index (non-const overload).
 
const std::vector< const dealii::DoFHandler< dim, spacedim > * > & get_dof_handlers () const
 Get the vector of all attached DoFHandlers.
 
const dealii::Triangulation< dim > & get_triangulation (const unsigned int dof_idx=0) const
 Get the triangulation associated with a given DoFHandler index.
 
unsigned int get_n_dofs_per_cell (const unsigned int dof_idx) const
 Get the number of DoFs per cell for a given DoFHandler index.
 
unsigned int get_degree (const unsigned int dof_idx) const
 Get the polynomial degree of the finite element at a given DoF index.
 
unsigned int get_n_q_points (const unsigned int dof_idx) const
 Get the number of quadrature points for a given quadrature index.
 
const number & get_min_cell_size () const
 Get the global minimum cell size.
 
number get_min_cell_size (const unsigned int dof_idx) const
 Get a suitable minimum cell size for a given finite element.
 
const number & get_max_cell_size () const
 Get the global maximum cell size.
 
const number & get_min_diameter () const
 Get the minimal cell diameter over the triangulation.
 
const dealii::AlignedVector< dealii::VectorizedArray< number > > & get_cell_sizes () const
 Get the vector of cell sizes used by the MatrixFree object.
 
MPI_Comm get_mpi_comm (const unsigned int dof_idx=0) const
 Get the MPI communicator for a given DoFHandler.
 
const dealii::IndexSet & get_locally_owned_dofs (const unsigned int dof_idx) const
 Get the set of locally owned DoFs for a given DoFHandler index.
 
const dealii::IndexSet & get_locally_relevant_dofs (const unsigned int dof_idx) const
 Get the set of locally relevant DoFs for a given DoFHandler index.
 
const std::shared_ptr< dealii::Utilities::MPI::Partitioner > & get_partitioner (const unsigned int dof_idx) const
 Get the partitioner object for a given DoFHandler index.
 
const ConditionalOStream get_pcout (const unsigned int level=1) const
 Get a ConditionalOStream associated with a given verbosity level.
 
unsigned int get_cell_range_category (const std::pair< unsigned, unsigned > &cell_range) const
 Get the cell range category for a given cell range.
 
std::pair< unsigned int, unsigned int > get_face_range_category (const std::pair< unsigned, unsigned > &face_range) const
 Get the face range category for a given face range.
 
bool is_hex_mesh (const unsigned int dof_idx=0) const
 Check whether the underlying mesh is a pure hypercube mesh.
 
bool is_FE_Q_iso_Q_1 (const unsigned int dof_idx, const unsigned int component=0) const
 Check whether a given component uses FE_Q_iso_Q1.
 
bool is_FE_DGQ (const unsigned int dof_idx, const unsigned int component=0) const
 Check whether a given component uses FE_DGQ.
 
CutUtil::CutPhaseType get_cut_type (const unsigned int dof_idx) const
 Get the cut-cell phase type for a given DoFHandler.
 
dealii::TimerOutput & get_timer () const
 Access the timer associated with this scratch data object.
 
dealii::Utilities::MPI::RemotePointEvaluation< dim, dim > & get_remote_point_evaluation (const unsigned int dof_idx) const
 Access the RemotePointEvaluation object for a given DoF index.
 

Public Attributes

bool enable_boundary_faces
 Flag indicating whether boundary-face matrix-free loops are enabled.
 
bool enable_inner_faces
 Flag indicating whether interior-face matrix-free loops are enabled.
 

Private Types

using VectorizedArrayType = dealii::VectorizedArray< number >
 
using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using BlockVectorType = dealii::LinearAlgebra::distributed::BlockVector< number >
 

Private Member Functions

void create_pcout (MPI_Comm mpi_communicator)
 Helper function that (re)creates the internal ConditionalOStreams.
 

Private Attributes

bool do_matrix_free
 
std::vector< dealii::ConditionalOStream > pcout
 
std::shared_ptr< dealii::Mapping< dim, spacedim > > mapping
 
std::vector< const dealii::DoFHandler< dim, spacedim > * > dof_handler
 
std::vector< const dealii::AffineConstraints< number > * > constraint
 
std::vector< dealii::Quadrature< dim > > quad
 
std::vector< dealii::Quadrature< dim - 1 > > face_quad
 
number min_cell_size
 
number max_cell_size
 
number min_diameter
 
dealii::AlignedVector< dealii::VectorizedArray< number > > cell_sizes
 
std::vector< dealii::IndexSet > locally_owned_dofs
 
std::vector< dealii::IndexSet > locally_relevant_dofs
 
std::vector< std::shared_ptr< dealii::Utilities::MPI::Partitioner > > partitioner
 
std::map< unsigned int, std::shared_ptr< dealii::Utilities::MPI::RemotePointEvaluation< dim, dim > > > rpe
 
const unsigned int verbosity_level
 
std::shared_ptr< dealii::TimerOutput > timer
 
dealii::MatrixFree< dim, number, VectorizedArrayTypematrix_free
 

Detailed Description

template<int dim, int spacedim, typename number>
class MeltPoolDG::ScratchData< dim, spacedim, number >

Container for shared scratch data between operations/operators.

This class centralizes all data that is commonly needed by different operations/operators working on the same mesh:

  • The dealii::Mapping used to transfer between reference and real cells.
  • One or more dealii::DoFHandler objects and their associated dealii::AffineConstraints.
  • Cell and face quadrature rules.
  • MPI-related data such as locally owned / relevant DoFs and dealii::Utilities::MPI::Partitioner objects.
  • A dealii::MatrixFree object for matrix-free operator evaluations, plus per-cell size information.
  • Optional utilities such as remote point evaluation and timing output.

The class can be used both in matrix-free and matrix-based workflows, controlled by the do_matrix_free flag passed to the constructor. It is intended to be initialized once per mesh / discretization and then reused by multiple operators to avoid duplicated setup work.

Template Parameters
dimTopological dimension of the problem.
spacedimDimension of the embedding physical space.
numberScalar number type used for matrix-free data structures.

Member Typedef Documentation

◆ BlockVectorType

template<int dim, int spacedim, typename number >
using MeltPoolDG::ScratchData< dim, spacedim, number >::BlockVectorType = dealii::LinearAlgebra::distributed::BlockVector<number>
private

◆ VectorizedArrayType

template<int dim, int spacedim, typename number >
using MeltPoolDG::ScratchData< dim, spacedim, number >::VectorizedArrayType = dealii::VectorizedArray<number>
private

◆ VectorType

template<int dim, int spacedim, typename number >
using MeltPoolDG::ScratchData< dim, spacedim, number >::VectorType = dealii::LinearAlgebra::distributed::Vector<number>
private

Constructor & Destructor Documentation

◆ ScratchData()

template<int dim, int spacedim, typename number >
MeltPoolDG::ScratchData< dim, spacedim, number >::ScratchData ( const MPI_Comm  mpi_communicator,
const unsigned int  verbosity_level_in,
const bool  do_matrix_free 
)

Construct a scratch data container.

Initializes the internal output streams and creates an associated dealii::TimerOutput object.

Parameters
mpi_communicatorMPI communicator used for all distributed data.
verbosity_level_inVerbosity level for dealii::ConditionalOStream output (0–3, where 0 effectively disables output).
do_matrix_freeIf true, build() will set up the internal dealii::MatrixFree object. If false, only partitioning and related data are created.

Member Function Documentation

◆ attach_constraint_matrix()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::attach_constraint_matrix ( const dealii::AffineConstraints< number > &  constraint)

Attach a constraint matrix and return its index.

The constraint pointer is stored internally; the referenced object must outlive this ScratchData instance.

Parameters
constraintConstraint matrix to attach.
Returns
Index of the newly attached constraint matrix (0-based).

◆ attach_dof_handler()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::attach_dof_handler ( const dealii::DoFHandler< dim, spacedim > &  dof_handler)

Attach a DoFHandler and return its index.

The DoFHandler pointer is stored internally; the referenced object must outlive this ScratchData instance.

Parameters
dof_handlerDoFHandler to attach.
Returns
Index of the newly attached DoFHandler (0-based).

◆ attach_dof_handler_and_constraint()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::attach_dof_handler_and_constraint ( const dealii::DoFHandler< dim, spacedim > &  dof_handler,
const dealii::AffineConstraints< number > &  constraint 
)

Attach a DoFHandler and its corresponding constraint matrix.

This is a convenience wrapper combining attach_dof_handler() and attach_constraint_matrix(), and asserts that the numbers of attached DoFHandlers and constraints remain consistent.

Parameters
dof_handlerDoFHandler to attach.
constraintConstraint matrix corresponding to dof_handler.
Returns
Index of the newly attached constraint / DoFHandler pair.

◆ attach_quadrature()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::attach_quadrature ( const dealii::Quadrature< dim > &  quadrature)

Attach a cell quadrature rule and create a corresponding face rule.

The provided cell quadrature is stored internally. A matching face quadrature is constructed using deal.II's internal utilities, supporting both tensor-product and simplex elements.

Parameters
quadratureCell quadrature rule to attach.
Returns
Index of the newly attached quadrature rule (0-based).

◆ build()

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::build ( const bool  enable_boundary_face_loops,
const bool  enable_inner_face_loops,
const bool  enable_normal_vector_update = false,
const bool  enable_inner_face_hessians_update = false 
)

Build matrix-free and mapping-related data structures.

If the class has been constructed with do_matrix_free = true, this function sets up the internal dealii::MatrixFree object from the stored mapping, DoFHandlers, constraints and quadrature rules. It also fills the vector of per-cell sizes.

The enable_* flags control which mapping update flags are set for cell, boundary-face and inner-face integrals.

Parameters
enable_boundary_face_loopsEnable setup of boundary face data.
enable_inner_face_loopsEnable setup of interior face data.
enable_normal_vector_updateInclude normal vectors in mapping updates.
enable_inner_face_hessians_updateInclude Hessians in mapping updates for inner face loops.

◆ clear()

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::clear ( )

Clear all attached data and reset to the default-constructed state.

This removes attached DoFHandlers, constraints, quadrature rules, partitioning information, mapping and matrix-free data. It does not modify the verbosity level or the do_matrix_free flag.

◆ create_partitioning()

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::create_partitioning ( )

Build partitioning and cell-size information for all attached DoFHandlers.

This function (re-)computes:

It assumes that at least one DoFHandler has been attached.

◆ create_pcout()

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::create_pcout ( MPI_Comm  mpi_communicator)
private

Helper function that (re)creates the internal ConditionalOStreams.

One ConditionalOStream is created for each verbosity level between 0 and 3.

Parameters
mpi_communicatorMPI communicator used to decide which rank prints.

◆ create_remote_point_evaluation()

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::create_remote_point_evaluation ( const unsigned int  dof_idx,
const std::function< std::vector< bool >()> &  marked_vertices = {} 
)

Create a dealii::Utilities::MPI::RemotePointEvaluation object for a given DoF index, if it does not already exist.

The marked_vertices callback allows to mark the vertices at which remote point evaluation will be performed.

Parameters
dof_idxIndex of the DoFHandler for which the object is created.
marked_verticesCallback returning a boolean mask of marked vertices.

◆ get_cell_range_category()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::get_cell_range_category ( const std::pair< unsigned, unsigned > &  cell_range) const

Get the cell range category for a given cell range.

This is a direct wrapper around dealii::MatrixFree::get_cell_range_category().

Parameters
cell_rangePair of indices denoting the cell range.
Returns
Category index of the cell range.

◆ get_cell_sizes()

template<int dim, int spacedim, typename number >
const dealii::AlignedVector< dealii::VectorizedArray< number > > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_cell_sizes ( ) const

Get the vector of cell sizes used by the MatrixFree object.

Each entry corresponds to a cell batch and stores the cell size in a dealii::VectorizedArray.

Returns
Constant reference to the cell size vector.

◆ get_constraint() [1/2]

template<int dim, int spacedim, typename number >
dealii::AffineConstraints< number > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_constraint ( const unsigned int  constraint_index)

Get a constraint object by index (non-const overload).

Parameters
constraint_indexIndex of the requested constraint matrix.
Returns
Reference to the constraint matrix.

◆ get_constraint() [2/2]

template<int dim, int spacedim, typename number >
const dealii::AffineConstraints< number > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_constraint ( const unsigned int  constraint_index) const

Get a constraint object by index (const overload).

Parameters
constraint_indexIndex of the requested constraint matrix.
Returns
Constant reference to the constraint matrix.

◆ get_constraints()

template<int dim, int spacedim, typename number >
const std::vector< const dealii::AffineConstraints< number > * > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_constraints ( ) const

Get the list of all attached constraint matrices.

Returns
Vector of pointers to all attached constraint matrices.

◆ get_cut_type()

template<int dim, int spacedim, typename number >
CutUtil::CutPhaseType MeltPoolDG::ScratchData< dim, spacedim, number >::get_cut_type ( const unsigned int  dof_idx) const

Get the cut-cell phase type for a given DoFHandler.

Delegates to CutUtil::get_cut_type() for the attached DoFHandler.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Cut-phase type associated with the DoFHandler.

◆ get_degree()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::get_degree ( const unsigned int  dof_idx) const

Get the polynomial degree of the finite element at a given DoF index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Polynomial degree of the associated finite element.

◆ get_dof_handler() [1/2]

template<int dim, int spacedim, typename number >
dealii::DoFHandler< dim, spacedim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_dof_handler ( const unsigned int  dof_idx)

Get a DoFHandler by index (non-const overload).

Parameters
dof_idxIndex of the DoFHandler.
Returns
Reference to the DoFHandler.

◆ get_dof_handler() [2/2]

template<int dim, int spacedim, typename number >
const dealii::DoFHandler< dim, spacedim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_dof_handler ( const unsigned int  dof_idx) const

Get a DoFHandler by index (const overload).

Parameters
dof_idxIndex of the DoFHandler.
Returns
Constant reference to the DoFHandler.

◆ get_dof_handlers()

template<int dim, int spacedim, typename number >
const std::vector< const dealii::DoFHandler< dim, spacedim > * > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_dof_handlers ( ) const

Get the vector of all attached DoFHandlers.

Returns
Vector of pointers to all DoFHandlers.

◆ get_face_quadrature()

template<int dim, int spacedim, typename number >
const dealii::Quadrature< dim - 1 > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_face_quadrature ( const unsigned int  quad_index) const

Get a face quadrature rule corresponding to a given cell rule.

Parameters
quad_indexIndex of the associated cell quadrature rule.
Returns
Constant reference to the face quadrature rule.

◆ get_face_quadratures()

template<int dim, int spacedim, typename number >
const std::vector< dealii::Quadrature< dim - 1 > > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_face_quadratures ( ) const

Get all stored face quadrature rules.

Returns
Vector of face quadrature rules.

◆ get_face_range_category()

template<int dim, int spacedim, typename number >
std::pair< unsigned int, unsigned int > MeltPoolDG::ScratchData< dim, spacedim, number >::get_face_range_category ( const std::pair< unsigned, unsigned > &  face_range) const

Get the face range category for a given face range.

This is a direct wrapper around dealii::MatrixFree::get_face_range_category().

Parameters
face_rangePair of indices denoting the face range.
Returns
Pair of category indices for the two sides of the face range.

◆ get_fe()

template<int dim, int spacedim, typename number >
const dealii::FiniteElement< dim, spacedim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_fe ( const unsigned int  fe_index) const

Get the finite element associated with a given DoF index.

Parameters
fe_indexIndex of the DoFHandler / finite element.
Returns
Constant reference to the corresponding finite element.

◆ get_locally_owned_dofs()

template<int dim, int spacedim, typename number >
const dealii::IndexSet & MeltPoolDG::ScratchData< dim, spacedim, number >::get_locally_owned_dofs ( const unsigned int  dof_idx) const

Get the set of locally owned DoFs for a given DoFHandler index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
IndexSet of locally owned DoFs.

◆ get_locally_relevant_dofs()

template<int dim, int spacedim, typename number >
const dealii::IndexSet & MeltPoolDG::ScratchData< dim, spacedim, number >::get_locally_relevant_dofs ( const unsigned int  dof_idx) const

Get the set of locally relevant DoFs for a given DoFHandler index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
IndexSet of locally relevant DoFs.

◆ get_mapping()

template<int dim, int spacedim, typename number >
const dealii::Mapping< dim, spacedim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_mapping ( ) const

Access the stored mapping.

Returns
Constant reference to the stored mapping.

◆ get_matrix_free() [1/2]

template<int dim, int spacedim, typename number >
dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_matrix_free ( )

Access the internal MatrixFree object (non-const).

Returns
Reference to the MatrixFree object.

◆ get_matrix_free() [2/2]

template<int dim, int spacedim, typename number >
const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_matrix_free ( ) const

Access the internal MatrixFree object (const).

Returns
Constant reference to the MatrixFree object.

◆ get_max_cell_size()

template<int dim, int spacedim, typename number >
const number & MeltPoolDG::ScratchData< dim, spacedim, number >::get_max_cell_size ( ) const

Get the global maximum cell size.

Returns
Reference to the maximal cell size.

◆ get_min_cell_size() [1/2]

template<int dim, int spacedim, typename number >
const number & MeltPoolDG::ScratchData< dim, spacedim, number >::get_min_cell_size ( ) const

Get the global minimum cell size.

This is derived from the minimal cell diameter divided by sqrt(dim).

Returns
Reference to the minimal cell size.

◆ get_min_cell_size() [2/2]

template<int dim, int spacedim, typename number >
number MeltPoolDG::ScratchData< dim, spacedim, number >::get_min_cell_size ( const unsigned int  dof_idx) const

Get a suitable minimum cell size for a given finite element.

For FE_Q_iso_Q1 elements, this is identical to get_min_cell_size(). For higher-order elements, the minimum cell size is scaled by the polynomial degree.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Minimum cell size corresponding to the finite element at dof_idx.

◆ get_min_diameter()

template<int dim, int spacedim, typename number >
const number & MeltPoolDG::ScratchData< dim, spacedim, number >::get_min_diameter ( ) const

Get the minimal cell diameter over the triangulation.

Returns
Reference to the minimal cell diameter.

◆ get_mpi_comm()

template<int dim, int spacedim, typename number >
MPI_Comm MeltPoolDG::ScratchData< dim, spacedim, number >::get_mpi_comm ( const unsigned int  dof_idx = 0) const

Get the MPI communicator for a given DoFHandler.

Parameters
dof_idxIndex of the DoFHandler (defaults to 0).
Returns
MPI communicator associated with the DoFHandler.

◆ get_n_dofs_per_cell()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::get_n_dofs_per_cell ( const unsigned int  dof_idx) const

Get the number of DoFs per cell for a given DoFHandler index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Number of DoFs per cell.

◆ get_n_q_points()

template<int dim, int spacedim, typename number >
unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::get_n_q_points ( const unsigned int  dof_idx) const

Get the number of quadrature points for a given quadrature index.

Parameters
quad_idxIndex of the quadrature rule.
Returns
Number of quadrature points.

◆ get_partitioner()

template<int dim, int spacedim, typename number >
const std::shared_ptr< dealii::Utilities::MPI::Partitioner > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_partitioner ( const unsigned int  dof_idx) const

Get the partitioner object for a given DoFHandler index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Shared pointer to the corresponding MPI partitioner.

◆ get_pcout()

template<int dim, int spacedim, typename number >
const ConditionalOStream MeltPoolDG::ScratchData< dim, spacedim, number >::get_pcout ( const unsigned int  level = 1) const

Get a ConditionalOStream associated with a given verbosity level.

Level 0 is always inactive, higher levels are active depending on the verbosity level passed to the constructor.

Parameters
levelVerbosity level (0–3).
Returns
ConditionalOStream for the requested level.

◆ get_quadrature()

template<int dim, int spacedim, typename number >
const dealii::Quadrature< dim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_quadrature ( const unsigned int  quad_index) const

Get a cell quadrature rule by index.

Parameters
quad_indexIndex of the quadrature rule.
Returns
Constant reference to the quadrature rule.

◆ get_quadratures()

template<int dim, int spacedim, typename number >
const std::vector< dealii::Quadrature< dim > > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_quadratures ( ) const

Get all stored cell quadrature rules.

Returns
Vector of cell quadrature rules.

◆ get_remote_point_evaluation()

template<int dim, int spacedim, typename number >
dealii::Utilities::MPI::RemotePointEvaluation< dim, dim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_remote_point_evaluation ( const unsigned int  dof_idx) const

Access the RemotePointEvaluation object for a given DoF index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Reference to the corresponding RemotePointEvaluation object.
Exceptions
dealii::ExcMessageif no RemotePointEvaluation object was created yet for the given dof_idx.

◆ get_timer()

template<int dim, int spacedim, typename number >
dealii::TimerOutput & MeltPoolDG::ScratchData< dim, spacedim, number >::get_timer ( ) const

Access the timer associated with this scratch data object.

Returns
Reference to the internal dealii::TimerOutput.

◆ get_triangulation()

template<int dim, int spacedim, typename number >
const dealii::Triangulation< dim > & MeltPoolDG::ScratchData< dim, spacedim, number >::get_triangulation ( const unsigned int  dof_idx = 0) const

Get the triangulation associated with a given DoFHandler index.

Parameters
dof_idxIndex of the DoFHandler.
Returns
Constant reference to the associated triangulation.

◆ initialize_bc_vector() [1/2]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::initialize_bc_vector ( BlockVectorType vec,
const unsigned int  dof_idx 
) const

Initialize all blocks of a block vector and distribute constraints.

All blocks are initialized using initialize_bc_vector() with the same dof_idx.

Parameters
[out]vecBlock vector to be initialized and constrained.
[in]dof_idxIndex of the DoFHandler / constraints pair to use.

◆ initialize_bc_vector() [2/2]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::initialize_bc_vector ( VectorType vec,
const unsigned int  dof_idx 
) const

Initialize a vector and distribute constraints for a given DoF index.

This is a convenience wrapper around initialize_dof_vector() which additionally applies the corresponding dealii::AffineConstraints via dealii::AffineConstraints::distribute().

Parameters
[out]vecVector to be initialized and constrained.
[in]dof_idxIndex of the DoFHandler / constraints pair to use.

◆ initialize_dof_vector() [1/3]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::initialize_dof_vector ( BlockVectorType vec,
const std::array< unsigned int, dim > &  dof_indices_per_block 
) const

Initialize DoFs vectors with a per block DoF index.

Parameters
[out]vecBlockVector initialized with the DoF indices.
[in]dof_indices_per_blockArray of DoF indices associated with the different blocks of the BlockVector.

◆ initialize_dof_vector() [2/3]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::initialize_dof_vector ( BlockVectorType vec,
const unsigned int  dof_idx 
) const

Initialize a block vector with dim components for a given DoF index.

All blocks are initialized consistently with the same DoFHandler index.

Parameters
[out]vecBlock vector to be initialized (resized to dim blocks).
[in]dof_idxIndex of the DoFHandler / partitioning to use.

◆ initialize_dof_vector() [3/3]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::initialize_dof_vector ( VectorType vec,
const unsigned int  dof_idx 
) const

Initialize a distributed vector for a given DoF index.

Either delegates to dealii::MatrixFree::initialize_dof_vector() (matrix-free mode) or reinitializes the vector using locally owned / relevant DoFs and the associated MPI communicator.

Parameters
[out]vecVector to be initialized.
[in]dof_idxIndex of the DoFHandler / partitioning to use.

◆ is_FE_DGQ()

template<int dim, int spacedim, typename number >
bool MeltPoolDG::ScratchData< dim, spacedim, number >::is_FE_DGQ ( const unsigned int  dof_idx,
const unsigned int  component = 0 
) const

Check whether a given component uses FE_DGQ.

This is implemented via string matching on the finite element name.

Parameters
dof_idxIndex of the DoFHandler.
componentComponent index within the finite element.
Returns
True if the sub-element is FE_DGQ, false otherwise.

◆ is_FE_Q_iso_Q_1()

template<int dim, int spacedim, typename number >
bool MeltPoolDG::ScratchData< dim, spacedim, number >::is_FE_Q_iso_Q_1 ( const unsigned int  dof_idx,
const unsigned int  component = 0 
) const

Check whether a given component uses FE_Q_iso_Q1.

This is implemented via string matching on the finite element name.

Parameters
dof_idxIndex of the DoFHandler.
componentComponent index within the finite element.
Returns
True if the sub-element is FE_Q_iso_Q1, false otherwise.

◆ is_hex_mesh()

template<int dim, int spacedim, typename number >
bool MeltPoolDG::ScratchData< dim, spacedim, number >::is_hex_mesh ( const unsigned int  dof_idx = 0) const

Check whether the underlying mesh is a pure hypercube mesh.

Parameters
dof_idxIndex of the DoFHandler.
Returns
True if all reference cells are hypercubes, false otherwise.

◆ reinit()

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::reinit ( const dealii::Mapping< dim, spacedim > &  mapping,
const std::vector< const dealii::DoFHandler< dim, spacedim > * > &  dof_handler,
const std::vector< const dealii::AffineConstraints< number > * > &  constraint,
const std::vector< dealii::Quadrature< dim > > &  quad,
const bool  enable_boundary_face_loops,
const bool  enable_inner_face_loops,
const bool  enable_normal_vector_update = false 
)

Set up mapping, DoFHandlers, constraints, quadrature rules and matrix-free data in a single call.

This is the high-level convenience entry point that clears any existing state, attaches all provided DoFHandlers, constraint matrices and quadrature rules, (re-)creates partitioning information and then calls build() to initialize matrix-free data if requested.

Parameters
mappingMapping used for all attached DoFHandlers.
dof_handlerVector of DoFHandlers to attach.
constraintVector of constraint matrices corresponding one-to-one to dof_handler.
quadVector of cell quadrature rules to attach.
enable_boundary_face_loopsIf true, face data for boundary loops are set up in build().
enable_inner_face_loopsIf true, face data for interior faces are set up in build().
enable_normal_vector_updateIf true, normal vectors are included in the mapping update flags.

◆ set_mapping() [1/2]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::set_mapping ( const dealii::Mapping< dim, spacedim > &  mapping)

Set the mapping by value.

Stores a clone of the given mapping object internally.

Parameters
mappingMapping object to be cloned and stored.

◆ set_mapping() [2/2]

template<int dim, int spacedim, typename number >
void MeltPoolDG::ScratchData< dim, spacedim, number >::set_mapping ( const std::shared_ptr< dealii::Mapping< dim, spacedim > >  mapping)

Set the mapping from a shared pointer.

The shared pointer is stored internally and may be shared with other parts of the code.

Parameters
mappingShared pointer to the mapping object to use.

Member Data Documentation

◆ cell_sizes

template<int dim, int spacedim, typename number >
dealii::AlignedVector<dealii::VectorizedArray<number> > MeltPoolDG::ScratchData< dim, spacedim, number >::cell_sizes
private

◆ constraint

template<int dim, int spacedim, typename number >
std::vector<const dealii::AffineConstraints<number> *> MeltPoolDG::ScratchData< dim, spacedim, number >::constraint
private

◆ do_matrix_free

template<int dim, int spacedim, typename number >
bool MeltPoolDG::ScratchData< dim, spacedim, number >::do_matrix_free
private

◆ dof_handler

template<int dim, int spacedim, typename number >
std::vector<const dealii::DoFHandler<dim, spacedim> *> MeltPoolDG::ScratchData< dim, spacedim, number >::dof_handler
private

◆ enable_boundary_faces

template<int dim, int spacedim, typename number >
bool MeltPoolDG::ScratchData< dim, spacedim, number >::enable_boundary_faces

Flag indicating whether boundary-face matrix-free loops are enabled.

This is set in reinit() / build() based on the corresponding arguments and can be queried by operators.

◆ enable_inner_faces

template<int dim, int spacedim, typename number >
bool MeltPoolDG::ScratchData< dim, spacedim, number >::enable_inner_faces

Flag indicating whether interior-face matrix-free loops are enabled.

This is set in reinit() / build() based on the corresponding arguments and can be queried by operators.

◆ face_quad

template<int dim, int spacedim, typename number >
std::vector<dealii::Quadrature<dim - 1> > MeltPoolDG::ScratchData< dim, spacedim, number >::face_quad
private

◆ locally_owned_dofs

template<int dim, int spacedim, typename number >
std::vector<dealii::IndexSet> MeltPoolDG::ScratchData< dim, spacedim, number >::locally_owned_dofs
private

◆ locally_relevant_dofs

template<int dim, int spacedim, typename number >
std::vector<dealii::IndexSet> MeltPoolDG::ScratchData< dim, spacedim, number >::locally_relevant_dofs
private

◆ mapping

template<int dim, int spacedim, typename number >
std::shared_ptr<dealii::Mapping<dim, spacedim> > MeltPoolDG::ScratchData< dim, spacedim, number >::mapping
private

◆ matrix_free

template<int dim, int spacedim, typename number >
dealii::MatrixFree<dim, number, VectorizedArrayType> MeltPoolDG::ScratchData< dim, spacedim, number >::matrix_free
private

◆ max_cell_size

template<int dim, int spacedim, typename number >
number MeltPoolDG::ScratchData< dim, spacedim, number >::max_cell_size
private

◆ min_cell_size

template<int dim, int spacedim, typename number >
number MeltPoolDG::ScratchData< dim, spacedim, number >::min_cell_size
private

◆ min_diameter

template<int dim, int spacedim, typename number >
number MeltPoolDG::ScratchData< dim, spacedim, number >::min_diameter
private

◆ partitioner

template<int dim, int spacedim, typename number >
std::vector<std::shared_ptr<dealii::Utilities::MPI::Partitioner> > MeltPoolDG::ScratchData< dim, spacedim, number >::partitioner
private

◆ pcout

template<int dim, int spacedim, typename number >
std::vector<dealii::ConditionalOStream> MeltPoolDG::ScratchData< dim, spacedim, number >::pcout
private

◆ quad

template<int dim, int spacedim, typename number >
std::vector<dealii::Quadrature<dim> > MeltPoolDG::ScratchData< dim, spacedim, number >::quad
private

◆ rpe

template<int dim, int spacedim, typename number >
std::map<unsigned int, std::shared_ptr<dealii::Utilities::MPI::RemotePointEvaluation<dim, dim> > > MeltPoolDG::ScratchData< dim, spacedim, number >::rpe
private

◆ timer

template<int dim, int spacedim, typename number >
std::shared_ptr<dealii::TimerOutput> MeltPoolDG::ScratchData< dim, spacedim, number >::timer
mutableprivate

◆ verbosity_level

template<int dim, int spacedim, typename number >
const unsigned int MeltPoolDG::ScratchData< dim, spacedim, number >::verbosity_level
private

The documentation for this class was generated from the following files: