![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <shape.h>
Public Types | |
| enum class | RBFBasisFunction : int { CUSTOM , WENDLANDC2 , LINEAR , GAUSS90 , GAUSS95 , GAUSS99 , C1C0 , C2C0 , C0C1 , C1C1 , C2C1 , C0C2 , C1C2 , C2C2 , COS } |
| 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 | |
| RBFShape (const std::string &shape_arguments_str, const Point< dim > &position, const Tensor< 1, 3 > &orientation) | |
| void | load_data_from_file () |
| void | remove_superfluous_data (DoFHandler< dim > &dof_handler, const bool mesh_based_precalculations) |
| 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_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 |
| std::shared_ptr< Shape< dim > > | static_copy () const override |
| double | displaced_volume () override |
| void | initialize_bounding_box () |
| double | evaluate_basis_function (const RBFBasisFunction basis_function, const double distance) const |
| double | evaluate_basis_function_derivative (const RBFBasisFunction basis_function, const double distance) const |
| void | determine_likely_nodes_for_one_cell (const typename DoFHandler< dim >::cell_iterator &cell, const Point< dim > support_point) |
| void | update_precalculations (DoFHandler< dim > &updated_dof_handler, const bool mesh_based_precalculations) |
| void | rotate_nodes () |
| void | swap_iterable_nodes (const typename DoFHandler< dim >::active_cell_iterator &cell) |
| 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 | 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 () |
| virtual void | clear_cache () |
| 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) |
| virtual void | set_layer_thickening (const double the_layer_thickening) |
Static Public Member Functions | |
| static double | wendlandc2 (const double distance) |
| static double | linear (const double distance) |
| static double | gauss90 (const double distance) |
| static double | gauss95 (const double distance) |
| static double | gauss99 (const double distance) |
| static double | c1c0 (const double distance) |
| static double | c2c0 (const double distance) |
| static double | c0c1 (const double distance) |
| static double | c1c1 (const double distance) |
| static double | c2c1 (const double distance) |
| static double | c0c2 (const double distance) |
| static double | c1c2 (const double distance) |
| static double | c2c2 (const double distance) |
| static double | cos (const double distance) |
| static double | wendlandc2_derivative (const double distance) |
| static double | linear_derivative (const double distance) |
| static double | gauss90_derivative (const double distance) |
| static double | gauss95_derivative (const double distance) |
| static double | gauss99_derivative (const double distance) |
| static double | c1c0_derivative (const double distance) |
| static double | c2c0_derivative (const double distance) |
| static double | c0c1_derivative (const double distance) |
| static double | c1c1_derivative (const double distance) |
| static double | c2c1_derivative (const double distance) |
| static double | c0c2_derivative (const double distance) |
| static double | c1c2_derivative (const double distance) |
| static double | c2c2_derivative (const double distance) |
| static double | cosinus_derivative (const double distance) |
| 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 | |
| std::vector< double > | weights |
| std::vector< Point< dim > > | nodes_positions |
| std::vector< Point< dim > > | rotated_nodes_positions |
| std::vector< double > | support_radii |
| std::vector< double > | basis_functions |
| std::vector< bool > | useful_rbf_nodes |
| 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 |
Private Attributes | |
| std::string | filename |
| size_t | number_of_nodes |
| std::shared_ptr< HyperRectangle< dim > > | bounding_box |
| std::vector< std::tuple< Point< dim >, double, std::shared_ptr< std::vector< size_t > > > > | iterable_nodes |
| std::map< const typename DoFHandler< dim >::cell_iterator, std::shared_ptr< std::vector< std::tuple< Point< dim >, double, std::shared_ptr< std::vector< size_t > > > > > > | likely_nodes_map |
| size_t | max_number_of_inside_nodes |
| DoFHandler< dim > * | dof_handler |
| double | maximal_support_radius |
Additional Inherited Members | |
| 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 |
RBF Shapes express the signed distance function as a linear combination of Radial Basis Functions (RBF), which have a defined support radius and basis function. A collection of nodes and weights compose the object. Outside of the domain covered by the nodes, the distance is computed by using the distance to a bounding box instead.
| dim | Dimension of the shape |
|
strong |
Enum class defining types of RBF kernel functions that could be used in the class.
Class taken from Optimad Bitpit. https://github.com/optimad/bitpit
| Enumerator | |
|---|---|
| CUSTOM | |
| WENDLANDC2 | |
| LINEAR | |
| GAUSS90 | |
| GAUSS95 | |
| GAUSS99 | |
| C1C0 | |
| C2C0 | |
| C0C1 | |
| C1C1 | |
| C2C1 | |
| C0C2 | |
| C1C2 | |
| C2C2 | |
| COS | |
| RBFShape< dim >::RBFShape | ( | const std::string & | shape_arguments_str, |
| const Point< dim > & | position, | ||
| const Tensor< 1, 3 > & | orientation ) |
An RBFShape represents a physical object by describing its signed distance field with a linear combination of radial basis functions. Each radial basis function has a location and properties that are used in the sum.
| shape_arguments_str | the name of the file used to load the data |
| position | the location of the RBF shape |
| orientation | the orientation of the shape with respect to each main axis |
Definition at line 1614 of file shape.cc.
References basis_functions, filename, iterable_nodes, likely_nodes_map, load_data_from_file(), max_number_of_inside_nodes, maximal_support_radius, nodes_positions, number_of_nodes, Shape< dim >::orientation, Shape< dim >::position, Shape< dim >::Shape(), support_radii, useful_rbf_nodes, and weights.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| void RBFShape< dim >::determine_likely_nodes_for_one_cell | ( | const typename DoFHandler< dim >::cell_iterator & | cell, |
| const Point< dim > | support_point ) |
Establishes which nodes bring a non null contribution to the RBF.
| cell | the cell for which the likely nodes are to be found |
| support_point | one point that is located inside the cell |
Definition at line 2035 of file shape.cc.
References iterable_nodes, likely_nodes_map, and maximal_support_radius.
|
overridevirtual |
Return the volume displaced by the solid.
Reimplemented from Shape< dim >.
Definition at line 1820 of file shape.cc.
References bounding_box.
|
inline |
Returns the value of the basis function for a given distance. Inspired by Optimad Bitpit. https://github.com/optimad/bitpit.
| basis_function | basis function to be used for calculation |
| distance | distance to the node normalized by the support radius |
Definition at line 2257 of file shape.cc.
References C0C1, c0c1(), C0C2, c0c2(), C1C0, c1c0(), C1C1, c1c1(), C1C2, c1c2(), C2C0, c2c0(), C2C1, c2c1(), C2C2, c2c2(), COS, cos(), GAUSS90, gauss90(), GAUSS95, gauss95(), GAUSS99, gauss99(), LINEAR, linear(), WENDLANDC2, and wendlandc2().
|
inline |
Returns the derivative of the basis function for a given distance. Inspired by Optimad Bitpit. https://github.com/optimad/bitpit.
| basis_function | basis function to be used for calculation |
| distance | distance to the node normalized by the support radius |
Definition at line 2297 of file shape.cc.
References C0C1, c0c1_derivative(), C0C2, c0c2_derivative(), C1C0, c1c0_derivative(), C1C1, c1c1_derivative(), C1C2, c1c2_derivative(), C2C0, c2c0_derivative(), C2C1, c2c1_derivative(), C2C2, c2c2_derivative(), COS, cosinus_derivative(), GAUSS90, gauss90_derivative(), GAUSS95, gauss95_derivative(), GAUSS99, gauss99_derivative(), LINEAR, linear_derivative(), WENDLANDC2, and wendlandc2_derivative().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
override |
Return the analytical gradient of the distance for the current RBF.
| evaluation_point | The point at which the function will be evaluated |
| component | This parameter is not used, but it is necessary because Shapes inherit from the Function class of deal.II. |
Definition at line 1736 of file shape.cc.
References basis_functions, bounding_box, Shape< dim >::effective_radius, evaluate_basis_function_derivative(), gradient(), iterable_nodes, rotated_nodes_positions, support_radii, and weights.
|
overridevirtual |
Return the analytical gradient of the distance.
| evaluation_point | The point at which the function will be evaluated |
| cell | The cell that is likely to contain the evaluation point |
| component | This 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 1665 of file shape.cc.
References bounding_box, gradient(), Shape< dim >::gradient_cache, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), and swap_iterable_nodes().
| void RBFShape< dim >::initialize_bounding_box | ( | ) |
Initializes the bounding box around the nodes which enables distance calculation even if the RBF nodes don't cover the whole domain.
A bounding box is constructed around the collection of nodes defining the RBF. It solves an issue where the collection of nodes is located only around the object itself, which would result in an undefined distance when the value is evaluated outside of all support radii. The hyper rectangle shape doesn't have this limitation, as its distance can be evaluated anywhere. The distance computed by an RBF object will therefore use an approximated distance when the evaluation point is too far.
Definition at line 1827 of file shape.cc.
References bounding_box, Shape< dim >::bounding_box_center, Shape< dim >::bounding_box_half_length, nodes_positions, number_of_nodes, Shape< dim >::orientation, and Shape< dim >::reverse_align_and_center().
|
inlinestatic |
|
inlinestatic |
| void RBFShape< dim >::load_data_from_file | ( | ) |
Load RBF 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 2100 of file shape.cc.
References basis_functions, bounding_box, Shape< dim >::effective_radius, filename, fill_vectors_from_file(), initialize_bounding_box(), iterable_nodes, maximal_support_radius, nodes_positions, number_of_nodes, rotate_nodes(), rotated_nodes_positions, support_radii, useful_rbf_nodes, and weights.
| void RBFShape< dim >::remove_superfluous_data | ( | DoFHandler< dim > & | 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.
| dof_handler | the reference to the new dof_handler |
| mesh_based_precalculations | mesh-based precalculations that can lead to slight shape misrepresentation (if RBF typed) |
Definition at line 2148 of file shape.cc.
References basis_functions, iterable_nodes, likely_nodes_map, number_of_nodes, rotated_nodes_positions, support_radii, update_precalculations(), useful_rbf_nodes, and weights.
| void RBFShape< dim >::rotate_nodes | ( | ) |
Rotate RBF nodes in the global reference frame (the reference frame of the triangulation).
Definition at line 2244 of file shape.cc.
References nodes_positions, Shape< dim >::reverse_align_and_center(), rotated_nodes_positions, and weights.
|
overridevirtual |
Return a pointer to a copy of the Shape.
Implements Shape< dim >.
Definition at line 1809 of file shape.cc.
References filename, Shape< dim >::orientation, and Shape< dim >::position.
| void RBFShape< dim >::swap_iterable_nodes | ( | const typename DoFHandler< dim >::active_cell_iterator & | cell | ) |
Swap the vector of all nodes with a likely node vector.
| cell | A likely one where the evaluation point is located |
Definition at line 2338 of file shape.cc.
References iterable_nodes, and likely_nodes_map.
| void RBFShape< 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.
| updated_dof_handler | the reference to the new dof_handler |
| mesh_based_precalculations | mesh-based precalculations that can lead to slight shape misrepresentation (if RBF typed) |
Definition at line 1860 of file shape.cc.
References determine_likely_nodes_for_one_cell(), dof_handler, iterable_nodes, likely_nodes_map, max_number_of_inside_nodes, maximal_support_radius, number_of_nodes, rotated_nodes_positions, useful_rbf_nodes, and weights.
|
overridevirtual |
Return the evaluation of the signed distance function of this solid at the given point evaluation point. The computation and addition of the bounding box distance are necessary since the RBF nodes may not cover the whole simulation domain. In that case, it is assumed that the distance from the RBF object is approximately the same as the distance from the corresponding bounding box.
| evaluation_point | The point at which the function will be evaluated |
| component | This parameter is not used, but it is necessary because Shapes inherit from the Function class of deal.II. |
Implements Shape< dim >.
Definition at line 1697 of file shape.cc.
References basis_functions, bounding_box, Shape< dim >::effective_radius, evaluate_basis_function(), iterable_nodes, Shape< dim >::layer_thickening, Shape< dim >::point_to_string(), rotated_nodes_positions, support_radii, value(), Shape< dim >::value_cache, and weights.
|
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.
| evaluation_point | The point at which the function will be evaluated |
| cell | The cell that is likely to contain the evaluation point |
| component | This 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 1635 of file shape.cc.
References bounding_box, Shape< dim >::effective_radius, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), swap_iterable_nodes(), value(), and Shape< dim >::value_cache.
|
inlinestatic |
|
inlinestatic |
| std::vector<double> RBFShape< dim >::basis_functions |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| std::vector<Point<dim> > RBFShape< dim >::nodes_positions |
|
private |
| std::vector<Point<dim> > RBFShape< dim >::rotated_nodes_positions |
| std::vector<double> RBFShape< dim >::support_radii |
| std::vector<bool> RBFShape< dim >::useful_rbf_nodes |
| std::vector<double> RBFShape< dim >::weights |