Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
CompositeShape< dim > Class Template Reference

#include <shape.h>

Inheritance diagram for CompositeShape< dim >:
[legend]

Public Types

enum class  BooleanOperation : int { Union , Difference , Intersection }
Public Types inherited from Shape< dim >
enum class  ShapeType : std::int8_t {
  sphere , hyper_rectangle , ellipsoid , torus ,
  cone , cylinder , cylindrical_tube , cylindrical_helix ,
  cut_hollow_sphere , death_star , composite , rbf ,
  opencascade , superquadric , plane
}

Public Member Functions

 CompositeShape (std::map< unsigned int, std::shared_ptr< Shape< dim > > > constituents, std::map< unsigned int, std::tuple< BooleanOperation, unsigned int, unsigned int > > operations, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
 CompositeShape (std::vector< std::shared_ptr< Shape< dim > > > constituents_vector, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
double value (const Point< dim > &evaluation_point, const unsigned int component=0) const override
double value_with_cell_guess (const Point< dim > &evaluation_point, const typename DoFHandler< dim >::active_cell_iterator &cell, const unsigned int component=0) override
Tensor< 1, dim > gradient (const Point< dim > &evaluation_point, const unsigned int component=0) const override
Tensor< 1, dim > gradient_with_cell_guess (const Point< dim > &evaluation_point, const typename DoFHandler< dim >::active_cell_iterator &cell, const unsigned int component=0) override
std::shared_ptr< Shape< dim > > static_copy () const override
void update_precalculations (DoFHandler< dim > &updated_dof_handler, const bool mesh_based_precalculations)
void load_data_from_file ()
void remove_superfluous_data (DoFHandler< dim > &updated_dof_handler, const bool mesh_based_precalculations)
std::pair< double, Tensor< 1, dim > > apply_boolean_operations (std::map< unsigned int, double > constituent_shapes_values, std::map< unsigned int, Tensor< 1, dim > > constituent_shapes_gradients) const
virtual void clear_cache () override
void set_layer_thickening (const double layer_thickening) override
Public Member Functions inherited from Shape< dim >
 Shape (double radius, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
virtual std::tuple< double, Tensor< 1, dim >, Point< dim > > distance_to_shape_with_cell_guess (Shape< dim > &shape, const typename DoFHandler< dim >::active_cell_iterator &cell, std::vector< Point< dim > > &candidate_points, double precision=1e-6, bool exact_distance_outside_of_contact=false)
virtual std::tuple< double, Tensor< 1, dim >, Point< dim > > distance_to_shape (Shape< dim > &shape, std::vector< Point< dim > > &candidate_points, double precision=1e-6, bool exact_distance_outside_of_contact=false)
bool bounding_box_contact (Shape< dim > &shape)
virtual void closest_surface_point (const Point< dim > &p, Point< dim > &closest_point, const typename DoFHandler< dim >::active_cell_iterator &cell_guess)
virtual void closest_surface_point (const Point< dim > &p, Point< dim > &closest_point) const
virtual double displaced_volume ()
virtual double local_curvature_radius (Point< dim > p)
virtual double local_curvature_radius_with_cell_guess (const Point< dim > &p, const typename DoFHandler< dim >::active_cell_iterator &cell)
virtual void set_position (const Point< dim > &new_position)
virtual void set_orientation (const Tensor< 1, 3 > &new_orientation)
virtual Point< dim > get_position ()
virtual Tensor< 1, 3 > get_orientation ()
virtual Tensor< 2, 3 > get_rotation_matrix ()
virtual Tensor< 1, dim > get_bounding_box_half_length ()
virtual Point< dim > get_bounding_box_center ()
virtual std::shared_ptr< Manifold< dim - 1, dim > > get_shape_manifold ()
Point< dim > align_and_center (const Point< dim > &evaluation_point) const
Point< dim > reverse_align_and_center (const Point< dim > &evaluation_point) const
std::string point_to_string (const Point< dim > &evaluation_point) const
void set_part_of_a_composite (const bool is_part_of_a_composite)

Private Attributes

std::map< unsigned int, std::shared_ptr< Shape< dim > > > constituents
std::map< unsigned int, std::tuple< BooleanOperation, unsigned int, unsigned int > > operations

Additional Inherited Members

Static Public Member Functions inherited from Shape< dim >
static double smooth_max (const double a, const double b, const double smooth_factor=10)
static Tensor< 1, 3 > rotation_matrix_to_xyz_angles (Tensor< 2, 3 > &rotation_matrix_representation)
Public Attributes inherited from Shape< dim >
enum Shape::ShapeType type
double effective_radius
std::string additional_info_on_shape
Tensor< 1, dim > bounding_box_half_length
Point< dim > bounding_box_center
Protected Attributes inherited from Shape< dim >
Point< dim > position
Tensor< 1, 3 > orientation
std::unordered_map< std::string, double > value_cache
std::unordered_map< std::string, Tensor< 1, dim > > gradient_cache
std::unordered_map< std::string, Point< dim > > closest_point_cache
bool part_of_a_composite
Tensor< 2, 3 > rotation_matrix
double layer_thickening

Detailed Description

template<int dim>
class CompositeShape< dim >

This class was designed so that specific composite shapes could be defined through the parameter file. Boolean operations such as union, difference, and intersection are allowed.

Template Parameters
dimDimension of the shape

Definition at line 2104 of file shape.h.

Member Enumeration Documentation

◆ BooleanOperation

template<int dim>
enum class CompositeShape::BooleanOperation : int
strong
Enumerator
Union 
Difference 
Intersection 

Definition at line 2107 of file shape.h.

Constructor & Destructor Documentation

◆ CompositeShape() [1/2]

template<int dim>
CompositeShape< dim >::CompositeShape ( std::map< unsigned int, std::shared_ptr< Shape< dim > > > constituents,
std::map< unsigned int, std::tuple< BooleanOperation, unsigned int, unsigned int > > operations,
const Point< dim > & position,
const Tensor< 1, 3 > & orientation )
inline

Constructs an assembly of shapes into a composite shape.

Parameters
constituentsThe shapes from which this composite shape will be composed
operationsThe list of operations to perform to construct the composite
position
orientation

Definition at line 2121 of file shape.h.

References Shape< dim >::bounding_box_center, Shape< dim >::bounding_box_half_length, constituents, Shape< dim >::effective_radius, operations, Shape< dim >::orientation, point_nd_to_3d(), Shape< dim >::position, and Shape< dim >::Shape().

◆ CompositeShape() [2/2]

template<int dim>
CompositeShape< dim >::CompositeShape ( std::vector< std::shared_ptr< Shape< dim > > > constituents_vector,
const Point< dim > & position,
const Tensor< 1, 3 > & orientation )
inline

Constructs an assembly of shapes into a composite shape from a vector of shapes. This constructor is mainly used for outputting multiple shapes with a global level set function defined as a union.

Parameters
constituents_vectorThe shapes from which this composite sphere will be composed
position
orientation

Definition at line 2254 of file shape.h.

References constituents, Shape< dim >::effective_radius, operations, Shape< dim >::orientation, Shape< dim >::position, Shape< dim >::Shape(), and Union.

Member Function Documentation

◆ apply_boolean_operations()

template<int dim>
std::pair< double, Tensor< 1, dim > > CompositeShape< dim >::apply_boolean_operations ( std::map< unsigned int, double > constituent_shapes_values,
std::map< unsigned int, Tensor< 1, dim > > constituent_shapes_gradients ) const
inline

Computes the assigned boolean operations.

Parameters
constituent_shapes_valuesmap containing the computed values for the component shapes
constituent_shapes_gradientsmap containing the computed gradients for the component shapes

Definition at line 1518 of file shape.cc.

References Difference, gradient(), levelset, operations, and Union.

◆ clear_cache()

template<int dim>
void CompositeShape< dim >::clear_cache ( )
overridevirtual

Clear the cache of the shape.

Reimplemented from Shape< dim >.

Definition at line 1596 of file shape.cc.

References Shape< dim >::clear_cache().

◆ gradient()

template<int dim>
Tensor< 1, dim > CompositeShape< dim >::gradient ( const Point< dim > & evaluation_point,
const unsigned int component = 0 ) const
override

Return the gradient of the distance function.

Parameters
evaluation_pointThe point at which the function will be evaluated
componentNot applicable

Definition at line 1357 of file shape.cc.

References Shape< dim >::align_and_center(), apply_boolean_operations(), constituents, Shape< dim >::effective_radius, gradient(), Shape< dim >::gradient_cache, levelset, Shape< dim >::point_to_string(), and Shape< dim >::reverse_align_and_center().

◆ gradient_with_cell_guess()

template<int dim>
Tensor< 1, dim > CompositeShape< dim >::gradient_with_cell_guess ( const Point< dim > & evaluation_point,
const typename DoFHandler< dim >::active_cell_iterator & cell,
const unsigned int component = 0 )
overridevirtual

Return the gradient of the distance function.

Parameters
evaluation_pointThe point at which the function will be evaluated
cellThe cell that is likely to contain the evaluation point
componentNot applicable

Reimplemented from Shape< dim >.

Definition at line 1406 of file shape.cc.

References Shape< dim >::align_and_center(), apply_boolean_operations(), constituents, Shape< dim >::effective_radius, gradient(), Shape< dim >::gradient_cache, levelset, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), and Shape< dim >::reverse_align_and_center().

◆ load_data_from_file()

template<int dim>
void CompositeShape< dim >::load_data_from_file ( )

Load data from file. To be called at initialization, after repartitioning or when shape has moved. This function is used only for RBF shapes and its composites at the moment.

Definition at line 1488 of file shape.cc.

References CompositeShape(), constituents, and load_data_from_file().

◆ remove_superfluous_data()

template<int dim>
void CompositeShape< dim >::remove_superfluous_data ( DoFHandler< dim > & updated_dof_handler,
const bool mesh_based_precalculations )

Remove data that affects only artificial cells (not locally owned and not ghost). The data is removed if it would never be accessed by the local process.

Parameters
updated_dof_handlerthe reference to the new dof_handler
mesh_based_precalculationsmesh-based precalculations that can lead to slight shape misrepresentation (if RBF typed)

Definition at line 1501 of file shape.cc.

References CompositeShape(), constituents, and remove_superfluous_data().

◆ set_layer_thickening()

template<int dim>
void CompositeShape< dim >::set_layer_thickening ( const double layer_thickening)
overridevirtual

See base.

Reimplemented from Shape< dim >.

Definition at line 1606 of file shape.cc.

References constituents, Shape< dim >::layer_thickening, and Shape< dim >::set_layer_thickening().

◆ static_copy()

template<int dim>
std::shared_ptr< Shape< dim > > CompositeShape< dim >::static_copy ( ) const
overridevirtual

Return a pointer to a copy of the Shape.

Implements Shape< dim >.

Definition at line 1460 of file shape.cc.

References constituents, operations, Shape< dim >::orientation, and Shape< dim >::position.

◆ update_precalculations()

template<int dim>
void CompositeShape< dim >::update_precalculations ( DoFHandler< dim > & updated_dof_handler,
const bool mesh_based_precalculations )

Sets the proper dof handler, then computes/updates the map of cells and their likely non-null nodes.

Parameters
updated_dof_handlerthe reference to the new dof_handler
mesh_based_precalculationsmesh-based precalculations that can lead to slight shape misrepresentation (if RBF typed)

Definition at line 1469 of file shape.cc.

References CompositeShape(), constituents, and update_precalculations().

◆ value()

template<int dim>
double CompositeShape< dim >::value ( const Point< dim > & evaluation_point,
const unsigned int component = 0 ) const
overridevirtual

Return the evaluation of the signed distance function of this solid at the given point evaluation point.

Parameters
evaluation_pointThe point at which the function will be evaluated
componentThis parameter is not used, but it is necessary because Shapes inherit from the Function class of deal.II.

Implements Shape< dim >.

Definition at line 1277 of file shape.cc.

References Shape< dim >::align_and_center(), apply_boolean_operations(), constituents, levelset, Shape< dim >::point_to_string(), and Shape< dim >::value_cache.

◆ value_with_cell_guess()

template<int dim>
double CompositeShape< dim >::value_with_cell_guess ( const Point< dim > & evaluation_point,
const typename DoFHandler< dim >::active_cell_iterator & cell,
const unsigned int component = 0 )
overridevirtual

Return the evaluation of the signed distance function of this solid at the given point evaluation point with a guess for the cell containing the evaluation point.

Parameters
evaluation_pointThe point at which the function will be evaluated
cellThe cell that is likely to contain the evaluation point
componentThis parameter is not used, but it is necessary because Shapes inherit from the Function class of deal.II.

Reimplemented from Shape< dim >.

Definition at line 1314 of file shape.cc.

References Shape< dim >::align_and_center(), apply_boolean_operations(), constituents, levelset, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), and Shape< dim >::value_cache.

Member Data Documentation

◆ constituents

template<int dim>
std::map<unsigned int, std::shared_ptr<Shape<dim> > > CompositeShape< dim >::constituents
private

Definition at line 2394 of file shape.h.

◆ operations

template<int dim>
std::map<unsigned int, std::tuple<BooleanOperation, unsigned int, unsigned int> > CompositeShape< dim >::operations
private

Definition at line 2401 of file shape.h.


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