Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/parser.hpp

    rf66195 r042f82  
    1 /** \file parser.hpp
     1/** \file parsing.hpp
    22 *
    33 * Definitions of various class functions for the parsing of value files.
     
    66
    77
    8 #ifndef PARSER_HPP_
    9 #define PARSER_HPP_
     8#ifndef PARSING_HPP_
     9#define PARSING_HPP_
    1010
    1111using namespace std;
    12 
    13 /*********************************************** includes ***********************************/
    1412
    1513// include config.h
     
    1816#endif
    1917
    20 /****************************************** forward declarations *****************************/
    21 
    22 class EnergyMatrix;
    23 class ForceMatrix;
    24 class HessianMatrix;
    25 class KeySetsContainer;
    26 class MatrixContainer;
    27 
    28 /********************************************** definitions *********************************/
     18// ======================================= DEFINES ==========================================
    2919
    3020#define EnergySuffix ".energy.all"
    31 #define EnergyFragmentSuffix ".energyfragment.all"
     21#define HcorrectionSuffix ".Hcorrection.all"
    3222#define ForcesSuffix ".forces.all"
    33 #define ForceFragmentSuffix ".forcefragment.all"
    34 #define HcorrectionSuffix ".Hcorrection.all"
    35 #define HcorrectionFragmentSuffix ".Hcorrectionfragment.all"
    36 #define HessianSuffix ".hessian_xx.all"
    37 #define HessianFragmentSuffix ".hessianfragment_xx.all"
    38 #define OrderSuffix ".Order"
    3923#define ShieldingSuffix ".sigma_all.csv"
    4024#define ShieldingPASSuffix ".sigma_all_PAS.csv"
    4125#define ShieldingFragmentSuffix ".sigma_all_fragment.all"
    4226#define ShieldingPASFragmentSuffix ".sigma_all_PAS_fragment.all"
    43 #define ChiSuffix ".chi_all.csv"
    44 #define ChiPASSuffix ".chi_all_PAS.csv"
    45 #define ChiFragmentSuffix ".chi_all_fragment.all"
    46 #define ChiPASFragmentSuffix ".chi_all_PAS_fragment.all"
    4727#define TimeSuffix ".speed"
     28#define EnergyFragmentSuffix ".energyfragment.all"
     29#define HcorrectionFragmentSuffix ".Hcorrectionfragment.all"
     30#define ForceFragmentSuffix ".forcefragment.all"
     31#define OrderSuffix ".Order"
    4832
    4933// ======================================= FUNCTIONS ==========================================
     
    5135bool FilePresent(const char *filename, bool test);
    5236bool TestParams(int argc, char **argv);
     37
     38
     39// ======================================= CLASS MatrixContainer =============================
     40
     41class MatrixContainer {
     42  public:
     43    double ***Matrix;
     44    int **Indices;
     45    char *Header;
     46    int MatrixCounter;
     47    int *RowCounter;
     48    int ColumnCounter;
     49
     50  MatrixContainer();
     51  virtual ~MatrixContainer();
     52
     53  bool ParseMatrix(const char *name, int skiplines, int skipcolumns, int MatrixNr);
     54  virtual bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
     55  bool AllocateMatrix(const char *GivenHeader, int MCounter, int *RCounter, int CCounter);
     56  bool ResetMatrix();
     57  double FindMinValue();
     58  double FindMaxValue();
     59  bool SetLastMatrix(double value, int skipcolumns);
     60  bool SetLastMatrix(double **values, int skipcolumns);
     61  //bool ParseIndices();
     62  //bool SumSubValues();
     63  bool SumSubManyBodyTerms(class MatrixContainer &Matrix, class KeySetsContainer &KeySet, int Order);
     64  bool WriteTotalFragments(const char *name, const char *prefix);
     65  bool WriteLastMatrix(const char *name, const char *prefix, const char *suffix);
     66};
     67
     68// ======================================= CLASS EnergyMatrix =============================
     69
     70class EnergyMatrix : public MatrixContainer {
     71  public:
     72    bool ParseIndices();
     73    bool SumSubEnergy(class EnergyMatrix &Fragments, class EnergyMatrix *CorrectionFragments, class KeySetsContainer &KeySet, int Order, double sign);
     74    bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
     75};
     76
     77// ======================================= CLASS ForceMatrix =============================
     78
     79class ForceMatrix : public MatrixContainer {
     80  public:
     81    bool ParseIndices(const char *name);
     82    bool SumSubForces(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, int Order, double sign);
     83    bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
     84};
    5385
    5486// ======================================= CLASS KeySetsContainer =============================
     
    71103};
    72104
    73 // ======================================= CLASS MatrixContainer =============================
    74 
    75 class MatrixContainer {
    76   public:
    77     double ***Matrix;
    78     int **Indices;
    79     char **Header;
    80     int MatrixCounter;
    81     int *RowCounter;
    82     int *ColumnCounter;
    83  
    84   MatrixContainer();
    85   virtual ~MatrixContainer();
    86  
    87   bool InitialiseIndices(class MatrixContainer *Matrix = NULL);
    88   bool ParseMatrix(const char *name, int skiplines, int skipcolumns, int MatrixNr);
    89   virtual bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
    90   bool AllocateMatrix(char **GivenHeader, int MCounter, int *RCounter, int *CCounter);
    91   bool ResetMatrix();
    92   double FindMinValue();
    93   double FindMaxValue();
    94   bool SetLastMatrix(double value, int skipcolumns);
    95   bool SetLastMatrix(double **values, int skipcolumns);
    96   //bool ParseIndices();
    97   //bool SumSubValues();
    98   bool SumSubManyBodyTerms(class MatrixContainer &Matrix, class KeySetsContainer &KeySets, int Order);
    99   bool WriteTotalFragments(const char *name, const char *prefix);
    100   bool WriteLastMatrix(const char *name, const char *prefix, const char *suffix);
    101 };
    102 
    103 // ======================================= CLASS EnergyMatrix =============================
    104 
    105 class EnergyMatrix : public MatrixContainer {
    106   public:
    107     bool ParseIndices();
    108     bool SumSubEnergy(class EnergyMatrix &Fragments, class EnergyMatrix *CorrectionFragments, class KeySetsContainer &KeySets, int Order, double sign);
    109     bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
    110 };
    111 
    112 // ======================================= CLASS ForceMatrix =============================
    113 
    114 class ForceMatrix : public MatrixContainer {
    115   public:
    116     bool ParseIndices(const char *name);
    117     bool SumSubForces(class ForceMatrix &Fragments, class KeySetsContainer &KeySets, int Order, double sign);
    118     bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
    119 };
    120 
    121 // ======================================= CLASS HessianMatrix =============================
    122 
    123 class HessianMatrix : public MatrixContainer {
    124   public:
    125     HessianMatrix();
    126     //~HessianMatrix();
    127     bool ParseIndices(char *name);
    128     bool SumSubManyBodyTerms(class MatrixContainer &MatrixValues, class KeySetsContainer &KeySets, int Order);
    129     bool SumSubHessians(class HessianMatrix &Fragments, class KeySetsContainer &KeySets, int Order, double sign);
    130     bool ParseFragmentMatrix(const char *name, const char *prefix, string suffix, int skiplines, int skipcolumns);
    131   private:
    132     bool IsSymmetric;
    133 };
    134 
    135 
    136105// ======================================= END =============================================
    137106
    138 #endif /*PARSER_HPP_*/
     107#endif /*PARSING_HPP_*/
Note: See TracChangeset for help on using the changeset viewer.