|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmathcomp.gridgeom.Grid
public class Grid
A Grid
knows its nodes, edges, and elements. The
information on the neighbors is stored in the edges.
Constructor Summary | |
---|---|
Grid(java.util.Set nodes,
java.util.Set edges,
java.util.Set elements)
Creates a new Grid from the given sets of nodes, edges and elements. |
Method Summary | |
---|---|
Triangle |
addNewTriangle(Node[] nodes)
Adds a new Triangle based on nodes . |
java.util.Map |
calcBoundary()
Calculates boundary nodes of this grid. |
java.util.Map |
calcBoundaryEdges()
Calculates boundary edges of this grid. |
static int |
co(int i,
int j)
Calculate the only number in {0,1,2} \ {i,j}. |
Grid |
createCopy()
Creates a new (essentially) deep copy of this . |
static Grid |
createFromFile(java.lang.String filename)
Creates a new Grid from the given filename . |
static Grid |
createFromReader(java.io.BufferedReader in)
Creates a new Grid from in . |
static Grid |
createFromReader(java.io.BufferedReader in,
boolean shiftDownIndices)
|
static Grid |
createFromReader2(java.io.BufferedReader in)
Creates a new Grid from in . |
static Grid |
createFromResource(java.lang.String res)
Creates a new Grid from the given res . |
static Grid |
createFromUrl(java.net.URL url)
Creates a new Grid from the given url . |
void |
createParentElements()
|
java.awt.geom.Rectangle2D |
getBounds()
|
double |
getC_G()
|
double |
getC_h()
|
Node |
getCenterNode()
|
java.util.Set |
getEdges()
Returns the edges. |
java.util.Set |
getElements()
Returns the elements. |
double |
getH()
|
int |
getIndex(Triangle t,
Triangle neighbour)
Returns the index of the edge of t which is
common. |
java.util.Set |
getInflowEdges()
|
java.util.Map |
getInfo()
|
java.lang.String |
getInfo(Edge e)
Each edge has a possible info associated with it. |
java.lang.String |
getInfo(Node n)
|
Node |
getMiddleNode(Node a,
Node b)
Calculates average of a and b . |
Node |
getMiddleNodeForEdge(Triangle t,
int index)
|
Triangle |
getNeighbour(Triangle t,
int i)
Returns the Triangle adjacent to t on
side i . |
java.util.Set |
getNodes()
Returns the nodes. |
java.util.Map |
getParentElements()
|
Grid |
getParentGrid()
|
Node |
getSchwerpunkt(Triangle t)
Calculates the average of the nodes of t . |
java.util.Map |
getTriangleInfo()
|
double |
getTriangleInfo(Triangle t)
Each triangle has a possible info associated with it. |
boolean |
isMarkedGreen(Triangle t)
|
static java.lang.String |
nextLine(java.io.BufferedReader in)
|
void |
putMarkedGreen(Triangle t)
|
void |
removeMarkedGreen(Triangle t)
|
void |
setBounds(java.awt.geom.Rectangle2D bounds)
|
void |
setCenterNode(Node centerNode)
|
void |
setEdges(java.util.Set edges)
Sets the edges. |
void |
setElements(java.util.Set elements)
Sets the elements. |
void |
setInfo(Edge e,
java.lang.String s)
|
void |
setInfo(java.util.Map map)
|
void |
setNodes(java.util.Set nodes)
Sets the nodes. |
void |
setParentElements(java.util.Map parentElements)
|
void |
setParentGrid(Grid parentGrid)
|
void |
setTriangleInfo(Triangle t,
double d)
|
void |
writeToFile(java.io.File file)
|
void |
writeToFile(java.io.File file,
boolean matlab)
Writes this grid to file . |
void |
writeToFile(java.lang.String filename)
Writes this grid to filename . |
void |
writeToWriter(java.io.PrintWriter out)
Writes this grid to out . |
void |
writeToWriter(java.io.PrintWriter out,
boolean matlab)
Writes this grid to out , with an Matlab compatible format,
if matlab is true . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Grid(java.util.Set nodes, java.util.Set edges, java.util.Set elements)
nodes
- edges
- elements
- Method Detail |
---|
public Triangle getNeighbour(Triangle t, int i)
Triangle
adjacent to t
on
side i
. It get's the Information from
t.getEdge(i)
.
t
- triangle of which we want to have the neighbouri
- number of the side of t
i
of
t
Edge.getOtherTriangle(Triangle)
public int getIndex(Triangle t, Triangle neighbour)
t
which is
common.
t
- neighbour
-
public Grid createCopy()
this
. Immutable
Objects are not cloned.
public static Grid createFromFile(java.lang.String filename)
Grid
from the given filename
.
filename
-
Grid
from filename
public static Grid createFromResource(java.lang.String res) throws java.io.FileNotFoundException
Grid
from the given res
.
res
-
Grid
from res
java.io.FileNotFoundException
createFromStream(InputStream, String)
public static Grid createFromUrl(java.net.URL url) throws java.io.IOException
Grid
from the given url
.
url
-
Grid
from url
java.io.IOException
createFromStream(InputStream, String)
public static Grid createFromReader(java.io.BufferedReader in) throws java.io.IOException
Grid
from in
.
in
-
Grid
from in
java.io.IOException
public static Grid createFromReader(java.io.BufferedReader in, boolean shiftDownIndices) throws java.io.IOException
java.io.IOException
public static Grid createFromReader2(java.io.BufferedReader in) throws java.io.IOException
Grid
from in
.
in
-
Grid
from in
java.io.IOException
public static java.lang.String nextLine(java.io.BufferedReader in) throws java.io.IOException
java.io.IOException
public void writeToFile(java.lang.String filename)
filename
.
filename
- writeToFile(File)
public void writeToFile(java.io.File file, boolean matlab)
file
.
file
- writeToWriter(PrintWriter)
public void writeToFile(java.io.File file)
public void writeToWriter(java.io.PrintWriter out) throws java.io.IOException
out
. Matlab-Export is true.
out
-
java.io.IOException
writeToWriter(PrintWriter, boolean)
public void writeToWriter(java.io.PrintWriter out, boolean matlab) throws java.io.IOException
out
, with an Matlab compatible format,
if matlab
is true
.
out
- matlab
- matlab compatible output
java.io.IOException
public Node getMiddleNode(Node a, Node b)
a
and b
.
a
- b
-
a
and b
public Node getMiddleNodeForEdge(Triangle t, int index)
public Node getSchwerpunkt(Triangle t)
t
.
t
-
t
public java.util.Map calcBoundary()
getNeighbour(Triangle, int)
,
getInfo(Edge)
public java.util.Map calcBoundaryEdges()
getNeighbour(Triangle, int)
,
TODO badly impl cause same double iteration as above
public java.util.Set getInflowEdges()
public java.lang.String getInfo(Edge e)
e
-
e
.public java.lang.String getInfo(Node n)
public Triangle addNewTriangle(Node[] nodes)
nodes
.
nodes
-
nodes
Triangle.Triangle(Node[])
public java.util.Set getEdges()
public java.util.Set getElements()
public java.util.Set getNodes()
public void setEdges(java.util.Set edges)
edges
- The edges to setpublic void setElements(java.util.Set elements)
elements
- The elements to setpublic void setNodes(java.util.Set nodes)
nodes
- The nodes to setpublic static int co(int i, int j)
i
- j
-
public double getH()
public double getC_h()
public double getC_G()
public Node getCenterNode()
public void setCenterNode(Node centerNode)
public java.awt.geom.Rectangle2D getBounds()
public void setBounds(java.awt.geom.Rectangle2D bounds)
public boolean isMarkedGreen(Triangle t)
public void putMarkedGreen(Triangle t)
public void removeMarkedGreen(Triangle t)
public java.util.Map getInfo()
public void setInfo(java.util.Map map)
public java.util.Map getParentElements()
public void setParentElements(java.util.Map parentElements)
public void createParentElements()
public Grid getParentGrid()
public void setParentGrid(Grid parentGrid)
public double getTriangleInfo(Triangle t)
t
-
public void setTriangleInfo(Triangle t, double d)
public java.util.Map getTriangleInfo()
public void setInfo(Edge e, java.lang.String s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |