tarrays.h - granular - granular dynamics simulation (HTM) git clone git://src.adamsgaard.dk/granular (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- tarrays.h (1881B) --- 1 #ifndef ARRAYS_ 2 #define ARRAYS_ 3 4 #include <stdio.h> 5 6 unsigned int idx3( 7 const unsigned int i, const unsigned int j, const unsigned int k, 8 const unsigned int nx, const unsigned int ny); 9 10 unsigned int idx3g( 11 const unsigned int i, const unsigned int j, const unsigned int k, 12 const unsigned int nx, const unsigned int ny); 13 14 unsigned int idx2( 15 const unsigned int i, const unsigned int j, const unsigned int nx); 16 17 unsigned int idx2g( 18 const unsigned int i, const unsigned int j, const unsigned int nx); 19 20 unsigned int idx1g(const unsigned int i); 21 22 double * spacing(const double *x, const int n); 23 double * linspace(const double lower, const double upper, const int n); 24 double * zeros(const int n); 25 double * ones(const int n); 26 double * initval(const double value, const int n); 27 double * empty(const int n); 28 29 double max(const double *a, const int n); 30 double min(const double *a, const int n); 31 32 void print_array(const double *a, const int n); 33 void print_arrays(const double *a, const double *b, const int n); 34 void print_arrays_2nd_normalized(const double *a, const double *b, const int n); 35 void print_three_arrays( 36 const double *a, 37 const double *b, 38 const double *c, 39 const int n); 40 41 void fprint_arrays(FILE *fp, const double *a, const double *b, const int n); 42 43 void fprint_three_arrays( 44 FILE *fp, 45 const double *a, 46 const double *b, 47 const double *c, 48 const int n); 49 50 void copy_values(const double *in, double *out, const int n); 51 double * copy(const double *in, const int n); 52 double * normalize(const double *in, const int n); 53 54 double euclidean_norm(const double *a, const int n); 55 double euclidean_distance(const double *a, const double *b, const int n); 56 double dot(const double *a, const double *b, const int n); 57 double * cross(const double a[3], const double b[3]); 58 59 #endif