AMR Namespace Reference

Developer Documentation: MeltPoolDG::AMR Namespace Reference
Developer Documentation
MeltPoolDG::AMR Namespace Reference

Namespaces

namespace  internal
 

Classes

class  AMRIndicatorBase
 
class  AMRRegion
 Type-erased wrapper representing a geometric region for adaptive mesh refinement. More...
 
class  BinaryOpIndicatorComposite
 
class  JumpIndicator
 
class  SphereAMRRegion
 Represents a spherical region for adaptive mesh refinement. More...
 
class  SphericalShellAMRRegion
 Represents a spherical shell region for adaptive mesh refinement (AMR). More...
 
class  SSEDIndicator
 

Typedefs

template<int dim>
using MarkCellsForRefinementType = std::function< bool(dealii::Triangulation< dim > &)>
 

Functions

template<typename number >
bool now (const AdaptiveMeshingData< number > &amr, const int n_time_step)
 
template<int dim, typename VectorType , typename number = typename VectorType::value_type>
void refine_grid (const MarkCellsForRefinementType< dim > &mark_cells_for_refinement, const AttachDoFHandlerAndVectorsType< dim, VectorType > &attach_vectors, const std::function< void()> &setup_dof_system, const AdaptiveMeshingData< number > &amr, dealii::Triangulation< dim > &tria, const int n_time_step, const std::function< void()> &post=std::function< void()>(), const std::function< void()> &pre=std::function< void()>())
 
template<int dim, typename VectorType , typename number >
void refine_grid (const std::function< bool(dealii::Triangulation< dim > &)> &mark_cells_for_refinement, const std::function< void(std::vector< VectorType * > &)> &attach_vectors, const std::function< void()> &setup_dof_system, const AdaptiveMeshingData< number > &amr, dealii::DoFHandler< dim > &dof_handler, const int n_time_step, const std::function< void()> &post=std::function< void()>(), const std::function< void()> &pre=std::function< void()>())
 
template<int dim, typename number >
bool mark_fixed_number (dealii::Triangulation< dim > &tria, const dealii::Vector< number > &indicator, const AdaptiveMeshingData< number > &amr_data, dealii::types::global_cell_index max_n_cells=std::numeric_limits< dealii::types::global_cell_index >::max())
 
template<int dim, typename number >
bool mark_fixed_fraction (dealii::Triangulation< dim > &tria, const dealii::Vector< number > &indicator, const AdaptiveMeshingData< number > &amr_data)
 
template<int dim, typename number >
bool set_refinement_flags_in_regions (dealii::Triangulation< dim > &tria, const std::vector< AMRRegion< dim, number > > &regions={}, bool do_coarsening=false)
 Marks cells in a triangulation for refinement if their centers fall inside specified regions.
 
template<int dim, typename VectorType , typename number >
void refine_grid (const MarkCellsForRefinementType< dim > &mark_cells_for_refinement, const std::function< void(std::vector< VectorType * > &)> &attach_vectors, const std::function< void()> &setup_dof_system, const AdaptiveMeshingData< number > &amr, dealii::DoFHandler< dim > &dof_handler, const int n_time_step, const std::function< void()> &post, const std::function< void()> &pre)
 
template void refine_grid (const MarkCellsForRefinementType< 1 > &, const AttachDoFHandlerAndVectorsType< 1, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::Triangulation< 1 > &, const int, const std::function< void()> &, const std::function< void()> &)
 
template void refine_grid (const MarkCellsForRefinementType< 2 > &, const AttachDoFHandlerAndVectorsType< 2, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::Triangulation< 2 > &, const int, const std::function< void()> &, const std::function< void()> &)
 
template void refine_grid (const MarkCellsForRefinementType< 3 > &, const AttachDoFHandlerAndVectorsType< 3, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::Triangulation< 3 > &, const int, const std::function< void()> &, const std::function< void()> &)
 
template void refine_grid (const MarkCellsForRefinementType< 1 > &, const std::function< void(std::vector< dealii::LinearAlgebra::distributed::Vector< double > * > &)> &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::DoFHandler< 1 > &, const int, const std::function< void()> &, const std::function< void()> &)
 
template void refine_grid (const MarkCellsForRefinementType< 2 > &, const std::function< void(std::vector< dealii::LinearAlgebra::distributed::Vector< double > * > &)> &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::DoFHandler< 2 > &, const int, const std::function< void()> &, const std::function< void()> &)
 
template void refine_grid (const MarkCellsForRefinementType< 3 > &, const std::function< void(std::vector< dealii::LinearAlgebra::distributed::Vector< double > * > &)> &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::DoFHandler< 3 > &, const int, const std::function< void()> &, const std::function< void()> &)
 
template bool mark_fixed_number (dealii::Triangulation< 1 > &tria, const dealii::Vector< double > &indicator, const AdaptiveMeshingData< double > &amr_data, dealii::types::global_cell_index max_n_cells)
 
template bool mark_fixed_number (dealii::Triangulation< 2 > &tria, const dealii::Vector< double > &indicator, const AdaptiveMeshingData< double > &amr_data, dealii::types::global_cell_index max_n_cells)
 
template bool mark_fixed_number (dealii::Triangulation< 3 > &tria, const dealii::Vector< double > &indicator, const AdaptiveMeshingData< double > &amr_data, dealii::types::global_cell_index max_n_cells)
 
template bool mark_fixed_fraction (dealii::Triangulation< 1 > &tria, const dealii::Vector< double > &indicator, const AdaptiveMeshingData< double > &amr_data)
 
template bool mark_fixed_fraction (dealii::Triangulation< 2 > &tria, const dealii::Vector< double > &indicator, const AdaptiveMeshingData< double > &amr_data)
 
template bool mark_fixed_fraction (dealii::Triangulation< 3 > &tria, const dealii::Vector< double > &indicator, const AdaptiveMeshingData< double > &amr_data)
 

Typedef Documentation

◆ MarkCellsForRefinementType

template<int dim>
using MeltPoolDG::AMR::MarkCellsForRefinementType = typedef std::function<bool(dealii::Triangulation<dim> &)>

Type alias definition for the lambda function that determines how the mesh is to be refined. If this function determines that the mesh does not change, it return false, true otherwise.

Function Documentation

◆ mark_fixed_fraction() [1/4]

template bool MeltPoolDG::AMR::mark_fixed_fraction ( dealii::Triangulation< 1 > &  tria,
const dealii::Vector< double > &  indicator,
const AdaptiveMeshingData< double > &  amr_data 
)

◆ mark_fixed_fraction() [2/4]

template bool MeltPoolDG::AMR::mark_fixed_fraction ( dealii::Triangulation< 2 > &  tria,
const dealii::Vector< double > &  indicator,
const AdaptiveMeshingData< double > &  amr_data 
)

◆ mark_fixed_fraction() [3/4]

template bool MeltPoolDG::AMR::mark_fixed_fraction ( dealii::Triangulation< 3 > &  tria,
const dealii::Vector< double > &  indicator,
const AdaptiveMeshingData< double > &  amr_data 
)

◆ mark_fixed_fraction() [4/4]

template<int dim, typename number >
bool MeltPoolDG::AMR::mark_fixed_fraction ( dealii::Triangulation< dim > &  tria,
const dealii::Vector< number > &  indicator,
const AdaptiveMeshingData< number > &  amr_data 
)

Marks cells for refinement or coarsening based on the provided indicator.

The marking strategy follows the approach described in deal.II’s documentation for GridRefinement::refine_and_coarsen_fixed_fraction().

Parameters
triaTriangulation whose cells are to be marked for refinement or coarsening. Smaller values indicate a lower need for refinement.
indicatorVector of refinement indicators for the active cells.
amr_dataObject defining the lower and upper fractions of cells to refine or coarsen.

◆ mark_fixed_number() [1/4]

template bool MeltPoolDG::AMR::mark_fixed_number ( dealii::Triangulation< 1 > &  tria,
const dealii::Vector< double > &  indicator,
const AdaptiveMeshingData< double > &  amr_data,
dealii::types::global_cell_index  max_n_cells 
)

◆ mark_fixed_number() [2/4]

template bool MeltPoolDG::AMR::mark_fixed_number ( dealii::Triangulation< 2 > &  tria,
const dealii::Vector< double > &  indicator,
const AdaptiveMeshingData< double > &  amr_data,
dealii::types::global_cell_index  max_n_cells 
)

◆ mark_fixed_number() [3/4]

template bool MeltPoolDG::AMR::mark_fixed_number ( dealii::Triangulation< 3 > &  tria,
const dealii::Vector< double > &  indicator,
const AdaptiveMeshingData< double > &  amr_data,
dealii::types::global_cell_index  max_n_cells 
)

◆ mark_fixed_number() [4/4]

template<int dim, typename number >
bool MeltPoolDG::AMR::mark_fixed_number ( dealii::Triangulation< dim > &  tria,
const dealii::Vector< number > &  indicator,
const AdaptiveMeshingData< number > &  amr_data,
dealii::types::global_cell_index  max_n_cells = std::numeric_limits<dealii::types::global_cell_index>::max() 
)

Marks cells for refinement or coarsening based on the provided indicator.

The marking strategy follows the approach described in deal.II’s documentation for GridRefinement::refine_and_coarsen_fixed_number().

Parameters
triaTriangulation whose cells are to be marked for refinement or coarsening. Smaller values indicate a lower need for refinement.
indicatorVector of refinement indicators for the active cells.
amr_dataObject defining the lower and upper fractions of cells to refine or coarsen.
max_n_cellsMaximum number of total cells allowed in the triangulation.

◆ now()

template<typename number >
bool MeltPoolDG::AMR::now ( const AdaptiveMeshingData< number > &  amr,
const int  n_time_step 
)
inline

determine whether the current

Parameters
n_time_stepis chosen to execute AMR
amrAMR parameters
n_time_stepcurrent time step number

◆ refine_grid() [1/9]

template void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< 1 > &  ,
const AttachDoFHandlerAndVectorsType< 1, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::Triangulation< 1 > &  ,
const int  ,
const std::function< void()> &  ,
const std::function< void()> &   
)

◆ refine_grid() [2/9]

template void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< 1 > &  ,
const std::function< void(std::vector< dealii::LinearAlgebra::distributed::Vector< double > * > &)> &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::DoFHandler< 1 > &  ,
const int  ,
const std::function< void()> &  ,
const std::function< void()> &   
)

◆ refine_grid() [3/9]

template void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< 2 > &  ,
const AttachDoFHandlerAndVectorsType< 2, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::Triangulation< 2 > &  ,
const int  ,
const std::function< void()> &  ,
const std::function< void()> &   
)

◆ refine_grid() [4/9]

template void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< 2 > &  ,
const std::function< void(std::vector< dealii::LinearAlgebra::distributed::Vector< double > * > &)> &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::DoFHandler< 2 > &  ,
const int  ,
const std::function< void()> &  ,
const std::function< void()> &   
)

◆ refine_grid() [5/9]

template void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< 3 > &  ,
const AttachDoFHandlerAndVectorsType< 3, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::Triangulation< 3 > &  ,
const int  ,
const std::function< void()> &  ,
const std::function< void()> &   
)

◆ refine_grid() [6/9]

template void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< 3 > &  ,
const std::function< void(std::vector< dealii::LinearAlgebra::distributed::Vector< double > * > &)> &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::DoFHandler< 3 > &  ,
const int  ,
const std::function< void()> &  ,
const std::function< void()> &   
)

◆ refine_grid() [7/9]

template<int dim, typename VectorType , typename number = typename VectorType::value_type>
void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< dim > &  mark_cells_for_refinement,
const AttachDoFHandlerAndVectorsType< dim, VectorType > &  attach_vectors,
const std::function< void()> &  setup_dof_system,
const AdaptiveMeshingData< number > &  amr,
dealii::Triangulation< dim > &  tria,
const int  n_time_step,
const std::function< void()> &  post = std::function<void()>(),
const std::function< void()> &  pre = std::function<void()>() 
)

Refine the mesh in

Parameters
triaif the
n_time_stepis chosen to be refined by now().
mark_cells_for_refinementlambda function of type MarkCellsForRefinementType, see its documentation for info
attach_vectorslambda function of type AttachDoFHandlerAndVectorsType, that attaches all DoFHandlers and their respective DoFVectors that ought to be transferred to the new mesh
setup_dof_systemsetup the dof system, this includes:
  • distribute DoFs on the new mesh
  • create partitioning for the new mesh
  • setup constraints on the new mesh
  • reinit the MatrixFree object for the new DoFs (ScratchData::build())
  • initialize all DoF vectors for the new DoF
postthis optional lambda function is run after AMR was executed
prethis optional lambda function is run before AMR was executed

◆ refine_grid() [8/9]

template<int dim, typename VectorType , typename number >
void MeltPoolDG::AMR::refine_grid ( const MarkCellsForRefinementType< dim > &  mark_cells_for_refinement,
const std::function< void(std::vector< VectorType * > &)> &  attach_vectors,
const std::function< void()> &  setup_dof_system,
const AdaptiveMeshingData< number > &  amr,
dealii::DoFHandler< dim > &  dof_handler,
const int  n_time_step,
const std::function< void()> &  post,
const std::function< void()> &  pre 
)

◆ refine_grid() [9/9]

template<int dim, typename VectorType , typename number >
void MeltPoolDG::AMR::refine_grid ( const std::function< bool(dealii::Triangulation< dim > &)> &  mark_cells_for_refinement,
const std::function< void(std::vector< VectorType * > &)> &  attach_vectors,
const std::function< void()> &  setup_dof_system,
const AdaptiveMeshingData< number > &  amr,
dealii::DoFHandler< dim > &  dof_handler,
const int  n_time_step,
const std::function< void()> &  post = std::function< void()>(),
const std::function< void()> &  pre = std::function< void()>() 
)

Same as above, but for only one

Parameters
dof_handler

◆ set_refinement_flags_in_regions()

template<int dim, typename number >
bool MeltPoolDG::AMR::set_refinement_flags_in_regions ( dealii::Triangulation< dim > &  tria,
const std::vector< AMRRegion< dim, number > > &  regions = {},
bool  do_coarsening = false 
)

Marks cells in a triangulation for refinement if their centers fall inside specified regions.

This function iterates over all active cells in the given triangulation and sets the refine flag for each cell whose center lies within any of the provided adaptive mesh refinement regions. Optionally, if the cell center does not lie within any region and the refine flag has not been already set for the cell, the coarsen flag is set.

Parameters
triaThe triangulation whose cells will be marked for refinement.
regionsA list of AMR regions. If a cell center lies inside any of those regions, the corresponding refinement flag will be set.
do_coarseningIf set, all cells which are not inside any of the regions and not yet marked for * refinement are marked for coarsening.
Returns
Returns true if any refine or coarsen flag has been set, otherwise returns false.
Note
If no regions are provided, the function returns immediately.