5#include <boost/multi_array.hpp>
6#include <boost/array.hpp>
7#include "CustomLibraries/np.hpp"
8#include "CustomLibraries/np_to_matplot.hpp"
9#include "CustomLibraries/wavePlotter.hpp"
10#include <matplot/matplot.h>
15#include "CoreAlgorithm/helper_func.hpp"
16#include "CoreAlgorithm/coeff.hpp"
17#include "CoreAlgorithm/source.hpp"
18#include "CoreAlgorithm/computational.hpp"
19#include "CoreAlgorithm/solver.hpp"
21std::string format_num(
int num,
int length = 8)
23 std::string str_num = std::to_string(num);
25 int str_length = str_num.length();
26 for (
int i = 0; i < length - str_length; i++)
27 str_num =
"0" + str_num;
43 double xmax = nx * dx;
45 double zmax = nz * dz;
47 double tmax = nt * dt;
53 boost::multi_array<double, 3> f =
waveSimCore::ricker(50, 50, f_M, amp, shift, tmin, tmax, nt, nx, nz);
61 std::cout <<
"min_u = " << min_u <<
" max_u = " << max_u <<
"\n";
62 std::vector<double> levels = matplot::linspace(min_u, max_u, num_levels);
63 std::cout << u[20][10][10] <<
"\n";
77 boost::multi_array<double, 1> x =
np::linspace(xmin, xmax, nx);
78 boost::multi_array<double, 1> z =
np::linspace(zmin, zmax, nz);
79 const boost::multi_array<double, 1> axis[2] = {x, z};
80 std::vector<boost::multi_array<double, 2>> XcZ =
np::meshgrid(axis,
false, np::xy);
89 my_plotter.animate(
"output-test.mp4", 20, nt - 1, 30);
This class is used to plot the wave field TODO: make it multithreaded.
matplot::vector_2d convert_to_matplot(const boost::multi_array< double, 2 > &arr)
Convert a 2D boost::multi_array to a matplot::vector_2d.
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.
boost::multi_array< double, 2 > get_profile(double xmin, double xmax, double zmin, double zmax, int nx, int nz, double r)
Get the velocity profile of the model as a 2D Array.
boost::multi_array< double, 3 > wave_solver(boost::multi_array< double, 2 > c, double dt, double dx, double dz, int nt, int nx, int nz, boost::multi_array< double, 3 > f)
::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)
boost::multi_array< double, 1 > linspace(double start, double stop, long unsigned int num)
Implements the numpy linspace function.
::value constexpr T min(boost::multi_array< T, ND > const &input_array)
Implements the numpy min function for an n-dimensionl multi array.
::value constexpr T max(boost::multi_array< T, ND > const &input_array)
Implements the numpy max function for an n-dimensionl multi array.