Changes in src/helpers.hpp [a67d19:920c70]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/helpers.hpp
ra67d19 r920c70 24 24 /********************************************** definitions *********************************/ 25 25 26 // some algebraic matrix stuff27 double RDET3(const double a[NDIM*NDIM]);28 double RDET2(const double a[4]);29 double RDET2(const double a0, const double a1, const double a2, const double a3);30 31 26 /********************************************** helpful functions *********************************/ 32 27 … … 53 48 bool check_bounds(double *x, double *cell_size); 54 49 void bound(double *b, double lower_bound, double upper_bound); 55 int pot(int base, int n);56 50 int CountLinesinFile(ifstream &InputFile); 57 51 char *FixedDigitNumber(const int FragmentNumber, const int digits); … … 64 58 /********************************************** helpful template functions *********************************/ 65 59 66 /** Flips two values.67 * \param x first value68 * \param y second value69 */70 template <typename T> void flip(T &x, T &y)71 {72 T tmp;73 tmp = x;74 x = y;75 y = tmp;76 };77 60 78 61 /** returns greater of the two values. … … 132 115 133 116 // allocate and fill 134 LookupTable = Calloc<T*>(count, "CreateFatherLookupTable - **LookupTable");117 LookupTable = new T*[count]; 135 118 if (LookupTable == NULL) { 136 119 DoeLog(0) && (eLog()<< Verbose(0) << "LookupTable memory allocation failed!" << endl); … … 187 170 }; 188 171 172 #define PLURAL_S(v) (((v)==1)?"":"s") 189 173 174 // this is to allow different modes of access for 175 // maps and sets 176 template<typename Res,typename T> 177 struct _take{ 178 Res get(T value) const; 179 }; 180 181 // if we have a set,vector etc we can directly access the result 182 template<typename Res> 183 struct _take<Res,Res>{ 184 static inline Res get(Res value){ 185 return value; 186 } 187 }; 188 189 // if we have a map we have to access the second part of 190 // the pair 191 template<typename Res,typename T1> 192 struct _take<Res,std::pair<T1,Res> >{ 193 static inline Res get(std::pair<T1,Res> value){ 194 return value.second; 195 } 196 }; 190 197 191 198 #endif /*HELPERS_HPP_*/
Note:
See TracChangeset
for help on using the changeset viewer.