-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpectralModifier.hpp
46 lines (38 loc) · 1.45 KB
/
SpectralModifier.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Credits to Yoann L. Launay, adapted from HACC/SWFFT or amrex-tutorials
#ifndef SPECTRALMODIFIER_HPP
#define SPECTRALMODIFIER_HPP
#include <AMReX_IntVect.H>
#include <AMReX_MultiFab.H>
#include <AMReX_MultiFabUtil.H>
// These are for SWFFT
#include <Distribution.H>
#include <AlignedAllocator.h>
#include <Dfft.H>
using namespace amrex;
class SpectralModifier
{
public:
inline SpectralModifier (MultiFab& input,
Geometry& geom,
int verbose);
inline SpectralModifier ();
inline void remap();
inline MultiFab apply_func (double (*amp_func)(double));
inline void apply_array ();
inline void FillInputWithRandomNoise(std::mt19937 gen);
private:
// pointers are sometimes useful because they can be initialized as nullptr
MultiFab* input;
Geometry geom;
int verbose = 2;
const BoxArray* ba;
DistributionMapping dmap;
IntVect n_box_dim; // n for each subbox (assumed the same everywhere) for each dim // SIZE OF EACH SUBGRID (one per rank). ba[0] gives the first subbox. Same nx,ny,nz on all ranks // size of BoxArray = number of subboxes
Box domain;
IntVect numb_boxes_dim; // number of subboxes per direction //length of Box object = associated nx/ny/nz
int numb_boxes; // total number of subboxes
Vector<int> rank_mapping; // to be passed from amrex rank mapping to dfft's
Real h;
};
#include "SpectralModifier.impl.hpp"
#endif /* SPECTRALMODIFIER_HPP */