devisor2.foundation.elements
Class Node

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

public class Node
extends GridItem
implements java.io.Serializable

This class represents a node of a grid. As all foundation classes, a node can draw itself and provides convenience methods to support the GridListener and the GridSelector.

See Also:
Serialized Form

Field Summary
protected  int[] coord
          cartesian coordinates of the node
protected  int index
          index of the node, read in mesh file
protected  int marker
          marker variable
protected  int npr
          boundary information variable
protected  int number
          number of the node, updated by updateNodeNumbers()
 java.util.Vector parents
          The edges which contains this node
protected  double[] value
          The values of the node
 
Fields inherited from class devisor2.foundation.GridItem
cc, marked, transformed, xmax, xmin, ymax, ymin
 
Constructor Summary
Node()
          Creates a zero node
Node(int xx, int yy)
          Creates a node at (x,y) without values
Node(int xx, int yy, Edge p)
          Creates a node at (x,y) in an edge p
Node(int xx, int yy, int nbValues)
          Creates a node at (x,y) with nbValues values
 
Method Summary
 void addParent(Edge p)
          addParent adds the given edge p to the parent vector
 java.lang.Object clone()
          creates a new Node with a copy of the data of this Node
 void draw(java.awt.Graphics g)
          draws the node to Graphics context g
 boolean equals(Node n, double eps)
          determines if two nodes located at the same place
 boolean equals2(Node n, double eps)
           
 int[] getCoord()
          gets the coordinate vector of the Node
 int getCoord(int i)
          gets the coordinate i of the Node
 java.util.Vector getFathers()
           
 int getMarker()
          gets the marker of the node.
 int getNPR()
          setNPR returns the nodal property
 int getNumber()
          gets the number of the node.
 double[] getParameters()
          returns all parameters of the griditem in an int array
 int[] getParams()
           
 Edge[] getParents()
          getParents() returns the parent edges as array of edges
 java.awt.Rectangle getPerimeter()
          calculates the perimeter of this node.
 double getValue(int i)
          gets an value of the node
 void interpolate(Node noeud1, Node noeud2, double coeff)
          set an interpolated node between noeud1 and noeud2 related to parameter coeff
 boolean isHit(int x, int y)
          Has a node been hit by a click on the given coordinates? This method works in screen coordinates only because it is pure convenience for the GridSelector class.
 boolean isInside(int[] topleft, int[] bottomright)
          Are we inside of a give 2D area ?
 void performMirror(double nx, double ny, double px, double py)
          This method mirrors the node at the given line
 void performTransformation(GridTransformation trf)
          applies the given affine transformation to the node
 boolean removeParent(Edge p)
          delParent deletes the given edge p from the parent vector
 void setCoord(int[] xx)
          setCoord sets the coordinates of the node
 void setCoord(int xx, int yy)
          setCoords sets the coordinates of the node
 void setCoord(int xx, int yy, int m)
          setCoord sets the coordinates of the node and the marker
 void setCoord(Node n)
          sets the coordinates of the actual node to the coordinates of Node n
 void setMarker(int n)
          sets the marker of the node to n.
 void setNPR(int unpr)
          setNPR sets the nodal property
 void setNumber(int i)
          Sets the number of the node to i.
 void setParameters(double[] params)
          sets the parameters to the given ones
 void setParams(int[] prm)
           
 void setValue(int i, double val)
          Sets the values of the node
 java.lang.String toString()
          prints the node's coordinates to the standard output
 
Methods inherited from class devisor2.foundation.GridItem
clearTransformedFlag, isMarked, setMarker, setMarker, unsetMarker
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

coord

protected int[] coord
cartesian coordinates of the node


value

protected double[] value
The values of the node


parents

public java.util.Vector parents
The edges which contains this node


number

protected int number
number of the node, updated by updateNodeNumbers()


index

protected int index
index of the node, read in mesh file


marker

protected int marker
marker variable


npr

protected int npr
boundary information variable

Constructor Detail

Node

public Node()
Creates a zero node


Node

public Node(int xx,
            int yy)
Creates a node at (x,y) without values


Node

public Node(int xx,
            int yy,
            Edge p)
Creates a node at (x,y) in an edge p


Node

public Node(int xx,
            int yy,
            int nbValues)
Creates a node at (x,y) with nbValues values

Method Detail

setNPR

public void setNPR(int unpr)
setNPR sets the nodal property

Parameters:
unpr - nodal property

getNPR

public int getNPR()
setNPR returns the nodal property


getParents

public Edge[] getParents()
getParents() returns the parent edges as array of edges


getFathers

public java.util.Vector getFathers()

addParent

public void addParent(Edge p)
addParent adds the given edge p to the parent vector


removeParent

public boolean removeParent(Edge p)
delParent deletes the given edge p from the parent vector


getParameters

public double[] getParameters()
Description copied from class: GridItem
returns all parameters of the griditem in an int array

Specified by:
getParameters in class GridItem
Returns:
all parameters of the node

getParams

public int[] getParams()

setParams

public void setParams(int[] prm)

setParameters

public void setParameters(double[] params)
sets the parameters to the given ones

Specified by:
setParameters in class GridItem

setNumber

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


getNumber

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


getMarker

public int getMarker()
gets the marker of the node.


setMarker

public void setMarker(int n)
sets the marker of the node to n.


setCoord

public void setCoord(int xx,
                     int yy)
setCoords sets the coordinates of the node


setCoord

public void setCoord(int[] xx)
setCoord sets the coordinates of the node


setCoord

public void setCoord(int xx,
                     int yy,
                     int m)
setCoord sets the coordinates of the node and the marker


setCoord

public void setCoord(Node n)
sets the coordinates of the actual node to the coordinates of Node n

Parameters:
n - Node to be copied
Returns:
none

getCoord

public int[] getCoord()
gets the coordinate vector of the Node


getCoord

public int getCoord(int i)
gets the coordinate i of the Node


setValue

public void setValue(int i,
                     double val)
Sets the values of the node

Parameters:
i - index of the value
Returns:
none

getValue

public double getValue(int i)
gets an value of the node

Parameters:
i - index of the value
Returns:
selected value

clone

public java.lang.Object clone()
creates a new Node with a copy of the data of this Node

Returns:
Node

toString

public java.lang.String toString()
prints the node's coordinates to the standard output

Returns:
none

draw

public void draw(java.awt.Graphics g)
draws the node to Graphics context g

Specified by:
draw in class GridItem

interpolate

public void interpolate(Node noeud1,
                        Node noeud2,
                        double coeff)
set an interpolated node between noeud1 and noeud2 related to parameter coeff

Parameters:
noeud1 - Node 1
noeud2 - Node 2
coeff - Range
Returns:
none

equals

public boolean equals(Node n,
                      double eps)
determines if two nodes located at the same place

Parameters:
n - node
eps - accuracy
Returns:
the same? yes/no

equals2

public boolean equals2(Node n,
                       double eps)

isInside

public boolean isInside(int[] topleft,
                        int[] bottomright)
Are we inside of a give 2D area ?

Specified by:
isInside in class GridItem
Parameters:
topleft - - the topleft corner of the rectangle
bottomright - - the bottom right corner of the rectangle
Returns:
is inside ? yes/no

isHit

public boolean isHit(int x,
                     int y)
Has a node been hit by a click on the given coordinates? This method works in screen coordinates only because it is pure convenience for the GridSelector class. On the other hand, the tolerance factor is unspecified in world coordinates.

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

getPerimeter

public java.awt.Rectangle getPerimeter()
calculates the perimeter of this node. Thus a node is a Point, the differences between calculated limits are 0

Specified by:
getPerimeter in class GridItem
Returns:
Perimeter of this node

performTransformation

public void performTransformation(GridTransformation trf)
applies the given affine transformation to the node

Specified by:
performTransformation in class GridItem
Parameters:
trf - - homonenous world coords

performMirror

public void performMirror(double nx,
                          double ny,
                          double px,
                          double py)
This method mirrors the node at the given line

Specified by:
performMirror in class GridItem