devisor2.foundation.elements
Class Cell

java.lang.Object
  extended bydevisor2.foundation.GridItem
      extended bydevisor2.foundation.elements.Cell
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Cell2D

public abstract class Cell
extends GridItem
implements java.io.Serializable

The class Cell provides a superior ground class for the cells which defines the discrete domain. This class is abstract and must be derived. Basically, a Cell is a container for some faces (or in 2D edges) which are defined via the cornering nodes. As always, there are additional properties like numbering, material constants etc.

See Also:
Quad, Tri, Line, Macro, Serialized Form

Field Summary
protected  Cell[] children
          Array for the children, should contain cells.
protected  int level
          Number of the cell
protected  int marker
          Marker of the cell
protected  int material_number
          Material number of the cell (UCD)
protected  int matrixblock
          parameters of the cell
protected  Cell[] neighbours
          Array for the neighbourhood, updated by updateCellNeighbours() should contain cells.
protected  Node[] nodes
          nodes of this cell, updated by updateCellNodes()
protected  int number
          Number of the cell
protected  int parallelblock
          parameters of the cell
protected  int[] parameters
          parameters of the cell
protected  Cell parent
          parent Cell
protected  double[] values
          Values stored in the cell.
 
Fields inherited from class devisor2.foundation.GridItem
cc, marked, transformed, xmax, xmin, ymax, ymin
 
Constructor Summary
Cell()
          Empty Constructor.
 
Method Summary
 void defValue(int i)
          Defines the length of the array of values in the cell
abstract  void draw(java.awt.Graphics g)
          Draws the perimeter of the cell.
abstract  void fill(java.awt.Graphics g)
          Draws the cell filled with its color.
 Cell[] getChildren()
           
 int getLevel()
          Returns the level of the cell.
 int getMarker()
          Returns the marker of the cell.
 int getMatrixBlock()
           
 Cell[] getNeighbours()
           
 double getNodeAverageValue(int index)
          Returns the average of the ith value of the nodes defining this cell.
 Node[] getNodes()
           
abstract  int getNPT()
           
 int getNumber()
          gets the number of the cell.
 int getParallelBlock()
           
 Cell getParent()
           
abstract  java.awt.Rectangle getPerimeter()
          This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of.
 double getValue(int i)
          Returns the ith value.
abstract  boolean isHit(int x, int y)
          Determines if the item has been hit by a click on the grid ALL IN SCREEN COORDINATES to avoid the snap mechanism
abstract  boolean isInside(int[] topleft, int[] bottomright)
          Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
 boolean isRect()
           
abstract  void performTransformation(GridTransformation trafo)
          This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance
 void setLevel(int m)
          sets the level of the cell.
 void setMarker(int m)
          sets the marker of the cell.
 void setMatrixBlock(int i)
           
 void setNumber(int i)
          Sets the number of the cell to i.
 void setParallelBlock(int i)
           
 void setValue(int i, double val)
          Sets the ith value to val.
abstract  Cell[] updateCellNeighbours()
          updates the neighbours of this cell
abstract  Node[] updateCellNodes()
          updates the Node array of this cell
 
Methods inherited from class devisor2.foundation.GridItem
clearTransformedFlag, getParameters, isMarked, performMirror, setMarker, setMarker, setParameters, unsetMarker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

number

protected int number
Number of the cell


material_number

protected int material_number
Material number of the cell (UCD)


level

protected int level
Number of the cell


marker

protected int marker
Marker of the cell


parameters

protected int[] parameters
parameters of the cell


neighbours

protected Cell[] neighbours
Array for the neighbourhood, updated by updateCellNeighbours() should contain cells.


children

protected Cell[] children
Array for the children, should contain cells.


parent

protected Cell parent
parent Cell


values

protected double[] values
Values stored in the cell.


parallelblock

protected int parallelblock
parameters of the cell


matrixblock

protected int matrixblock
parameters of the cell


nodes

protected Node[] nodes
nodes of this cell, updated by updateCellNodes()

Constructor Detail

Cell

public Cell()
Empty Constructor. Sets the number to 0.

Method Detail

setParallelBlock

public void setParallelBlock(int i)

getParallelBlock

public int getParallelBlock()

setMatrixBlock

public void setMatrixBlock(int i)

getMatrixBlock

public int getMatrixBlock()

defValue

public void defValue(int i)
Defines the length of the array of values in the cell


setValue

public void setValue(int i,
                     double val)
Sets the ith value to val.


getValue

public double getValue(int i)
Returns the ith value.


isRect

public boolean isRect()

getNodeAverageValue

public double getNodeAverageValue(int index)
Returns the average of the ith value of the nodes defining this cell.


getMarker

public int getMarker()
Returns the marker of the cell.


setMarker

public void setMarker(int m)
sets the marker of the cell.

Parameters:
m - marker value

getLevel

public int getLevel()
Returns the level of the cell.


setLevel

public void setLevel(int m)
sets the level of the cell.

Parameters:
m - level value

setNumber

public void setNumber(int i)
Sets the number of the cell to i.


getParent

public Cell getParent()

getNeighbours

public Cell[] getNeighbours()

getChildren

public Cell[] getChildren()

getNodes

public Node[] getNodes()

getNumber

public int getNumber()
gets the number of the cell.


updateCellNodes

public abstract Node[] updateCellNodes()
updates the Node array of this cell

Returns:
the nodes of this cell in order of faces/edges

updateCellNeighbours

public abstract Cell[] updateCellNeighbours()
updates the neighbours of this cell


draw

public abstract void draw(java.awt.Graphics g)
Draws the perimeter of the cell.

Specified by:
draw in class GridItem

getNPT

public abstract int getNPT()

fill

public abstract void fill(java.awt.Graphics g)
Draws the cell filled with its color.


isInside

public abstract boolean isInside(int[] topleft,
                                 int[] bottomright)
Is the item inside a given rectangular area? All in WORLD COORDINATES!!!

Specified by:
isInside in class GridItem
Parameters:
topleft - - the topleft corner of the rectangle
bottomright - - the bottom right corner of the rectangle
Returns:
true if the item is completely inside the rectangle

isHit

public abstract boolean isHit(int x,
                              int y)
Determines if the item has been hit by a click on the grid ALL IN SCREEN COORDINATES to avoid the snap mechanism

Specified by:
isHit in class GridItem
Returns:
true if the item has been hit

getPerimeter

public abstract java.awt.Rectangle getPerimeter()
Description copied from class: GridItem
This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of.

Specified by:
getPerimeter in class GridItem
Returns:
a Rectangle object defining the perimeter

performTransformation

public abstract void performTransformation(GridTransformation trafo)
Description copied from class: GridItem
This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance

Specified by:
performTransformation in class GridItem
Parameters:
trafo - - a GridTransform instance representing the transformation