| 4 | 
  | 
#include <sys/stat.h> | 
| 5 | 
  | 
 | 
| 6 | 
  | 
#include <iostream> | 
| 7 | 
< | 
#include <cmath> | 
| 7 | 
> | 
#include <math.h> | 
| 8 | 
  | 
 | 
| 9 | 
  | 
#include <stdio.h> | 
| 10 | 
  | 
#include <stdlib.h> | 
| 33 | 
  | 
using namespace dumpRead; | 
| 34 | 
  | 
 | 
| 35 | 
  | 
 | 
| 36 | 
< | 
DumpReader :: DumpReader( char *in_name ){ | 
| 36 | 
> | 
DumpReader :: DumpReader(const char *in_name ){ | 
| 37 | 
  | 
 | 
| 38 | 
  | 
  isScanned = false; | 
| 39 | 
  | 
  headFP = new FilePos; | 
| 226 | 
  | 
   | 
| 227 | 
  | 
  framePos = frameStart[whichFrame]->getPos(); | 
| 228 | 
  | 
 | 
| 229 | 
+ | 
  fsetpos(inFile, framePos); | 
| 230 | 
  | 
   | 
| 231 | 
  | 
 | 
| 231 | 
– | 
 | 
| 232 | 
  | 
  eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); | 
| 233 | 
  | 
  if( eof_test == NULL ){ | 
| 234 | 
  | 
    sprintf( painCave.errMsg, | 
| 316 | 
  | 
   | 
| 317 | 
  | 
  haveError = 0; | 
| 318 | 
  | 
  if (worldRank == 0) { | 
| 319 | 
< | 
 | 
| 319 | 
> | 
    fsetpos(inFile, framePos); | 
| 320 | 
  | 
    eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); | 
| 321 | 
  | 
    if( eof_test == NULL ){ | 
| 322 | 
  | 
      sprintf( painCave.errMsg, | 
| 497 | 
  | 
  // set the string tokenizer | 
| 498 | 
  | 
   | 
| 499 | 
  | 
  foo = strtok(readLine, " ,;\t"); | 
| 500 | 
< | 
   | 
| 500 | 
> | 
  atoms[atomIndex]->setType(foo); | 
| 501 | 
  | 
  // check the atom name to the current atom | 
| 502 | 
  | 
   | 
| 503 | 
< | 
  if( strcmp( foo, atoms[atomIndex]->getType() ) ){ | 
| 504 | 
< | 
    sprintf( painCave.errMsg, | 
| 505 | 
< | 
             "Initialize from file error. Atom %s at index %d " | 
| 506 | 
< | 
             "in file %s does not" | 
| 507 | 
< | 
             " match the BASS atom %s.\n", | 
| 508 | 
< | 
             foo, atomIndex, inName, atoms[atomIndex]->getType() ); | 
| 509 | 
< | 
    return strdup( painCave.errMsg ); | 
| 510 | 
< | 
  } | 
| 503 | 
> | 
  //if( strcmp( foo, atoms[atomIndex]->getType() ) ){ | 
| 504 | 
> | 
  //  sprintf( painCave.errMsg, | 
| 505 | 
> | 
  //    "Initialize from file error. Atom %s at index %d " | 
| 506 | 
> | 
  //     "in file %s does not" | 
| 507 | 
> | 
  //     " match the BASS atom %s.\n", | 
| 508 | 
> | 
  //     foo, atomIndex, inName, atoms[atomIndex]->getType() ); | 
| 509 | 
> | 
  //  return strdup( painCave.errMsg ); | 
| 510 | 
> | 
  //} | 
| 511 | 
  | 
     | 
| 512 | 
  | 
  // get the positions | 
| 513 | 
  | 
 | 
| 686 | 
  | 
 | 
| 687 | 
  | 
  char *foo; // the pointer to the current string token  | 
| 688 | 
  | 
  int j; | 
| 689 | 
+ | 
  double chi, integralOfChidt; | 
| 690 | 
+ | 
  double eta[9]; | 
| 691 | 
  | 
 | 
| 692 | 
  | 
  // set the string tokenizer | 
| 693 | 
  | 
   | 
| 787 | 
  | 
  } | 
| 788 | 
  | 
  boxMat[8] = atof( foo );     | 
| 789 | 
  | 
 | 
| 790 | 
+ | 
  return NULL; | 
| 791 | 
+ | 
 | 
| 792 | 
+ | 
  //get chi and integralOfChidt, they should appear by pair | 
| 793 | 
+ | 
  foo = strtok(NULL, " ,;\t\n"); | 
| 794 | 
+ | 
  if(foo != NULL){ | 
| 795 | 
+ | 
    chi = atof(foo); | 
| 796 | 
+ | 
     | 
| 797 | 
+ | 
    foo = strtok(NULL, " ,;\t\n"); | 
| 798 | 
+ | 
    if(foo == NULL){ | 
| 799 | 
+ | 
      sprintf( painCave.errMsg, | 
| 800 | 
+ | 
               "chi and integralOfChidt should appear by pair in %s\n", inName ); | 
| 801 | 
+ | 
      return strdup( painCave.errMsg ); | 
| 802 | 
+ | 
    } | 
| 803 | 
+ | 
    integralOfChidt = atof( foo ); | 
| 804 | 
+ | 
     | 
| 805 | 
+ | 
    //push chi and integralOfChidt into SimInfo::properties which can be | 
| 806 | 
+ | 
    //retrieved by integrator later | 
| 807 | 
+ | 
    DoubleData* chiValue = new DoubleData(); | 
| 808 | 
+ | 
    chiValue->setID(CHIVALUE_ID); | 
| 809 | 
+ | 
    chiValue->setData(chi); | 
| 810 | 
+ | 
    simnfo->addProperty(chiValue); | 
| 811 | 
+ | 
     | 
| 812 | 
+ | 
    DoubleData* integralOfChidtValue = new DoubleData(); | 
| 813 | 
+ | 
    integralOfChidtValue->setID(INTEGRALOFCHIDT_ID); | 
| 814 | 
+ | 
    integralOfChidtValue->setData(integralOfChidt); | 
| 815 | 
+ | 
    simnfo->addProperty(integralOfChidtValue); | 
| 816 | 
+ | 
     | 
| 817 | 
+ | 
  } | 
| 818 | 
+ | 
  else | 
| 819 | 
+ | 
    return NULL; | 
| 820 | 
+ | 
   | 
| 821 | 
+ | 
  //get eta | 
| 822 | 
+ | 
  for(int i = 0 ; i < 9; i++){ | 
| 823 | 
+ | 
    foo = strtok(NULL, " ,;\t"); | 
| 824 | 
+ | 
    if(foo == NULL){ | 
| 825 | 
+ | 
      sprintf( painCave.errMsg, | 
| 826 | 
+ | 
               "error in reading eta[%d] from %s\n", i, inName ); | 
| 827 | 
+ | 
      return strdup( painCave.errMsg ); | 
| 828 | 
+ | 
    } | 
| 829 | 
+ | 
    eta[i] = atof( foo ); | 
| 830 | 
+ | 
  } | 
| 831 | 
+ | 
   | 
| 832 | 
+ | 
  //push eta into SimInfo::properties which can be | 
| 833 | 
+ | 
  //retrieved by integrator later | 
| 834 | 
+ | 
  //simnfo->setBoxM( theBoxMat3 ); | 
| 835 | 
+ | 
  DoubleArrayData* etaValue = new DoubleArrayData(); | 
| 836 | 
+ | 
  etaValue->setID(ETAVALUE_ID); | 
| 837 | 
+ | 
  etaValue->setData(eta, 9); | 
| 838 | 
+ | 
  simnfo->addProperty(etaValue); | 
| 839 | 
+ | 
   | 
| 840 | 
+ | 
   | 
| 841 | 
  | 
  return NULL; | 
| 842 | 
+ | 
   | 
| 843 | 
+ | 
   | 
| 844 | 
+ | 
 | 
| 845 | 
  | 
} | 
| 846 | 
  | 
 | 
| 847 | 
  | 
 |