Jive reference manual
List of all members | Public Types | Public Member Functions | Static Public Member Functions
jive::geom::Shape Class Referenceabstract

Encapsulates the geometrical properties of a finite element. More...

Inheritance diagram for jive::geom::Shape:
Inheritance graph

Public Types

typedef util::Vector Vector
 A vector type. More...
 
typedef util::Matrix Matrix
 A matrix type. More...
 

Public Member Functions

virtual int globalRank () const =0
 Returns the global rank of this shape. More...
 
virtual int localRank () const =0
 Returns the local rank of this shape. More...
 
virtual int nodeCount () const =0
 Returns the number of nodes. More...
 
virtual int shapeFuncCount () const =0
 Returns the number of shape functions. More...
 
virtual int integrationPointCount () const =0
 Returns the number of integration points. More...
 
virtual Matrix getLocalNodeCoords () const =0
 Returns the coordinates of the nodes in the local coordinate system. More...
 
virtual Matrix getIntegrationPoints () const =0
 Returns the integration points in the local coordinate system. More...
 
virtual void getGlobalIntegrationPoints (const Matrix &x, const Matrix &c) const
 Computes the integration points in the global coordinate system. More...
 
virtual void getIntegrationWeights (const Vector &w, const Matrix &c) const =0
 Computes the integration weights in the global coordinate system. More...
 
virtual Matrix getShapeFunctions () const =0
 Returns the shape functions evaluated in the integration points. More...
 
virtual void evalShapeFunctions (const Vector &h, const Vector &u) const =0
 Computes the shape functions in a given point. More...
 
virtual void getGlobalPoint (const Vector &x, const Vector &u, const Matrix &c) const =0
 Converts a local coordinate vector to a global coordinate vector. More...
 
virtual bool getLocalPoint (const Vector &u, const Vector &x, double eps, const Matrix &c) const
 Converts a global coordinate vector to a local coordinate vector. More...
 
virtual bool containsLocalPoint (const Vector &u) const =0
 Tests whether a point lies within this shape. More...
 
virtual jem::ClassgetClass () const
 Returns the Class instance representing the runtime class of this object. More...
 
- Public Member Functions inherited from jem::Object
virtual String toString () const
 Returns a short textual description of this object. More...
 
virtual long hashValue () const
 Returns a hash value for this object. More...
 
virtual bool equals (const Ref< Object > &obj) const
 Tests whether two objects are equal. More...
 
Ref< Objectclone () const
 Returns a copy of this object. More...
 

Static Public Member Functions

static jem::ClassgetType ()
 Returns a pointer to a Class object representing this class. More...
 
- Static Public Member Functions inherited from jem::Object
static ClassgetType ()
 Returns the Class instance representing the Object class. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jem::Collectable
 Collectable ()
 Creates an empty Collectable. More...
 
 ~Collectable ()
 Frees resources. More...
 

Detailed Description

#include <jive/geom/Shape.h>

The abstract base class Shape encapsulates the geometrical properties of a finite element. It can be used to evaluate an integral over the domain of an element, and to evaluate the shape functions of an element.

A Shape object comprises a set of nodes, a set of integration points and corresponding integration weights, and a set of shape functions. Although the number of shape functions and the number of nodes are typically the same, they may also be different.

A shape has a local coordinate system in which it has a fixed geometry. In other words, the nodes of a shape are located at fixed points in the local coordinate system of that shape. The rank – that is, the number of dimensions – of the local coordinate system is said to be the local rank of a shape.

Shapes `live' in a global coordinate system that is typically connected to a finite element mesh or some region in space and/or time. The rank of the global coordinate system is said to be the global rank of a shape. Note that the global rank may differ from the local rank. For instance, a shape representing a surface in a three-dimensional space has global rank three and local rank two.

A shape does not store the global coordinates of its nodes; these must be passed as a parameter to the Shape member functions that require the global coordinates. The advantage of this design is that a single Shape object can be used to evaluate the geometrical properties of multiple finite elements.

See also
StdShape

Member Typedef Documentation

The Vector type represents a one-dimensional array of doubles. It is just an alias for jive::util::Vector.

The Matrix type represents a two-dimensional array of doubles. It is just an alias for jive::util::Matrix.

Member Function Documentation

static jem::Class* jive::geom::Shape::getType ( )
static

Returns a pointer to a jem::Class object that represents the Shape class. This pointer remains valid during the entire lifetime of the current program.

Returns
A pointer to a jem::Class object that represents this class.
virtual int jive::geom::Shape::globalRank ( ) const
pure virtual

Returns the rank (number of dimensions) of the global coordinate system in which this shape `lives'.

Returns
The global rank of this shape.

Implemented in jive::geom::InternalShape, jive::geom::BoundaryShape, and jive::geom::InterfaceShape.

virtual int jive::geom::Shape::localRank ( ) const
pure virtual

Returns the rank (number of dimensions) of the local coordinate defined by this shape.

Returns
The local rank of this shape.

Implemented in jive::geom::ParametricShape, jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, and jive::geom::InterfaceShape.

virtual int jive::geom::Shape::nodeCount ( ) const
pure virtual

Returns the number of nodes attached to this shape.

Returns
The number of nodes.

Implemented in jive::geom::ParametricShape, jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, and jive::geom::InterfaceShape.

virtual int jive::geom::Shape::shapeFuncCount ( ) const
pure virtual

Returns the number of shape functions encapsulated by this shape. Note that the number of shape functions and the number of nodes may differ.

Returns
The number of shape functions.

Implemented in jive::geom::ParametricShape, jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, and jive::geom::InterfaceShape.

virtual int jive::geom::Shape::integrationPointCount ( ) const
pure virtual

Returns the number of integration points encapsulated by this shape.

Returns
The number of integration points.
virtual Matrix jive::geom::Shape::getLocalNodeCoords ( ) const
pure virtual

Returns a matrix containing the local coordinate vectors of the nodes attached to this shape. If c denotes the returned matrix, then c(i,j) equals the i-th coordinate of the j-th node.

This function can be useful when testing a new shape class.

virtual Matrix jive::geom::Shape::getIntegrationPoints ( ) const
pure virtual

Returns a matrix containing the local coordinates of the integration points encapsulated by this shape. If x denotes the returned matrix, then x(i,j) yields the i-th coordinate of the j-th integration point.

For performance reasons the returned matrix may share its data with one of the private members of this shape. One should therefore not modify the contents of the matrix.

Returns
A matrix containing the local coordinates of the integration points.
virtual void jive::geom::Shape::getGlobalIntegrationPoints ( const Matrix x,
const Matrix c 
) const
virtual

Fills the matrix x with the global coordinates of the integration points encapsulated by this shape: x(i,j) is set to the i-th coordinate of the j-th integration point. The matrix c should contain the global coordinates of the nodes attached to this shape: c(i,j) should be equal to the i-th coordinate of the j-th node.

The default implementation of this function is given by:

int i;
for ( i = 0; i < u.size(1); i++ )
{
this->getGlobalPoint ( x(slice(ALL),i), u(slice(ALL),i), c );
}
Parameters
x- a matrix that will be filled with the global coordinates of the integration points.
c- a matrix containing the global node coordinates.
Precondition
x.size(0) == this->globalRank() &&
x.size(1) == this->integrationPointCount() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()

Reimplemented in jive::geom::ParametricShape, jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, jive::geom::ParametricVolume, jive::geom::Parametric4DShape, jive::geom::ParametricArea, jive::geom::ParametricLine, jive::geom::ParametricEdge, and jive::geom::ParametricSurface.

virtual void jive::geom::Shape::getIntegrationWeights ( const Vector w,
const Matrix c 
) const
pure virtual

Fills the vector w with the integration weights in the global coordinate system: w[i] is set to the weight of the i-th integration point. The matrix c should contain the global node coordinates: c(i,j) should be equal to the i-th coordinate of the j-th node.

The following code fragment demonstrates how the integration weights can be used to evaluate the integral of a function over the domain of a shape.

// Evaluates the integral of the function
//
// f(x,y,z,...) = x + y + z + ...
//
// over the domain of a given shape.
double evalIntegral ( const Shape& shape, const Matrix& c )
{
const int rank = shape.globalRank ();
const int ipCount = shape.integrationPointCount ();
Matrix x ( rank, ipCount );
Vector w ( ipCount );
double r;
double f;
int i;
shape.getGlobalIntegrationPoints ( x, c );
shape.getIntegrationWeights ( w, c );
r = 0.0;
for ( i = 0; i < ipCount; i++ )
{
f = sum( x(slice(ALL),i) );
r += w[i] * f;
}
return r;
}
Parameters
w- a vector that will be filled with the global integration weights.
c- a matrix containing the global node coordinates.
Precondition
w.size() == this->integrationPointCount() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()

Implemented in jive::geom::BoundaryPoint, jive::geom::ParametricVolume, jive::geom::Parametric4DShape, jive::geom::ParametricArea, jive::geom::ParametricLine, jive::geom::ParametricEdge, jive::geom::ParametricSurface, and jive::geom::Parametric4DSurf.

virtual Matrix jive::geom::Shape::getShapeFunctions ( ) const
pure virtual

Returns a matrix containing the values of the shape functions in the integration points of this shape. If the returned matrix is denoted by h, then h(i,j) equals the value of the i-th shape function in the j-th integration point.

The contents of the returned matrix should not be modified because it may share its data with one of the private members of this shape.

Returns
A matrix containing the values of the shape functions in the integration points.

Implemented in jive::geom::ParametricShape, jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, and jive::geom::InterfaceShape.

virtual void jive::geom::Shape::evalShapeFunctions ( const Vector h,
const Vector u 
) const
pure virtual

Fills the vector h with the values of the shape functions in a specific point within this shape: h[i] is set to the i-th shape function in that point. The vector u should contain the local coordinates of the point: u[i] should be equal to the i-th local coordinate.

Parameters
h- a vector that will be filled with the values of the shape functions in a specific point within this shape.
u- a vector containing the local coordinates of the specified point.
Precondition
h.size() == this->shapeFuncCount() &&
u.size() == this->localRank() && this->containsLocalPoint ( u )

Implemented in jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, and jive::geom::InterfaceShape.

virtual void jive::geom::Shape::getGlobalPoint ( const Vector x,
const Vector u,
const Matrix c 
) const
pure virtual

Fills the vector x with the global coordinates of a specific point within this shape: x[i] is set to the i-th global coordinate. The vector u should contain the local coordinates of that point: u[i] should be equal to the i-th local coordinate. The matrix c should contain the global node coordinates: c(i,j) should be equal to the i-th global coordinate of the j-th node.

Parameters
x- a vector that will be set to the global coordinates of the specified point.
u- a vector containing the local coordinates of that point.
c- a matrix containing the global node coordinates.
Precondition
x.size() == this->globalRank() &&
u.size() == this->localRank() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount() &&
this->containsLocalPoint ( u )

Implemented in jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, jive::geom::ParametricVolume, jive::geom::Parametric4DShape, jive::geom::ParametricArea, jive::geom::ParametricLine, jive::geom::ParametricEdge, and jive::geom::ParametricSurface.

virtual bool jive::geom::Shape::getLocalPoint ( const Vector u,
const Vector x,
double  eps,
const Matrix c 
) const
virtual

This function tries to convert a global coordinate vector to a local coordinate vector. It returns true if the conversion succeeds and the global coordinate vector points to a location `near' this shape. Otherwise it returns false.

If the return value equals true, the vector u will contain the local coordinate vector: u[i] will be set to the i-th local coordinate. The vector x should contain the global coordinate vector to be converted: x[i] should be equal to the i-th global coordinate. The double eps specifies the maximum allowed distance – in the global coordinate system – between this shape and the location pointed to by the vector x. The matrix c should contain the global node coordinates: c(i,j) should be equal to the i-th coordinate of the j-th node.

Note that a shape class does not have to support this function. In fact, the default implementation of this function simply throws a jem::IllegalOperationException.

Parameters
u- a vector that will be filled with the local coordinates of the point specified by the global coordinate vector x.
x- a global coordinate vector.
eps- the maximum allowed distance between the specified point and this shape.
c- a matrix containing the global node coordinates.
Precondition
u.size() == this->localRank() &&
x.size() == this->globalRank() &&
eps > 0.0 &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()
Returns
true if the conversion succeeds, and false otherwise.

Reimplemented in jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, jive::geom::ParametricVolume, jive::geom::Parametric4DShape, jive::geom::ParametricArea, jive::geom::ParametricLine, jive::geom::ParametricEdge, and jive::geom::ParametricSurface.

virtual bool jive::geom::Shape::containsLocalPoint ( const Vector u) const
pure virtual

Returns true if the point specified by the local coordinate vector u lies within this shape, and false otherwise.

Parameters
u- a local coordinate vector.
Precondition
u.size() == this->localRank()
Returns
true if the specified point lies within this shape, and false otherwise.

Implemented in jive::geom::ParametricBoundary, jive::geom::BoundaryPoint, and jive::geom::InterfaceShape.

virtual jem::Class* jive::geom::Shape::getClass ( ) const
virtual

Returns a pointer to the Class instance representing the runtime class of this object. If T denotes the runtime class of this object, then this function is equivalent with T::getType(). The pointer is valid during the entire lifetime of the program.

Returns
A pointer to the Class instance representing the runtime class of this object.

Reimplemented from jem::Object.

Reimplemented in jive::geom::InternalShape, and jive::geom::BoundaryShape.