ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/SHAPES/SHAPE.cpp
(Generate patch)

Comparing trunk/SHAPES/SHAPE.cpp (file contents):
Revision 1290 by gezelter, Wed Jun 23 20:53:17 2004 UTC vs.
Revision 1299 by gezelter, Thu Jun 24 15:56:05 2004 UTC

# Line 35 | Line 35 | void SHAPE::readSHAPEfile(const char *fname) {
35      printf("Could not open SHAPE file %s\n", fname);
36      exit(-1);
37    }
38 <  rewind(shapeFile);
39 <  lineNum = 0;
38 >  
39 >  findBegin( "ShapeInfo" );
40 >
41    eof_test = fgets( readLine, sizeof(readLine), shapeFile );
42 <  lineNum++;
42 <  if( eof_test == NULL ){
43 <    printf("Error in reading SHAPE from SHAPE file at line %d.\n",
44 <           lineNum );
45 <    exit(-1);
46 <  }
47 <  // first find the shape name:
42 >
43    while( eof_test != NULL ){
44      // toss comment lines
45      if( readLine[0] != '!' && readLine[0] != '#' ){
46 +      
47 +      foo = strtok(readLine, " ,;\t");
48 +      if (!strcasecmp(foo, "end")) break;
49  
50        nTokens = count_tokens(readLine, " ,;\t");
51        if (nTokens < 5) {
52 <        printf("Not enough data on information line in SHAPE file.\n");
52 >        printf("Not enough data on shapeInfo line in SHAPE file.\n");
53          exit(-1);
54        }
55  
# Line 68 | Line 66 | void SHAPE::readSHAPEfile(const char *fname) {
66        break;
67      }
68      eof_test = fgets( readLine, sizeof(readLine), shapeFile );
71    lineNum++;
69    }
70  
71    findBegin( "ContactFunctions" );
# Line 257 | Line 254 | int SHAPE::count_tokens(char *line, char *delimiters)
254  
255    free(working_line);
256    return(ntokens);
257 + }
258 +
259 +
260 + double SHAPE::getSigmaAt(double costheta, double phi) {
261 +
262 +  vector<SHFunc*>::iterator sigmaIter;
263 +  double sigma;
264 +
265 +  sigma = 0.0;
266 +
267 +  for(sigmaIter = sigmaFuncs.begin();  sigmaIter != sigmaFuncs.end();
268 +      ++sigmaIter)    
269 +    sigma += (*sigmaIter)->getValueAt(costheta, phi);
270 +
271 +  return sigma;
272   }
273 +
274 + double SHAPE::getSAt(double costheta, double phi) {
275 +
276 +  vector<SHFunc*>::iterator sIter;
277 +  double s;
278 +
279 +  s = 0.0;
280 +  
281 +  for(sIter = sFuncs.begin(); sIter != sFuncs.end();  ++sIter)
282 +    s += (*sIter)->getValueAt(costheta, phi);
283 +  
284 +  return s;
285 + }
286 +
287 + double SHAPE::getEpsAt(double costheta, double phi) {
288 +
289 +  vector<SHFunc*>::iterator epsIter;
290 +  double eps;
291 +
292 +  eps = 0.0;
293 +  
294 +  for(epsIter = epsFuncs.begin(); epsIter != epsFuncs.end(); ++epsIter)    
295 +    eps += (*epsIter)->getValueAt(costheta, phi);
296 +  
297 +  return eps;
298 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines