libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::TriangleInterface::PolygonHole Class Reference

A concrete instantiation of the Hole class that describes polygonal (triangular, square, pentagonal, ...) holes. More...

#include <mesh_triangle_holes.h>

Inheritance diagram for libMesh::TriangleInterface::PolygonHole:
[legend]

Public Member Functions

 PolygonHole (const Point &center, Real radius, unsigned int n_points)
 Constructor specifying the center, radius, and number of points which comprise the hole. More...
 
virtual unsigned int n_points () const libmesh_override
 The number of geometric points which define the hole. More...
 
virtual Point point (const unsigned int n) const libmesh_override
 Return the nth point defining the hole. More...
 
virtual Point inside () const libmesh_override
 Return an (arbitrary) point which lies inside the hole. More...
 

Private Attributes

Point _center
 (x,y) location of the center of the hole More...
 
Real _radius
 circular hole radius More...
 
unsigned int _n_points
 number of points used to describe the hole. More...
 

Detailed Description

A concrete instantiation of the Hole class that describes polygonal (triangular, square, pentagonal, ...) holes.

Definition at line 81 of file mesh_triangle_holes.h.

Constructor & Destructor Documentation

libMesh::TriangleInterface::PolygonHole::PolygonHole ( const Point center,
Real  radius,
unsigned int  n_points 
)

Constructor specifying the center, radius, and number of points which comprise the hole.

The points will all lie on a circle of radius r.

Definition at line 32 of file mesh_triangle_holes.C.

34  :
35  _center(center),
36  _radius(radius),
37  _n_points(n_points_in)
38 {}
const Real radius
Point _center
(x,y) location of the center of the hole
unsigned int _n_points
number of points used to describe the hole.

Member Function Documentation

Point libMesh::TriangleInterface::PolygonHole::inside ( ) const
virtual

Return an (arbitrary) point which lies inside the hole.

Implements libMesh::TriangleInterface::Hole.

Definition at line 58 of file mesh_triangle_holes.C.

References _center.

59 {
60  // The center of the hole is definitely inside.
61  return _center;
62 }
Point _center
(x,y) location of the center of the hole
unsigned int libMesh::TriangleInterface::PolygonHole::n_points ( ) const
virtual

The number of geometric points which define the hole.

Implements libMesh::TriangleInterface::Hole.

Definition at line 41 of file mesh_triangle_holes.C.

References _n_points.

42 {
43  return _n_points;
44 }
unsigned int _n_points
number of points used to describe the hole.
Point libMesh::TriangleInterface::PolygonHole::point ( const unsigned int  n) const
virtual

Return the nth point defining the hole.

Implements libMesh::TriangleInterface::Hole.

Definition at line 46 of file mesh_triangle_holes.C.

References _center, _n_points, _radius, libMesh::pi, and libMesh::Real.

47 {
48  // The nth point lies at the angle theta = 2 * pi * n / _n_points
49  const Real theta = static_cast<Real>(n) * 2.0 * libMesh::pi / static_cast<Real>(_n_points);
50 
51  return Point(_center(0) + _radius*std::cos(theta), // x=r*cos(theta)
52  _center(1) + _radius*std::sin(theta), // y=r*sin(theta)
53  0.);
54 }
Point _center
(x,y) location of the center of the hole
unsigned int _n_points
number of points used to describe the hole.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real pi
.
Definition: libmesh.h:172

Member Data Documentation

Point libMesh::TriangleInterface::PolygonHole::_center
private

(x,y) location of the center of the hole

Definition at line 101 of file mesh_triangle_holes.h.

Referenced by inside(), and point().

unsigned int libMesh::TriangleInterface::PolygonHole::_n_points
private

number of points used to describe the hole.

The actual points can be generated knowing the center and radius. For example, n_points=3 would generate a triangular hole.

Definition at line 113 of file mesh_triangle_holes.h.

Referenced by n_points(), and point().

Real libMesh::TriangleInterface::PolygonHole::_radius
private

circular hole radius

Definition at line 106 of file mesh_triangle_holes.h.

Referenced by point().


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