NAME
DynNode - class for holding node information
INCLUDE
include "DynNode.h"
SYNTAX
class DynNode : public HandleId
{
friend class List;
friend class ManipGridDynFE;
friend class GridDynFE;
protected:
Ptv(real) glob_coor;
bool is_bo_node;
List(int, ListItemInst) bo_inds;
int no_of_refs;
public:
DynNode () {}
DynNode (const DynNode& node);
DynNode (const Ptv(real)& glob_coor);
~DynNode() {}
friend Os& operator << (Os& os, DynNode& node);
bool operator != (const DynNode& node) const;
bool operator == (const DynNode& node) const;
DynNode& operator = (const DynNode& node);
bool operator < (const DynNode& node) const;
void print (Os& os);
real getGlobCoor(int dir) const;
const Ptv(real)& getGlobCoor() const;
bool boNode (int ind) const;
bool boNode () const;
void setBoNode ();
void addNewBoInd (int bo_ind);
bool removeBoInd (int bo_ind);
void setNewBoNode (int bo_ind);
void addToBoIndList (int bo_ind);
void getBoIndList (List(int, ListItemInst)& bo_ind_list) const;
void setBoNodeToInnerNode ();
void setNewCoords (const Ptv(real)& new_coords);
void setNewCoor (const real new_coor, const int dir);
void setNodesRefs (const int no_refs);
int getNodesRefs () const;
void increaseGlobCoor (const real dx, const int dir);
protected:
// These are variables to increase the efficiency of procedures in the
// ManipGridDynFE class.
int global_node_no; // used in updateToStaticStorage
// The following variables are introduced to increase the efficiency of
// "triangularElement", "twoTriangularElements" and "removeDomainExtended"
// in "GridDynFE".
bool is_inside;
bool exact_hit;
bool is_to_be_removed;
Handle(DynNode) replacing_node;
};
#define Type DynNode
#include <VecSimplest_Type.h>
#undef Type
#define Type Handle(DynNode)
#include <VecSimplest_Type.h>
#undef Type
#define Type DynNode
#define Itemtype ListItemHandle
#include <ListItemHandle_Type.h>
#include <List_Type.h>
#undef Itemtype
#undef Type
//--------- inline functions --------------------------------------------------
//----------------------------------------------------------------------------
inline real DynNode:: getGlobCoor (int dir) const
//----------------------------------------------------------------------------
{
return glob_coor(dir);
}
//----------------------------------------------------------------------------
inline const Ptv(real)& DynNode:: getGlobCoor () const
//----------------------------------------------------------------------------
{
return glob_coor;
}
//----------------------------------------------------------------------------
inline void DynNode:: setBoNode ()
//----------------------------------------------------------------------------
{
is_bo_node = true;
}
//----------------------------------------------------------------------------
inline bool DynNode:: boNode () const
//----------------------------------------------------------------------------
{
return is_bo_node;
}
//----------------------------------------------------------------------------
inline void DynNode:: addNewBoInd (int bo_ind)
//----------------------------------------------------------------------------
{
bo_inds.append(bo_ind);
}
//----------------------------------------------------------------------------
inline void DynNode:: setNewBoNode (int bo_ind)
//----------------------------------------------------------------------------
{
#ifdef SAFETY_CHECKS
if (is_bo_node || bo_inds.getNoEntries()!=0)
errorFP("Node:: setNewBoNode",
"The assumption that the node is not already a boundary node, "
"is false.0);
#endif
is_bo_node = true;
bo_inds.append(bo_ind);
}
//----------------------------------------------------------------------------
inline void DynNode:: setBoNodeToInnerNode ()
//----------------------------------------------------------------------------
{
is_bo_node = false;
bo_inds.remove();
}
//----------------------------------------------------------------------------
inline void DynNode:: setNewCoords (const Ptv(real)& new_coords)
//----------------------------------------------------------------------------
{
glob_coor = new_coords;
}
//----------------------------------------------------------------------------
inline void DynNode:: setNewCoor (const real new_coor, const int dir)
//----------------------------------------------------------------------------
{
glob_coor(dir) = new_coor;
}
//----------------------------------------------------------------------------
inline void DynNode:: setNodesRefs (const int no_refs)
//----------------------------------------------------------------------------
{
no_of_refs = no_refs;
}
//----------------------------------------------------------------------------
inline int DynNode:: getNodesRefs () const
//----------------------------------------------------------------------------
{
return no_of_refs;
}
//----------------------------------------------------------------------------
inline void DynNode:: increaseGlobCoor (const real dx, const int dir)
//----------------------------------------------------------------------------
{
glob_coor(dir)+=dx;
}
KEYWORDS
node
DESCRIPTION
The class implements a node. That is, the class stores the node
coordinates, a bool to decide if the node is a boundary node, any
boundary indicators and the number of references to the node.
The boundary indicators are stored in a List of integers. The
public HandleId ensures that handles can be used on the class.
The friend class List ensures that the node can be included in a
node list in class GridDynFE. Five variables are introduced to
increase the efficiency of GridDynFE. There is a variable for
storing the global node number. This variable is only initialized
and used when updating from dynamic to static storage in Grid
DynFE. The other four variables are used in triangularElement,
twoTriangularElements and removeDomainExtended, which are func
tions in GridDynFE. The variable is_inside determines whether the
node is inside or outside a given domain, exact_hit determines if
the node is on a intersecting line or not. is_to_be_removed
determines if a node shall be removed and replacing_node is a
Handle pointing to the replacing node. The Handle pointer is the
reason for splitting Handle.h into Handle_ClassType_h.h and Han
dle_ClassType_C.h. The global and local node number is kept
track of in GridDynFE and Element. Each node is included in a
node list in GridDynFE and in a VecSimplest in the element(s) to
which the node belongs.
CONSTRUCTORS AND INITIALIZATION
There are two constructors. The empty constructor required by
VecSimplest(DynNode) and a constructor taking the nodal coordi
nates as argument.
MEMBER FUNCTIONS
operator << - calls the print function. prints the node
coordinates, the number of handles pointing to the node and any
boundary indicators to the output given as argument. This func
tion is called for by the List class.
operator != - tests for inequality by comparing the node
coordinates. The function is called for by the List class.
operator == - uses operator != to determine whether the
node given as argument and this node are alike or not. Returns
true if they are, and false if not.
operator = - assignment operator. The function assigns
this node to the node given as argument.
operator < - compares two nodes and returns true if
this node has smaller coordinates than the node given as argu
ment. This function is required by the sort function in the node
list. The node with the smallest coordinates is the node which is
nearest the origin.
print - the same as the function operator <<
above.
getGlobCoor - two functions. The first one returns the
global node coordinate in the direction given as argument. The
second returns a Ptv with the global coordinates.
setBoNode - changes is_bo_node to true, the node
becomes a boundary node (no specified indicator, though).
boNode - returns true if the node is a boundary
node (arguments as for GridFE::boNode).
addNewBoInd - adds the boundary indicator given as argu
ment to the boundary indicator list. It is assumed that the
boundary indicator is not already in the list.
removeBoInd - if the boundary indicator given as argu
ment is in the nodes boundary indicator list, it is removed and
true is returned. If not, false is returned. This function is
used in addLayer in GridDynFE to increase the efficiency of the
function.
setNewBoNode - makes the node a boundary node and gives
it the boundary indicator given as argument. It is assumed that
the node is not already a boundary node.
addToBoIndList - checks if the boundary indicator given as
argument is already in the boundary indicator list. If it is not,
then the boundary indicator is appended to the list.
getBoIndList - assigns the list given as argument to the
boundary indicator list.
setBoNodeToInnerNode - sets a boundary node to a inner node by
deleting all boundary indicators and setting is_bo_node to false.
setNewCoords - changes the nodal coordinates to the coor
dinates given as argument.
setNewCoor - changes the nodal coordinate in the dir
direction.
setNodesRefs - determines the number of references to the
node (i.e. the number of handles pointing to the node), by ini
tializing no_of_refs to the number of references given as argu
ment.
getNodesRefs - returns the number of references to the
node.
"increaseGlobCoor - increases the boundary coordinate in the
dir direction with dx, where dir and dx are given as arguments.
SEE ALSO
class GridDynFE, class Element, class List(Type, ListItemHandle),
class HandleId
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Sigurd Solgaard, SINTEF/UiO