1 /* Copyright (C) 2003-2007 CAMP 2 * Copyright (C) 2007-2008 CAMd 3 * Copyright (C) 2005 CSC - IT Center for Science Ltd. 4 * Please see the accompanying LICENSE file for further information. */ 5 6 #ifndef DOUBLECOMPLEXDEFINED 7 # define DOUBLECOMPLEXDEFINED 1 8 # include <complex.h> 9 typedef double complex double_complex; 10 #endif 11 12 #undef T 13 #undef Z 14 #ifndef BMGSCOMPLEX 15 # define T double 16 # define Z(f) f 17 #else 18 # define T double_complex 19 # define Z(f) f ## z 20 #endif 21 22 #ifndef BMGS_H 23 #define BMGS_H 24 25 typedef int bool; 26 #define true 1 27 #define false 0 28 29 typedef struct 30 { 31 int ncoefs; 32 double* coefs; 33 long* offsets; 34 long n[3]; 35 long j[3]; 36 } bmgsstencil; 37 38 typedef struct 39 { 40 int l; 41 double dr; 42 int nbins; 43 double* data; 44 } bmgsspline; 45 46 bmgsstencil bmgs_stencil(int ncoefs, const double* coefs, const long* offsets, 47 int range, const long size[3]); 48 bmgsstencil bmgs_laplace(int k, double scale, const double h[3], const long n[3]); 49 bmgsstencil bmgs_mslaplaceA(double scale, 50 const double h[3], 51 const long n[3]); 52 bmgsstencil bmgs_mslaplaceB(const long n[3]); 53 bmgsstencil bmgs_gradient(int k, int i, double h, 54 const long n[3]); 55 void bmgs_deletestencil(bmgsstencil* spline); 56 bmgsspline bmgs_spline(int l, double dr, int nbins, double* f); 57 double bmgs_splinevalue(const bmgsspline* spline, double r); 58 void bmgs_get_value_and_derivative(const bmgsspline* spline, double r, 59 double *f, double *dfdr); 60 void bmgs_deletespline(bmgsspline* spline); 61 void bmgs_radial1(const bmgsspline* spline, 62 const int n[3], const double C[3], 63 const double h[3], 64 int* b, double* d); 65 void bmgs_radial2(const bmgsspline* spline, const int n[3], 66 const int* b, const double* d, 67 double* f, double* g); 68 void bmgs_radial3(const bmgsspline* spline, int m, 69 const int n[3], 70 const double C[3], 71 const double h[3], 72 const double* f, double* a); 73 void bmgs_radiald3(const bmgsspline* spline, int m, int c, 74 const int n[3], 75 const double C[3], 76 const double h[3], 77 const double* f, const double* g, double* a); 78 void bmgs_fd(const bmgsstencil* s, const double* a, double* b); 79 void bmgs_wfd(int nweights, const bmgsstencil* stencils, const double** weights, const double* a, double* b); 80 void bmgs_relax(const int relax_method, const bmgsstencil* s, double* a, double* b, 81 const double* src, const double w); 82 void bmgs_wrelax(const int relax_method, const int nweights, const bmgsstencil* stencils, const double** weights, double* a, double* b, 83 const double* src, const double w); 84 void bmgs_cut(const double* a, const int n[3], const int c[3], 85 double* b, const int m[3]); 86 void bmgs_zero(double* a, const int n[3], const int c[3], 87 const int s[3]); 88 void bmgs_paste(const double* a, const int n[3], 89 double* b, const int m[3], const int c[3]); 90 void bmgs_pastep(const double* a, const int n[3], 91 double* b, const int m[3], const int c[3]); 92 void bmgs_rotate(const double* a, const int size[3], double* b, double angle, 93 int d, long c, double*, long*, long*, double*, long*, long*, 94 int exact); 95 void bmgs_translate(double* a, const int sizea[3], const int size[3], 96 const int start1[3], const int start2[3]); 97 void bmgs_restrict(int k, double* a, const int n[3], double* b, double* w); 98 void bmgs_interpolate(int k, int skip[3][2], 99 const double* a, const int n[3], 100 double* b, double* w); 101 // complex routines: 102 void bmgs_fdz(const bmgsstencil* s, const double_complex* a, 103 double_complex* b); 104 void bmgs_wfdz(int nweights, const bmgsstencil* stencils, const double** weights, const double_complex* a, double_complex* b); 105 void bmgs_cutz(const double_complex* a, const int n[3], 106 const int c[3], 107 double_complex* b, const int m[3]); 108 void bmgs_cutmz(const double_complex* a, const int n[3], 109 const int c[3], 110 double_complex* b, const int m[3], double_complex phase); 111 void bmgs_zeroz(double_complex* a, const int n[3], 112 const int c[3], 113 const int s[3]); 114 void bmgs_pastez(const double_complex* a, const int n[3], 115 double_complex* b, const int m[3], 116 const int c[3]); 117 void bmgs_pastepz(const double_complex* a, const int n[3], 118 double_complex* b, const int m[3], 119 const int c[3]); 120 void bmgs_rotatez(const double_complex* a, const int size[3], 121 double_complex* b, double angle, int d, 122 long c, double*, long*, long*, double*, long*, long*, 123 int exact); 124 void bmgs_translatemz(double_complex* a, const int sizea[3], const int size[3], 125 const int start1[3], const int start2[3], 126 double_complex phase); 127 void bmgs_restrictz(int k, double_complex* a, 128 const int n[3], double_complex* b, double_complex* w); 129 void bmgs_interpolatez(int k, int skip[3][2], 130 const double_complex* a, const int n[3], 131 double_complex* b, double_complex* w); 132 133 #endif 134