rewrite the coordinate getter

currently controlled from input2.c lines 297-298. will need to add a
flag to not load the coordinates.
This commit is contained in:
Elad Salomons
2015-09-12 16:34:52 +03:00
parent 186f21f9a7
commit 4d6bcef623
6 changed files with 32 additions and 159 deletions

View File

@@ -42,8 +42,6 @@ extern char *Fldname[];
extern char *Tok[MAXTOKS];
extern STmplist *PrevPat;
extern STmplist *PrevCurve;
extern STmplist *PrevCoord;
extern int Ntokens;
@@ -591,46 +589,24 @@ int coordata()
**--------------------------------------------------------------
*/
{
double x,y;
SFloatlist *fx, *fy;
STmplist *c;
double x, y;
int j;
/* Check for valid curve ID */
/* Check for valid node ID */
if (Ntokens < 3) return(201);
if (
PrevCoord != NULL &&
strcmp(Tok[0],PrevCoord->ID) == 0
) c = PrevCoord;
else c = findID(Tok[0],Coordlist);
// c = findID(Tok[0],Coordlist);
if (c == NULL) return(205);
/* Check for valid data */
/* Check for valid data */
if ((j = findnode(Tok[0])) == 0) return(203);
if (!getfloat(Tok[1],&x)) return(202);
if (!getfloat(Tok[2],&y)) return(202);
/* Add new data point to curve's linked list */
fx = (SFloatlist *) malloc(sizeof(SFloatlist));
fy = (SFloatlist *) malloc(sizeof(SFloatlist));
if (fx == NULL || fy == NULL) return(101);
fx->value = x;
fx->next = c->x;
c->x = fx;
fy->value = y;
fy->next = c->y;
c->y = fy;
//Curve[c->i].Npts++;
/* Save the pointer to this curve */
PrevCoord = c;
return(0);
/* Save coordn data */
//Coord[Njuncs].X = x;
//Coord[Njuncs].Y = y;
/* Save coord data */
strncpy(Coord[j].ID, Node[j].ID, MAXID);
Coord[j].X = x;
Coord[j].Y = y;
Coord[j].HaveCoords = 1;
return(0);
} /* end of coordata */
int demanddata()