My Project
Loading...
Searching...
No Matches
Opm::Elasticity::BoundaryGrid Class Reference

A class describing a quad grid. More...

#include <boundarygrid.hh>

Classes

struct  BoundedPredicate
 Predicate for checking if a vertex falls within a quads bounding box. More...
 
class  Quad
 A class describing a linear, quadrilateral element. More...
 
class  Vertex
 A class describing a 2D vertex. More...
 
struct  VertexLess
 Predicate for sorting vertices. More...
 

Public Types

typedef Dune::FieldVector< double, 3 > GlobalCoordinate
 A coordinate on the underlying 3D grid.
 
typedef Dune::FieldVector< double, 2 > FaceCoord
 A coordinate on the quad grid.
 

Public Member Functions

 BoundaryGrid ()
 Default (empty) constructor.
 
virtual ~BoundaryGrid ()
 Default (empty) destructor.
 
void add (const Quad &quad)
 Add a quad to the grid.
 
void addToColumn (size_t col, const Quad &quad)
 
Quadoperator[] (int index)
 Obtain a reference to a quad.
 
const Quadoperator[] (int index) const
 Obtain a const reference to a quad.
 
const QuadgetQuad (int col, int index) const
 
size_t size () const
 Obtain the number of quads in the grid.
 
size_t colSize (int i) const
 
size_t totalNodes () const
 Return the total number of nodes on the grid when known.
 
bool isFixed (int node) const
 Check if a given node is marked as fixed.
 
bool find (Vertex &res, const Vertex &coord) const
 Locate the position of a vertex on the grid.
 

Static Public Member Functions

static BoundaryGrid uniform (const FaceCoord &min, const FaceCoord &max, int k1, int k2, bool dc=false)
 Establish an uniform quad grid.
 
static void extract (FaceCoord &res, const GlobalCoordinate &coord, int dir)
 Helper function for extracting given 2D coordinates from a 3D coordinate.
 
static void extract (Vertex &res, const Dune::FieldVector< double, 3 > &coord, int dir)
 Helper function for extracting given 2D coordinates from a 3D vector.
 

Protected Member Functions

bool bilinearSolve (double epsilon, double order, const double *A, const double *B, std::vector< double > &X, std::vector< double > &Y) const
 Solves a bi-linear set of equations in x and y.
 
bool cubicSolve (double eps, double A, double B, double C, double D, std::vector< double > &X) const
 Solves the cubic equation A*x^3+B*x^2+C*x+D=0.
 
int Q4inv (FaceCoord &res, const Quad &q, const FaceCoord &coord, double epsZero, double epsOut) const
 Find the local coordinates of a given point within a given quad.
 

Protected Attributes

std::vector< Quadgrid
 Our quadrilateral elements.
 
std::vector< std::vector< Quad > > colGrids
 
std::vector< bool > fixNodes
 Whether or not a given node is marked as fixed.
 
size_t nodes
 Total number of nodes on grid.
 

Friends

std::ostream & operator<< (std::ostream &os, const BoundaryGrid &g)
 Print to a stream.
 

Detailed Description

A class describing a quad grid.

Member Function Documentation

◆ add()

void Opm::Elasticity::BoundaryGrid::add ( const Quad quad)

Add a quad to the grid.

Parameters
[in]quadThe quad to add

◆ bilinearSolve()

bool Opm::Elasticity::BoundaryGrid::bilinearSolve ( double  epsilon,
double  order,
const double *  A,
const double *  B,
std::vector< double > &  X,
std::vector< double > &  Y 
) const
protected

Solves a bi-linear set of equations in x and y.

A1 * x*y + A2 * x + A3 * y = A4 B1 * x*y + B2 * x + B3 * y = B4

Parameters
[in]epsilonThe tolerance for equality checks with zero
[in]orderThe expected order of the solution (used for unique checks)
[in]AThe coefficients of the first equation
[in]BThe coefficients of the second equation
[out]XThe first component of the solutions
[out]YThe second component of the solutions

◆ cubicSolve()

bool Opm::Elasticity::BoundaryGrid::cubicSolve ( double  eps,
double  A,
double  B,
double  C,
double  D,
std::vector< double > &  X 
) const
protected

Solves the cubic equation A*x^3+B*x^2+C*x+D=0.

Parameters
[in]epsThe tolerance for equality checks with zero
[in]AEquation coefficient
[in]BEquation coefficient
[in]CEquation coefficient
[in]DEquation coefficient
[out]XThe obtained solutions

◆ extract() [1/2]

void Opm::Elasticity::BoundaryGrid::extract ( FaceCoord res,
const GlobalCoordinate coord,
int  dir 
)
static

Helper function for extracting given 2D coordinates from a 3D coordinate.

Parameters
[in]coordThe 3D coordinates of the vertex
[in]dirThe direction to ignore
[out]resThe resulting coordinates

◆ extract() [2/2]

void Opm::Elasticity::BoundaryGrid::extract ( Vertex res,
const Dune::FieldVector< double, 3 > &  coord,
int  dir 
)
static

Helper function for extracting given 2D coordinates from a 3D vector.

Parameters
[in]coordThe 3D coordinates of the vertex
[in]dirThe direction to ignore
[out]resThe resulting coordinates

◆ find()

bool Opm::Elasticity::BoundaryGrid::find ( Vertex res,
const Vertex coord 
) const

Locate the position of a vertex on the grid.

Parameters
[in]coordThe coordinate of the vertex
[out]resThe resulting coordinates

◆ isFixed()

bool Opm::Elasticity::BoundaryGrid::isFixed ( int  node) const
inline

Check if a given node is marked as fixed.

Parameters
[in]nodeThe requested node
Returns
Whether or not the node is marked as fixed

◆ operator[]() [1/2]

Quad & Opm::Elasticity::BoundaryGrid::operator[] ( int  index)
inline

Obtain a reference to a quad.

Parameters
[in]indexThe index of the requested quad
Returns
A reference to the requested quad

◆ operator[]() [2/2]

const Quad & Opm::Elasticity::BoundaryGrid::operator[] ( int  index) const
inline

Obtain a const reference to a quad.

Parameters
[in]indexThe index of the requested quad
Returns
A const reference to the requested quad

◆ Q4inv()

int Opm::Elasticity::BoundaryGrid::Q4inv ( FaceCoord res,
const Quad q,
const FaceCoord coord,
double  epsZero,
double  epsOut 
) const
protected

Find the local coordinates of a given point within a given quad.

Parameters
[in]qThe quad to search within
[in]coordThe coordinates to search for
[in]epsZeroThe tolerance for equality checks with zero
[in]epsOutThe tolerance check for outside checks
[out]resThe obtained result

◆ totalNodes()

size_t Opm::Elasticity::BoundaryGrid::totalNodes ( ) const
inline

Return the total number of nodes on the grid when known.

See also
uniform

◆ uniform()

BoundaryGrid Opm::Elasticity::BoundaryGrid::uniform ( const FaceCoord min,
const FaceCoord max,
int  k1,
int  k2,
bool  dc = false 
)
static

Establish an uniform quad grid.

Parameters
[in]minLower left corner
[in]maxUpper right corner
[in]k1Number of elements in the first direction
[in]k2Number of elements in the second direction
[in]dcIf true, order quads according to dune conventions
Returns
A quad grid spanning the given area. Nodes are numbered

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