NAME
GridDynFE - class for storing a GridFE grid in a list structure.
INCLUDE
include "GridDynFE.h"
SYNTAX
class GridDynFE : public virtual GridFE
{
friend class ManipGridDynFE;
protected:
real tolerance;
bool is_sorted;
static real angle
(
int node,
int node1,
int node2,
const VecSimplest(Ptv(real))& node_coor
);
void addBoIndToGlobBoIndList (int bo_ind);
void decideNneMaxnneAndOnemat (const GridFE& grid_small);
bool compareNodes
(
const Ptv(real)& node_coor,
Handle(DynNode)& loc_node_hand,
List(DynNode, ListItemHandle)& tmp_node_list // for efficiency
);
void setNewBoInd (int bo_ind);
void removeNodes ();
public:
// representation of GridFE data in terms of lists:
List(DynNode, ListItemHandle) node_list;
List(DynElement, ListItemHandle) element_list;
List(int, ListItemInst) all_bo_inds;
GridDynFE() {}
GridDynFE (const GridDynFE& grid) : GridFE (grid) {}
~GridDynFE() {}
void updateFromStaticStorage ();
void updateToStaticStorage
(
bool sorted_node_list = false,
int no_lapl_smoothings = 0
);
void printElmList (Os os) const;
void printNodeList (Os os) const;
void operator= (const GridDynFE& grid);
void operator= (const GridFE& grid);
bool nodeListIsSorted() const;
CLASS_INFO
};
inline bool GridDynFE:: nodeListIsSorted() const
{
return is_sorted;
}
inline void GridDynFE:: operator= (const GridFE& grid)
{ GridFE::operator=(grid); }
KEYWORDS
node, element, finite element, grid, mesh, dynamic grid
DESCRIPTION
The class is derived from GridFE. It implements a finite element
grid and contains a dynamic list structure which enables the
functions in ManipGridDynFE to make changes to the grid. Each
node and element in the grid is stored in DynNode and DynElement
objects.
The dynamic list structure in GridDynFE consists of a node list,
an element list and a list with the boundary indicators of the
grid. The list structure is chosen because the number of entries
to a list does not need to be fixed, which would be the case if
vectors were used. The node list is a list of type List(DynN
ode,ListItemHandle), which has a pointer to each DynNode object
in the grid. The element list is a list of type List(DynEle
ment,ListItemHandle), which has a pointer to each DynElement
object in the grid. The list containing the boundary indicators
is a list of type List(int,ListItemInst).
The variable tolerance holds the smallest error allowed when com
paring two coordinate values. The variable is_sorted is a bool
which is true if the node list is sorted. The variable is ini
tially true. It is set to false if entries are added to the node
list, causing it no longer to be sorted.
The class reads information from the static storage structure and
stores it in one node list and one finite element list. These
lists are manipulated by the static functions in the class Manip
GridDynFE and the result is written back to the static storage
structure.
CONSTRUCTORS AND INITIALIZATION
There is only one empty constructor. The GridDynFE is initialized
in the same way as GridFE. See the documentation of GridFE for
further information. After the static storage is initialized,
the function updateFromStaticStorage is called to initialize the
node and element lists. One can then call, e.g., ManipGridDynFE
functions. After the grid is manipulated, the lists should be
copied back to the static GridFE storage structure by the func
tion updateToStaticStorage.
PROTECTED MEMBER FUNCTIONS
angle - a static function that calculates the angle between the
line from node number node to node number node1 and the line from
node number node to node number node2. The angle is measured in
radians.
addBoIndToGlobBoIndList - a function that checks if the boundary
indicator given as argument is already in the global boundary
indicator list. If not, the boundary indicator is appended to the
list.
decideNneMaxnneAndOnemat - a function that is used when the grid
given as argument is added to the existing grid. The function
alters the different entities of the grid so that they are con
sistent with the resulting grid.
compareNodes - a function that checks if there is a node in the
node list with the coordinates node_coor. If there is, the node
is appended to the Handle loc_node_hand given as argument and
true is returned. If not, false is returned. The function is used
when a hypercube or a layer is added to the grid.
setNewBoInd - a function that is called when the dynamic grid has
been altered. The function assigns the boundary indicator bo_ind
to the new boundary nodes.
removeNodes - a function that removes the nodes that are only in
the node list, i.e. nodes with only one reference pointing to it.
The function is typically called after the removal of one or sev
eral elements.
PUBLIC MEMBER FUNCTIONS
updateFromStaticStorage - a function that updates the dynamic
list structure in GridDynFE, based on the static array struc
ture. Before calling this function, the static array structure
has to be initialized by a preprocessor (e.g. PreproBox). This
function initializes the dynamic list structure based on the
information stored in the static array structure. The tolerance
of the grid is calculated. Variables specific for the GridDynFE
object are initialized. Node and element objects are initialized
and appended to the corresponding lists.
This function becomes the most time consuming operation when
sorting the node list is omitted. The reason this function
becomes the most time consuming operation is the initialization
of the element objects. Each element object has a vector of Han
dle pointers to its local nodes. When initializing the element,
each Handle pointer has to be rebinded to the node in the node
list which corresponds to each local node. This is an operation
of order O(nel where nel is the number of elements in the grid
and nne is the number of local nodes in an element. A second
operation is also time consuming, namely initializing the bound
ary information of each node. This is an operation of order O(nno
nno is the number of nodes in the grid and nbind is the number of
boundary indicators.
updateToStaticStorage - a function that updates the static array
structure from the dynamic list structure. The function takes two
arguments, sorted_node_list and no_lapl_smoothings. The function
sorts the node list if the argument sorted_node_list is true.
The node list is not sorted if the variable is false. If the
argument no_lapl_smoothings is zero Laplacian smoothing is not
performed on the grid. If the variable is greater than zero, the
number determines how many iterations are done in the smoothing
routine. Note that the node list is sorted before Laplacian
smoothing is used. There is no point in sorting the node list
after Laplacian smoothing is used, since the placement of the
nodes in the data structure will no longer correspond to the
nodal placement in the grid. For the same reason, there is no
point in sorting the nodes if the preprocessor PreproBox has not
been used. The static array structure is redimensioned with the
new parameters and updated from the data in the lists.
If the program is compiled in debug mode, the node list is
searched for nodes with only one reference, i.e. nodes which do
not belong to any element and therefore should not be read to the
static storage. If such nodes are found, a bug report is given.
The dynamic structure represented by the node list, the element
list and the list of all boundary indicators are deleted. The
grid is smoothed, if the variable no_lapl_smoothings is greater
than zero. The smoothing is done by changing the coordinates of
each node so that the new nodal coordinates are the average of
the coordinates of the neighboring nodes. This is repeated an
arbitrary number of times. Laplacian smoothing is only performed
on the inner nodes of the grid.
printElmList - a function that prints the element list.
printNodeList - a function that prints the node list.
nodeListIsSorted - a function that returns true if the node list
is sorted and false if not.
SEE ALSO
class ManipGridDynFE, class DynElement, class DynNode, class
"List(Type, ListItemHandle), class HandleId, class GridFE
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Sigurd Solgaard, SINTEF/UiO