Changes in src/helpers.hpp [5034e1:99593f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/helpers.hpp
-
Property mode
changed from
100755
to100644
r5034e1 r99593f 18 18 #include <fstream> 19 19 20 #include "defs.hpp" 20 21 #include "memoryallocator.hpp" 22 23 /********************************************** definitions *********************************/ 24 25 // some algebraic matrix stuff 26 double RDET3(const double a[NDIM*NDIM]); 27 double RDET2(const double a[4]); 28 double RDET2(const double a0, const double a1, const double a2, const double a3); 21 29 22 30 /********************************************** helpful functions *********************************/ … … 44 52 bool check_bounds(double *x, double *cell_size); 45 53 void bound(double *b, double lower_bound, double upper_bound); 46 void flip(double *x, double *y);47 54 int pot(int base, int n); 48 55 int CountLinesinFile(ifstream &InputFile); … … 50 57 bool IsValidNumber( const char *string); 51 58 int CompareDoubles (const void * a, const void * b); 52 double * ReturnFullMatrixforSymmetric(double *cell_size); 53 static void performCriticalExit(); 59 double * ReturnFullMatrixforSymmetric(const double * const cell_size); 60 double * InverseMatrix(const double * const A); 61 void performCriticalExit(); 54 62 55 63 /********************************************** helpful template functions *********************************/ 64 65 /** Flips two values. 66 * \param x first value 67 * \param y second value 68 */ 69 template <typename T> void flip(T &x, T &y) 70 { 71 T tmp; 72 tmp = x; 73 x = y; 74 y = tmp; 75 }; 56 76 57 77 /** Creates a lookup table for true father's Atom::Nr -> atom ptr. … … 60 80 * \paran *end end of chain list 61 81 * \param **Lookuptable pointer to return allocated lookup table (should be NULL on start) 62 * \param count optional predetermined countfor table (otherwise we set the count to highest true father id)82 * \param count optional predetermined size for table (otherwise we set the count to highest true father id) 63 83 * \return true - success, false - failure 64 84 */ … … 87 107 } 88 108 89 // allocat and fill90 LookupTable = Malloc<T*>(count, "CreateFatherLookupTable - **LookupTable");109 // allocate and fill 110 LookupTable = Calloc<T*>(count, "CreateFatherLookupTable - **LookupTable"); 91 111 if (LookupTable == NULL) { 92 112 cerr << "LookupTable memory allocation failed!" << endl; 93 113 status = false; 94 114 } else { 95 for (int i=0;i<count;i++)96 LookupTable[i] = NULL;97 115 Walker = start; 98 116 while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.