}
private void getBytes() {
+ boolean searching=true;
+ while(searching) {
+ for(;pos<lastlocation;pos++) {
+ if (buffer[pos]!=' '&&buffer[pos]!='\n'&&buffer[pos]!='\t') {
+ searching=false;
+ break;
+ }
+ }
+ if (searching) {
+ readnewdata();
+ }
+ }
start=pos;
for(;pos<lastlocation;pos++) {
if (buffer[pos]==' '||
}
readnewdata();
start=lastlocation-start;
- for(;true;pos++) {
+ for(;pos<lastlocation;pos++) {
if (buffer[pos]==' '||
buffer[pos]=='\n') {
+ end=pos+start;
+ start=0;
pos++;
skipline();
return;
}
tmp[pos+start]=buffer[pos];
}
- end=pos+start;
}
}
\ No newline at end of file
*/
void calculateCircumCircle() {
coordinate circumCenterPtr = this.circumCenter;
-
yada.Assert(numCoordinate == 2 || numCoordinate == 3);
if (numCoordinate == 2) {
double angleConstraint;
public element(coordinate[] coordinates, int numCoordinate, double angle) {
+ this.circumCenter=new coordinate();
this.coordinates=new coordinate[3];
this.midpoints=new coordinate[3]; /* midpoint of each edge */
this.radii=new double[3]; /* half of edge length */
-
this.edges=new edge[3];
+ for (int i = 0; i < 3; i++) {
+ this.midpoints[i] = new coordinate();
+ this.edges[i]=new edge();
+ }
for (int i = 0; i < numCoordinate; i++) {
this.coordinates[i] = coordinates[i];
}
* =============================================================================
*/
int mesh_read(String fileNamePrefix) {
- char inputBuff[]=new char[256];
int i;
int numElement = 0;
-
avltree edgeMapPtr = new avltree(0);
/*
bytereader br=new bytereader(inputFile);
int numEntry=br.getInt();
int numDimension=br.getInt();
+ br.jumptonextline();
yada.Assert(numDimension == 2); /* must be 2-D */
int numCoordinate = numEntry + 1; /* numbering can start from 1 */
coordinate coordinates[] = new coordinate[numCoordinate];
id=br.getInt();
x=br.getDouble();
y=br.getDouble();
+ br.jumptonextline();
coordinates[id].x = x;
coordinates[id].y = y;
}
br=new bytereader(inputFile);
numEntry=br.getInt();
numDimension=br.getInt();
+ br.jumptonextline();
yada.Assert(numEntry == 0); /* .node file used for vertices */
yada.Assert(numDimension == 2); /* must be edge */
numEntry=br.getInt();
+ br.jumptonextline();
for (i = 0; i < numEntry; i++) {
int id;
int a;
id=br.getInt();
a=br.getInt();
b=br.getInt();
+ br.jumptonextline();
yada.Assert(a >= 0 && a < numCoordinate);
yada.Assert(b >= 0 && b < numCoordinate);
insertCoordinates[0] = coordinates[a];
br=new bytereader(inputFile);
numEntry=br.getInt();
numDimension=br.getInt();
+ br.jumptonextline();
yada.Assert(numDimension == 3); /* must be triangle */
for (i = 0; i < numEntry; i++) {
int id;
a=br.getInt();
b=br.getInt();
c=br.getInt();
+ br.jumptonextline();
yada.Assert(a >= 0 && a < numCoordinate);
yada.Assert(b >= 0 && b < numCoordinate);
yada.Assert(c >= 0 && c < numCoordinate);
* =============================================================================
*/
public void parseArgs (String argv[]) {
- for(int index=0;index>argv.length;index++) {
+ for(int index=0;index<argv.length;index++) {
if (argv[index].equals("-a")) {
index++;
global_angleConstraint=Double.parseDouble(argv[index]);
}
public static void Assert(boolean status) {
+ if (!status) {
+ System.out.println("Failed assert");
+ int [] x=new int[1];
+ x[0]=3/0;
+ }
}
/* =============================================================================
* process