ParMooN
 All Classes Functions Variables Friends Pages
breakage.h
1 #ifndef MPIMIS_BREAKAGE
2 #define MPIMIS_BREAKAGE
3 
4 #include "basictools.h"
5 #include "constants.h"
6 #include "equationsolver.h"
7 //#include "newton.h"
8 #include "timer.h"
9 
10 typedef class Breakage breakage;
11 typedef breakage* pbreakage;
12 
13 class Breakage {
14 public:
15  // Constructor for uniform grid
16  Breakage(double _xmin, double _xmax, int _na, int _nx, int _ny, int _nz) {
17  xmin = pow(_xmin, 3), xmax = pow(_xmax, 3), na = _na, nx = _nx, ny = _ny, nz = _nz;
18  a = allocate_vector(na); g = allocate_vector(na); lg = (int*)malloc((na + 1) * sizeof(int));
19  freq_integral_coeff = allocate_vector(na); plus_integral_coeff = allocate_vector(na);
20  a = allocate_vector(na); fill_uniform_grid(xmin, xmax, na, a); transform_grid_m2l(xmin, xmax, na, a);
21  fill_freq_integral_coeff(); };
22 
23  ~Breakage() { free_vector(a);
24  free_vector(freq_integral_coeff); free_vector(plus_integral_coeff); free_vector(g); free((void*)lg); };
25 
26 private:
27  double xmin;
28  double xmax;
29  double* a; int na;
30  int* lg; double* g;
31  double* freq_integral_coeff;
32  double* plus_integral_coeff;
33 
34  int nx, ny, nz;
35 
36 private:
37  // Plus and minus parts with respect to one single spatial point
38  // sizoef(input / output) = na, sizeof(data = velocity) = 3
39  void breakage_plus(double* input, double* output, double* data);
40  void breakage_minus(double* input, double* output);
41 
42  int is_on_boundary(int ir, double* vr);
43 
44  double get_value_at_x(double* fi, double x);
45 
46  void fill_freq_integral_coeff();
47 
48  int solvequarticequation(double* roots, int& cRealRoots, double C_r, double cube_x);
49 
50 // double lower_bound_g(double& x, double& CE);
51  void fill_g(double& CE);
52  void fill_lg(double& CE);
53  void fill_plus_integral_coeff();
54  double definite_integral(double& fa, double& fb, double& a, double& b, double c, double& x1, double& x2);
55  double frequency(double* input);
56 
57 public:
58  // Breakage operator with the whole input and output
59  // sizoef(input / output) = nx * ny * nz * na
60  // sizeof(data = velocity) = 3 * nx * ny * nz
61  void apply_breakage(double* input, double* output, double* v);
62 };
63 
64 #endif // MPIMIS_BREAKAGE
Definition: breakage.h:13