NetDEM v1.0
Loading...
Searching...
No Matches
netdem::LevelSetSplittor Class Reference

A domain splitter that uses a level set function to define the domain. More...

#include <level_set_splittor.hpp>

Inheritance diagram for netdem::LevelSetSplittor:
netdem::DomainSplittor netdem::LevelSetFunction

Public Member Functions

 LevelSetSplittor ()
 Default constructor.
 
void InitFromSTL (STLModel const &stl_model, int num_ele_each) override
 Initializes the domain splitter from an STL model.
 
void InitFromDistanceMap (std::string const &file_name)
 Initializes the domain splitter from a distance map file.
 
void InitFromDistanceMap (double corner_x, double corner_y, double corner_z, double sp, int dim_x, int dim_y, int dim_z, const VecXT< double > &dist_list)
 Initializes the domain splitter from a list of distances.
 
void GetPeriDigmNodes (VecXT< Vec3d > *const nodes, VecXT< double > *const node_vols) override
 Gets the nodes and volumes of the discretized domain.
 
void MakePorosity (double porosity) override
 Modifies the domain by adding porosity.
 
STLModel GetSTLModel () override
 Gets the STL model corresponding to the discretized domain.
 
STLModel GetSTLModel (const VecXT< int > &node_indices) override
 Gets the STL model corresponding to a subset of the discretized domain.
 
- Public Member Functions inherited from netdem::DomainSplittor
 DomainSplittor ()
 Default constructor.
 
virtual void InitFromSTL (std::string const &stl_file, int num_ele_each)
 Initializes the domain splitter from an STL file.
 
virtual ~DomainSplittor ()
 Virtual destructor.
 
- Public Member Functions inherited from netdem::LevelSetFunction
 LevelSetFunction ()
 Default constructor.
 
Vec3d const & GetCorner () const
 
double GetSpacing () const
 
Vec3i const & GetDimensions () const
 
double GetSignedDistance (int id_x, int id_y, int id_z)
 Get the signed distance value of a certian cell of the grid.
 
VecXT< VecXT< VecXT< double > > > const & GetSignedDistanceTable () const
 
void SetCorner (double corner_x, double corner_y, double corner_z)
 Set the corner of the grid.
 
void SetSpacing (double sp)
 Set the spacing between grid points.
 
void SetDimension (double dim_x, double dim_y, double dim_z)
 Set the dimensions of the grid.
 
void SetSignedDistance (int id_x, int id_y, int id_z, double sdf)
 Set the signed distance value of a certian cell of the grid.
 
void InitFromSDFCalculator (const SDFCalculator &sdf_calculator)
 Initialize from a signed distance field.
 
double SignedDistance (Vec3d const &pos) const
 Compute the signed distance at a point in space.
 
Vec3d GradientInterpolate (Vec3d const &pos)
 Compute the gradient at a point in space using interpolation.
 
Vec3d GradientMinus (int i, int j, int k)
 Compute the gradient at the grid point (i, j, k) using backward differences.
 
Vec3d GradientPlus (int i, int j, int k)
 Compute the gradient at the grid point (i, j, k) using forward differences.
 
void Reinitialization (int iter, double dt)
 Perform reinitialization to maintain properties of the level set function.
 
void Reinitialization ()
 Perform reinitialization with default parameters.
 

Additional Inherited Members

- Protected Attributes inherited from netdem::LevelSetFunction
Vec3d corner {-0.5, -0.5, -0.5}
 Coordinates of the corner of the grid.
 
double spacing {0.05}
 Spacing between grid points.
 
Vec3i dim {21, 21, 21}
 Dimensions of the grid.
 
VecXT< VecXT< VecXT< double > > > signed_distance_table
 Table containing the signed distance values.
 

Detailed Description

A domain splitter that uses a level set function to define the domain.

This class extends the DomainSplittor and LevelSetFunction classes to implement a domain splitter that uses a level set function to define the geometry of the domain. The level set function is a scalar field that represents the distance between points in the domain and the boundary of the domain.

Constructor & Destructor Documentation

◆ LevelSetSplittor()

LevelSetSplittor::LevelSetSplittor ( )

Default constructor.

Member Function Documentation

◆ GetPeriDigmNodes()

void LevelSetSplittor::GetPeriDigmNodes ( VecXT< Vec3d > *const nodes,
VecXT< double > *const node_vols )
overridevirtual

Gets the nodes and volumes of the discretized domain.

This method populates the given arrays with the positions of the nodes and the volumes of the elements in the discretized domain.

Parameters
nodesA pointer to an array of Vec3d objects to fill with node positions.
node_volsA pointer to an array of doubles to fill with element volumes.

Implements netdem::DomainSplittor.

◆ GetSTLModel() [1/2]

STLModel LevelSetSplittor::GetSTLModel ( )
overridevirtual

Gets the STL model corresponding to the discretized domain.

This method returns an STL model representing the discretized domain.

Returns
An STLModel object representing the discretized domain.

Implements netdem::DomainSplittor.

◆ GetSTLModel() [2/2]

STLModel LevelSetSplittor::GetSTLModel ( const VecXT< int > & node_indices)
overridevirtual

Gets the STL model corresponding to a subset of the discretized domain.

This method returns an STL model representing a subset of the discretized domain defined by the given indices.

Parameters
node_indicesA VecXT<int> object containing the indices of the subset of elements to include in the STL model.
Returns
An STLModel object representing the subset of the discretized domain.

Implements netdem::DomainSplittor.

◆ InitFromDistanceMap() [1/2]

void LevelSetSplittor::InitFromDistanceMap ( double corner_x,
double corner_y,
double corner_z,
double sp,
int dim_x,
int dim_y,
int dim_z,
const VecXT< double > & dist_list )

Initializes the domain splitter from a list of distances.

This method creates a level set function from a list of distances and uses it to define the geometry of the domain.

Parameters
corner_xThe x coordinate of the corner of the bounding box for the level set function.
corner_yThe y coordinate of the corner of the bounding box for the level set function.
corner_zThe z coordinate of the corner of the bounding box for the level set function.
spThe spacing between grid points in the level set function.
dim_xThe number of grid points along the x axis of the level set function.
dim_yThe number of grid points along the y axis of the level set function.
dim_zThe number of grid points along the z axis of the level set function.
dist_listA VecXT<double> object containing the distances to use in the level set function.

◆ InitFromDistanceMap() [2/2]

void LevelSetSplittor::InitFromDistanceMap ( std::string const & file_name)

Initializes the domain splitter from a distance map file.

This method loads a distance map file and creates a level set function to define the geometry of the domain.

Parameters
file_nameThe path to the distance map file to load.

◆ InitFromSTL()

void LevelSetSplittor::InitFromSTL ( STLModel const & stl_model,
int num_ele_each )
overridevirtual

Initializes the domain splitter from an STL model.

This method initializes the domain splitter using the given STL model and creates a level set function to define the geometry of the domain.

Parameters
stl_modelThe STL model to use as the domain.
num_ele_eachThe desired number of elements in each dimension of the split domain.

Implements netdem::DomainSplittor.

◆ MakePorosity()

void LevelSetSplittor::MakePorosity ( double porosity)
overridevirtual

Modifies the domain by adding porosity.

This method modifies the discretized domain by randomly removing elements from it, according to the given porosity value.

Parameters
porosityThe desired porosity of the modified domain.

Implements netdem::DomainSplittor.


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