5#ifndef WAVESIMC_SOURCE_HPP
6#define WAVESIMC_SOURCE_HPP
14 boost::multi_array<double, 3>
ricker(
int i_s,
int j_s,
double f,
double amp,
double shift,
15 double tmin,
double tmax,
int nt,
int nx,
int nz)
17 const double pi = 3.141592654;
19 boost::multi_array<double, 1> t =
np::linspace(tmin, tmax, nt);
20 boost::multi_array<double, 1> pft2 =
np::pow(pi * f * (t - shift), 2.0);
21 boost::multi_array<double, 1> r = amp * (1.0 - 2.0 * pft2) *
np::exp(-1.0 * pft2);
23 int dimensions_x[] = {nx};
24 boost::multi_array<double, 1> x = np::zeros<double>(dimensions_x);
26 int dimensions_z[] = {nz};
27 boost::multi_array<double, 1> z = np::zeros<double>(dimensions_z);
32 const boost::multi_array<double, 1> axis[3] = {r, x, z};
33 std::vector<boost::multi_array<double, 3>> RXZ =
np::meshgrid(axis,
false, np::ij);
34 boost::multi_array<double, 3> source = RXZ[0] * RXZ[1] * RXZ[2];
boost::multi_array< double, 3 > ricker(int i_s, int j_s, double f, double amp, double shift, double tmin, double tmax, int nt, int nx, int nz)
Get the Ricker wavelet as a 3D Array.
::value constexpr boost::multi_array< T, ND > pow(const boost::multi_array< T, ND > &input_array, const T exponent)
Implements the numpy pow function on multi arrays.
::value constexpr std::vector< boost::multi_array< T, ND > > meshgrid(const boost::multi_array< T, 1 >(&cinput)[ND], bool sparsing=false, indexing indexing_type=xy)
::value constexpr boost::multi_array< T, ND > exp(const boost::multi_array< T, ND > &input_array)
Implements the numpy exp function on multi arrays.
boost::multi_array< double, 1 > linspace(double start, double stop, long unsigned int num)
Implements the numpy linspace function.