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

Encapsulates the geometrical properties of a regular, internal element. More...

Inheritance diagram for jive::geom::InternalShape:
Inheritance graph

Public Types

typedef jem::numeric::SparseStructure Topology
 A type representing the boundary topology of an internal shape. More...
 
typedef util::IntVector IntVector
 A type representing a one-dimensional integer array. More...
 
typedef util::Cubix Cubix
 A three-dimensional array type. More...
 
- Public Types inherited from jive::geom::Shape
typedef util::Vector Vector
 A vector type. More...
 
typedef util::Matrix Matrix
 A matrix type. More...
 

Public Member Functions

virtual int globalRank () const
 Returns the global rank of this shape. More...
 
virtual int boundaryCount () const =0
 Returns the number of boundaries. More...
 
virtual BoundaryShapegetBoundaryShape (int ibnd) const =0
 Returns a boundary shape object given a boundary index. More...
 
virtual IntVector getBoundaryNodes (int ibnd) const =0
 Returns the indices of the nodes on one of the boundaries of this shape. More...
 
virtual Topology getBoundaryTopology () const
 Returns the boundary topology of this internal shape. More...
 
virtual void getBoundaryCoords (const Matrix &x, int ibnd, const Matrix &c) const
 Collects the coordinates of the nodes on a specific boundary of this shape. More...
 
virtual void getShapeGradients (const Cubix &g, const Vector &w, const Matrix &c) const
 Computes the gradients of the shape functions in the integration points of this shape. More...
 
virtual void evalShapeGradients (const Matrix &g, const Vector &u, const Matrix &c) const =0
 Computes the gradients of the shape functions in a specific point within this shape. More...
 
virtual void getNodeGradients (const Cubix &g, const Matrix &c) const
 Computes the gradients of the shape functions in the nodes of this shape. More...
 
virtual void getBoundaryGradients (const Cubix &g, int ibnd, const Matrix &c) const =0
 Computes the gradients of the shape functions in the integration points on a boundary of this shape. More...
 
virtual jem::ClassgetClass () const
 Returns the Class instance representing the runtime class of this object. More...
 
- Public Member Functions inherited from jive::geom::Shape
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...
 
- 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 jive::geom::Shape
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...
 

Protected Member Functions

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

Detailed Description

#include <jive/geom/InternalShape.h>

The abstract class InternalShape encapsulates the geometrical properties of a regular finite element. It extends the interface defined by the Shape class with functions that compute the gradients of the shape functions in various points within an element.

The local coordinate system of an internal shape has the same rank as the global coordinate system in which that shape `lives'. This means that the member function localRank() and globalRank() return the same number.

An internal shape may have multiple boundaries that are represented by instances of the BoundaryShape class. Each boundary is identified by an index that ranges from zero to the number of boundaries minus one. The following code fragment shows how to compute the surface area of an internal element by iterating over its boundaries.

// Compute the surface area of the internal shape s. The matrix c
// should contain the global node coordinates of the shape.
double getSurfaceArea ( const InternalShape& s,
const Matrix& c )
{
BoundaryShape* b;
Matrix x;
Vector w;
double a;
int i, j;
a = 0.0;
for ( i = 0; i < s.boundaryCount(); i++ )
{
b = s.getBoundaryShape ( i );
x.ref ( Matrix( b->globalRank(), b->nodeCount() ) );
w.ref ( Vector( b->integrationPointCount() ) );
s .getBoundaryCoords ( x, i, c );
b->getIntegrationWeights ( w, x );
a += sum ( w );
}
return a;
}
See also
BoundaryShape

Member Typedef Documentation

The Topology type represents the boundary topology of an internal shape. It is an alias for jem::numeric::SparseStructure.

The IntVector type represents a one-dimensional integer array. It is just an alias for jive::util::IntVector.

The Cubix type represents a three-dimensional array of double precision numbers. It is an alias for jive::util::Cubix.

Constructor & Destructor Documentation

virtual jive::geom::InternalShape::~InternalShape ( )
protectedvirtual

Member Function Documentation

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

Returns a pointer to a jem::Class object that represents the InternalShape 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::InternalShape::globalRank ( ) const
virtual

Returns the rank (number of dimensions) of the global coordinate system in which this internal shape `lives'. The implementation provided by the InternalShape class simply returns this->localRank().

Returns
The global rank of this internal shape.

Implements jive::geom::Shape.

virtual int jive::geom::InternalShape::boundaryCount ( ) const
pure virtual

Returns the number of boundaries of this internal shape.

Returns
The number of boundaries of this shape.

Implemented in jive::geom::ParametricShape.

virtual BoundaryShape* jive::geom::InternalShape::getBoundaryShape ( int  ibnd) const
pure virtual

Returns a pointer to the BoundaryShape instance that represents the boundary with index ibnd of this internal shape. The pointer remains valid during the lifetime of this internal shape object.

Parameters
ibnd- a valid boundary index.
Precondition
ibnd >= 0 && ibnd < this->boundaryCount()
Returns
A pointer to a BoundaryShape that represents one of the boundaries of this internal shape.
virtual IntVector jive::geom::InternalShape::getBoundaryNodes ( int  ibnd) const
pure virtual

Returns an array containing the indices of the nodes on the boundary with index ibnd. If nodes denotes the returned array, then nodes.size() equals the number of nodes on the boundary and nodes[i] yields the index of the i-th node on that boundary. In other words, if j equals nodes[i], then the j-th node of this internal shape is the i-th node on the specified boundary.

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

Parameters
ibnd- a valid boundary index.
Precondition
ibnd >= 0 && ibnd < this->boundaryCount()
Returns
The indices of the nodes on a specific boundary.
virtual Topology jive::geom::InternalShape::getBoundaryTopology ( ) const
virtual

Returns a jem::numeric::SparseStructure that encodes the non-zero pattern of the boundary-node connectivity matrix of this internal shape. This matrix is a sparse, boolean matrix that indicates which boundaries are attached to which nodes. To be precise, the matrix entry at location (i,j) is non-zero if the i-th boundary is attached to the j-th node of this shape.

Let s denote the sparse structure returned by this function. Then s.size(0) equals the number of boundaries of this shape; s.size(1) equals the number of nodes attached to this shape; and s.getColumnIndices(i) yields an integer array containing the indices of the nodes attached to boundary i. This array is identical to the array returned by this->getBoundaryNodes(i).

For performance reasons, the returned sparse structure may point directly to the private data structures of this shape. This means that one should not modify the contents of the sparse structure; invoke the member clone ont the sparse structure if you do want to modify the sparse structure.

The default implementation of this member function provided by the InternalShape class constructs a sparse structure on the fly by repeatedly calling the member function getBoundaryNodes().

Returns
An instance of the class jem::numeric::SparseStructure that represents boundary connectivity matrix of this shape.

Reimplemented in jive::geom::ParametricShape.

virtual void jive::geom::InternalShape::getBoundaryCoords ( const Matrix x,
int  ibnd,
const Matrix c 
) const
virtual

Fills the matrix x with the (global) coordinates of the nodes on the boundary ibnd of this shape: x(i,j) is set to the i-th coordinate of the j-th node on that boundary. The matrix c should contain the global node coordinates of this shape; c(i,j) should be equal to the i-th coordinate of the j-th node.

The default implementation provided by the InternalShape class simply uses the select function provided by the Jem library:

x = select ( c, slice(ALL), getBoundaryNodes(ibnd) );
Parameters
x- a matrix that will be filled with the global coordinates of the nodes on the i-th boundary.
ibnd- a valid boundary index.
c- a matrix containing the global node coordinates of this shape.
Precondition
x.size(0) == this->globalRank() &&
x.size(1) == this->getBoundaryNodes(ibnd).size() &&
ibnd >= 0 && ibnd < this->boundaryCount() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()
virtual void jive::geom::InternalShape::getShapeGradients ( const Cubix g,
const Vector w,
const Matrix c 
) const
virtual

Fills the three-dimensional array g with the spatial derivatives of the shape functions in the integration points of this shape: g(i,j,k) is set to the derivative with respect to the i-th coordinate of the j-th shape function in the k-th integration point. As a bonus, the vector w is filled with the global integration weights: w[i] is set to the integration weight of the i-th integration point. The matrix c should contain the global node coordinates of this shape; c(i,j) should be equal to the i-th coordinate of the j-th node.

Note that the derivatives are computed in the global coordinate system.

The implementation of this function provided by the InternalShape class repeatedly calls the member function evalShapeGradients(). Derived classes are encouraged to provide a more efficient implementation.

Parameters
g- a three-dimensional array that will be filled with the gradients of the shape functions.
w- a vector that will be filled with the global integration weights.
c- a matrix containing the global node coordinates.
Precondition
g.size(0) == this->globalRank() &&
g.size(1) == this->nodeCount() &&
g.size(2) == this->integrationPointCount() &&
w.size() == this->integrationPointCount() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()
virtual void jive::geom::InternalShape::evalShapeGradients ( const Matrix g,
const Vector u,
const Matrix c 
) const
pure virtual

Fills the matrix g with the spatial derivatives of the shape functions in a specific point in this shape: g(i,j) is set to the derivative with respect of the i-th coordinate of the j-th shape function in that point. 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 of this shape; c(i,j) should be equal to the i-th coordinate of the j-th node.

Note that the derivatives are computed in the global coordinate system.

Parameters
g- a matrix that will be filled with the gradients of the shape functions.
u- a local coordinate vector.
c- a matrix containing the global node coordinates.
Precondition
g.size(0) == this->globalRank() &&
g.size(1) == this->nodeCount() &&
u.size() == this->localRank() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()

Implemented in jive::geom::ParametricVolume, jive::geom::Parametric4DShape, jive::geom::ParametricArea, and jive::geom::ParametricLine.

virtual void jive::geom::InternalShape::getNodeGradients ( const Cubix g,
const Matrix c 
) const
virtual

Fills the three-dimensional array g with the spatial derivatives of the shape functions in the nodes: g(i,j,k) is set to the derivative with respect to the i-th coordinate of the j-th shape function in the k-th node. The matrix c should contain the global node coordinates of this shape; c(i,j) should be equal to the i-th coordinate of the j-th node.

Note that the derivatives are computed in the global coordinate system.

The implementation of this function provided by the InternalShape class repeatedly calls the member function evalShapeGradients(). Derived classes are encouraged to provide a more efficient implementation.

Parameters
g- a three-dimensional array that will be filled with the gradients of the shape functions.
c- a matrix containing the global node coordinates.
Precondition
g.size(0) == this->globalRank () &&
g.size(1) == this->nodeCount () &&
g.size(2) == this->nodeCount () &&
c.size(0) == this->globalRank () &&
c.size(1) == this->nodeCount ()
virtual void jive::geom::InternalShape::getBoundaryGradients ( const Cubix g,
int  ibnd,
const Matrix c 
) const
pure virtual

Fills the three-dimensional array g with the spatial derivatives of the shape functions in the integration points on the boundary ibnd of this shape: g(i,j,k) is set to the derivative with respect to the i-th coordinate of the j-th shape function in the k-th integration point on the boundary ibnd. The matrix c should contain the global node coordinates of this shape; c(i,j) should be equal to the i-th coordinate of the j-th node.

Note that the derivatives are computed in the global coordinate system.

Parameters
g- a three-dimensional matrix that will be filled with the gradients of the shape functions.
ibnd- a valid boundary index.
c- a matrix containing the global node coordinates.
Precondition
g.size(0) == this->globalRank() &&
g.size(1) == this->nodeCount() &&
g.size(2) == this->getBoundaryShape(ibnd)->integrationPointCount() &&
ibnd >= 0 && ibnd < this->boundaryCount() &&
c.size(0) == this->globalRank() &&
c.size(1) == this->nodeCount()
virtual jem::Class* jive::geom::InternalShape::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 jive::geom::Shape.