| [a0bcf1] | 1 | /** \file parsing.hpp | 
|---|
|  | 2 | * | 
|---|
|  | 3 | * Definitions of various class functions for the parsing of value files. | 
|---|
|  | 4 | * | 
|---|
|  | 5 | */ | 
|---|
|  | 6 |  | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #ifndef PARSING_HPP_ | 
|---|
|  | 9 | #define PARSING_HPP_ | 
|---|
|  | 10 |  | 
|---|
|  | 11 | // ======================================= DEFINES ========================================== | 
|---|
|  | 12 |  | 
|---|
|  | 13 | #define MYEPSILON 1e-13 | 
|---|
|  | 14 | #define FactorsFile "BondFragmentTE-Factors.dat" | 
|---|
|  | 15 | #define ForcesFile "BondFragmentForces-Factors.dat" | 
|---|
|  | 16 | #define KeySetsFile "BondFragmentKeySets.dat" | 
|---|
|  | 17 | #define FragmentPrefix "BondFragment" | 
|---|
|  | 18 | #define EnergySuffix ".energy.all" | 
|---|
|  | 19 | #define ForcesSuffix ".forces.all" | 
|---|
|  | 20 | #define TimeSuffix ".speed" | 
|---|
|  | 21 | #define EnergyFragmentSuffix ".energyfragment.all" | 
|---|
|  | 22 | #define ForceFragmentSuffix ".forcefragment.all" | 
|---|
|  | 23 | #define OrderSuffix ".Order" | 
|---|
|  | 24 |  | 
|---|
|  | 25 | // ======================================= FUNCTIONS ========================================== | 
|---|
|  | 26 |  | 
|---|
|  | 27 | #ifdef HAVE_INLINE | 
|---|
|  | 28 | inline | 
|---|
|  | 29 | #endif | 
|---|
|  | 30 | bool FilePresent(const char *filename); | 
|---|
|  | 31 |  | 
|---|
|  | 32 | #ifdef HAVE_INLINE | 
|---|
|  | 33 | inline | 
|---|
|  | 34 | #endif | 
|---|
|  | 35 | bool TestParams(int argc, char **argv); | 
|---|
|  | 36 |  | 
|---|
|  | 37 | // ======================================= CLASS MatrixContainer ============================= | 
|---|
|  | 38 |  | 
|---|
|  | 39 | class MatrixContainer { | 
|---|
|  | 40 | public: | 
|---|
|  | 41 | double ***Matrix; | 
|---|
|  | 42 | int **Indices; | 
|---|
|  | 43 | char *Header; | 
|---|
|  | 44 | int MatrixCounter; | 
|---|
|  | 45 | int *RowCounter; | 
|---|
|  | 46 | int ColumnCounter; | 
|---|
|  | 47 |  | 
|---|
|  | 48 | MatrixContainer(); | 
|---|
|  | 49 | ~MatrixContainer(); | 
|---|
|  | 50 |  | 
|---|
|  | 51 | bool ParseMatrix(char *name, char *prefix, char *suffix, int skiplines, int skipcolumns); | 
|---|
|  | 52 | bool AllocateMatrix(char *GivenHeader, int MCounter, int *RCounter, int CCounter); | 
|---|
|  | 53 | bool ResetMatrix(); | 
|---|
|  | 54 | bool SetLastMatrix(double value, int skipcolumns); | 
|---|
|  | 55 | bool SetLastMatrix(double **values, int skipcolumns); | 
|---|
|  | 56 | //bool ParseIndices(); | 
|---|
|  | 57 | //bool SumSubValues(); | 
|---|
|  | 58 | bool SumSubManyBodyTerms(class MatrixContainer &Matrix, class KeySetsContainer &KeySet, int Order); | 
|---|
|  | 59 | bool WriteTotalFragments(const char *name, const char *prefix); | 
|---|
|  | 60 | bool WriteLastMatrix(const char *name, const char *prefix, const char *suffix); | 
|---|
|  | 61 | }; | 
|---|
|  | 62 |  | 
|---|
|  | 63 | // ======================================= CLASS EnergyMatrix ============================= | 
|---|
|  | 64 |  | 
|---|
|  | 65 | class EnergyMatrix : public MatrixContainer { | 
|---|
|  | 66 | public: | 
|---|
|  | 67 | bool ParseIndices(); | 
|---|
|  | 68 | bool SumSubEnergy(class EnergyMatrix &Fragments, class KeySetsContainer &KeySet, int Order); | 
|---|
|  | 69 | }; | 
|---|
|  | 70 |  | 
|---|
|  | 71 | // ======================================= CLASS ForceMatrix ============================= | 
|---|
|  | 72 |  | 
|---|
|  | 73 | class ForceMatrix : public MatrixContainer { | 
|---|
|  | 74 | public: | 
|---|
|  | 75 | bool ParseIndices(char *name); | 
|---|
|  | 76 | bool SumSubForces(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, int Order); | 
|---|
|  | 77 | }; | 
|---|
|  | 78 |  | 
|---|
|  | 79 | // ======================================= CLASS KeySetsContainer ============================= | 
|---|
|  | 80 |  | 
|---|
|  | 81 | class KeySetsContainer { | 
|---|
|  | 82 | public: | 
|---|
|  | 83 | int **KeySets; | 
|---|
|  | 84 | int *AtomCounter; | 
|---|
|  | 85 | int FragmentCounter; | 
|---|
|  | 86 | int Order; | 
|---|
|  | 87 | int *FragmentsPerOrder; | 
|---|
|  | 88 | int **OrderSet; | 
|---|
|  | 89 |  | 
|---|
|  | 90 | KeySetsContainer(); | 
|---|
|  | 91 | ~KeySetsContainer(); | 
|---|
|  | 92 |  | 
|---|
|  | 93 | bool ParseKeySets(const char *name, const int *ACounter, const int FCounter); | 
|---|
|  | 94 | bool ParseManyBodyTerms(); | 
|---|
|  | 95 | bool KeySetsContainer::Contains(const int GreaterSet, const int SmallerSet); | 
|---|
|  | 96 | }; | 
|---|
|  | 97 |  | 
|---|
|  | 98 | // ======================================= END ============================================= | 
|---|
|  | 99 |  | 
|---|
|  | 100 | #endif /*PARSING_HPP_*/ | 
|---|