NAME
DynElement - class for holding information about a finite element
INCLUDE
include "DynElement.h"
SYNTAX
class DynElement : public HandleId
{
friend class List;
friend class ManipGridDynFE;
protected:
int nne;
int material_no;
String elm_tp;
Ptv(real) global_centroid;
VecSimplest(Handle(DynNode)) loc_node_vec;
public:
DynElement
(
int elm_no,
const GridFE& grid,
const VecSimplest(Handle(DynNode))& node_vec
);
DynElement
(
int nne_,
const String& elm_tp_,
const Ptv(real)& global_centroid_,
int material_no_,
const Handle(DynNode)& node1,
const Handle(DynNode)& node2,
const Handle(DynNode)& node3
);
DynElement () {}
~DynElement () {}
friend Os& operator << (Os& os, DynElement& element);
bool operator != (const DynElement& element ) const;
bool operator == (const DynElement& element ) const;
DynElement& operator = (const DynElement& element );
bool operator < (const DynElement& element ) const;
void print (Os& os);
void setElmType (const String& type);
void setNoNodesInElm (int number_of_nodes_in_elm);
void setLocNodeVec (const VecSimplest(Handle(DynNode))& l_n_vec);
void replaceNode (int local_node, DynNode& new_node);
const String& getElmType () const;
int getNoNodesInElm () const;
void getLocNodeVec (VecSimplest(Handle(DynNode))& l_n_vec) const;
const Ptv(real)& getGlobalCentroid () const;
int getMaterialType () const;
protected:
// This variable is introduced to increase the efficiency of procedures
// in the ManipGridDynFE class.
bool is_outside; // used removeHypercubeNew and
// removeHypercubeNewImproved
};
#define Type DynElement
#include <VecSimplest_Type.h>
#undef Type
#define ClassType DynElement
#include <Handle.h>
#undef ClassType
#define Type Handle(DynElement)
#include <VecSimplest_Type.h>
#undef Type
#define Type DynElement
#define Itemtype ListItemHandle
#include <ListItemHandle_Type.h>
#include <List_Type.h>
#undef Itemtype
#undef Type
//--------- inline functions --------------------------------------------------
//----------------------------------------------------------------------------
inline bool DynElement:: operator != (const DynElement& element) const
//----------------------------------------------------------------------------
{
if (global_centroid != element.global_centroid)
return true;
else
return false;
}
//----------------------------------------------------------------------------
inline bool DynElement:: operator == (const DynElement& element) const
//----------------------------------------------------------------------------
{
return notbool(operator!= (element));
}
//-----------------------------------------------------------------------------
inline void DynElement:: setElmType (const String& type )
//-----------------------------------------------------------------------------
{
this->elm_tp = type;
}
//-----------------------------------------------------------------------------
inline void DynElement:: setNoNodesInElm (int number_of_nodes_in_elm)
//-----------------------------------------------------------------------------
{
this->nne = number_of_nodes_in_elm;
}
//-----------------------------------------------------------------------------
inline void DynElement:: replaceNode (int local_node, DynNode& new_node)
//-----------------------------------------------------------------------------
{
loc_node_vec(local_node).rebind (new_node);
}
//-----------------------------------------------------------------------------
inline const String& DynElement:: getElmType () const
//-----------------------------------------------------------------------------
{
return elm_tp;
}
//-----------------------------------------------------------------------------
inline int DynElement:: getNoNodesInElm () const
//-----------------------------------------------------------------------------
{
return nne;
}
//-----------------------------------------------------------------------------
inline const Ptv(real)& DynElement:: getGlobalCentroid () const
//-----------------------------------------------------------------------------
{
return global_centroid;
}
//-----------------------------------------------------------------------------
inline int DynElement:: getMaterialType () const
//-----------------------------------------------------------------------------
{
return material_no;
}
KEYWORDS
finite element
DESCRIPTION
The class implements a finite element. That is, the class stores
all the relevant information on one finite element. In detail the
class contains: a VecSimplest containing the nodes in the ele
ment, number of nodes in the element, the element type, the ele
ments material number and the elements global centroid. The last
variable, is_outside, determines whether the element centroid is
outside a user given domain or not. The variable is used in
removeDomainExtended, triangularElement and twoTriangularElements
in GridDynFE. Each element is included in the element list in
GridDynFE. The public HandleId ensures that handles can be used
on the class. The friend class List ensures that the element can
be included in a element list in class GridDynFE.
CONSTRUCTORS AND INITIALIZATION
There are three constructors. One empty constructor and one that
takes the element number, a GridFE object and a VecSimplest con
taining Handle pointers to the elements nodes as argument. The
third constructor takes the number of nodes, the element type,
the global centroid, the material number and three handles point
ing to three nodes as argument, and constructs a triangular ele
ment.
MEMBER FUNCTIONS
operator << - calls the print function. The function is
called for by the List class.
operator != - tests for equality by comparing the global
centroids. The function is called for by the List class.
operator == - uses operator != to determine whether the
element given as argument and this element are alike or not.
Returns true if they are, and false if not.
operator = - assignment operator. The function assigns
this element to the element given as argument.
operator < - compares two elements and returns true if
this element has smaller global centroid than the element given
as argument. This function is required by the sort function in
the element list. The element with the smallest global centroid
coordinates is the element which is nearest the origin.
print - print the contents of the element to the out
put given as argument. Mainly for debugging purposes.
setElmType - sets the element type to the element type
given as argument.
setNoNodesInElm - sets number of nodes in the element.
setLocNodeVec - sets the local node vector.
replaceNode - given a local node number local_node, the
node handle of this local node is rebound to a new node
(new_node).
getElmType - returns the element type.
getNoNodesInElm - returns the number of nodes in the element.
getLocNodeVec - assigns the local node vector given as argu
ment to the elements local node vector.
getGlobalCentroid - returns the coordinates of the global cen
troid.
getMaterialType - returns the material number of the element.
SEE ALSO
class GridDynFE class, class DynNode, class List(Type, Lis
tItemHandle), class HandleId
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Sigurd Solgaard, SINTEF/UiO