Commit dc782dc8 authored by Jan Oliver Oelerich's avatar Jan Oliver Oelerich

UNFINISHED. steps towards split array storage in Wave.hpp

parent af1c8fe8
......@@ -182,9 +182,11 @@ void GridManager::generateGrids() {
for(unsigned int ix = 0; ix < samplingX(); ix++) {
for(unsigned int iy = 0; iy < samplingY(); iy++) {
if(pow(kx(ix), 2) + pow(ky(iy), 2) > pow(1.0 / (3.0 * max(1./scaleX(), 1./scaleY())), 2)) {
_bandwidth_limit_mask(ix, iy) = 0.0;
_bandwidth_limit_mask.real(ix, iy) = 0.0;
_bandwidth_limit_mask.imag(ix, iy) = 0.0;
} else {
_bandwidth_limit_mask(ix, iy) = 1.0;
_bandwidth_limit_mask.real(ix, iy) = 1.0;
_bandwidth_limit_mask.imag(ix, iy) = 0.0;
}
}
}
......
......@@ -1139,8 +1139,8 @@ void IO::dumpWave(string filename, const Wave &wave) {
"%d %d %f %f %f\n",
ix,
iy,
wave(ix, iy).real(),
wave(ix, iy).imag(),
sqrt(pow(wave(ix, iy).real(), 2) + pow(wave(ix, iy).imag(), 2)));
wave.real(ix, iy),
wave.imag(ix, iy),
sqrt(pow(wave.real(ix, iy), 2) + pow(wave.imag(ix, iy), 2)));
fclose(f);
}
......@@ -364,7 +364,7 @@ void Simulation::calculatePixel(ScanPoint &point, const double defocus) {
if(ind >= 0 && ind < (int)_gridman->adfDetectorGrid().size()) {
// check for not a number
auto intens = (float) pow(abs(wave(ix, iy)), 2);
auto intens = (float) pow(wave.abs(ix, iy), 2);
if(!::isnan(intens))
detector_intensities[ind] += intens;
}
......@@ -399,7 +399,7 @@ void Simulation::calculatePixel(ScanPoint &point, const double defocus) {
if(j > bandwidth_ly / 2)
jj = wave.ly() - bandwidth_ly + j;
intensity = pow(abs(wave(ii, jj)), 2);
intensity = pow(wave.abs(ii, jj), 2);
total_intensity += intensity;
tmp_intensities.push_back(intensity);
}
......@@ -757,9 +757,12 @@ void Simulation::generatePropagator() {
for(unsigned int ix = 0; ix < lx; ix++) {
for(unsigned int iy = 0; iy < ly; iy++) {
if(!p.bandwidthLimiting() || pow(_gridman->kx(ix), 2) + pow(_gridman->ky(iy), 2) < sdense2) {
_propagator(ix, iy) = polar(1.0, scale * (float) (pow(_gridman->kx(ix), 2) + pow(_gridman->ky(iy), 2)));
auto prop = polar(1.0, scale * (float) (pow(_gridman->kx(ix), 2) + pow(_gridman->ky(iy), 2)));
_propagator.real(ix, iy) = (float)prop.real();
_propagator.imag(ix, iy) = (float)prop.real();
} else {
_propagator(ix, iy) = 0.0;
_propagator.real(ix, iy) = 0.0;
_propagator.imag(ix, iy) = 0.0;
}
}
}
......@@ -799,7 +802,8 @@ void Simulation::makeProbe(Wave &wave, const double defocus, double px, double p
if(alpha_sq <= pow(p.probeMinAperture() / 1000., 2) || alpha_sq >= pow(p.probeMaxAperture() / 1000., 2)) {
// set wave to zero here.
wave(x, y) = std::polar(0.0, 1.0);
wave.real(x, y) = 0.0;
wave.imag(x, y) = 0.0;
} else {
chi_defocus = -pref * defocus * alpha_sq;
chi_astigmatism = pref *
......@@ -810,7 +814,9 @@ void Simulation::makeProbe(Wave &wave, const double defocus, double px, double p
chi_c5 = pref / 3 * p.probeC5() * (double) pow(alpha_sq, 3);
w = 2.0 * Params::pi * (px * kx + py * ky);
wave(x, y) = std::polar(1.0, w + chi_defocus - chi_astigmatism - chi_cs - chi_c5);
auto v = std::polar(1.0, w + chi_defocus - chi_astigmatism - chi_cs - chi_c5);
wave.real(x, y) = (float)v.real();
wave.imag(x, y) = (float)v.imag();
}
}
}
......
......@@ -118,7 +118,9 @@ void Slice::calculateTransmissionFunction(const shared_ptr<FPConfManager> &fpman
// finish calculation
for(unsigned int current_x = 0; current_x < samples_x; ++current_x) {
for(unsigned int current_y = 0; current_y < samples_y; ++current_y) {
_transmission_function(current_x, current_y) = polar(1.0, sigma * vz[current_x][current_y]);
auto v = polar(1.0, sigma * vz[current_x][current_y]);
_transmission_function.real(current_x, current_y) = (float)v.real();
_transmission_function.imag(current_x, current_y) = (float)v.imag();
}
}
......
......@@ -28,15 +28,15 @@
#include <sstream>
#include <map>
#ifdef __GNUC__
#if GNUC > 7
#ifdef __GNUG__
#if __GNUG__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#endif
#include "../3rdparty/jsoncpp/json/json.h"
#ifdef __GNUC__
#if GNUC > 7
#ifdef __GNUG__
#if __GNUG__ > 6
#pragma GCC diagnostic pop
#endif
#endif
......
This diff is collapsed.
......@@ -37,15 +37,15 @@
#include <execinfo.h>
#include <unistd.h>
#ifdef __GNUC__
#if GNUC > 7
#ifdef __GNUG__
#if __GNUG__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#endif
#include "../3rdparty/tinyformat/tinyformat.h"
#ifdef __GNUC__
#if GNUC > 7
#ifdef __GNUG__
#if __GNUG__ > 6
#pragma GCC diagnostic pop
#endif
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment