Skip to content

Commit

Permalink
documentation improvements and code cleanup ref #29703
Browse files Browse the repository at this point in the history
  • Loading branch information
miaoyinb committed Jan 27, 2025
1 parent 8771a00 commit 1dc385c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

The `CutMeshByLevelSetGenerator` is an extended version of [`CutMeshByPlaneGenerator`](/CutMeshByPlaneGenerator.md). It is used to trim a 3D input mesh based on a given level set `f(x,y,z)`. The portion of the input mesh that is within the level set (i.e., `f(x,y,z)<=0`) is retained, while the portion of the input mesh that is outside the level set (i.e., `f(x,y,z)>0`) is discarded. The input mesh, given by [!param](/Mesh/CutMeshByLevelSetGenerator/input), must be 3D and contain only first-order elements. The level set is specified by [!param](/Mesh/CutMeshByLevelSetGenerator/level_set), which can be interpreted by `FParser` as a function of `x`, `y`, and `z` (i.e., `f(x,y,z)`). The mesh is then smoothed to avert a "zigzag" cut along element boundaries.
The `CutMeshByLevelSetGenerator` is an extended version of [`CutMeshByPlaneGenerator`](/CutMeshByPlaneGenerator.md). It is used to trim a 3D input mesh based on a given level set `f(x,y,z)=0`. The portion of the input mesh that is within the level set (i.e., `f(x,y,z)<=0`) is retained, while the portion of the input mesh that is outside the level set (i.e., `f(x,y,z)>0`) is discarded. The input mesh, given by [!param](/Mesh/CutMeshByLevelSetGenerator/input), must be 3D and contain only first-order elements. The level set is specified by [!param](/Mesh/CutMeshByLevelSetGenerator/level_set), which can be interpreted by `FParser` as a function of `x`, `y`, and `z` (i.e., `f(x,y,z)`). As each element that is across the cutting level set is cut based on the interception points, this mesh generator ensures a smooth cut instead of a "zigzag" cut along element boundaries.

Using this mesh generator, a 3D structured mesh defined by a bounding box (e.g., generated by [`GeneratedMeshGenerator`](/GeneratedMeshGenerator.md)) can be subtracted into a 3D mesh with its shape define by a given level set.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

The `CutMeshByPlaneGenerator` is basically the 3D version of [`XYMeshLineCutter`](/XYMeshLineCutter.md). It is used to slice a 3D input mesh along a given plane, and discard the portion of the mesh on one side of the plane. The input mesh, given by [!param](/Mesh/CutMeshByPlaneGenerator/input), must be 3D and contain only first-order elements. The cutting plane is specified by [!param](/Mesh/CutMeshByPlaneGenerator/plane_normal) and [!param](/Mesh/CutMeshByPlaneGenerator/plane_point), which are two `libMesh::Point` type data that represent the normal vector of the cutting plane and a point on the cutting plane, respectively. This mesh generator removes the part of the mesh located on the side of the plane in the direction of the normal vector. The mesh is then smoothed to ensure a straight cut instead of a "zigzag" cut along element boundaries as generated by [`PlaneDeletionGenerator`](/PlaneDeletionGenerator.md).
The `CutMeshByPlaneGenerator` is basically the 3D version of [`XYMeshLineCutter`](/XYMeshLineCutter.md). It is used to slice a 3D input mesh along a given plane, and discard the portion of the mesh on one side of the plane. The input mesh, given by [!param](/Mesh/CutMeshByPlaneGenerator/input), must be 3D and contain only first-order elements. The cutting plane is specified by [!param](/Mesh/CutMeshByPlaneGenerator/plane_normal) and [!param](/Mesh/CutMeshByPlaneGenerator/plane_point), which are two `libMesh::Point` type data that represent the normal vector of the cutting plane and a point on the cutting plane, respectively. This mesh generator removes the part of the mesh located on the side of the plane in the direction of the normal vector. As each element that is across the cutting plane is cut based on the interception points, this mesh generator ensures a straight cut instead of a "zigzag" cut along element boundaries as generated by [`PlaneDeletionGenerator`](/PlaneDeletionGenerator.md).

## Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class CutMeshByLevelSetGeneratorBase : public MeshGenerator, public FunctionPars
PointLevelSetRelationIndex pointLevelSetRelation(const Point & point);

/**
* Calculate the intersection point of a plane and a line segment defined by two points separated
* by the plane.
* Calculate the intersection point of a level set and a line segment defined by two
* points separated by the level set.
* @param point1 The first point of the line segment
* @param point2 The second point of the line segment
* @return the intersection point of the plane and the line segment
* @return the intersection point of the level set and the line segment
*/
Point pointPairLevelSetInterception(const Point & point1, const Point & point2);

Expand Down Expand Up @@ -89,7 +89,7 @@ class CutMeshByLevelSetGeneratorBase : public MeshGenerator, public FunctionPars
*/
const Node * nonDuplicateNodeCreator(ReplicatedMesh & mesh,
std::vector<const Node *> & new_on_plane_nodes,
const Point & new_point);
const Point & new_point) const;

/**
* Evaluate the level set function at a given point.
Expand Down
11 changes: 6 additions & 5 deletions framework/src/meshgenerators/CutMeshByLevelSetGeneratorBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ CutMeshByLevelSetGeneratorBase::validParams()
params.addParam<boundary_id_type>("cut_face_id",
"The boundary id of the face generated by the cut. An "
"id will be automatically assigned if not provided.");
params.addParam<BoundaryName>("cut_face_name",
"The boundary name of the face generated by the cut.");
params.addParam<BoundaryName>(
"cut_face_name", BoundaryName(), "The boundary name of the face generated by the cut.");

params.addClassDescription(
"This CutMeshByLevelSetGeneratorBase object is designed to be the base class of mesh "
Expand All @@ -47,8 +47,7 @@ CutMeshByLevelSetGeneratorBase::CutMeshByLevelSetGeneratorBase(const InputParame
: MeshGenerator(parameters),
FunctionParserUtils<false>(parameters),
_input_name(getParam<MeshGeneratorName>("input")),
_cut_face_name(isParamValid("cut_face_name") ? getParam<BoundaryName>("cut_face_name")
: BoundaryName()),
_cut_face_name(getParam<BoundaryName>("cut_face_name")),
_input(getMeshByName(_input_name))
{
_cut_face_id = isParamValid("cut_face_id") ? getParam<boundary_id_type>("cut_face_id") : -1;
Expand Down Expand Up @@ -215,7 +214,9 @@ CutMeshByLevelSetGeneratorBase::pointPairLevelSetInterception(const Point & poin

const Node *
CutMeshByLevelSetGeneratorBase::nonDuplicateNodeCreator(
ReplicatedMesh & mesh, std::vector<const Node *> & new_on_plane_nodes, const Point & new_point)
ReplicatedMesh & mesh,
std::vector<const Node *> & new_on_plane_nodes,
const Point & new_point) const
{
for (const auto & new_on_plane_node : new_on_plane_nodes)
{
Expand Down

0 comments on commit 1dc385c

Please sign in to comment.