ls1-MarDyn
ls1-MarDyn molecular dynamics code
DummyExpansion.h
1/*
2 * DummyExpansion.h
3 *
4 * Created on: Mar 31, 2016
5 * Author: gallardjm
6 */
7
8#ifndef DUMMYEXPANSION_H_
9#define DUMMYEXPANSION_H_
10#include <math.h>
11#include "bhfmm/fft/FFTAccelerableExpansion.h"
12
13/*
14 * Dummy SH_Expansion used to compute the transfer function from the vector
15 *
16 * Use a DummyStorage (truncated version of SH_Storage)
17 */
18
23public:
24 /* constructors */
25 DummyStorage(unsigned N) :
26 numRows(N), totalNumEntries(N * (N + 1) / 2) {
27 entries = new double[totalNumEntries];
28 }
29
30 /* destructor */
31 ~~DummyStorage() {
32 delete[] entries;
33 }
34
35 inline double & access(unsigned i, unsigned j) {
36 return entries[index(i, j)];
37 }
38 inline const double & access_const(unsigned i, unsigned j) const {
39 return entries[index(i, j)];
40 }
41
42 inline unsigned index(unsigned i, unsigned j) const {
43 return i * (i + 1) / 2 + j;
44 }
45
46private:
48 unsigned numRows;
49 unsigned totalNumEntries;
50
51 double * entries;
52};
53
63public:
64 /* constructors */
65 DummyExpansion(unsigned ord) :
66 FFTAccelerableExpansion(), order(ord), C(ord + 1), S(ord + 1) {
67 }
68
69 /* destructor */
71 }
72
73 // math operators
74 void evaluate_M_at_r(double X, double Y, double Z);
75
76 double & get_C(unsigned l, unsigned m) {
77 return acc_C(l, m);
78 }
79 double & get_S(unsigned l, unsigned m) {
80 return acc_S(l, m);
81 }
82
83private:
84 //direct accessor
85 inline double & acc_C(unsigned l, unsigned m) {
86 return C.access(l, m);
87 }
88 inline double & acc_S(unsigned l, unsigned m) {
89 return S.access(l, m);
90 }
91
92 //const accesssor
93 inline double acc_c_C(unsigned l, unsigned m) const {
94 return C.access_const(l, m);
95 }
96 inline double acc_c_S(unsigned l, unsigned m) const {
97 return S.access_const(l, m);
98 }
99
100 // Fields:
101 unsigned order;
102
103 DummyStorage C; // C-terms: real part
104 DummyStorage S; // S-terms: imaginary or (-imaginary) part, see 13.4.8
105};
106
107#endif
Definition: DummyExpansion.h:62
double & get_S(unsigned l, unsigned m)
Definition: DummyExpansion.h:79
double & get_C(unsigned l, unsigned m)
Definition: DummyExpansion.h:76
Definition: DummyExpansion.h:22
Definition: FFTAccelerableExpansion.h:21
FFTAccelerableExpansion()
Constructor, set the storage pointer to NULL by default.
Definition: FFTAccelerableExpansion.h:26