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

#include <shape.h>

Inheritance diagram for Sphere< dim >:
[legend]

Public Member Functions

 Sphere (double radius, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
double value (const Point< dim > &evaluation_point, const unsigned int component=0) const 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
double displaced_volume () override
void set_position (const Point< dim > &position) override
virtual std::shared_ptr< Manifold< dim - 1, dim > > get_shape_manifold () override
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) override
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) override
virtual double local_curvature_radius (Point< dim > p) override
virtual double local_curvature_radius_with_cell_guess (const Point< dim > &p, const typename DoFHandler< dim >::active_cell_iterator &cell) override
Public Member Functions inherited from Shape< dim >
 Shape (double radius, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
virtual double value_with_cell_guess (const Point< dim > &evaluation_point, const typename DoFHandler< dim >::active_cell_iterator &cell, const unsigned int component=0)
bool bounding_box_contact (Shape< dim > &shape)
virtual 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)
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 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 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)

Private Attributes

std::shared_ptr< Functions::SignedDistance::Sphere< dim > > sphere_function

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
}
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 Sphere< dim >

Definition at line 1369 of file shape.h.

Constructor & Destructor Documentation

◆ Sphere()

template<int dim>
Sphere< dim >::Sphere ( double radius,
const Point< dim > & position,
const Tensor< 1, 3 > & orientation )
inline

Constructor for a sphere.

Parameters
radiusThe sphere radius
positionThe sphere center
orientationThe sphere orientation

Definition at line 1378 of file shape.h.

References Shape< dim >::bounding_box_center, Shape< dim >::bounding_box_half_length, Shape< dim >::orientation, Shape< dim >::position, Shape< dim >::Shape(), and sphere_function.

Member Function Documentation

◆ displaced_volume()

template<int dim>
double Sphere< dim >::displaced_volume ( )
overridevirtual

Return the volume displaced by the solid.

Reimplemented from Shape< dim >.

Definition at line 324 of file shape.cc.

References Shape< dim >::effective_radius.

◆ distance_to_shape()

template<int dim>
std::tuple< double, Tensor< 1, dim >, Point< dim > > Sphere< dim >::distance_to_shape ( Shape< dim > & shape,
std::vector< Point< dim > > & candidate_points,
double precision = 1e-6,
bool exact_distance_outside_of_contact = false )
overridevirtual

Return the distance, the center point, and the normal between the current shape and the shape given in the argument. The center point is the point that minimized the level set obtained from the intersection of the two shapes. The normal is defined using the closest surface point on the two shapes. This function is an optimized version of the general shape distance calculation for the case of a sphere.

Parameters
shapeThe shape with which the distance is evaluated
candidate_pointsThis is the initial guess points used in the calculation. (In this implementation, this parameter is void)
precisionThis is the precision of the distance between the two shapes. (In this implementation, this parameter is void)
exact_distance_outside_of_contactThis is a boolean to force the exact distance evaluation if the shapes are not in contact. (In this implementation, this parameter is void)

Reimplemented from Shape< dim >.

Definition at line 387 of file shape.cc.

References Shape< dim >::effective_radius, Shape< dim >::get_position(), Shape< dim >::position, Shape< dim >::Shape(), Sphere(), and Shape< dim >::value().

◆ distance_to_shape_with_cell_guess()

template<int dim>
std::tuple< double, Tensor< 1, dim >, Point< dim > > Sphere< 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 )
overridevirtual

Return the distance, the center point, and the normal between the current shape and the shape given in the argument. The center point is the point that minimized the level set obtained from the intersection of the two shapes. The normal is defined using the closest surface point on the two shapes. This function is an optimized version of the general shape distance calculation for the case of a sphere.

Parameters
shapeThe shape with which the distance is evaluated
cellThe cell that is likely to contain the evaluation point
candidate_pointsThis is the initial guess points used in the calculation. (In this implementation this parameter is void)
precisionThis is the precision of the distance between the two shapes. (In this implementation this parameter is void)
exact_distance_outside_of_contactThis is a boolean to force the exact distance evaluation if the shapes are not in contact. (In this implementation this parameter is void)

Reimplemented from Shape< dim >.

Definition at line 348 of file shape.cc.

References Shape< dim >::effective_radius, Shape< dim >::get_position(), Shape< dim >::gradient_with_cell_guess(), Shape< dim >::position, Shape< dim >::Shape(), Sphere(), and Shape< dim >::value_with_cell_guess().

◆ get_shape_manifold()

template<int dim>
std::shared_ptr< Manifold< dim - 1, dim > > Sphere< dim >::get_shape_manifold ( )
overridevirtual

Return the manifold of the sphere as a spherical manifold center at the position of the shape.

Reimplemented from Shape< dim >.

Definition at line 317 of file shape.cc.

References Shape< dim >::position.

◆ gradient()

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

References Shape< dim >::effective_radius, Shape< dim >::position, and sphere_function.

◆ local_curvature_radius()

template<int dim>
double Sphere< dim >::local_curvature_radius ( Point< dim > p)
overridevirtual

Return the curvature of the level set at a given point.

Parameters
pThe point where the curvature is evaluated.

Reimplemented from Shape< dim >.

Definition at line 422 of file shape.cc.

References Shape< dim >::position.

◆ local_curvature_radius_with_cell_guess()

template<int dim>
double Sphere< dim >::local_curvature_radius_with_cell_guess ( const Point< dim > & p,
const typename DoFHandler< dim >::active_cell_iterator & cell )
overridevirtual

Return the curvature of the level set at a given point using the.

Parameters
cellThe cell that is likely to contain the evaluation point
pThe point where the curvature is evaluated.

Reimplemented from Shape< dim >.

Definition at line 429 of file shape.cc.

References Shape< dim >::position.

◆ set_position()

template<int dim>
void Sphere< dim >::set_position ( const Point< dim > & new_position)
overridevirtual

Sets a new position for the shape.

Parameters
new_positionThe new position the shape will be placed at

Reimplemented from Shape< dim >.

Definition at line 339 of file shape.cc.

References Shape< dim >::effective_radius, Shape< dim >::position, Shape< dim >::set_position(), and sphere_function.

◆ static_copy()

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

Return a pointer to a copy of the Shape.

Implements Shape< dim >.

Definition at line 291 of file shape.cc.

References Shape< dim >::effective_radius, Shape< dim >::orientation, and Shape< dim >::position.

◆ value()

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

References Shape< dim >::layer_thickening, and sphere_function.

Member Data Documentation

◆ sphere_function

template<int dim>
std::shared_ptr<Functions::SignedDistance::Sphere<dim> > Sphere< dim >::sphere_function
private

Definition at line 1488 of file shape.h.


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