* queue_pop
* =============================================================================
*/
- public Object queue_pop () {
+ public Object queue_pop() {
int newPop = (pop + 1) % capacity;
if (newPop == push) {
return null;
private int compare(Object a,Object b)
{
+ //0 element_listCompareEdge
if(compID == 0)
- return compareKeysDefault(a,b);
- else
- return compareKeysDefault(a,b);
+ return element.compareEdge((edge)a,(edge)b);
}
* =============================================================================
* rbtree_t* rbtree_alloc (long (*compare)(const void*, const void*));
*/
+
+ //0 element_listCompareEdge
+
public RBTree(int compID) {
this.compID = compID;
this.root = null;
* -- put smallest coordinate in position 0
* =============================================================================
*/
- static void minimizeCoordinates (element elementPtr) {
- coordinate[] coordinates = elementPtr.coordinates;
- int numCoordinate = elementPtr.numCoordinate;
+ void minimizeCoordinates() {
int minPosition = 0;
for (int i = 1; i < numCoordinate; i++) {
double denominator = 2 * ((bxDelta * cyDelta) - (cxDelta * byDelta));
double rx = ax - (xNumerator / denominator);
double ry = ay + (yNumerator / denominator);
- yada.Assert(fabs(denominator) > DBL_MIN); /* make sure not colinear */
+ yada.Assert(Math.fabs(denominator) > 2.2250738585072014e-308); /* make sure not colinear */
circumCenterPtr.x = rx;
circumCenterPtr.y = ry;
}
- elementPtr.circumRadius = coordinate.coordinate_distance(circumCenterPtr,
+ circumRadius = coordinate.coordinate_distance(circumCenterPtr,
coordinates[0]);
}
edgePtr.secondPtr = firstPtr;
}
- coordinate midpointPtr = elementPtr.midpoints[i];
+ coordinate midpointPtr = midpoints[i];
midpointPtr.x = (firstPtr.x + secondPtr.x) / 2.0;
midpointPtr.y = (firstPtr.y + secondPtr.y) / 2.0;
- elementPtr.radii[i] = coordinate.coordinate_distance(firstPtr, midpointPtr);
+ radii[i] = coordinate.coordinate_distance(firstPtr, midpointPtr);
}
* initEdges
* =============================================================================
*/
- void initEdges(coordinate coordinates, int numCoordinate) {
+ void initEdges(coordinate[] coordinates, int numCoordinate) {
numEdge = ((numCoordinate * (numCoordinate - 1)) / 2);
for (int e = 0; e < numEdge; e++) {
* Contains a copy of input arg 'coordinates'
* =============================================================================
*/
- public element(coordinate[] coordinates, int numCoordinate) {
+
+ double angleConstraint;
+ public element(coordinate[] coordinates, int numCoordinate, double angle) {
this.coordinates=new coordinate[3];
this.midpoints=new coordinate[3]; /* midpoint of each edge */
this.radii=new double[3]; /* half of edge length */
}
this.numCoordinate = numCoordinate;
minimizeCoordinates();
+ this.angleConstraint=angle;
checkAngles();
calculateCircumCircle();
initEdges(coordinates, numCoordinate);
* For use in MAP_T
* =============================================================================
*/
- int element_mapCompareEdge (Object aPtr, Object bPtr) {
+ int element_mapCompareEdge (edge aPtr, edge bPtr) {
edge aEdgePtr = (edge)(aPtr.firstPtr);
edge bEdgePtr = (edge)(bPtr.firstPtr);
* -- Can we deallocate?
* =============================================================================
*/
- boolean element_isGarbage() {
+ public boolean element_isGarbage() {
return isGarbage;
}
* Returns pointer to aElementPtr's shared edge
* =============================================================================
*/
- edge element_getCommonEdge (element aElementPtr, element bElementPtr) {
+ static edge element_getCommonEdge (element aElementPtr, element bElementPtr) {
edge aEdges[] = aElementPtr.edges;
edge bEdges[] = bElementPtr.edges;
int aNumEdge = aElementPtr.numEdge;
return midpoints[e];
}
}
- yada.Assert(0);
+ yada.Assert(false);
}
return circumCenter;
}
* Return FALSE if minimum angle constraint not met
* =============================================================================
*/
- boolean element_checkAngles(double angleConstraint) {
+ boolean checkAngles() {
// double angleConstraint = global_angleConstraint;
if (numCoordinate == 3) {
for (int i = 0; i < 3; i++) {
+++ /dev/null
-public global {
- public global() {
- }
-
- int global_totalNumAdded;
- int global_numProcess;
-}
\ No newline at end of file
--- /dev/null
+public class global_arg {
+ public global_arg() {
+ }
+
+ int global_totalNumAdded;
+ int global_numProcess;
+}
\ No newline at end of file
public void siftUp(int startIndex) {
int index = startIndex;
while ((index > 1)) {
- long parentIndex = PARENT(index);
+ int parentIndex = PARENT(index);
Object parentPtr = elements[parentIndex];
Object thisPtr = elements[index];
if (compare(parentPtr, thisPtr) >= 0) {
*/
public boolean heap_insert(Object dataPtr) {
if ((size + 1) >= capacity) {
- long newCapacity = capacity * 2;
+ int newCapacity = capacity * 2;
Object newElements[] = new Object[newCapacity];
this.capacity = newCapacity;
for (int i = 0; i <= size; i++) {
size++;
elements[size] = dataPtr;
- siftUp(heapPtr, size);
+ siftUp(size);
return true;
}
element aElementPtr = (element)aPtr;
element bElementPtr = (element)bPtr;
- if (aElementPtr.encroachedEdgePtr) {
- if (bElementPtr.encroachedEdgePtr) {
+ if (aElementPtr.encroachedEdgePtr!=null) {
+ if (bElementPtr.encroachedEdgePtr!=null) {
return 0; /* do not care */
} else {
return 1;
}
}
- if (bElementPtr.encroachedEdgePtr) {
+ if (bElementPtr.encroachedEdgePtr!=null) {
return -1;
}
}
MAINCLASS=yada
SRC=${MAINCLASS}.java \
tmpheap.java \
+ bytereader.java \
List_t.java \
tmpRBTree.java \
Random.java \
+ global_arg.java \
tmpQueue_t.java \
coordinate.java \
edge.java \
*/
public class mesh {
- element rootElementPtr;
- Queue_t initBadQueuePtr;
- int size;
- RBTree boundarySetPtr;
-
+ element rootElementPtr;
+ Queue_t initBadQueuePtr;
+ int size;
+ RBTree boundarySetPtr;
+ double angle;
/* =============================================================================
* mesh_alloc
* =============================================================================
*/
- public mesh() {
+ public mesh(double angle) {
+ this.angle=angle;
rootElementPtr = null;
initBadQueuePtr = new Queue_t(-1);
size = 0;
- boundarySetPtr = new RBTree(null, element_listCompareEdge);
+ boundarySetPtr = new RBTree(0);
}
int numEdge = elementPtr.element_getNumEdge();
for (int i = 0; i < numEdge; i++) {
edge edgePtr = elementPtr.element_getEdge(i);
- if (!MAP_CONTAINS(edgeMapPtr, edgePtr)) {
+ if (!edgeMapPtr.contains(edgePtr)) {
/* Record existance of this edge */
boolean isSuccess =
- PMAP_INSERT(edgeMapPtr, edgePtr, elementPtr);
+ edgeMapPtr.insert(edgePtr, elementPtr);
yada.Assert(isSuccess);
} else {
/*
* Shared edge; update each element's neighborList
*/
boolean isSuccess;
- element sharerPtr = (element)MAP_FIND(edgeMapPtr, edgePtr);
+ element sharerPtr = (element)edgeMapPtr.find(edgePtr);
yada.Assert(sharerPtr!=null); /* cannot be shared by >2 elements */
elementPtr.element_addNeighbor(sharerPtr);
sharerPtr.element_addNeighbor(elementPtr);
- isSuccess = PMAP_REMOVE(edgeMapPtr, edgePtr);
+ isSuccess = edgeMapPtr.remove(edgePtr);
yada.Assert(isSuccess);
- isSuccess = PMAP_INSERT(edgeMapPtr,
- edgePtr,
+ isSuccess = edgeMapPtr.insert(edgePtr,
null); /* marker to check >2 sharers */
yada.Assert(isSuccess);
}
edge encroachedPtr = elementPtr.element_getEncroachedPtr();
if (encroachedPtr!=null) {
if (!boundarySetPtr.contains(encroachedPtr)) {
- element_clearEncroached(elementPtr);
+ elementPtr.element_clearEncroached();
}
}
}
yada.Assert(status);
}
- elementPtr.element_isGarbage(true);
+ elementPtr.element_setIsGarbage(true);
}
* =============================================================================
*/
boolean TMmesh_removeBoundary(edge boundaryPtr) {
- return boundarySetPtr.remove(boundaryPtr);
+ return boundarySetPtr.deleteObjNode(boundaryPtr);
}
* createElement
* =============================================================================
*/
-static void createElement (coordinate coordinates,
- int numCoordinate,
+ void createElement(coordinate[] coordinates, int numCoordinate,
avltree edgeMapPtr) {
- element elementPtr = new element(coordinates, numCoordinate);
- yada.Assert(elementPtr!=null);
-
- if (numCoordinate == 2) {
- edge boundaryPtr = elementPtr.element_getEdge(0);
- boolean status = boundarySetPtr.insert(boundaryPtr, null);
- yada.Assert(status);
- }
-
- mesh_insert(elementPtr, edgeMapPtr);
-
- if (elementPtr.element_isBad()) {
- boolean status = initBadQueuePtr.queue_push(elementPtr);
- yada.Assert(status);
- }
+ element elementPtr = new element(coordinates, numCoordinate, angle);
+ yada.Assert(elementPtr!=null);
+
+ if (numCoordinate == 2) {
+ edge boundaryPtr = elementPtr.element_getEdge(0);
+ boolean status = boundarySetPtr.insert(boundaryPtr, null);
+ yada.Assert(status);
+ }
+
+ TMmesh_insert(elementPtr, edgeMapPtr);
+
+ if (elementPtr.element_isBad()) {
+ boolean status = initBadQueuePtr.queue_push(elementPtr);
+ yada.Assert(status);
+ }
}
* =============================================================================
*/
int mesh_read(String fileNamePrefix) {
- FILE inputFile;
- coordinate coordinates;
- char fileName[]=new char[256];
- int fileNameSize = sizeof(fileName) / sizeof(fileName[0]);
char inputBuff[]=new char[256];
- int inputBuffSize = sizeof(inputBuff) / sizeof(inputBuff[0]);
- int numEntry;
- int numDimension;
- int numCoordinate;
int i;
int numElement = 0;
/*
* Read .node file
*/
- snprintf(fileName, fileNameSize, "%s.node", fileNamePrefix);
- inputFile = fopen(fileName, "r");
- yada.Assert(inputFile);
- fgets(inputBuff, inputBuffSize, inputFile);
- sscanf(inputBuff, "%li %li", numEntry, numDimension);
+
+ String fileName=fileNamePrefix+".node";
+ FileInputStream inputFile = new FileInputStream(fileName);
+ bytereader br=new bytereader(inputFile);
+ int numEntry=br.getInt();
+ int numDimension=br.getInt();
yada.Assert(numDimension == 2); /* must be 2-D */
- numCoordinate = numEntry + 1; /* numbering can start from 1 */
- coordinates = new coordinate[numCoordinate];
+ int numCoordinate = numEntry + 1; /* numbering can start from 1 */
+ coordinate coordinates[] = new coordinate[numCoordinate];
+ for(i=0;i<numCoordinate;i++)
+ coordinates[i]=new coordinate();
+
for (i = 0; i < numEntry; i++) {
- int id;
- double x;
- double y;
- if (!fgets(inputBuff, inputBuffSize, inputFile)) {
- break;
- }
- if (inputBuff[0] == '#') {
- continue; /* TODO: handle comments correctly */
- }
- sscanf(inputBuff, "%li %lf %lf", id, x, y);
- coordinates[id].x = x;
- coordinates[id].y = y;
+ int id;
+ double x;
+ double y;
+ id=br.getInt();
+ x=br.getDouble();
+ y=br.getDouble();
+ coordinates[id].x = x;
+ coordinates[id].y = y;
}
yada.Assert(i == numEntry);
- fclose(inputFile);
-
+ inputFile.close();
+
/*
* Read .poly file, which contains boundary segments
*/
- snprintf(fileName, fileNameSize, "%s.poly", fileNamePrefix);
- inputFile = fopen(fileName, "r");
- yada.Assert(inputFile);
- fgets(inputBuff, inputBuffSize, inputFile);
- sscanf(inputBuff, "%li %li", numEntry, numDimension);
+ fileName=fileNamePrefix+".poly";
+ inputFile = new FileInputStream(fileName);
+ br=new bytereader(inputFile);
+ numEntry=br.getInt();
+ numDimension=br.getInt();
yada.Assert(numEntry == 0); /* .node file used for vertices */
yada.Assert(numDimension == 2); /* must be edge */
- fgets(inputBuff, inputBuffSize, inputFile);
- sscanf(inputBuff, "%li", numEntry);
+ numEntry=br.getInt();
for (i = 0; i < numEntry; i++) {
- int id;
- int a;
- int b;
- coordinate insertCoordinates=new coordinate[2];
- if (!fgets(inputBuff, inputBuffSize, inputFile)) {
- break;
- }
- if (inputBuff[0] == '#') {
- continue; /* TODO: handle comments correctly */
- }
- sscanf(inputBuff, "%li %li %li", id, a, b);
- yada.Assert(a >= 0 && a < numCoordinate);
- yada.Assert(b >= 0 && b < numCoordinate);
- insertCoordinates[0] = coordinates[a];
- insertCoordinates[1] = coordinates[b];
- createElement(meshPtr, insertCoordinates, 2, edgeMapPtr);
+ int id;
+ int a;
+ int b;
+ coordinate insertCoordinates[]=new coordinate[2];
+ id=br.getInt();
+ a=br.getInt();
+ b=br.getInt();
+ yada.Assert(a >= 0 && a < numCoordinate);
+ yada.Assert(b >= 0 && b < numCoordinate);
+ insertCoordinates[0] = coordinates[a];
+ insertCoordinates[1] = coordinates[b];
+ createElement(insertCoordinates, 2, edgeMapPtr);
}
yada.Assert(i == numEntry);
numElement += numEntry;
- fclose(inputFile);
+ inputFile.close();
/*
* Read .ele file, which contains triangles
*/
- snprintf(fileName, fileNameSize, "%s.ele", fileNamePrefix);
- inputFile = fopen(fileName, "r");
- yada.Assert(inputFile);
- fgets(inputBuff, inputBuffSize, inputFile);
- sscanf(inputBuff, "%li %li", numEntry, numDimension);
+ fileName=fileNamePrefix+".ele";
+ inputFile = new FileInputStream(fileName);
+ br=new bytereader(inputFile);
+ numEntry=br.getInt();
+ numDimension=br.getInt();
yada.Assert(numDimension == 3); /* must be triangle */
for (i = 0; i < numEntry; i++) {
- int id;
- int a;
- int b;
- int c;
- coordinate insertCoordinates[]=new coordinate[3];
- if (!fgets(inputBuff, inputBuffSize, inputFile)) {
- break;
- }
- if (inputBuff[0] == '#') {
- continue; /* TODO: handle comments correctly */
- }
- sscanf(inputBuff, "%li %li %li %li", id, a, b, c);
- yada.Assert(a >= 0 && a < numCoordinate);
- yada.Assert(b >= 0 && b < numCoordinate);
- yada.Assert(c >= 0 && c < numCoordinate);
- insertCoordinates[0] = coordinates[a];
- insertCoordinates[1] = coordinates[b];
- insertCoordinates[2] = coordinates[c];
- createElement(meshPtr, insertCoordinates, 3, edgeMapPtr);
+ int id;
+ int a;
+ int b;
+ int c;
+ coordinate insertCoordinates[]=new coordinate[3];
+ id=br.getInt();
+ a=br.getInt();
+ b=br.getInt();
+ c=br.getInt();
+ yada.Assert(a >= 0 && a < numCoordinate);
+ yada.Assert(b >= 0 && b < numCoordinate);
+ yada.Assert(c >= 0 && c < numCoordinate);
+ insertCoordinates[0] = coordinates[a];
+ insertCoordinates[1] = coordinates[b];
+ insertCoordinates[2] = coordinates[c];
+ createElement(insertCoordinates, 3, edgeMapPtr);
}
yada.Assert(i == numEntry);
numElement += numEntry;
- fclose(inputFile);
-
- free(coordinates);
- MAP_FREE(edgeMapPtr);
-
+ inputFile.close();
return numElement;
}
while (!searchQueuePtr.queue_isEmpty()) {
List_t neighborListPtr;
- element currentElementPtr = (element)queue_pop(searchQueuePtr);
+ element currentElementPtr = (element)searchQueuePtr.queue_pop();
if (visitedMapPtr.contains(currentElementPtr)) {
continue;
}
* Continue breadth-first search
*/
if (!visitedMapPtr.contains(neighborElementPtr)) {
- boolean isSuccess = searchQueuePtr.queue_push(neighborElementPtr);
+ isSuccess = searchQueuePtr.queue_push(neighborElementPtr);
yada.Assert(isSuccess);
}
} /* for each neighbor */
public int TMretriangulate (element elementPtr,
region regionPtr,
mesh meshPtr,
- avltree edgeMapPtr) {
+ avltree edgeMapPtr, double angle) {
Vector_t badVectorPtr = regionPtr.badVectorPtr; /* private */
List_t beforeListPtr = regionPtr.beforeListPtr; /* private */
List_t borderListPtr = regionPtr.borderListPtr; /* private */
while (it.nextPtr!=null) {
it=it.nextPtr;
- element beforeElementPtr = (element)it.nodePtr;
+ element beforeElementPtr = (element)it.dataPtr;
meshPtr.TMmesh_remove(beforeElementPtr);
}
coordinates[0] = centerCoordinate;
coordinates[1] = (coordinate)(edgePtr.firstPtr);
- element aElementPtr = new element(coordinates, 2);
- yada.Assert(aElementPtr);
+ element aElementPtr = new element(coordinates, 2, angle);
+ yada.Assert(aElementPtr!=null);
meshPtr.TMmesh_insert(aElementPtr, edgeMapPtr);
coordinates[1] = (coordinate)edgePtr.secondPtr;
- element bElementPtr = new element(coordinates, 2);
- yada.Assert(bElementPtr);
+ element bElementPtr = new element(coordinates, 2, angle);
+ yada.Assert(bElementPtr!=null);
meshPtr.TMmesh_insert(bElementPtr, edgeMapPtr);
boolean status = meshPtr.TMmesh_removeBoundary(elementPtr.element_getEdge(0));
yada.Assert(status);
- status = mesPtr.TMmesh_insertBoundary(aElementPtr.element_getEdge(0));
+ status = meshPtr.TMmesh_insertBoundary(aElementPtr.element_getEdge(0));
yada.Assert(status);
status = meshPtr.TMmesh_insertBoundary(bElementPtr.element_getEdge(0));
yada.Assert(status);
it=borderListPtr.head;
while (it.nextPtr!=null) {
- coordinate coordinates[]=new coordinates[3];
+ coordinate coordinates[]=new coordinate[3];
edge borderEdgePtr = (edge)it.dataPtr;
- yada.Assert(borderEdgePtr);
+ yada.Assert(borderEdgePtr!=null);
coordinates[0] = centerCoordinate;
coordinates[1] = (coordinate)(borderEdgePtr.firstPtr);
coordinates[2] = (coordinate)(borderEdgePtr.secondPtr);
- element afterElementPtr = new element(coordinates, 3);
+ element afterElementPtr = new element(coordinates, 3, angle);
yada.Assert(afterElementPtr!=null);
meshPtr.TMmesh_insert(afterElementPtr, edgeMapPtr);
- if (afterElementPTr.element_isBad()) {
+ if (afterElementPtr.element_isBad()) {
TMaddToBadVector(badVectorPtr, afterElementPtr);
}
}
avltree edgeMapPtr) {
boolean isBoundary = false;
- if (centerElementPtr.element_getNumEdge() == 1) {
+ if(centerElementPtr.element_getNumEdge() == 1) {
isBoundary = true;
}
it=it.nextPtr;
element neighborElementPtr = (element)it.dataPtr;
neighborElementPtr.element_isGarbage(); /* so we can detect conflicts */
- if (!beforeListPtr.find(neighborElementPtr)) {
+ if (beforeListPtr.find(neighborElementPtr)==null) {
if (neighborElementPtr.element_isInCircumCircle(centerCoordinatePtr)) {
/* This is part of the region */
if (!isBoundary && (neighborElementPtr.element_getNumEdge() == 1)) {
}
} else {
/* This element borders region; save info for retriangulation */
- edge borderEdgePtr = neighborElementPtr.element_getCommonEdge(currentElementPtr);
- if (!borderEdgePtr) {
- TM_RESTART();
+ edge borderEdgePtr = element.element_getCommonEdge(neighborElementPtr, currentElementPtr);
+
+ if (borderEdgePtr==null) {
+ Thread.abort();
}
borderListPtr.insert(borderEdgePtr); /* no duplicates */
if (!edgeMapPtr.contains(borderEdgePtr)) {
* -- Returns net number of elements added to mesh
* =============================================================================
*/
- int TMregion_refine(element elementPtr, mesh meshPtr) {
+ int TMregion_refine(element elementPtr, mesh meshPtr, double angle) {
int numDelta = 0;
avltree edgeMapPtr = null;
element encroachElementPtr = null;
if (encroachElementPtr!=null) {
encroachElementPtr.element_setIsReferenced(true);
numDelta += TMregion_refine(encroachElementPtr,
- meshPtr);
+ meshPtr, angle);
if (elementPtr.element_isGarbage()) {
break;
}
numDelta += TMretriangulate(elementPtr,
this,
meshPtr,
- edgeMapPtr);
+ edgeMapPtr, angle);
}
return numDelta;
* =============================================================================
*/
-public class yada {
+public class yada extends Thread {
String global_inputPrefix;
int global_numThread;
double global_angleConstraint;
heap global_workHeapPtr;
int global_totalNumAdded;
int global_numProcess;
- global global;
+ global_arg globalvar;
public yada() {
global_inputPrefix = "";
global_numProcess = 0;
}
- public yada(mesh meshptr, heap heapptr, double angle, global g) {
+ public yada(mesh meshptr, heap heapptr, double angle, global_arg g) {
global_meshPtr=meshptr;
global_workHeapPtr=heapptr;
global_angleConstraint=angle;
- global=g;
+ globalvar=g;
}
global_angleConstraint=Double.parseDouble(argv[index]);
} else if (argv[index].equals("-i")) {
index++;
- global_inputprefix=argv[index];
+ global_inputPrefix=argv[index];
} else if (argv[index].equals("-t")) {
index++;
global_numThread=Integer.parseInt(argv[index]);
} else {
displayUsage();
- System.exit();
+ System.exit(-1);
}
}
}
*/
public static int initializeWork (heap workHeapPtr, mesh meshPtr) {
Random randomPtr = new Random();
- randomPtr.seed(0);
+ randomPtr.random_seed(0);
meshPtr.mesh_shuffleBad(randomPtr);
int numBad = 0;
- while (1) {
- element elementPtr = mesh_getBad(meshPtr);
- if (elementPtr==null) {
- break;
- }
- numBad++;
- boolean status = workHeapPtr.heap_insert(elementPtr);
- yada.Assert(status);
- elementPtr.element_setIsReferenced(true);
+ while (true) {
+ element elementPtr = meshPtr.mesh_getBad();
+ if (elementPtr==null) {
+ break;
+ }
+ numBad++;
+ boolean status = workHeapPtr.heap_insert(elementPtr);
+ yada.Assert(status);
+ elementPtr.element_setIsReferenced(true);
}
return numBad;
* process
* =============================================================================
*/
- public static void process() {
+ public void process() {
heap workHeapPtr = global_workHeapPtr;
mesh meshPtr = global_meshPtr;
int totalNumAdded = 0;
int numProcess = 0;
region regionPtr = new region();
- yada.Assert(regionPtr);
while (true) {
element elementPtr;
int numAdded;
atomic {
regionPtr.region_clearBad();
- numAdded = regionPtr.TMregion_refine(elementPtr, meshPtr);
+ numAdded = regionPtr.TMregion_refine(elementPtr, meshPtr, global_angleConstraint);
}
atomic {
elementPtr.element_setIsReferenced(false);
}
atomic {
- global.global_totalNumAdded=global.global_totalNumAdded + totalNumAdded;
- global.global_numProcess=global.global_numProcess + numProcess;
+ globalvar.global_totalNumAdded=globalvar.global_totalNumAdded + totalNumAdded;
+ globalvar.global_numProcess=globalvar.global_numProcess + numProcess;
}
}
public void run() {
Barrier.enterBarrier();
- process()
+ process();
Barrier.enterBarrier();
}
* Initialization
*/
yada y=new yada();
- global g=new global();
- y.global=g;
+ global_arg g=new global_arg();
+ y.globalvar=g;
y.parseArgs(argv);
Barrier.setBarrier(y.global_numThread);
- y.global_meshPtr = new mesh();
+ y.global_meshPtr = new mesh(y.global_angleConstraint);
System.out.println("Angle constraint = "+ y.global_angleConstraint);
System.out.println("Reading input... ");
- int initNumElement = y.global_meshPtr.mesh_read(global_inputPrefix);
+ int initNumElement = y.global_meshPtr.mesh_read(y.global_inputPrefix);
System.out.println("done.");
y.global_workHeapPtr = new heap(1);
- for(int i=1;i<global_numThread;i++) {
- yada ychild=new yada(y.global_meshPtr, y.global_angleConstraint, y.global_angleConstraint, g);
+ for(int i=1;i<y.global_numThread;i++) {
+ yada ychild=new yada(y.global_meshPtr, y.global_workHeapPtr, y.global_angleConstraint, g);
ychild.start();
}
- int initNumBadElement = y.global_workHeapPtr.initializeWork(y.global_meshPtr);
+ int initNumBadElement = initializeWork(y.global_workHeapPtr,y.global_meshPtr);
System.out.println("Initial number of mesh elements = "+ initNumElement);
System.out.println("Initial number of bad elements = "+ initNumBadElement);
System.out.println(" done.");
System.out.println("Elapsed time = "+(stop-start));
- int finalNumElement = initNumElement + y.global.global_totalNumAdded;
+ int finalNumElement = initNumElement + y.globalvar.global_totalNumAdded;
System.out.println("Final mesh size = "+ finalNumElement);
- System.out.println("Number of elements processed = "+ y.global.global_numProcess);
+ System.out.println("Number of elements processed = "+ y.globalvar.global_numProcess);
}
}