Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/helpers.hpp

    • Property mode changed from 100755 to 100644
    r5034e1 r99593f  
    1818#include <fstream>
    1919
     20#include "defs.hpp"
    2021#include "memoryallocator.hpp"
     22
     23/********************************************** definitions *********************************/
     24
     25// some algebraic matrix stuff
     26double RDET3(const double a[NDIM*NDIM]);
     27double RDET2(const double a[4]);
     28double RDET2(const double a0, const double a1, const double a2, const double a3);
    2129
    2230/********************************************** helpful functions *********************************/
     
    4452bool check_bounds(double *x, double *cell_size);
    4553void bound(double *b, double lower_bound, double upper_bound);
    46 void flip(double *x, double *y);
    4754int pot(int base, int n);
    4855int CountLinesinFile(ifstream &InputFile);
     
    5057bool IsValidNumber( const char *string);
    5158int CompareDoubles (const void * a, const void * b);
    52 double * ReturnFullMatrixforSymmetric(double *cell_size);
    53 static void performCriticalExit();
     59double * ReturnFullMatrixforSymmetric(const double * const cell_size);
     60double * InverseMatrix(const double * const A);
     61void performCriticalExit();
    5462
    5563/********************************************** helpful template functions *********************************/
     64
     65/** Flips two values.
     66 * \param x first value
     67 * \param y second value
     68 */
     69template <typename T> void flip(T &x, T &y)
     70{
     71  T tmp;
     72  tmp = x;
     73  x = y;
     74  y = tmp;
     75};
    5676
    5777/** Creates a lookup table for true father's Atom::Nr -> atom ptr.
     
    6080 * \paran *end end of chain list
    6181 * \param **Lookuptable pointer to return allocated lookup table (should be NULL on start)
    62  * \param count optional predetermined count for 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)
    6383 * \return true - success, false - failure
    6484 */
     
    87107  }
    88108
    89   // allocat and fill
    90   LookupTable = Malloc<T*>(count, "CreateFatherLookupTable - **LookupTable");
     109  // allocate and fill
     110  LookupTable = Calloc<T*>(count, "CreateFatherLookupTable - **LookupTable");
    91111  if (LookupTable == NULL) {
    92112    cerr << "LookupTable memory allocation failed!" << endl;
    93113    status = false;
    94114  } else {
    95     for (int i=0;i<count;i++)
    96       LookupTable[i] = NULL;
    97115    Walker = start;
    98116    while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
Note: See TracChangeset for help on using the changeset viewer.