diff --git a/src/tools/analysis_jkellerer/densities/density_to_h5.py b/src/tools/analysis_jkellerer/densities/density_to_h5.py
new file mode 100644
index 0000000..1798b40
--- /dev/null
+++ b/src/tools/analysis_jkellerer/densities/density_to_h5.py
@@ -0,0 +1,42 @@
+import numpy as np
+import h5py as h5py
+import os
+import sys
+import matplotlib
+import matplotlib.pyplot as plt
+
+from functions.calculate_density_from_karl import *
+import functions.plot_standards as pst
+
+
+def densityToH5(filename, filename_output):
+ keys = ["/Populations/e-/e-", "/Populations/T+/T+", "/Populations/T2+/T2+", "/Populations/T3+/T3+"]
+
+ zmins = getZBinsMin(filename, keys[0])
+ zmaxs = getZBinsMax(filename, keys[0])
+ Emins = getEBinsMin(filename, keys[0])
+ Emaxs = getEBinsMax(filename, keys[0])
+
+ print("Get Density: e-")
+ total_density_e = getDensities(filename, keys[0])
+ density_e = np.sum(total_density_e,3)[:,:,0]
+
+ print("Get Density: T+")
+ total_density_T = getDensities(filename, keys[1])
+ density_T = np.sum(total_density_T,3)[:,:,0]
+
+ print("Get Density: T2+")
+ total_density_T2 = getDensities(filename, keys[2])
+ density_T2 = np.sum(total_density_T2,3)[:,:,0]
+
+ print("Get Density: T3+")
+ total_density_T3 = getDensities(filename, keys[3])
+ density_T3 = np.sum(total_density_T3,3)[:,:,0]
+
+ total_density = np.array((density_T + density_T2 + density_T3 -density_e)/1E6)
+
+ f = h5py.File(filename_output, 'w')
+ key_density = "Density/total"
+
+ f.create_dataset(key_density, data=total_density, dtype=float)
+ f.close()
diff --git a/src/tools/analysis_jkellerer/poissonSolver/config/params.xml b/src/tools/analysis_jkellerer/poissonSolver/config/params.xml
new file mode 100644
index 0000000..ed7ef31
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/config/params.xml
@@ -0,0 +1,54 @@
+
+
+
+
+ 18
+ 4.5
+
+
+
+
+ 5
+ 16
+
+
+
+
+ ./config/density.h5
+ /Density/total
+
+
+
+
+
+
+
+ 1
+ 0.003333333333333333
+
+
+ 1
+ 0.
+
+
+ 0
+
+
+
+ 1000
+ 0.0001
+
+
+
+
+
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/include/Boundary.h b/src/tools/analysis_jkellerer/poissonSolver/include/Boundary.h
new file mode 100644
index 0000000..53c3898
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/include/Boundary.h
@@ -0,0 +1,16 @@
+#ifndef BOUNDARY_H
+#define BOUNDARY_H
+
+enum BoundaryType {
+ pml = 0,
+ pec = 1
+};
+
+class Boundary {
+ public:
+ Boundary(BoundaryType type, double data);
+ BoundaryType type;
+ const double data;
+};
+
+#endif /* BOUNDARY_H */
diff --git a/src/tools/analysis_jkellerer/poissonSolver/include/Fields.h b/src/tools/analysis_jkellerer/poissonSolver/include/Fields.h
new file mode 100644
index 0000000..2b3b297
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/include/Fields.h
@@ -0,0 +1,66 @@
+#ifndef FIELDS_H
+#define FIELDS_H
+
+#include "blitz/array.h"
+
+namespace Fields {
+
+
+
+class Density {
+ public:
+ Density(blitz::Array& data);
+ Density(const Density& density);
+
+ blitz::Array data() const;
+ blitz::Array data_;
+};
+
+Density interpolateOnGrid(Density& denstity);
+
+class Potential {
+ public:
+ Potential(blitz::Array& data);
+ blitz::Array data() const;
+ blitz::Array data_;
+
+};
+
+class ElectricField {
+ public:
+ ElectricField(
+ blitz::Array& data_r,
+ blitz::Array& data_z);
+
+ blitz::Array data_r_;
+ blitz::Array data_z_;
+};
+
+/*
+Density interpolateOnGrid(Density& denstity);
+
+class Potential {
+ public:
+ Potential(blitz::Array& data);
+ Potential(int nr, int nz);
+
+ blitz::Array data() const;
+
+ private:
+ blitz::Array data_;
+};
+
+class ElectricField {
+
+};
+
+ElectricField interpolateOnGrid(
+ ElectricField& electric_field,
+ double dr_new,
+ double dz_new);
+*/
+};
+
+
+
+#endif /* FIELDS_H */
diff --git a/src/tools/analysis_jkellerer/poissonSolver/include/IO.h b/src/tools/analysis_jkellerer/poissonSolver/include/IO.h
new file mode 100644
index 0000000..60c2ec2
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/include/IO.h
@@ -0,0 +1,25 @@
+#ifndef IO_H
+#define IO_H
+
+#include "Parameter.h"
+#include "Fields.h"
+#include "Boundary.h"
+#include "PoissonSolver.h"
+
+namespace IO {
+ Fields::Density denstiy(const Parameter& parameter);
+ Boundary rearwallBoundary(const Parameter& parameter);
+ Boundary tubewallBoundary(const Parameter& parameter);
+ Boundary dpsBoundary(const Parameter& parameter);
+
+ double length(const Parameter& parameter);
+ double radius(const Parameter& parameter);
+
+ PoissonSolver solver(const Parameter& parameter);
+
+ void save(const Fields::Potential& potential, const Parameter& parameter);
+ void save(const Fields::Density& density, const Parameter& parameter);
+ void save(const Fields::ElectricField& density, const Parameter& parameter);
+};
+
+#endif /* IO_H */
diff --git a/src/tools/analysis_jkellerer/poissonSolver/include/Parameter.h b/src/tools/analysis_jkellerer/poissonSolver/include/Parameter.h
new file mode 100644
index 0000000..6d171ea
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/include/Parameter.h
@@ -0,0 +1,13 @@
+#ifndef PARAMETER_H
+#define PARAMETER_H
+
+#include
+#include "pugixml/pugixml.hpp"
+
+class Parameter {
+ public:
+ Parameter(std::string filename);
+ const pugi::xml_document document;
+};
+
+#endif /* PARAMETER_H */
diff --git a/src/tools/analysis_jkellerer/poissonSolver/include/PoissonSolver.h b/src/tools/analysis_jkellerer/poissonSolver/include/PoissonSolver.h
new file mode 100644
index 0000000..9c50b41
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/include/PoissonSolver.h
@@ -0,0 +1,44 @@
+#ifndef POISSONSOLVER_H
+#define POISSONSOLVER_H
+
+#include "Fields.h"
+#include "Boundary.h"
+
+class PoissonSolver {
+ public:
+ PoissonSolver(double target_accuracy, int num_cycles);
+
+ Fields::Potential solve(
+ Fields::Density& density,
+ Boundary& rearwall,
+ Boundary& tubewall,
+ Boundary& dps,
+ double radius,
+ double length);
+
+ Fields::ElectricField solve(
+ Fields::Potential& potential,
+ double radius,
+ double length);
+
+ private:
+ void iterationPotential(
+ Fields::Potential& potential,
+ Fields::Density& density,
+ Boundary& rearwall,
+ Boundary& tubewall,
+ Boundary& dps,
+ double dr,
+ double dz) const;
+
+ bool converged(
+ Fields::Potential& potential,
+ Fields::Density& density,
+ double dr,
+ double dz) const;
+
+ const double target_accuracy_;
+ const int num_cycles_;
+};
+
+#endif /* POISSONSOLVER_H */
diff --git a/src/tools/analysis_jkellerer/poissonSolver/makefile b/src/tools/analysis_jkellerer/poissonSolver/makefile
new file mode 100644
index 0000000..3cc4dc6
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/makefile
@@ -0,0 +1,85 @@
+dummy: all
+
+DO_DEBUGGING = true
+
+# Directories
+PROJECT_DIR = $(HOMEBASE)/src/tools/analysis_jkellerer/poissonSolver
+
+SRC_DIR = $(PROJECT_DIR)/src
+TEST_DIR = $(PROJECT_DIR)/test
+BIN_DIR = $(PROJECT_DIR)/bin
+BUILD_DIR = $(PROJECT_DIR)/build
+INCLUDES_DIR = $(PROJECT_DIR)/include
+
+# Includes
+include $(HOMEBASE)/src/makeinclude/ostype.mak
+include $(HOMEBASE)/src/makeinclude/$(X_OSTYPE)
+
+CODEBAUM_INC = -I$(HOMEBASE)/include
+HDF5_INC = -I/usr/include/hdf5/serial
+HDF5_LIB = -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -lhdf5
+LIBS = -L$(HOMEBASE)/lib/$(X_OSTYPE)/ -lblitz -lm $(HDF5_LIB)
+MAIN_INC = -I$(INCLUDES_DIR)
+
+# Compiler instructions
+CXXFLAGS=$(X_OFLAGS) $(BLITZ_INC) $(CODEBAUM_INC) $(MAIN_INC) $(HDF5_INC) -fno-finite-math-only
+CXXFLAGS_TEST = $(CXXFLAGS)
+
+ifeq ($(DO_DEBUGGING),true)
+ CXXFLAGS += -g -DBZ_DEBUG
+endif
+
+# Sources
+SOURCES = $(wildcard $(SRC_DIR)/*.cpp)
+#SOURCES_TEST = $(wildcard $(SRC_DIR)/*.cpp)
+SOURCES_TEST = $(filter-out $(SRC_DIR)/main.cpp, $(wildcard $(SRC_DIR)/*.cpp))
+SOURCES_TEST += $(wildcard $(TEST_DIR)/*.cpp)
+
+# Objects
+OBJECTS=$(addprefix $(BUILD_DIR)/, $(notdir $(SOURCES:.cpp=.o)) )
+OBJECTS_TEST=$(addprefix $(BUILD_DIR)/, $(notdir $(SOURCES_TEST:.cpp=.o)) )
+
+TARGET=$(BIN_DIR)/poisson_solver
+TARGET_TEST=$(BIN_DIR)/poisson_solver_test
+
+
+all: info $(TARGET)
+
+testing: $(TARGET_TEST)
+
+info:
+ @echo
+ @echo "-----> CONFIG = "$(CONFIG)
+ @echo "-----> X_OSTYPE = "$(X_OSTYPE)
+ @echo
+
+$(TARGET): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LIBS) -o $(TARGET)
+ @echo
+ @echo "Linking done"
+ @echo
+
+$(TARGET_TEST): $(BUILD_DIR) $(BIN_DIR) $(OBJECTS_TEST)
+ $(CXX) $(OBJECTS_TEST) $(LIBS) -o $(TARGET_TEST)
+ @echo
+ @echo "Linking done"
+ @echo
+
+$(BIN_DIR):
+ @mkdir -p $(BIN_DIR)
+
+$(BUILD_DIR):
+ @mkdir -p $(BUILD_DIR)
+
+$(BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ @echo "Create $(notdir $@) from $(notdir $<)"
+ @echo
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+$(BUILD_DIR)/%.o : $(TEST_DIR)/%.cpp
+ @echo "Create $@ from $<"
+ $(CXX) $(CXXFLAGS_TEST) $< -c -o $@
+
+clean:
+ -rm -rf $(BUILD_DIR)
+ -rm -rf $(BIN_DIR)
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/src/Boundary.cpp b/src/tools/analysis_jkellerer/poissonSolver/src/Boundary.cpp
new file mode 100644
index 0000000..3c8efcf
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/src/Boundary.cpp
@@ -0,0 +1,7 @@
+#include "Boundary.h"
+
+
+Boundary::Boundary(BoundaryType type, double data):
+ type(type),
+ data(data)
+{}
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/src/Fields.cpp b/src/tools/analysis_jkellerer/poissonSolver/src/Fields.cpp
new file mode 100644
index 0000000..301de18
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/src/Fields.cpp
@@ -0,0 +1,76 @@
+#include "Fields.h"
+
+
+namespace Fields
+{
+ Density::Density(blitz::Array& data):
+ data_(data.copy())
+ {
+ }
+
+ Density::Density(const Density& density):
+ data_(density.data())
+ {}
+
+ blitz::Array Density::data() const
+ {
+ return data_.copy();
+ }
+
+ Density interpolateOnGrid(Density& denstity)
+ {
+ const blitz::TinyVector extent = denstity.data().extent();
+ const blitz::TinyVector interpol_extent =
+ extent + blitz::TinyVector(1,1);
+
+ blitz::Array interpolated(interpol_extent);
+ interpolated = 0.;
+
+ // center values
+ for(int i = 1; i < interpol_extent(0)-1; ++i){
+ for(int j = 1; j < interpol_extent(1)-1; ++j){
+ interpolated(i,j) = (
+ denstity.data_(i-1, j-1)
+ + denstity.data_(i-1, j)
+ + denstity.data_(i, j-1)
+ + denstity.data_(i,j))/4;
+ }
+ }
+
+ // values for r=0
+ for(int j = 1; j < interpol_extent(1)-1; ++j){
+ interpolated(0,j) =
+ (denstity.data_(0,j-1) + denstity.data_(0,j))/2;
+ }
+
+ // values for j = j_max
+ int j_max = interpol_extent(1)-1;
+ for(int i = 1; i < interpol_extent(0)-1; ++i){
+ interpolated(i,j_max) =
+ (denstity.data_(i-1, j_max-1) + denstity.data_(i, j_max-1))/2;
+ }
+ interpolated(0, j_max) = denstity.data_(0, j_max-1);
+
+ return Density(interpolated);
+ }
+
+ Potential::Potential(blitz::Array& data):
+ data_(data.copy())
+ {
+ }
+
+ blitz::Array Potential::data() const
+ {
+ return data_.copy();
+ }
+
+ ElectricField::ElectricField(
+ blitz::Array& data_r,
+ blitz::Array& data_z):
+ data_r_(data_r.copy()),
+ data_z_(data_z.copy())
+ {
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/src/IO.cpp b/src/tools/analysis_jkellerer/poissonSolver/src/IO.cpp
new file mode 100644
index 0000000..6e2b194
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/src/IO.cpp
@@ -0,0 +1,175 @@
+#include "IO.h"
+#include
+#include
+
+#include "highfive/H5File.hpp"
+#include "highfive/H5DataSet.hpp"
+#include "highfive/H5DataSpace.hpp"
+
+#include
+
+namespace IO {
+
+
+Fields::Density denstiy(const Parameter& parameter)
+{
+ //blitz::Array data(40,180);
+ //data = 0.;
+ //data(blitz::Range(0,1),blitz::Range(2,7)) = 1.;
+ //return Fields::Density(data);
+
+ std::string filename = std::string(
+ parameter.document.first_element_by_path(
+ "Parameters/Input/Density").child_value("Filename"));
+ std::cout << filename << std::endl;
+ std::string path = std::string(
+ parameter.document.first_element_by_path(
+ "Parameters/Input/Density").child_value("H5Path"));
+ std::cout << path << std::endl;
+ HighFive::File f(filename, HighFive::File::ReadOnly);
+ HighFive::DataSet dataset = f.getDataSet(path);
+
+ std::vector> data;
+ dataset.read(data);
+
+ const int nz = data[0].size();
+ const int nr = data.size();
+ blitz::Array data2d(nr, nz);
+
+ for(int ri = 0; ri(type_i);
+ if(type == BoundaryType::pec){
+ const double data = std::atof(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver/Boundary/Rear").child_value("Potential"));
+ return Boundary(type, data);
+ }
+ else if(type == BoundaryType::pml){
+ return Boundary(type, 0.);
+ }
+}
+
+Boundary tubewallBoundary(const Parameter& parameter)
+{
+ const int type_i = std::atoi(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver/Boundary/Tube").child_value("Type"));
+ const BoundaryType type = static_cast(type_i);
+ if(type == BoundaryType::pec){
+ const double data = std::atof(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver/Boundary/Tube").child_value("Potential"));
+ return Boundary(type, data);
+ }
+ else if(type == BoundaryType::pml){
+ return Boundary(type, 0.);
+ }
+}
+Boundary dpsBoundary(const Parameter& parameter)
+{
+ const int type_i = std::atoi(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver/Boundary/DPS").child_value("Type"));
+ const BoundaryType type = static_cast(type_i);
+ if(type == BoundaryType::pec){
+ const double data = std::atof(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver/Boundary/DPS").child_value("Potential"));
+ return Boundary(type, data);
+ }
+ else if(type == BoundaryType::pml){
+ return Boundary(type, 0.);
+ }
+}
+
+double radius(const Parameter& parameter)
+{
+ const double radius = std::atof(
+ parameter.document.first_element_by_path(
+ "Parameters/Geometry").child_value("Radius"));
+ return radius;
+}
+
+double length(const Parameter& parameter)
+{
+ const double length = std::atof(
+ parameter.document.first_element_by_path(
+ "Parameters/Geometry").child_value("Length"));
+ return length;
+}
+
+PoissonSolver solver(const Parameter& parameter)
+{
+
+ double target_accuracy = std::atof(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver").child_value("Precission"));
+ int num_cycles = std::atoi(
+ parameter.document.first_element_by_path(
+ "Parameters/Solver").child_value("MaxIterations"));
+ return PoissonSolver(target_accuracy, num_cycles);
+}
+
+
+void save(const Fields::Potential& potential, const Parameter& parameter)
+{
+ std::string filename = std::string(
+ parameter.document.first_element_by_path(
+ "Parameters/Output/Potential").child_value("Filename"));
+ std::ofstream outdata;
+ outdata.open(filename);
+ for(int i = 0; i < potential.data_.extent(0); ++i){
+ for(int j = 0; j
+#include
+
+pugi::xml_document openFile(std::string filename)
+{
+ pugi::xml_document parameter_file;
+ pugi::xml_parse_result result = parameter_file.load_file(filename.c_str());
+
+ if(result.status == pugi::xml_parse_status::status_ok){
+ std::cout << "Loaded paramters from params.xml.\n";
+ }
+ else{
+ std::cout << result.description() << std::endl;
+ throw std::runtime_error("Can not load params.xml.\n");
+ }
+ return parameter_file;
+}
+
+
+Parameter::Parameter(std::string filename):
+ document(openFile(filename))
+{}
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/src/PoissonSolver.cpp b/src/tools/analysis_jkellerer/poissonSolver/src/PoissonSolver.cpp
new file mode 100644
index 0000000..545dd1d
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/src/PoissonSolver.cpp
@@ -0,0 +1,167 @@
+#include "PoissonSolver.h"
+#include
+
+PoissonSolver::PoissonSolver(
+ double target_accuracy, int num_cycles):
+ target_accuracy_(target_accuracy),
+ num_cycles_(num_cycles)
+{}
+
+Fields::Potential PoissonSolver::solve(
+ Fields::Density& density,
+ Boundary& rearwall,
+ Boundary& tubewall,
+ Boundary& dps,
+ double radius,
+ double length)
+{
+ const int nr = density.data_.extent(0);
+ const int nz = density.data_.extent(1);
+
+ const double dz = length/nz;
+ const double dr = radius/nr;
+
+ blitz::Array potential_data(nr, nz);
+ potential_data = 0.;
+
+ Fields::Potential potential(potential_data);
+
+ int it = 1;
+ do{
+ iterationPotential(
+ potential, density, rearwall, tubewall, dps, dr, dz);
+ if(it%1000 == 0){
+ if(converged(potential, density, dr, dz)){
+ break;
+ };
+ }
+ ++it;
+ }
+ while(it < num_cycles_);
+ return potential;
+}
+
+void PoissonSolver::iterationPotential(
+ Fields::Potential& potential,
+ Fields::Density& density,
+ Boundary& rearwall,
+ Boundary& tubewall,
+ Boundary& dps,
+ double dr,
+ double dz) const
+{
+ const int nr = density.data_.extent(0);
+ const int nz = density.data_.extent(1);
+
+ // finite diff calculation
+ for(int i = 1; i < nr-1; ++i){
+ for(int k = 1; k efield_z(nr,nz-1);
+ efield_z = 0;
+
+ for(int i = 0; i < nr-1; ++i){
+ for(int j = 0; j < nz-1; ++j){
+ efield_z(i,j) =
+ (potential.data_(i,j) - potential.data_(i,j+1))/dz;
+ }
+ }
+
+ blitz::Array efield_r(nr-1,nz);
+ efield_r = 0;
+
+ for(int i = 0; i < nr-1; ++i){
+ for(int j = 0; j < nz; ++j){
+ efield_r(i,j) =
+ (potential.data_(i,j) - potential.data_(i+1,j))/dr;
+ }
+ }
+
+ return Fields::ElectricField(efield_r, efield_z);
+}
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/src/main.cpp b/src/tools/analysis_jkellerer/poissonSolver/src/main.cpp
new file mode 100644
index 0000000..f34bb72
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/src/main.cpp
@@ -0,0 +1,44 @@
+#include
+#include "blitz/array.h"
+#include "catch/catch.hpp"
+#include
+#include "Parameter.h"
+#include "IO.h"
+#include "Boundary.h"
+
+int main(int argc, char *argv[]){
+
+ const std::string parameter_filename = std::string(argv[1]);
+ Parameter parameter(parameter_filename);
+
+ const double radius = IO::radius(parameter);
+ const double length = IO::length(parameter);
+
+ Boundary rearwall = IO::rearwallBoundary(parameter);
+ Boundary tubewall = IO::tubewallBoundary(parameter);
+ Boundary dps = IO::dpsBoundary(parameter);
+
+ Fields::Density density = IO::denstiy(parameter);
+
+ Fields::Density interpolated(Fields::interpolateOnGrid(density));
+
+ PoissonSolver solver = IO::solver(parameter);
+ Fields::Potential potential = solver.solve(
+ interpolated,
+ rearwall,
+ tubewall,
+ dps,
+ radius,
+ length);
+
+ Fields::ElectricField efield = solver.solve(
+ potential,
+ radius,
+ length);
+
+ IO::save(potential, parameter);
+ IO::save(efield, parameter);
+ IO::save(interpolated, parameter);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/test/test_fields.cpp b/src/tools/analysis_jkellerer/poissonSolver/test/test_fields.cpp
new file mode 100644
index 0000000..29d893e
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/test/test_fields.cpp
@@ -0,0 +1,44 @@
+#include "catch/catch.hpp"
+
+
+#include "Fields.h"
+
+
+TEST_CASE("Density", "[Density]"){
+ SECTION("Interpolation"){
+ blitz::Array data(3,4);
+ data = 0.;
+ data(0,blitz::Range::all()) = 1;
+ data(1,blitz::Range::all()) = 2;
+ data(2,blitz::Range::all()) = 3;
+
+ Fields::Density density_old(data);
+ Fields::Density density_interpol =
+ Fields::interpolateOnGrid(density_old);
+ SECTION("First z value is zero"){
+ REQUIRE(density_interpol.data_(0,0) == 0.);
+ REQUIRE(density_interpol.data_(1,0) == 0.);
+ REQUIRE(density_interpol.data_(2,0) == 0.);
+ }
+
+ SECTION("Intermediate values are mean of values"){
+ REQUIRE(density_interpol.data_(1,1) == (1+1+2+2)/4.);
+ REQUIRE(density_interpol.data_(2,1) == (2+2+3+3)/4.);
+ REQUIRE(density_interpol.data_(3,1) == 0.);
+ }
+
+ SECTION("Outer values are zero"){
+ REQUIRE(density_interpol.data_(3,0) == 0.);
+ REQUIRE(density_interpol.data_(3,1) == 0.);
+ REQUIRE(density_interpol.data_(3,2) == 0.);
+ REQUIRE(density_interpol.data_(3,3) == 0.);
+ REQUIRE(density_interpol.data_(3,4) == 0.);
+ }
+
+ SECTION("Last z values are mean of last density"){
+ REQUIRE(density_interpol.data_(0,4) == 1.);
+ REQUIRE(density_interpol.data_(1,4) == (1+2)/2.);
+ REQUIRE(density_interpol.data_(2,4) == (2+3)/2.);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/tools/analysis_jkellerer/poissonSolver/test/test_main.cpp b/src/tools/analysis_jkellerer/poissonSolver/test/test_main.cpp
new file mode 100644
index 0000000..7bf2a58
--- /dev/null
+++ b/src/tools/analysis_jkellerer/poissonSolver/test/test_main.cpp
@@ -0,0 +1,5 @@
+#define CATCH_CONFIG_MAIN
+#include "catch/catch.hpp"
+
+TEST_CASE( "1: All tests cases reside in other .cpp files (empty)", "[multi-file:1]" ){
+}
\ No newline at end of file