Tools Namespace Reference

Developer Documentation: MeltPoolDG::LevelSet::Tools Namespace Reference
Developer Documentation
MeltPoolDG::LevelSet::Tools Namespace Reference

Classes

class  NearestPoint
 Compute nearest points to the isocontour of a level set function. More...
 

Enumerations

enum  BooleanType { Union , Intersection , Subtraction }
 

Functions

template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 interpolate (const value_type1 &ls, const value_type2 &val1, const value_type3 &val2)
 
template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 interpolate_reciprocal (const value_type1 &ls, const value_type2 &val1, const value_type3 &val2)
 
template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 interpolate_cubic (const value_type1 &ls, const value_type2 &val1, const value_type3 &val2)
 
template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 interpolate_cubic_derivative (const value_type1 &ls, const value_type2 &val1, const value_type3 &val2)
 
template<typename number >
number approximate_distance_from_tanh_level_set (const number phi, const number eps, const number cutoff)
 Computes an approximate signed distance from a hyperbolic tangent level-set value.
 
template<typename number >
dealii::LinearAlgebra::distributed::Vector< number > merge_two_indicator_fields (const dealii::LinearAlgebra::distributed::Vector< number > &indicator_1, const dealii::LinearAlgebra::distributed::Vector< number > &indicator_2, BooleanType type=BooleanType::Union, const number indicator_value_interior=1.0, const number indicator_value_exterior=-1.0)
 
template<int dim, typename number >
void collect_interface_cells_and_intersection_points (std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< dim > > > > &surface_cells_and_unit_points, std::vector< dealii::Point< dim > > &surface_points, const dealii::DoFHandler< dim > &dof_handler, const dealii::Mapping< dim > &mapping, const dealii::LinearAlgebra::distributed::Vector< number > &level_set_vector, const number contour_value=0.0, const unsigned int n_subdivisions=1, const number tolerance=1e-10)
 Identifies volume cells intersected by a level set and extracts the corresponding quadrature points at the intersection (in both real and reference coordinates).
 
template<int dim, typename number >
void evaluate_at_interface (const dealii::DoFHandler< dim > &dof_handler, const dealii::Mapping< dim > &mapping, const dealii::LinearAlgebra::distributed::Vector< number > &level_set_vector, const std::function< void(const typename dealii::DoFHandler< dim >::active_cell_iterator &, const std::vector< dealii::Point< dim > > &, const std::vector< dealii::Point< dim > > &, const std::vector< number > &)> &evaluate_at_interface_points, const number contour_value=0.0, const unsigned int n_subdivisions=1, const number tolerance=1e-10, const bool use_mca=true)
 Evaluates user-defined quantities at an implicitly defined interface.
 
template<int dim, typename number >
std::vector< std::tuple< const typename dealii::Triangulation< dim, dim >::cell_iterator, std::vector< dealii::Point< dim > >, std::vector< number > > > generate_surface_mesh_info (const dealii::DoFHandler< dim > &dof_handler, const dealii::Mapping< dim > &mapping, const dealii::LinearAlgebra::distributed::Vector< number > &level_set, const number contour_value=0.0, const unsigned int n_subdivisions=1, const number tolerance=1e-10, const bool use_mca=true)
 Generates surface mesh data corresponding to an implicit interface.
 
template<int dim, typename number >
void generate_points_along_normal (std::vector< dealii::Point< dim > > &global_points_normal_to_interface, std::vector< unsigned int > &global_points_normal_to_interface_pointer, const dealii::DoFHandler< dim > &dof_handler_ls, const dealii::FESystem< dim > &fe_normal, const dealii::Mapping< dim > &mapping, const dealii::LinearAlgebra::distributed::Vector< number > &level_set_vector, const dealii::LinearAlgebra::distributed::BlockVector< number > &normal_vector, const number max_distance_per_side, const unsigned int n_inc_per_side, const bool bidirectional=true, const number contour_value=0.0, const unsigned int n_subdivisions_MCA=1)
 
template<int dim, typename number >
void set_material_id_from_level_set (const ScratchData< dim, dim, number > &scratch_data, const unsigned int ls_dof_idx, const dealii::LinearAlgebra::distributed::Vector< number > &level_set_heaviside, const number lower_threshold=0.5)
 
template<typename number >
dealii::VectorizedArray< number > compute_mask_narrow_band (const dealii::VectorizedArray< number > &val, const number narrow_band_threshold)
 
template dealii::LinearAlgebra::distributed::Vector< double > merge_two_indicator_fields (const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::LinearAlgebra::distributed::Vector< double > &, BooleanType, const double, const double)
 
template void collect_interface_cells_and_intersection_points (std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< 1 > > > > &, std::vector< dealii::Point< 1 > > &, const dealii::DoFHandler< 1 > &, const dealii::Mapping< 1 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const double, const unsigned int, const double)
 
template void collect_interface_cells_and_intersection_points (std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< 2 > > > > &, std::vector< dealii::Point< 2 > > &, const dealii::DoFHandler< 2 > &, const dealii::Mapping< 2 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const double, const unsigned int, const double)
 
template void collect_interface_cells_and_intersection_points (std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< 3 > > > > &, std::vector< dealii::Point< 3 > > &, const dealii::DoFHandler< 3 > &, const dealii::Mapping< 3 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const double, const unsigned int, const double)
 
template void evaluate_at_interface (const dealii::DoFHandler< 1 > &, const dealii::Mapping< 1 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const std::function< void(const typename dealii::DoFHandler< 1 >::active_cell_iterator &, const std::vector< dealii::Point< 1 > > &, const std::vector< dealii::Point< 1 > > &, const std::vector< double > &)> &, const double, const unsigned int, const double, const bool)
 
template void evaluate_at_interface (const dealii::DoFHandler< 2 > &, const dealii::Mapping< 2 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const std::function< void(const typename dealii::DoFHandler< 2 >::active_cell_iterator &, const std::vector< dealii::Point< 2 > > &, const std::vector< dealii::Point< 2 > > &, const std::vector< double > &)> &, const double, const unsigned int, const double, const bool)
 
template void evaluate_at_interface (const dealii::DoFHandler< 3 > &, const dealii::Mapping< 3 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const std::function< void(const typename dealii::DoFHandler< 3 >::active_cell_iterator &, const std::vector< dealii::Point< 3 > > &, const std::vector< dealii::Point< 3 > > &, const std::vector< double > &)> &, const double, const unsigned int, const double, const bool)
 
template std::vector< std::tuple< const typename dealii::Triangulation< 1, 1 >::cell_iterator, std::vector< dealii::Point< 1 > >, std::vector< double > > > generate_surface_mesh_info (const dealii::DoFHandler< 1 > &, const dealii::Mapping< 1 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const double, const unsigned int, const double, const bool)
 
template std::vector< std::tuple< const typename dealii::Triangulation< 2, 2 >::cell_iterator, std::vector< dealii::Point< 2 > >, std::vector< double > > > generate_surface_mesh_info (const dealii::DoFHandler< 2 > &, const dealii::Mapping< 2 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const double, const unsigned int, const double, const bool)
 
template std::vector< std::tuple< const typename dealii::Triangulation< 3, 3 >::cell_iterator, std::vector< dealii::Point< 3 > >, std::vector< double > > > generate_surface_mesh_info (const dealii::DoFHandler< 3 > &, const dealii::Mapping< 3 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const double, const unsigned int, const double, const bool)
 
template void generate_points_along_normal (std::vector< dealii::Point< 2 > > &, std::vector< unsigned int > &, const dealii::DoFHandler< 2 > &, const dealii::FESystem< 2 > &, const dealii::Mapping< 2 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::LinearAlgebra::distributed::BlockVector< double > &, const double, const unsigned int, const bool, const double, const unsigned int)
 
template void generate_points_along_normal (std::vector< dealii::Point< 3 > > &, std::vector< unsigned int > &, const dealii::DoFHandler< 3 > &, const dealii::FESystem< 3 > &, const dealii::Mapping< 3 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::LinearAlgebra::distributed::BlockVector< double > &, const double, const unsigned int, const bool, const double, const unsigned int)
 
template void set_material_id_from_level_set (const ScratchData< 1, 1, double > &, const unsigned int, const dealii::LinearAlgebra::distributed::Vector< double > &, const double)
 
template void set_material_id_from_level_set (const ScratchData< 2, 2, double > &, const unsigned int, const dealii::LinearAlgebra::distributed::Vector< double > &, const double)
 
template void set_material_id_from_level_set (const ScratchData< 3, 3, double > &, const unsigned int, const dealii::LinearAlgebra::distributed::Vector< double > &, const double)
 

Enumeration Type Documentation

◆ BooleanType

Enumerator
Union 
Intersection 
Subtraction 

Function Documentation

◆ approximate_distance_from_tanh_level_set()

template<typename number >
number MeltPoolDG::LevelSet::Tools::approximate_distance_from_tanh_level_set ( const number  phi,
const number  eps,
const number  cutoff 
)
inline

Computes an approximate signed distance from a hyperbolic tangent level-set value.

This function converts a phase-field value phi, typically originating from a hyperbolic tangent profile, into an approximate signed distance. The relation is based on the inverse transformation

\[ d = \varepsilon \log\left(\frac{1+\phi}{1-\phi}\right), \]

where \(\varepsilon\) controls the interface thickness.

To avoid numerical instability near \(\phi = \pm 1\), the value is clamped using the parameter cutoff. For values outside the interval \((-\text{cutoff}, \text{cutoff})\), the returned distance is saturated at the corresponding cutoff distance.

Template Parameters
numberNumeric type used for computations (e.g., float, double).
Parameters
phiLevel-set value, typically in the range [-1,1].
epsInterface thickness parameter \(\varepsilon\).
cutoffCutoff value used to limit the logarithm argument away from singularities at \(\phi = \pm 1\).
Returns
Approximate signed distance corresponding to the phase-field value.

◆ collect_interface_cells_and_intersection_points() [1/4]

template void MeltPoolDG::LevelSet::Tools::collect_interface_cells_and_intersection_points ( std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< 1 > > > > &  ,
std::vector< dealii::Point< 1 > > &  ,
const dealii::DoFHandler< 1 > &  ,
const dealii::Mapping< 1 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double  ,
const unsigned int  ,
const double   
)

◆ collect_interface_cells_and_intersection_points() [2/4]

template void MeltPoolDG::LevelSet::Tools::collect_interface_cells_and_intersection_points ( std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< 2 > > > > &  ,
std::vector< dealii::Point< 2 > > &  ,
const dealii::DoFHandler< 2 > &  ,
const dealii::Mapping< 2 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double  ,
const unsigned int  ,
const double   
)

◆ collect_interface_cells_and_intersection_points() [3/4]

template void MeltPoolDG::LevelSet::Tools::collect_interface_cells_and_intersection_points ( std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< 3 > > > > &  ,
std::vector< dealii::Point< 3 > > &  ,
const dealii::DoFHandler< 3 > &  ,
const dealii::Mapping< 3 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double  ,
const unsigned int  ,
const double   
)

◆ collect_interface_cells_and_intersection_points() [4/4]

template<int dim, typename number >
void MeltPoolDG::LevelSet::Tools::collect_interface_cells_and_intersection_points ( std::vector< std::pair< std::pair< unsigned int, unsigned int >, std::vector< dealii::Point< dim > > > > &  surface_cells_and_unit_points,
std::vector< dealii::Point< dim > > &  surface_points,
const dealii::DoFHandler< dim > &  dof_handler,
const dealii::Mapping< dim > &  mapping,
const dealii::LinearAlgebra::distributed::Vector< number > &  level_set_vector,
const number  contour_value = 0.0,
const unsigned int  n_subdivisions = 1,
const number  tolerance = 1e-10 
)

Identifies volume cells intersected by a level set and extracts the corresponding quadrature points at the intersection (in both real and reference coordinates).

This function applies a marching cube algorithm to detect where a level set function intersects the computational mesh. For each locally-owned cell that is cut by the level set interface (i.e., where the level set function crosses a given contour value), the function computes the intersection points and maps them to unit (reference) cell coordinates.

Parameters
[out]surface_cells_and_unit_pointsA list of locally-owned cells that are intersected by the level set surface, each paired with its corresponding unit (reference) quadrature points.
[out]surface_pointsA list of all real-space intersection points on the level set surface, collected from all intersected volume cells.
[in]dof_handlerThe DoFHandler associated with the finite element field representing the level set.
[in]mappingThe Mapping used to transform between real and unit cell coordinates.
[in]level_set_vectorThe distributed vector storing the level set function values over the mesh.
[in]contour_valueThe isocontour value that defines the level set interface (default: 0.0).
[in]n_subdivisionsThe number of subdivisions per cell edge for the marching cubes algorithm (used to refine intersection detection; default: 1).
[in]toleranceA small numerical tolerance used to determine zero-crossings in the marching cubes interface detection (default: 1e-10).

◆ compute_mask_narrow_band()

template<typename number >
dealii::VectorizedArray< number > MeltPoolDG::LevelSet::Tools::compute_mask_narrow_band ( const dealii::VectorizedArray< number > &  val,
const number  narrow_band_threshold 
)

◆ evaluate_at_interface() [1/4]

template void MeltPoolDG::LevelSet::Tools::evaluate_at_interface ( const dealii::DoFHandler< 1 > &  ,
const dealii::Mapping< 1 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const std::function< void(const typename dealii::DoFHandler< 1 >::active_cell_iterator &, const std::vector< dealii::Point< 1 > > &, const std::vector< dealii::Point< 1 > > &, const std::vector< double > &)> &  ,
const double  ,
const unsigned int  ,
const double  ,
const bool   
)

◆ evaluate_at_interface() [2/4]

template void MeltPoolDG::LevelSet::Tools::evaluate_at_interface ( const dealii::DoFHandler< 2 > &  ,
const dealii::Mapping< 2 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const std::function< void(const typename dealii::DoFHandler< 2 >::active_cell_iterator &, const std::vector< dealii::Point< 2 > > &, const std::vector< dealii::Point< 2 > > &, const std::vector< double > &)> &  ,
const double  ,
const unsigned int  ,
const double  ,
const bool   
)

◆ evaluate_at_interface() [3/4]

template void MeltPoolDG::LevelSet::Tools::evaluate_at_interface ( const dealii::DoFHandler< 3 > &  ,
const dealii::Mapping< 3 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const std::function< void(const typename dealii::DoFHandler< 3 >::active_cell_iterator &, const std::vector< dealii::Point< 3 > > &, const std::vector< dealii::Point< 3 > > &, const std::vector< double > &)> &  ,
const double  ,
const unsigned int  ,
const double  ,
const bool   
)

◆ evaluate_at_interface() [4/4]

template<int dim, typename number >
void MeltPoolDG::LevelSet::Tools::evaluate_at_interface ( const dealii::DoFHandler< dim > &  dof_handler,
const dealii::Mapping< dim > &  mapping,
const dealii::LinearAlgebra::distributed::Vector< number > &  level_set_vector,
const std::function< void(const typename dealii::DoFHandler< dim >::active_cell_iterator &, const std::vector< dealii::Point< dim > > &, const std::vector< dealii::Point< dim > > &, const std::vector< number > &)> &  evaluate_at_interface_points,
const number  contour_value = 0.0,
const unsigned int  n_subdivisions = 1,
const number  tolerance = 1e-10,
const bool  use_mca = true 
)

Evaluates user-defined quantities at an implicitly defined interface.

This utility function enables the evaluation of quantities at interfaces defined implicitly by a scalar field (level set function), represented by the level_set_vector. The interface is identified as the contour where the level set function equals the specified contour_value.

The interface is reconstructed on each active cell using the Marching Cubes algorithm (or an optional alternative method if use_mca is false). The algorithm identifies quadrature points within the reference cell and computes corresponding surface integration weights (JxW values) for numerical integration.

For each active cell in the provided DoFHandler cut by the interface, the user-supplied lambda function evaluate_at_interface_points is called.

This interface evaluation can be used to implement a variety of tasks, such as integrating quantities over the interface, interpolating field values, or assembling contributions into global data structures like DoF vectors.

Template Parameters
dimThe spatial dimension.
numberThe numeric type used for computations (e.g., float, double).
Parameters
[in]dof_handlerThe DoFHandler associated with the finite element space defining the level set function.
[in]mappingA Mapping object describing the transformation from reference to real space.
[in]level_set_vectorA vector representing the level set function, defined at the DoF locations.
[in]evaluate_at_interface_pointsA user-defined callback function that is called for each active cell containing interface segments. The callback signature must be: void(const active_cell_iterator &cell, const std::vector<Point<dim>> &points_real, const std::vector<Point<dim>> &points_reference, const std::vector<number> &JxW)
[in]contour_valueThe level set value at which the interface is extracted (default is 0.0).
[in]n_subdivisionsThe number of subdivisions per cell used to increase the resolution of the marching cubes grid (default is 1, i.e., no subdivision).
[in]toleranceA small tolerance used for numerical comparisons when identifying interface segments (default is 1e-10).
[in]use_mcaA flag indicating whether to use the Marching Cubes Algorithm (MCA) for interface reconstruction (default is true). If false, the NonMatching infrastructure of deal.II is used.
Note
The accuracy of the interface location depends on the resolution of the level set function and the number of subdivisions. For better accuracy, consider refining the mesh or increasing n_subdivisions.

◆ generate_points_along_normal() [1/3]

template void MeltPoolDG::LevelSet::Tools::generate_points_along_normal ( std::vector< dealii::Point< 2 > > &  ,
std::vector< unsigned int > &  ,
const dealii::DoFHandler< 2 > &  ,
const dealii::FESystem< 2 > &  ,
const dealii::Mapping< 2 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::LinearAlgebra::distributed::BlockVector< double > &  ,
const double  ,
const unsigned int  ,
const bool  ,
const double  ,
const unsigned int   
)

◆ generate_points_along_normal() [2/3]

template void MeltPoolDG::LevelSet::Tools::generate_points_along_normal ( std::vector< dealii::Point< 3 > > &  ,
std::vector< unsigned int > &  ,
const dealii::DoFHandler< 3 > &  ,
const dealii::FESystem< 3 > &  ,
const dealii::Mapping< 3 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::LinearAlgebra::distributed::BlockVector< double > &  ,
const double  ,
const unsigned int  ,
const bool  ,
const double  ,
const unsigned int   
)

◆ generate_points_along_normal() [3/3]

template<int dim, typename number >
void MeltPoolDG::LevelSet::Tools::generate_points_along_normal ( std::vector< dealii::Point< dim > > &  global_points_normal_to_interface,
std::vector< unsigned int > &  global_points_normal_to_interface_pointer,
const dealii::DoFHandler< dim > &  dof_handler_ls,
const dealii::FESystem< dim > &  fe_normal,
const dealii::Mapping< dim > &  mapping,
const dealii::LinearAlgebra::distributed::Vector< number > &  level_set_vector,
const dealii::LinearAlgebra::distributed::BlockVector< number > &  normal_vector,
const number  max_distance_per_side,
const unsigned int  n_inc_per_side,
const bool  bidirectional = true,
const number  contour_value = 0.0,
const unsigned int  n_subdivisions_MCA = 1 
)

This utility function computes a point cloud global_points_normal_to_interface in a narrow band around a level set vector. The parameter global_points_normal_to_interface_pointer holds at indices [n, n+1] the index range of connected points along the normal corresponding to the point n at the interface. First, the marching cube algorithm is exploited to determine points at the interface given at the contour level contour_value. Then, for each point at the interface points along the normal are generated.

◆ generate_surface_mesh_info() [1/4]

template std::vector< std::tuple< const typename dealii::Triangulation< 1, 1 >::cell_iterator, std::vector< dealii::Point< 1 > >, std::vector< double > > > MeltPoolDG::LevelSet::Tools::generate_surface_mesh_info ( const dealii::DoFHandler< 1 > &  ,
const dealii::Mapping< 1 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double  ,
const unsigned int  ,
const double  ,
const bool   
)

◆ generate_surface_mesh_info() [2/4]

template std::vector< std::tuple< const typename dealii::Triangulation< 2, 2 >::cell_iterator, std::vector< dealii::Point< 2 > >, std::vector< double > > > MeltPoolDG::LevelSet::Tools::generate_surface_mesh_info ( const dealii::DoFHandler< 2 > &  ,
const dealii::Mapping< 2 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double  ,
const unsigned int  ,
const double  ,
const bool   
)

◆ generate_surface_mesh_info() [3/4]

template std::vector< std::tuple< const typename dealii::Triangulation< 3, 3 >::cell_iterator, std::vector< dealii::Point< 3 > >, std::vector< double > > > MeltPoolDG::LevelSet::Tools::generate_surface_mesh_info ( const dealii::DoFHandler< 3 > &  ,
const dealii::Mapping< 3 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double  ,
const unsigned int  ,
const double  ,
const bool   
)

◆ generate_surface_mesh_info() [4/4]

template<int dim, typename number >
std::vector< std::tuple< const typename dealii::Triangulation< dim, dim >::cell_iterator, std::vector< dealii::Point< dim > >, std::vector< number > > > MeltPoolDG::LevelSet::Tools::generate_surface_mesh_info ( const dealii::DoFHandler< dim > &  dof_handler,
const dealii::Mapping< dim > &  mapping,
const dealii::LinearAlgebra::distributed::Vector< number > &  level_set,
const number  contour_value = 0.0,
const unsigned int  n_subdivisions = 1,
const number  tolerance = 1e-10,
const bool  use_mca = true 
)

Generates surface mesh data corresponding to an implicit interface.

This function constructs a surface mesh representation of an interface implicitly defined by a scalar field (level set function), given in the form of a level_set_as_heaviside vector. The interface corresponds to the isosurface where the level set equals the specified contour_value.

Internally, this function uses the Marching Cubes algorithm (or an optional alternative method) to identify interface segments on each active cell. The resulting surface mesh information is returned as a list of tuples, where each tuple contains:

  • the cell iterator of the active cell containing a portion of the interface,
  • the unit (reference space) quadrature points on the interface within that cell,
  • and the corresponding (surface) integration weights for those points.

This mesh information can be used for interface visualization or integration over implicitly defined surfaces.

Template Parameters
dimThe spatial dimension of the problem.
numberThe numeric type used in the computation (e.g., float, double).
Parameters
[in]dof_handlerThe DoFHandler associated with the finite element space describing the level set field.
[in]mappingA Mapping object used to transform between reference and real space.
[in]level_set_as_heavisideA vector representing the level set field.
[in]contour_valueThe value at which to extract the interface (default is 0.0).
[in]n_subdivisionsThe number of subdivisions per cell for resolving the interface (default is 1).
[in]toleranceNumerical tolerance for comparing level set values (default is 1e-10).
[in]use_mcaIf true, the Marching Cubes Algorithm is used for interface reconstruction (default is true).
Returns
A vector of tuples, each containing:
  • a cell iterator to an active dim-cell containing dim-1 interface geometry,
  • a list of quadrature points (in unit coordinates) lying on the interface,
  • and the associated integration weights (JxW values).

◆ interpolate()

template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 MeltPoolDG::LevelSet::Tools::interpolate ( const value_type1 &  ls,
const value_type2 &  val1,
const value_type3 &  val2 
)
inline

Interpolate between val1 and val2 with the following function

x = (1 - ls) val1 + ls val2

◆ interpolate_cubic()

template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 MeltPoolDG::LevelSet::Tools::interpolate_cubic ( const value_type1 &  ls,
const value_type2 &  val1,
const value_type3 &  val2 
)
inline

Interpolate between val1 and val2 with the cubic function

x = val1 + ( val2 - val1 ) ( -2 ls³ + 3 ls² )

◆ interpolate_cubic_derivative()

template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 MeltPoolDG::LevelSet::Tools::interpolate_cubic_derivative ( const value_type1 &  ls,
const value_type2 &  val1,
const value_type3 &  val2 
)
inline

Derivative of interpolate_cubic() with respect to @ls. Returns

( val2 - val1 ) (-6 ls² + 6 ls)

◆ interpolate_reciprocal()

template<typename value_type1 , typename value_type2 , typename value_type3 >
value_type1 MeltPoolDG::LevelSet::Tools::interpolate_reciprocal ( const value_type1 &  ls,
const value_type2 &  val1,
const value_type3 &  val2 
)
inline

Interpolate between val1 and val2 with the reciprocal function

        1

x = ------------------— (1 - ls) ls -------— + ---— val1 val2

◆ merge_two_indicator_fields() [1/2]

template dealii::LinearAlgebra::distributed::Vector< double > MeltPoolDG::LevelSet::Tools::merge_two_indicator_fields ( const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
BooleanType  ,
const double  ,
const double   
)

◆ merge_two_indicator_fields() [2/2]

template<typename number >
dealii::LinearAlgebra::distributed::Vector< number > MeltPoolDG::LevelSet::Tools::merge_two_indicator_fields ( const dealii::LinearAlgebra::distributed::Vector< number > &  indicator_1,
const dealii::LinearAlgebra::distributed::Vector< number > &  indicator_2,
BooleanType  type = BooleanType::Union,
const number  indicator_value_interior = 1.0,
const number  indicator_value_exterior = -1.0 
)

For two indicator vectors, representing e.g. implicit geometries, this function computes a boolean operation and returns the resulting vector. The user has to take care on distributing relevant constraints afterwards.

◆ set_material_id_from_level_set() [1/4]

template void MeltPoolDG::LevelSet::Tools::set_material_id_from_level_set ( const ScratchData< 1, 1, double > &  ,
const unsigned int  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double   
)

◆ set_material_id_from_level_set() [2/4]

template void MeltPoolDG::LevelSet::Tools::set_material_id_from_level_set ( const ScratchData< 2, 2, double > &  ,
const unsigned int  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double   
)

◆ set_material_id_from_level_set() [3/4]

template void MeltPoolDG::LevelSet::Tools::set_material_id_from_level_set ( const ScratchData< 3, 3, double > &  ,
const unsigned int  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const double   
)

◆ set_material_id_from_level_set() [4/4]

template<int dim, typename number >
void MeltPoolDG::LevelSet::Tools::set_material_id_from_level_set ( const ScratchData< dim, dim, number > &  scratch_data,
const unsigned int  ls_dof_idx,
const dealii::LinearAlgebra::distributed::Vector< number > &  level_set_heaviside,
const number  lower_threshold = 0.5 
)

Set the material ID of cells depending on their level-set values, given by level_set_heaviside and the corresponding DoFHandler index ls_dof_idx. Cells with level-set values larger than or equal to the threshold value (lower_threshold) are indicated by a material_id of 1, others by a material_id of 0.

Note
This function should only be used, if the isosurface is aligned with the cell faces, because we do not treat real cut-cells special.