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

#include <shape.h>

Inheritance diagram for Superquadric< dim >:
[legend]

Public Member Functions

 Superquadric (const Tensor< 1, dim > half_lengths, const Tensor< 1, dim > exponents, const double epsilon, 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
std::shared_ptr< Shape< dim > > static_copy () const 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
void closest_surface_point (const Point< dim > &p, Point< dim > &closest_point, const typename DoFHandler< dim >::active_cell_iterator &cell_guess) override
void closest_surface_point (const Point< dim > &p, Point< dim > &closest_point) const override
double superquadric (const Point< dim > &centered_point) const
Point< dim > superquadric_gradient (const Point< dim > &centered_point) const
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 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 ()
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 sign (const double prm)
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)

Private Attributes

Tensor< 1, dim > half_lengths
Tensor< 1, dim > exponents
double epsilon

Additional Inherited Members

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 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 Superquadric< dim >

This class defines superquadric shapes. Their signed distance function is: \(\left|\frac{x}{a}\right|^r + \left|\frac{y}{b}\right|^s + \left|\frac{z}{c}\right|^t - 1 = 0\).

Template Parameters
dimDimension of the shape

Definition at line 1569 of file shape.h.

Constructor & Destructor Documentation

◆ Superquadric()

template<int dim>
Superquadric< dim >::Superquadric ( const Tensor< 1, dim > half_lengths,
const Tensor< 1, dim > exponents,
const double epsilon,
const Point< dim > & position,
const Tensor< 1, 3 > & orientation )
inline

Constructor for a superquadric shape.

Parameters
half_lengthsThe half-lengths of each direction
exponentsThe blockiness in each direction
epsilonThe tolerance for surface representation
positionThe superquadric center
orientationThe superquadric orientation

Definition at line 1580 of file shape.h.

References Shape< dim >::bounding_box_center, Shape< dim >::bounding_box_half_length, epsilon, exponents, half_lengths, Shape< dim >::orientation, Shape< dim >::position, and Shape< dim >::Shape().

Member Function Documentation

◆ closest_surface_point() [1/2]

template<int dim>
void Superquadric< dim >::closest_surface_point ( const Point< dim > & p,
Point< dim > & closest_point ) const
overridevirtual

◆ closest_surface_point() [2/2]

template<int dim>
void Superquadric< dim >::closest_surface_point ( const Point< dim > & p,
Point< dim > & closest_point,
const typename DoFHandler< dim >::active_cell_iterator & cell_guess )
overridevirtual

Sets the closest_point parameter to be the point on the surface of the shape which has the minimal distance from the given point p. Since this function is at the core of the calculations for superquadrics, it is redefined here.

Parameters
pThe point at which the evaluation is performed
closest_pointThe reference to the closest point. This point will be modified by the function.
cell_guessA guess of the cell containing the evaluation point, which is useful to reduce computation time

Reimplemented from Shape< dim >.

Definition at line 490 of file shape.cc.

References Shape< dim >::closest_point_cache, closest_surface_point(), gradient(), Shape< dim >::gradient_cache, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), value(), and Shape< dim >::value_cache.

◆ gradient()

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

Return the analytical gradient of the distance.

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.

Definition at line 638 of file shape.cc.

References Shape< dim >::align_and_center(), closest_surface_point(), Shape< dim >::effective_radius, gradient(), Shape< dim >::gradient_cache, Shape< dim >::point_to_string(), and superquadric().

◆ gradient_with_cell_guess()

template<int dim>
Tensor< 1, dim > Superquadric< 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 666 of file shape.cc.

References Shape< dim >::closest_point_cache, closest_surface_point(), gradient(), Shape< dim >::gradient_cache, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), value(), and Shape< dim >::value_cache.

◆ sign()

template<int dim>
double Superquadric< dim >::sign ( const double prm)
inlinestatic

Return the sign of the parameter. To be removed once PR#794 is merged.

Parameters
prmparameter

Definition at line 1676 of file shape.h.

◆ static_copy()

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

Return a pointer to a copy of the Shape.

Implements Shape< dim >.

Definition at line 625 of file shape.cc.

References epsilon, exponents, half_lengths, Shape< dim >::orientation, and Shape< dim >::position.

◆ superquadric()

template<int dim>
double Superquadric< dim >::superquadric ( const Point< dim > & centered_point) const
inline

Computes the value of the superquadric from its equation.

Parameters
centered_pointpoint at which we make the evaluation, in the shape referential

Definition at line 1691 of file shape.h.

References exponents, and half_lengths.

◆ superquadric_gradient()

template<int dim>
Point< dim > Superquadric< dim >::superquadric_gradient ( const Point< dim > & centered_point) const
inline

Computes the gradient of the superquadric from its equation.

Parameters
centered_pointpoint at which we make the evaluation, in the shape referential

Definition at line 1703 of file shape.h.

References epsilon, exponents, gradient(), and half_lengths.

◆ value()

template<int dim>
double Superquadric< 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 564 of file shape.cc.

References Shape< dim >::align_and_center(), closest_surface_point(), Shape< dim >::layer_thickening, Shape< dim >::point_to_string(), superquadric(), and Shape< dim >::value_cache.

◆ value_with_cell_guess()

template<int dim>
double Superquadric< 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 592 of file shape.cc.

References Shape< dim >::closest_point_cache, closest_surface_point(), gradient(), Shape< dim >::gradient_cache, levelset, Shape< dim >::part_of_a_composite, Shape< dim >::point_to_string(), value(), and Shape< dim >::value_cache.

Member Data Documentation

◆ epsilon

template<int dim>
double Superquadric< dim >::epsilon
private

Definition at line 1727 of file shape.h.

◆ exponents

template<int dim>
Tensor<1, dim> Superquadric< dim >::exponents
private

Definition at line 1726 of file shape.h.

◆ half_lengths

template<int dim>
Tensor<1, dim> Superquadric< dim >::half_lengths
private

Definition at line 1725 of file shape.h.


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