devisor2.foundation.base
Class BasicDomain

java.lang.Object
  extended bydevisor2.foundation.base.BasicDomain
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DomainStatistics

public abstract class BasicDomain
extends java.lang.Object
implements java.io.Serializable

This is the first class in a long line of the Domain class hierarchy. Here, all basic data structures which hold the data of the domain are defined, and access methods are provided: For everything that can be included in a domain, numerous ADD and DELETE methods are available.

See Also:
Serialized Form

Nested Class Summary
 class BasicDomain.DPoint
           
 
Field Summary
 int BoundaryEdgeCount
          number of Boundary Edges in the domain
 int BoundaryNodeCount
          number of Boundary Nodes in the domain
protected  ControlCenter cc
           
 java.util.Vector cells
           
 int CellValueCount
           
protected  boolean changed
          flag to indicate that the domain was changed
 DomainBoundary db
          the boundary of the domain
protected  java.lang.String domainfileformat
          fileformat of the domain (use constants provided)
protected  java.lang.String domainfilename
          filename of the domain
 int[] ecke1
           
 java.util.Vector edges
           
static java.lang.String FEAST
          constant for the FEAST file format
static java.lang.String FEAT
          constant for the FEAT file format
 java.lang.String name
          name of the domain
 java.util.Vector nodes
          the nodes and cells themselves
 int NodeValueCount
          number of values in the domain
protected  int[] perimeter
          perimter of the domain
static java.lang.String UCD
          constant for the UCD file format
 int[] validpx
           
 int[] validpy
           
 
Constructor Summary
BasicDomain()
          creates a new domain with default values for everything
 
Method Summary
 void add(GridItem item)
          adds the given GridItem to the domain's corresponding vectors every time appending at the end (for segments, the working boundary is used
 Cell addCell(Cell n)
          adds a cell at the end of the according list to the domain
 Edge addEdge(Edge e)
          adds a edge at the end of the according list to the domain
 Node addNode(Node n)
          adds a node/cell at the end of the according list to the domain
 Edge adjustEdge(Edge e)
          adds a edge to the domain and checks for its existance
 Edge adjustEdge(Node a, Node b)
          adds a edge to the domain and checks for its existance
 Node adjustNode(Node neu)
          adds a node/cell to the domain and checks for its existance
 void centerDomain()
          scales a domain to adapt the grid size to the gui frame size
 void centerDomain(boolean modus)
           
 void centerDomain(java.awt.Rectangle box)
           
 void construct_boundary()
           
 void del(GridItem item)
          removes the given GridItem from the domain
 void delCell(Cell c)
          deletes an cell element of the domain, and recursively all afterwards isolated edges
 void delEdge(Edge e)
          deletes an edge of the domain, but WITHOUT deleting its nodes, which will remain isolated afterwards.
 void delNode(Node n)
          deletes an node element of the domain
 void draw(java.awt.Graphics g)
          draws the whole domain
 void drawGrid(java.awt.Graphics g)
           
 int getBoundaryEdgeCount()
           
 int getBoundaryNodeCount()
          returns the number of boundary nodes in the domain
 Cell getCell(int number)
           
 int getCellCount()
          returns the number of cells in the domain
 java.util.Vector getCells()
           
 Edge getEdge(int number)
           
 int getEdgeCount()
          returns the number of edges in the domain
 Edge getEdgeForNode(Node n, double eps)
          gets the edge the node n resides on
 java.util.Vector getEdges()
           
 java.lang.String getFileformat()
          returns the file format of the domain (UCD, FEAT or FEAST)
 java.lang.String getFilename()
          returns the filename of the domain
 int getMaxParallelBlock()
          returns the maximum number of parallel blocks
 java.lang.String getName()
          gets the name of the domain
 int[] getNearestCells(int ipb, int izpb, BasicDomain.DPoint mp)
           
 Node getNode(int number)
           
 int getNodeCount()
          returns the number of nodes in the domain
 java.util.Vector getNodes()
           
 Node getNodeWithSameCoords(Node n)
          gets the Node in the Domain with the same coords
 BasicDomain.DPoint getParallelBlockCenter(int ipb)
           
 int[] getPerimeter()
          returns the perimeter of the domain
 int[] getPerimeter(boolean trf)
           
 boolean hasChanged()
          returns if the domain has been changed recently
 boolean isFeastable()
          Performs a check if the domain is containing elements only supported by the FEAST file format.
 void rectifyElement(Node n1, Node n2, Node n3, Node n4)
           
 void resetCellMarkers()
          resets the cell markers to a value of 0
 void resetEdgeMarkers()
          resets the edge markers to a value of 0
 void resetNodeMarkers()
          resets the node markers to a value of 0
 Edge searchEdge(Node a, Node b)
          searches for an edge with nodes a and b.
 void setDomainPerimeter(int[] p)
           
 void setName(java.lang.String s)
          sets the name of this domain
 void updateAll()
          update all numbers
 void updateCellNeighbours()
          sets the nodes in the cells according to their edges
 void updateCellNodes()
          sets the nodes in the cells according to their edges
 void updateCellNumbers()
          sets the cell numbers according to their index in the cell vector
 void updateEdgeNumbers()
          sets the cell numbers according to their index in the cell vector
 void updateNodeNumbers()
          sets the node numbers according to their index in the node vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cc

protected ControlCenter cc

changed

protected boolean changed
flag to indicate that the domain was changed


BoundaryEdgeCount

public int BoundaryEdgeCount
number of Boundary Edges in the domain


BoundaryNodeCount

public int BoundaryNodeCount
number of Boundary Nodes in the domain


nodes

public java.util.Vector nodes
the nodes and cells themselves


edges

public java.util.Vector edges

cells

public java.util.Vector cells

NodeValueCount

public int NodeValueCount
number of values in the domain


CellValueCount

public int CellValueCount

db

public DomainBoundary db
the boundary of the domain


name

public java.lang.String name
name of the domain


domainfilename

protected java.lang.String domainfilename
filename of the domain


domainfileformat

protected java.lang.String domainfileformat
fileformat of the domain (use constants provided)


perimeter

protected int[] perimeter
perimter of the domain


ecke1

public int[] ecke1

validpx

public int[] validpx

validpy

public int[] validpy

UCD

public static final java.lang.String UCD
constant for the UCD file format

See Also:
Constant Field Values

FEAT

public static final java.lang.String FEAT
constant for the FEAT file format

See Also:
Constant Field Values

FEAST

public static final java.lang.String FEAST
constant for the FEAST file format

See Also:
Constant Field Values
Constructor Detail

BasicDomain

public BasicDomain()
creates a new domain with default values for everything

Method Detail

resetCellMarkers

public void resetCellMarkers()
resets the cell markers to a value of 0


resetEdgeMarkers

public void resetEdgeMarkers()
resets the edge markers to a value of 0


resetNodeMarkers

public void resetNodeMarkers()
resets the node markers to a value of 0


construct_boundary

public void construct_boundary()

getNearestCells

public int[] getNearestCells(int ipb,
                             int izpb,
                             BasicDomain.DPoint mp)

getParallelBlockCenter

public BasicDomain.DPoint getParallelBlockCenter(int ipb)

rectifyElement

public void rectifyElement(Node n1,
                           Node n2,
                           Node n3,
                           Node n4)

getMaxParallelBlock

public int getMaxParallelBlock()
returns the maximum number of parallel blocks


updateNodeNumbers

public void updateNodeNumbers()
sets the node numbers according to their index in the node vector


updateEdgeNumbers

public void updateEdgeNumbers()
sets the cell numbers according to their index in the cell vector


updateCellNumbers

public void updateCellNumbers()
sets the cell numbers according to their index in the cell vector


updateCellNodes

public void updateCellNodes()
sets the nodes in the cells according to their edges


updateCellNeighbours

public void updateCellNeighbours()
sets the nodes in the cells according to their edges


updateAll

public void updateAll()
update all numbers


getNodeCount

public int getNodeCount()
returns the number of nodes in the domain

Returns:
number of nodes

getBoundaryNodeCount

public int getBoundaryNodeCount()
returns the number of boundary nodes in the domain

Returns:
number of boundary nodes

getCellCount

public int getCellCount()
returns the number of cells in the domain

Returns:
number of cells

getEdgeCount

public int getEdgeCount()
returns the number of edges in the domain

Returns:
number of edges

getNodes

public java.util.Vector getNodes()

getEdges

public java.util.Vector getEdges()

getCells

public java.util.Vector getCells()

getBoundaryEdgeCount

public int getBoundaryEdgeCount()

getNode

public Node getNode(int number)
Returns:
null if no such node exists, the node with the given number otherwise

getEdge

public Edge getEdge(int number)
Returns:
null if no such edge exists, the edge with the given number otherwise

getCell

public Cell getCell(int number)
Returns:
null if no such edge exists, the edge with the given number otherwise

add

public void add(GridItem item)
adds the given GridItem to the domain's corresponding vectors every time appending at the end (for segments, the working boundary is used

Parameters:
item - - a node, cell, edge, or segment

adjustNode

public Node adjustNode(Node neu)
adds a node/cell to the domain and checks for its existance


adjustEdge

public Edge adjustEdge(Node a,
                       Node b)
adds a edge to the domain and checks for its existance


adjustEdge

public Edge adjustEdge(Edge e)
adds a edge to the domain and checks for its existance


addNode

public Node addNode(Node n)
adds a node/cell at the end of the according list to the domain

Parameters:
n - element to be inserted

addCell

public Cell addCell(Cell n)
adds a cell at the end of the according list to the domain

Parameters:
n - element to be inserted

addEdge

public Edge addEdge(Edge e)
adds a edge at the end of the according list to the domain


setName

public void setName(java.lang.String s)
sets the name of this domain


del

public void del(GridItem item)
removes the given GridItem from the domain


delNode

public void delNode(Node n)
deletes an node element of the domain

Parameters:
n - element to be deleted

delCell

public void delCell(Cell c)
deletes an cell element of the domain, and recursively all afterwards isolated edges

Parameters:
c - element to be deleted

delEdge

public void delEdge(Edge e)
deletes an edge of the domain, but WITHOUT deleting its nodes, which will remain isolated afterwards. If the cell does not exist, nothing happens

Parameters:
e - - edge to be deleted

getName

public java.lang.String getName()
gets the name of the domain

Returns:
String

getEdgeForNode

public Edge getEdgeForNode(Node n,
                           double eps)
gets the edge the node n resides on


getNodeWithSameCoords

public Node getNodeWithSameCoords(Node n)
gets the Node in the Domain with the same coords

Parameters:
n - node to be searched
Returns:
the node with the same coords, null if such a node does not exist

searchEdge

public Edge searchEdge(Node a,
                       Node b)
searches for an edge with nodes a and b. If so an edge exists the reference is returned else null


drawGrid

public void drawGrid(java.awt.Graphics g)

draw

public void draw(java.awt.Graphics g)
draws the whole domain

Parameters:
g - graphics context
Returns:
none

getPerimeter

public int[] getPerimeter()
returns the perimeter of the domain

Returns:
double[4] erg (xmin,ymin,xmax,ymax)

getPerimeter

public int[] getPerimeter(boolean trf)

centerDomain

public void centerDomain()
scales a domain to adapt the grid size to the gui frame size


setDomainPerimeter

public void setDomainPerimeter(int[] p)

centerDomain

public void centerDomain(boolean modus)

centerDomain

public void centerDomain(java.awt.Rectangle box)

isFeastable

public boolean isFeastable()
Performs a check if the domain is containing elements only supported by the FEAST file format.

Returns:
true if the domain needs FEAST format to be saved correctly, false otherwise

getFilename

public java.lang.String getFilename()
returns the filename of the domain


getFileformat

public java.lang.String getFileformat()
returns the file format of the domain (UCD, FEAT or FEAST)


hasChanged

public boolean hasChanged()
returns if the domain has been changed recently