From 47932fdfa6631cfdb596d51c1afca9127856c12d Mon Sep 17 00:00:00 2001 From: Xiangyu Hu Date: Fri, 26 Jul 2024 14:42:56 +0200 Subject: [PATCH] done --- src/shared/geometries/base_geometry.h | 13 ++++++------- src/shared/geometries/complex_shape.h | 23 ++++++++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/shared/geometries/base_geometry.h b/src/shared/geometries/base_geometry.h index 6067dcb69b..43c36e5f68 100644 --- a/src/shared/geometries/base_geometry.h +++ b/src/shared/geometries/base_geometry.h @@ -21,9 +21,9 @@ * * * ------------------------------------------------------------------------- */ /** - * @file base_geometry.h - * @brief Define the base classes Shape, BinaryShape and Edge, - * which are the base classes for all geometries. + * @file base_geometry.h + * @brief Define the base classes Shape, BinaryShape and Edge, + * which are the base classes for all geometries. * @author Chi Zhang, Yongchuan Yu and Xiangyu Hu */ @@ -92,11 +92,10 @@ class Shape using SubShapeAndOp = std::pair; /** * @class BinaryShapes - * @brief a collections of shapes with binary operations + * @brief A collections of shapes with binary operations. * This class has ownership of all shapes by using a unique pointer vector. * In this way, add or subtract a shape will call the shape's constructor other than * passing the shape pointer. - * For now, partially overlapped the shapes are not allowed for binary operations. */ class BinaryShapes : public Shape { @@ -106,7 +105,7 @@ class BinaryShapes : public Shape virtual ~BinaryShapes(){}; template - void add(Args &&...args) + void add(Args &&... args) { Shape *sub_shape = sub_shape_ptrs_keeper_.createPtr(std::forward(args)...); SubShapeAndOp sub_shape_and_op(sub_shape, ShapeBooleanOps::add); @@ -114,7 +113,7 @@ class BinaryShapes : public Shape }; template - void subtract(Args &&...args) + void subtract(Args &&... args) { Shape *sub_shape = sub_shape_ptrs_keeper_.createPtr(std::forward(args)...); SubShapeAndOp sub_shape_and_op(sub_shape, ShapeBooleanOps::sub); diff --git a/src/shared/geometries/complex_shape.h b/src/shared/geometries/complex_shape.h index c95745c96d..da1ce20f63 100644 --- a/src/shared/geometries/complex_shape.h +++ b/src/shared/geometries/complex_shape.h @@ -21,10 +21,10 @@ * * * ------------------------------------------------------------------------- */ /** - * @file complex_shape.h - * @brief Here, we define the a container of different type of shapes, which allow - * the boolean operation between the different type of shapes. The shapes - * can be defined previously and add to this complex shapes container. + * @file complex_shape.h + * @brief Here, we define the a container of different type of shapes, which allow + * the boolean operation between the different type of shapes. The shapes + * can be defined previously and add to this complex shapes container. */ #ifndef COMPLEX_SHAPE_H @@ -39,6 +39,15 @@ namespace SPH { class LevelSetShape; +/** + * @class ComplexShape + * @brief For now, if the level set shape (for particle relaxation) + * will be generated from the complex shape, + * partially overlapped shapes are not allowed for 3D problems. + * However, if only the contain function + * is used, for example generating particles using lattice generator, + * partially overlapped shapes are allowed. + **/ class ComplexShape : public BinaryShapes { public: @@ -47,7 +56,7 @@ class ComplexShape : public BinaryShapes virtual ~ComplexShape(){}; template - LevelSetShape *defineLevelSetShape(SPHBody &sph_body, const std::string &shape_name, Args &&...args) + LevelSetShape *defineLevelSetShape(SPHBody &sph_body, const std::string &shape_name, Args &&... args) { size_t index = getSubShapeIndexByName(shape_name); LevelSetShape *level_set_shape = sub_shape_ptrs_keeper_[index].createPtr( @@ -71,12 +80,12 @@ class AlignedBoxShape : public TransformShape public: /** construct directly */ template - explicit AlignedBoxShape(int upper_bound_axis, const Transform &transform, Args &&...args) + explicit AlignedBoxShape(int upper_bound_axis, const Transform &transform, Args &&... args) : TransformShape(transform, std::forward(args)...), alignment_axis_(upper_bound_axis){}; /** construct from a shape already has aligned boundaries */ template - explicit AlignedBoxShape(int upper_bound_axis, const Shape &shape, Args &&...args) + explicit AlignedBoxShape(int upper_bound_axis, const Shape &shape, Args &&... args) : TransformShape( Transform(Vecd(0.5 * (shape.bounding_box_.second_ + shape.bounding_box_.first_))), 0.5 * (shape.bounding_box_.second_ - shape.bounding_box_.first_), std::forward(args)...),