Diffpack Documentation
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Search
BasisFuncGrid Class Reference
basis function modification of a GridFE object (mixed FEM).
More...
#include <BasisFuncGrid.h>
Inheritance diagram for BasisFuncGrid::
List of all members.
Public Methods |
| | BasisFuncGrid () |
| | BasisFuncGrid (const GridFE &grid) |
| | BasisFuncGrid (const BasisFuncGrid &bfgrid_) |
| | ~BasisFuncGrid () |
| void | redim (const GridFE &grid) |
| const GridFE& | grid () const |
| GridFE& | grid () |
| void | setElmType (const String &old_tp, const String &new_tp) |
| void | setElmType (const String &new_tp) |
| bool | update () |
| bool | ok () const |
| bool | isoparametric () const |
| int | loc2glob (int e, int dof) const |
| void | loc2glob (VecSimple(int) &l2g, int e) const |
| int | getNoNodesInElm (int e=1) const |
| int | getNoBasisFuncInElm (int e=1) const |
| int | getNoBasisFuncAtBasisNodeInElm (int elm_node, int e=1) const |
| int | getBasisFuncNoInElm (int elm_node, int basis_func_no_at_this_node, int e=1) const |
| int | getBasisFuncNode (int global_basis_func_no) const |
| int | node2dof (int node) const |
| int | getNoNodes () const |
| int | getNoBoInds () const |
| int | getTotalNoDof () const |
| int | getNoSpaceDim () const |
| int | getNoPhysicalSpaceDim () const |
| real | getCoor (int node, int dir) const |
| Ptv(real) | getCoor (int node) const |
| void | getCoor (Ptv(real) &point, int node) const |
| void | getMinMaxCoord (Ptv(real) &mincoord, Ptv(real) &maxcoord) const |
| String | getElmType (int e=1) const |
| bool | allElmsOfSameType () const |
| const Indicators& | getEssBoInds () const |
| Indicators& | getEssBoInds () |
| void | setBoInd (int node, int indno) |
| void | clearBoInd (int node, int indno) |
| void | attach (Indicators &essboinds, bool automatic_fill=true) |
| void | fillIndicators (Indicators &bfind) |
| bool | notEqual (const BasisFuncGrid &bfnodes) |
| bool | essBoNode (int node, int indno) const |
| bool | essBoNode (int node) const |
| bool | essBoNodesInElm (int elm_no, int indno) const |
| bool | essBoNodesInElm (int elm_no) const |
| void | print (Os os) const |
| void | scan (Is is) |
| virtual void | startIterator () |
| virtual bool | nextPt (Ptv(real) &x) |
| bool | nextPt (Ptv(real) &x, int &node) |
| virtual int | getNoPoints () const |
| int | isNode (const Ptv(real) &point) |
| virtual int | nearestPoint (const Ptv(real) &point, real &distance, bool &exact) |
| virtual void | scale () |
| virtual void | unscale () |
| void | attachScale (const SpaceTimeScale &scale) |
| virtual void | isToBeChanged () |
| virtual void | flipAroundSymmetryPlane (int dir, real plane) |
| void | move (const FieldsFE &displacement, real scale_factor=1.0) |
| void | move (bool do_not_move_basis_function_nodes) |
Detailed Description
basis function modification of a GridFE object (mixed FEM).
NAME: BasisFuncGrid - basis function modification of a GridFE object (mixed FEM)
DESCRIPTION:
In this description we shall by the term basis functions mean the functions used for approximating the unknown(s) in a finite element method for a PDE or system of PDEs. The set of functions used to map an element from the local element coordinate system to the physical domain is called geometry functions.
Finite element basis functions are usually defined in terms of a standard finite element grid. In that case the geometric mapping of the elements and the basis functions are based on the same set of functions. We refer to such elements as isoparametric. In the isoparametric case, "GridFE" represents the complete information about the grid.
In mixed finite element methods one often utilizes non-isoparametric elements, that is, elements where the geometric mapping and the expansion of the unknown(s) (the basis functions) are based on different sets of functions (e.g., one constant basis function on a quadrilateral element with bilinear geometry functions). One will then often have a set of nodes defining the geometry and an additional set of nodes related to the basis functions for the unknown(s).
The description of various elements is represented as subclasses in the "ElmDef" hierarchy. Every element has a definition of its geometry functions ("geomtFunc" in "ElmDef") and basis functions ("basisFunc" in "ElmDef"). The nodes that are related to the geometry functions are represented in a "GridFE" object. Our idea is to introduce an additional class, "BasisFuncGrid", for representing the nodes related to the basis functions. In case of isoparametric elements, class "BasisFuncGrid" gets all its information from an underlying "GridFE" object. However, for non-isoparametric elements, "BasisFuncGrid" will have its own set of nodes.
Technically, class "BasisFuncGrid" has an indicator "isop" that is true if all elements in the grid are isoparametric. Typical "BasisFuncGrid" member functions test if "isop" is true, in that case the corresponding function in the associated "GridFE" is called, and when it is false, the function has to look up information in the internal data structure of class "BasisFuncGrid" to compute the desired quantity.
NOTE: The current implementation requires that all non-isoparametric elements are of the same type.
Constructor & Destructor Documentation
|
BasisFuncGrid::BasisFuncGrid (
|
)
|
|
|
|
There are two constructors besides the copy constructor. The one without arguments does nothing. The other constructor takes an "GridFE" object as argument. Calling this constructor is equivalent with using the constructor without arguments and calling the "redim" function (this is standard in Diffpack). Hence, to initialize the "BasisFuncGrid" object, one must feed a "GridFE" object to "BasisFuncGrid", either using the constructor or the "redim" function. If the elements are isoparametric, this is sufficient initialization of the "BasisFuncGrid" object. For non-isoparametric elements, one must assign the element type by calling "setElmType". This version of class "BasisFuncGrid" can only work with one element type if non-isoparametric elements are wanted. The "setElmType" function will automatically initiate computations for managing the degrees of freedom for a scalar field over the given non-isoparametric element. Handling degrees of freedom for composite fields is the responsibility of class "DegFreeFE". |
|
BasisFuncGrid::BasisFuncGrid (
|
const GridFE & grid )
|
|
|
|
See documentation of one of the overloaded constructor. |
|
BasisFuncGrid::BasisFuncGrid (
|
const BasisFuncGrid & bfgrid_ )
|
|
|
|
See documentation of one of the overloaded constructor. |
|
BasisFuncGrid::~BasisFuncGrid (
|
)
|
|
Member Function Documentation
|
bool BasisFuncGrid::allElmsOfSameType (
|
) const
|
|
|
void BasisFuncGrid::attach (
|
Indicators & essboinds,
|
|
bool automatic_fill = true )
|
|
|
|
enables attachment of a new boundary indicator for essential conditions (see documentation of "getEssBoInds"). If one attaches a new set of indicators in a "GridFE" object, one must attach the corresponding "Indicators" objects in all "BasisFuncGrid" classes that are connected to this "GridFE" object, if the elements are non-isoparametric. That is, for non-isoparametric elements the indicator information consists of a "GridFE" indicator and one corresponding indicator for all "BasisFuncGrid" objects. The "GridFE" indicator will then determine the natural conditions along sides (a geometric property), whereas the "BasisFuncGrid" indicators deal with the essential conditions related to basis function degrees of freedom. If an "Indicators" object is set and attached to the "GridFE" object, one simply calls "fillIndicators" to compute the corresponding indicator aimed at "BasisFuncGrid". Thereafter one calls "attach" to attach this indicator to the "BasisFuncGrid" object. When the extra boolean argument to "attach" is true, "attach" will first call "fillIndicators" to ensure that the indicator is updated according to the indicator information in the underlying grid. |
|
|
attach a scaling of the spatial coordinates.
Reimplemented from GridWithPts. |
|
void BasisFuncGrid::clearBoInd (
|
int node,
|
|
int indno )
|
|
|
|
the inverse of "setBoInd", see documentation of the "setBoInd" function. |
|
bool BasisFuncGrid::essBoNode (
|
int node ) const
|
|
|
|
See documentation of one of the overloaded functions. |
|
bool BasisFuncGrid::essBoNode (
|
int node,
|
|
int indno ) const
|
|
|
|
determines if a basis function node has an indicator on. An overloaded version returns true if any indicator is on at a node. |
|
bool BasisFuncGrid::essBoNodesInElm (
|
int elm_no ) const
|
|
|
|
See documentation of one of the overloaded functions. |
|
bool BasisFuncGrid::essBoNodesInElm (
|
int elm_no,
|
|
int indno ) const
|
|
|
|
determines if any basis function node in the element has an indicator on. An overloaded version returns true if any node in the has any indicator on. |
|
void BasisFuncGrid::fillIndicators (
|
Indicators & bfind )
|
|
|
|
computes a boundary indicator for the current "BasisFuncGrid" object, using information about the current indicator in the underlying "GridFE" object. This function is normally called from "attach". |
|
void BasisFuncGrid::flipAroundSymmetryPlane (
|
int dir,
|
|
real plane ) [virtual]
|
|
|
int BasisFuncGrid::getBasisFuncNoInElm (
|
int elm_node,
|
|
int basis_func_no_at_this_node,
|
|
int e = 1 ) const
|
|
|
|
returns the logcal basis function number in this element, given the element number "e", the local basis function number at the node (i.e. an integer from 1 to the number of basis functions associated with this particular node), and the local number "elm_node" of a node in the element. |
|
int BasisFuncGrid::getBasisFuncNode (
|
int global_basis_func_no ) const
|
|
|
|
given a global basis function number (degree of freedom for a scalar field) "global_basis_func_no", the function returns the basis function node number that corresponds to this degree of freedom. (At present, the function can only handle the trivial case where the number of basis functions equals the number of basis function nodes, otherwise an error message is issued.) |
|
void BasisFuncGrid::getCoor (
|
Ptv(real) & point,
|
|
int node ) const
|
|
|
Ptv(real) BasisFuncGrid::getCoor (
|
int node ) const
|
|
|
real BasisFuncGrid::getCoor (
|
int node,
|
|
int dir ) const
|
|
|
String BasisFuncGrid::getElmType (
|
int e = 1 ) const
|
|
|
Indicators & BasisFuncGrid::getEssBoInds (
|
) [inline]
|
|
|
|
See documentation of one of the overloaded functions. |
|
const Indicators & BasisFuncGrid::getEssBoInds (
|
) const [inline]
|
|
|
|
returns access to the "Indicators" object (inside this "BasisFuncGrid" object) that holds the information about essential boundary conditions at basis function nodes. Note that these indicators are used for essential boundary conditions only (this is reflected in the name, here "getEssBoInds", while the corresponding function in "GridFE" is "boundaryData"). Natural conditions are associated with sides in elements and reflect hence geometry properties, i.e., "GridFE" must be responsible for this information. That is, the indicators in "GridFE" (accessed by "boundaryData" and "clear/setBoInd" functions) cover natural condititions, and in the case of isoparametric elements, also essential conditions. See also comments regarding the "attach" function. |
|
void BasisFuncGrid::getMinMaxCoord (
|
Ptv(real) & mincoord,
|
|
Ptv(real) & maxcoord ) const [virtual]
|
|
|
|
returns the hypercube (with respect to the Cartesian coordinate system where the grid coordinates are defined) that encloses the grid. This function is only meaningful if the grid represents some kind of geometry in the problem.
Reimplemented from GridWithPts. |
|
int BasisFuncGrid::getNoBasisFuncAtBasisNodeInElm (
|
int elm_node,
|
|
int e = 1 ) const
|
|
|
|
returns the number of basis functions (degrees of freedom) at a basis function node "elm_node" in an element "e". Normally this will be 1, but in p-FEM the basis function nodes on the sides of the elements will have many associated basis functions. |
|
int BasisFuncGrid::getNoBasisFuncInElm (
|
int e = 1 ) const
|
|
|
int BasisFuncGrid::getNoBoInds (
|
) const [inline]
|
|
|
int BasisFuncGrid::getNoNodes (
|
) const
|
|
|
|
returns the number of basis function nodes. In the example given under "getNoNodesInElm", "bg.getNoNodes()" equals the number of elements in the grid, that is, "bg.grid().getNoElms()". |
|
int BasisFuncGrid::getNoNodesInElm (
|
int e = 1 ) const
|
|
|
|
returns the number of basis function nodes in an element. For example, if we have the 4-node quadrilateral element with a constant shape function,
// we have a BasisFuncGrid bg
int m = bg.grid().getNoNodesInElm(e);
int n = bg.getNoNodesInElm(e);
Here "m" will be 4 while "n" will be 1. |
|
int BasisFuncGrid::getNoPhysicalSpaceDim (
|
) const [inline]
|
|
|
int BasisFuncGrid::getNoPoints (
|
) const [virtual]
|
|
|
int BasisFuncGrid::getNoSpaceDim (
|
) const [inline, virtual]
|
|
|
|
returns the number of space dimensions.
Reimplemented from GridWithPts. |
|
int BasisFuncGrid::getTotalNoDof (
|
) const
|
|
|
GridFE & BasisFuncGrid::grid (
|
) [inline]
|
|
|
|
See documentation of one of the overloaded functions. |
|
const GridFE & BasisFuncGrid::grid (
|
) const [inline]
|
|
|
|
gives access to the underlying "GridFE" object. |
|
int BasisFuncGrid::isNode (
|
const Ptv(real) & point )
|
|
|
void BasisFuncGrid::isToBeChanged (
|
) [virtual]
|
|
|
|
indicates that the grid is to be changed and that the grid must be stored on the grid file (see class "SimResFile" or class "FieldWriter") next time a field referencing this grid is dumped to file. The function is typically used when the grid is moved or refined.
Reimplemented from Grid. |
|
bool BasisFuncGrid::isoparametric (
|
) const [inline]
|
|
|
|
returns true if all elements in the grid are of isoparametric type (that is, the same functions are used for determining the shape of the element and the expansion of the unknown over the element). |
|
void BasisFuncGrid::loc2glob (
|
VecSimple(int) & l2g,
|
|
int e ) const
|
|
|
|
See documentation of one of the overloaded functions. |
|
int BasisFuncGrid::loc2glob (
|
int e,
|
|
int dof ) const
|
|
|
|
returns the global node number corresponding to a local node in an element. The term "node" here refers to a node used for defining basis functions. Therefore, this "loc2glob" function is central for relating local degrees of freedom to global degrees of freedom in the linear system that arises from the finite element discretization. The version of the function that also takes a vector, redims and fills the vector with global node numbers for all local nodes in the element. |
|
void BasisFuncGrid::move (
|
bool do_not_move_basis_function_nodes )
|
|
|
|
See documentation of one of the overloaded functions. |
|
void BasisFuncGrid::move (
|
const FieldsFE & displacement,
|
|
real scale_factor = 1.0 )
|
|
|
|
moves the basis function nodes, if the basis function grid consists of non-isoparametric elements. One function takes a displacement field and moves the nodes according to this field (see also the similar "move" function in class "GridFE"). The other function takes a "do_not_move_basis_function_nodes" argument, and if this argument is false, it recomputes the coordinates of the basis function nodes by executing the private "generateMesh" function. This latter version is slower than the former, but the basis function coordinates will be consistent with their location in the reference coordinate system (note that interpolating a displacement field generally gives a small mismatch between the moved node and its location computed by first moving the geometry and then mapping a local node). If "do_not_move_basis_function_nodes" is true, calling a "move" in a "BasisFuncGrid" object does actually nothing except marking that the grid has changed and must be restored the next time a field is dumped in simres format. This is very efficient. The internal "bool incorrect_coor" is then turned on to indicate that the values in "coor" are incorrect. However, it is seldom that these values are actually needed in a simulation (plotting velocity vectors at basis function nodes is one example). Also, if the mesh is isoparametric, "move" has no effect on "coor" anyway. Note that "GridFE move" must be called prior to any "BasisFuncGrid move"! |
|
int BasisFuncGrid::nearestPoint (
|
const Ptv(real) & point,
|
|
real & distance,
|
|
bool & exact ) [virtual]
|
|
|
|
computes the grid point that is nearest to an arbitrarily given point. The input argument is the specified point, while the output arguments are the distance to the point and a boolean variable indicating if the given point coincides with one of the grid points. If the boolean value is true, the distance to the point is zero. The return value is the point number of the point that is nearest to the specified point. There are some overloaded versions of "nearestPoint". These are aimed at various search algorithms required by "valuePt" in finite element meshes.
Reimplemented from GridWithPts. |
|
bool BasisFuncGrid::nextPt (
|
Ptv(real) & x,
|
|
int & node )
|
|
|
bool BasisFuncGrid::nextPt (
|
Ptv(real) & x ) [virtual]
|
|
|
|
gives the coordinates of the next point in the grid. The return value is false when there are no more points in the grid. Here is an example on iteration over the grid points:
grid.startIterator();
while (grid.nextPt(p))
Reimplemented from GridWithPts. |
|
int BasisFuncGrid::node2dof (
|
int node ) const
|
|
|
|
returns the basis function number (i.e. degree of freedom number for the associated scalar field) of the first basis function at a particular node. If this application of the function is to be successful, one must follow a convention that when there are several degrees of freedom (associated with a single scalar field) at a basis function node, the first degree of freedom represents the function value. If there is only one basis function (degree of freedom) at each basis function node, the "node2dof" is an identity mapping. |
|
bool BasisFuncGrid::notEqual (
|
const BasisFuncGrid & bfnodes )
|
|
|
bool BasisFuncGrid::ok (
|
) const
|
|
|
void BasisFuncGrid::print (
|
Os os ) const [virtual]
|
|
|
|
prints the grid (usually in ascii format).
Reimplemented from Grid. |
|
void BasisFuncGrid::redim (
|
const GridFE & grid )
|
|
|
void BasisFuncGrid::scale (
|
) [virtual]
|
|
|
void BasisFuncGrid::scan (
|
Is is ) [virtual]
|
|
|
|
reads the grid (usually in ascii format -- seldom used).
Reimplemented from Grid. |
|
void BasisFuncGrid::setBoInd (
|
int node,
|
|
int indno )
|
|
|
|
this function is described in "GridFE", but now the indicators are associated with the nodes that are used in the definition of the basis functions. |
|
void BasisFuncGrid::setElmType (
|
const String & new_tp )
|
|
|
|
See documentation of one of the overloaded functions. |
|
void BasisFuncGrid::setElmType (
|
const String & old_tp,
|
|
const String & new_tp )
|
|
|
|
sets the element type for an element. For example, if you have generated a grid consisting of "ElmB4n2D" elements in a preprocessor, you must apply the bilinear element for mapping the element geometries, but the basis functions in each element can be changed - for example to piecewise constants. One then simply calls "setElmType" with the proper argument. If you do not know at compile them the elements in the grid ("old_tp"), you can look up the element type in the computed grid:
basis_func_grid->setElmType (new_tp);
or (the older construct)
basis_func_grid->setElmType (grid->getElmType(1),new_tp);
Note that "getElmType(1)" (i.e. look up type of element no. 1) is okay since any use of "BasisFuncGrid" requires that all the elements in the geometry grid are of the same type. |
|
void BasisFuncGrid::startIterator (
|
) [virtual]
|
|
|
|
initializes an iteration over the grid points.
Reimplemented from GridWithPts. |
|
void BasisFuncGrid::unscale (
|
) [virtual]
|
|
|
bool BasisFuncGrid::update (
|
)
|
|
|
|
updates the size of internal data structures if the grid has been changed. For example, in adaptive methods, one should call "update" every time the "GridFE" object has been manipulated (e.g. refined). Similar update functions are present in various fields, for example, in "FieldFE". |
Friends And Related Function Documentation
The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.