IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM > Class Template Reference

Provides an analytic description of a convex polygon. It inherets from the EmbeddedBoundaryShape base class and provides a concrete implementation of the "isInside()" method, which specifies whether a cell is INSIDE the convex poly. More...

#include <EmbeddedBoundaryShapePolygon.h>

Inheritance diagram for SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >:
Inheritance graph
[legend]

Public Member Functions

 EmbeddedBoundaryShapePolygon (const std::string &object_name, tbox::Pointer< tbox::Database > input_db)
 
 ~EmbeddedBoundaryShapePolygon ()
 
bool isInside (const double *xyz) const
 
void isInside (const int *nx, const double *dx, const double *origin, int *inout) const
 
virtual void printClassData (std::ostream &os) const
 

Private Member Functions

void getFromInput (tbox::Pointer< tbox::Database > db)
 
bool sameSide (double p1[3], double p2[3], double a[3], double b[3]) const
 
bool pointInPolygon (tbox::Array< double > v_x, tbox::Array< double > v_y, double p_x, double p_y) const
 
void crossProduct (double a[3], const double b[3], const double c[3]) const
 
double dotProduct (const double a[3], const double b[3]) const
 

Private Attributes

std::string d_object_name
 
double d_height
 
double d_eps
 
tbox::Array< doubled_vx
 
tbox::Array< doubled_vy
 
int d_num_vertices
 

Detailed Description

template<int DIM>
class SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >

The user must specify at least three coordinates that define the vertices the poly. If the problem is 3D, a height must also be specified. An example input entry would look like:

*        Polygon1{
*           type = "POLYGON"
*           coords_1 = 1.0 , 1.0
*           coords_2 = 2.0 , 1.0
*           coords_3 = 2.0 , 2.0
*           coords_4 = 1.0 , 2.0
*           height = 8.0
*        }
* 

Constructor & Destructor Documentation

◆ EmbeddedBoundaryShapePolygon()

template<int DIM>
SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::EmbeddedBoundaryShapePolygon ( const std::string &  object_name,
tbox::Pointer< tbox::Database input_db 
)
Parameters
object_namename of object of this class
input_dbthe input database which contains radius and center specification.

◆ ~EmbeddedBoundaryShapePolygon()

The destructor does nothing.

Member Function Documentation

◆ isInside() [1/2]

template<int DIM>
bool SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::isInside ( const double xyz) const
virtual

Concrete implementation of the isInside() method defined by the EmbeddedBoundaryShapeX base class. This method indicates whether the supplied xyz coordinates are inside or outside of the polygon.

Parameters
xyzdouble array[DIM] specifying coordinates.

Reimplemented from SAMRAI::appu::EmbeddedBoundaryShape< DIM >.

◆ isInside() [2/2]

template<int DIM>
void SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::isInside ( const int nx,
const double dx,
const double origin,
int inout 
) const
virtual

Concrete implementation of the isInside() method defined by the EmbeddedBoundaryShapeX base class. This method indicates whether the array of xyz coordinates are inside or outside of the polygon.

Parameters
nxinteger array [DIM] specifying number of points in each dir
dxdouble array [DIM] specifying spacing of points in each dir
origindouble array [DIM] specifying origin of lower corner
inoutint array dimensioned the total number of points (i.e. nx[0]*nx[1]*nx[2]). This is an OUTPUT quantity.

Reimplemented from SAMRAI::appu::EmbeddedBoundaryShape< DIM >.

◆ printClassData()

template<int DIM>
virtual void SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::printClassData ( std::ostream &  os) const
virtual

Dump data to supplied stream.

Implements SAMRAI::appu::EmbeddedBoundaryShape< DIM >.

◆ getFromInput()

template<int DIM>
void SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::getFromInput ( tbox::Pointer< tbox::Database db)
private

Read name, and vertex information from input. The name is optional but at least three vertices must be specified by the input file.

◆ sameSide()

template<int DIM>
bool SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::sameSide ( double  p1[3],
double  p2[3],
double  a[3],
double  b[3] 
) const
private

Returns TRUE if points p1 and p2 are on the same side of line segment ab; FALSE otherwise.

◆ pointInPolygon()

template<int DIM>
bool SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::pointInPolygon ( tbox::Array< double v_x,
tbox::Array< double v_y,
double  p_x,
double  p_y 
) const
private

Returns TRUE if a point p is within a convex polygon defined by vertices (v_x[i], * v_y[i]), i = 0..d_num_vertices-1; FALSE otherwise.

◆ crossProduct()

template<int DIM>
void SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::crossProduct ( double  a[3],
const double  b[3],
const double  c[3] 
) const
private

This method computes the cross prodcut, A = B cross C.

◆ dotProduct()

template<int DIM>
double SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::dotProduct ( const double  a[3],
const double  b[3] 
) const
private

This method computes the dot product of A and B.

Member Data Documentation

◆ d_object_name

template<int DIM>
std::string SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::d_object_name
private

◆ d_height

template<int DIM>
double SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::d_height
private

◆ d_eps

template<int DIM>
double SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::d_eps
private

◆ d_vx

template<int DIM>
tbox::Array<double> SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::d_vx
private

◆ d_vy

template<int DIM>
tbox::Array<double> SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::d_vy
private

◆ d_num_vertices

template<int DIM>
int SAMRAI::appu::EmbeddedBoundaryShapePolygon< DIM >::d_num_vertices
private

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