libMesh::TriangleInterface::PolygonHole Class Reference

#include <mesh_triangle_holes.h>

Inheritance diagram for libMesh::TriangleInterface::PolygonHole:

Public Member Functions

 PolygonHole (Point center, Real radius, unsigned int n_points)
 
virtual unsigned int n_points () const
 
virtual Point point (const unsigned int n) const
 
virtual Point inside () const
 

Private Attributes

Point _center
 
Real _radius
 
unsigned int _n_points
 

Detailed Description

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

Definition at line 77 of file mesh_triangle_holes.h.

Constructor & Destructor Documentation

libMesh::TriangleInterface::PolygonHole::PolygonHole ( 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.

33  : _center(center),
34  _radius(radius),
35  _n_points(n_points_in)
36  {}

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 56 of file mesh_triangle_holes.C.

57  {
58  // The center of the hole is definitely inside.
59  return _center;
60  }
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 39 of file mesh_triangle_holes.C.

40  {
41  return _n_points;
42  }
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 44 of file mesh_triangle_holes.C.

References libMesh::pi, and libMesh::Real.

45  {
46  // The nth point lies at the angle theta = 2 * pi * n / _n_points
47  const Real theta = static_cast<Real>(n) * 2.0 * libMesh::pi / static_cast<Real>(_n_points);
48 
49  return Point(_center(0) + _radius*std::cos(theta), // x=r*cos(theta)
50  _center(1) + _radius*std::sin(theta), // y=r*sin(theta)
51  0.);
52  }

Member Data Documentation

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

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

Definition at line 97 of file mesh_triangle_holes.h.

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 109 of file mesh_triangle_holes.h.

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

circular hole radius

Definition at line 102 of file mesh_triangle_holes.h.


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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:01 UTC

Hosted By:
SourceForge.net Logo