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 | using namespace std;
|
---|
12 |
|
---|
13 | // include config.h
|
---|
14 | #ifdef HAVE_CONFIG_H
|
---|
15 | #include <config.h>
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | // ======================================= DEFINES ==========================================
|
---|
19 |
|
---|
20 | #define EnergySuffix ".energy.all"
|
---|
21 | #define ForcesSuffix ".forces.all"
|
---|
22 | #define ShieldingSuffix ".sigma_all.csv"
|
---|
23 | #define ShieldingPASSuffix ".sigma_all_PAS.csv"
|
---|
24 | #define ShieldingFragmentSuffix ".sigma_all_fragment.all"
|
---|
25 | #define ShieldingPASFragmentSuffix ".sigma_all_PAS_fragment.all"
|
---|
26 | #define TimeSuffix ".speed"
|
---|
27 | #define EnergyFragmentSuffix ".energyfragment.all"
|
---|
28 | #define ForceFragmentSuffix ".forcefragment.all"
|
---|
29 | #define OrderSuffix ".Order"
|
---|
30 |
|
---|
31 | // ======================================= FUNCTIONS ==========================================
|
---|
32 |
|
---|
33 | bool FilePresent(const char *filename, bool test);
|
---|
34 | bool TestParams(int argc, char **argv);
|
---|
35 |
|
---|
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, string 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 Contains(const int GreaterSet, const int SmallerSet);
|
---|
96 | };
|
---|
97 |
|
---|
98 | // ======================================= END =============================================
|
---|
99 |
|
---|
100 | #endif /*PARSING_HPP_*/
|
---|