Changeset d982bb for molecuilder


Ignore:
Timestamp:
Apr 28, 2008, 11:36:11 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
8efbfc
Parents:
34d37c
Message:

All filenames (const char *) have been transferred to defs.hpp

Filenames have been transformed into #define's into order to centralise these values. Parser.hpp had these already and they were streamlined to match defs.hpp (which is now included in parser.hpp)

Location:
molecuilder/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/defs.hpp

    r34d37c rd982bb  
    3737enum value_type { string_type, double_type, int_type, row_int, row_double, grid, lower_trigrid, upper_trigrid};
    3838
     39// various standard filenames
     40#define KEYSETFILE "KeySets.dat"
     41#define ADJACENCYFILE "Adjacency.dat"
     42#define TEFACTORSFILE "TE-Factors.dat"
     43#define FORCESFILE "Forces-Factors.dat"
     44#define FRAGMENTPREFIX "BondFragment"
     45#define STANDARDCONFIG "unknown.conf"
     46#define STANDARDELEMENTSDB "elements.db"
     47#define STANDARDVALENCEDB "valence.db"
     48#define STANDARDORBITALDB "orbitals.db"
     49#define STANDARDHBONDDISTANCEDB "Hbonddistance.db"
     50#define STANDARDHBONDANGLEDB "Hbondangle.db"
     51
    3952
    4053#endif /*DEFS_HPP_*/
  • molecuilder/src/moleculelist.cpp

    r34d37c rd982bb  
    385385  strcpy(PathBackup, configuration->GetDefaultPath());
    386386  // open file for the total energy factor
    387   sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, "TE-Factors.dat");
     387  sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, TEFACTORSFILE);
    388388  output.open(TEFilename, ios::out);
    389389  // output TEList (later to file AtomicTEList.dat)
     
    402402 
    403403  // open file for the force factors
    404   sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, "Forces-Factors.dat");
     404  sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, FORCESFILE);
    405405  output.open(TEFilename, ios::out);
    406406  //cout << Verbose(1) << "Final AtomicForcesList: ";
  • molecuilder/src/molecules.cpp

    r34d37c rd982bb  
    18951895  cout << Verbose(1) << "Parsing the KeySet file ... ";
    18961896  // open file and read
    1897   sprintf(filename, "%s/%s%s", path, "BondFragment", "KeySets.dat");
     1897  sprintf(filename, "%s/%s%s", path, FRAGMENTPREFIX, KEYSETFILE);
    18981898  KeySetFile.open(filename);
    18991899  if (KeySetFile != NULL) {
     
    19441944  bool status = true;
    19451945
    1946   sprintf(filename, "%s/%s%s", path, "BondFragment", "Adjacency.dat");
     1946  sprintf(filename, "%s/%s%s", path, FRAGMENTPREFIX, ADJACENCYFILE);
    19471947  AdjacencyFile.open(filename);
    19481948  cout << Verbose(1) << "Saving adjacency list ... ";
     
    19791979  bool status = true;
    19801980 
    1981   sprintf(filename, "%s/%s%s", path, "BondFragment", "Adjacency.dat");
     1981  sprintf(filename, "%s/%s%s", path, FRAGMENTPREFIX, ADJACENCYFILE);
    19821982  File.open(filename);
    19831983  *out << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ...";
  • molecuilder/src/parser.cpp

    r34d37c rd982bb  
    4343  stringstream line;
    4444
    45   line << argv[1] << FactorsFile;
     45  line << argv[1] << FRAGMENTPREFIX << TEFACTORSFILE;
    4646  return FilePresent(line.str().c_str());
    4747};
     
    106106  // count the number of matrices
    107107  MatrixCounter = -1; // we count one too much
    108   line << name << FactorsFile;
     108  line << name << FRAGMENTPREFIX << TEFACTORSFILE;
    109109  input.open(line.str().c_str(), ios::in);
    110110  if (input == NULL) {
     
    127127    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    128128    if (i != MatrixCounter) 
    129       line << name << FragmentPrefix << FragmentNumber << "/" << prefix << suffix;
     129      line << name << FRAGMENTPREFIX << FragmentNumber << "/" << prefix << suffix;
    130130    else
    131131      line << name << prefix << suffix;
     
    329329    stringstream line;
    330330    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    331     line << name << FragmentPrefix << FragmentNumber << "/" << prefix;
     331    line << name << FRAGMENTPREFIX << FragmentNumber << "/" << prefix;
    332332    Free((void **)&FragmentNumber, "*FragmentNumber");
    333333    output.open(line.str().c_str(), ios::out);
     
    424424  cout << "Parsing force indices." << endl;
    425425  Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "ForceMatrix::ParseIndices: **Indices");
    426   line << name << ForcesFile;
     426  line << name << FRAGMENTPREFIX << FORCESFILE;
    427427  input.open(line.str().c_str(), ios::in);
    428428  //cout << "Opening " << line.str() << " ... "  << input << endl;
     
    439439    Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
    440440    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    441     cout << FragmentPrefix << FragmentNumber << "[" << RowCounter[i] << "]:";
     441    cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    442442    Free((void **)&FragmentNumber, "ForceMatrix::ParseIndices: *FragmentNumber");
    443443    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
     
    521521  cout << "Parsing key sets." << endl;
    522522  KeySets = (int **) Malloc(sizeof(int *)*FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
    523   line << name << KeySetsFile;
     523  line << name << FRAGMENTPREFIX << KEYSETFILE;
    524524  input.open(line.str().c_str(), ios::in);
    525525  if (input == NULL) {
     
    535535    KeySets[i] = (int *) Malloc(sizeof(int)*AtomCounter[i], "KeySetsContainer::ParseKeySets: *KeySets[]");
    536536    FragmentNumber = FixedDigitNumber(FragmentCounter, i);
    537     cout << FragmentPrefix << FragmentNumber << "[" << AtomCounter[i] << "]:";
     537    cout << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";
    538538    Free((void **)&FragmentNumber, "KeySetsContainer::ParseKeySets: *FragmentNumber");
    539539    input.getline(filename, 1023);
  • molecuilder/src/parser.hpp

    r34d37c rd982bb  
    1818// ======================================= DEFINES ==========================================
    1919
    20 #define FactorsFile "BondFragmentTE-Factors.dat"
    21 #define ForcesFile "BondFragmentForces-Factors.dat"
    22 #define KeySetsFile "BondFragmentKeySets.dat"
    23 #define FragmentPrefix "BondFragment"
    2420#define EnergySuffix ".energy.all"
    2521#define ForcesSuffix ".forces.all"
  • molecuilder/src/periodentafel.cpp

    r34d37c rd982bb  
    171171  // fill elements DB
    172172  if (filename == NULL)
    173     infile.open("elements.db");
     173    infile.open(STANDARDELEMENTSDB);
    174174  else
    175175    infile.open(filename);
     
    210210
    211211  // fill valence DB per element
    212   infile.open("valence.db");
     212  infile.open(STANDARDVALENCEDB);
    213213  if (infile != NULL) {
    214214    while (!infile.eof()) {
     
    225225
    226226  // fill valence DB per element
    227   infile.open("orbitals.db");
     227  infile.open(STANDARDORBITALDB);
    228228  if (infile != NULL) {
    229229    while (!infile.eof()) {
     
    240240 
    241241  // fill H-BondDistance DB per element
    242   infile.open("Hbonddistance.db");
     242  infile.open(STANDARDHBONDDISTANCEDB);
    243243  if (infile != NULL) {
    244244    while (!infile.eof()) {
     
    258258 
    259259  // fill H-BondAngle DB per element
    260   infile.open("Hbondangle.db");
     260  infile.open(STANDARDHBONDANGLEDB);
    261261  if (infile != NULL) {
    262262    while (!infile.eof()) {
Note: See TracChangeset for help on using the changeset viewer.