Commit 434d5e53 authored by steffen.schotthoefer's avatar steffen.schotthoefer
Browse files

Merge branch 'develop' into 'master'

Miscellaneous changes

See merge request !40
parents bf911fca 642f5c6d
Pipeline #136559 passed with stage
in 3 minutes and 50 seconds
version: 2
python:
version: 3.7
install:
- requirements: doc/requirements.txt
sphinx:
builder: html
configuration: doc/conf.py
submodules:
exclude: all
formats: []
......@@ -33,7 +33,8 @@ RUN apt-get update \
RUN pip3 install tensorflow==2.2.2\
pygmsh==6.1.1 Pillow pydicom gcovr \
matplotlib\
scipy
scipy\
pandas
RUN cd /usr/local \
&& wget -nc --quiet http://gmsh.info/bin/Linux/gmsh-4.7.0-Linux64-sdk.tgz \
......
[![pipeline status](https://git.scc.kit.edu/rtsn/rtsn/badges/master/pipeline.svg)](https://git.scc.kit.edu/rtsn/rtsn/-/commits/master) [![coverage report](https://git.scc.kit.edu/rtsn/rtsn/badges/master/coverage.svg)](https://git.scc.kit.edu/rtsn/rtsn/-/commits/master)
[![pipeline status](https://git.scc.kit.edu/rtsn/rtsn/badges/master/pipeline.svg)](https://git.scc.kit.edu/rtsn/rtsn/-/commits/master) [![coverage report](https://git.scc.kit.edu/rtsn/rtsn/badges/master/coverage.svg)](https://git.scc.kit.edu/rtsn/rtsn/-/commits/master) [![Documentation Status](https://readthedocs.org/projects/kit-rt/badge/?version=latest)](https://kit-rt.readthedocs.io/en/latest/?badge=latest)
# KiT-RT - an HPC Radio Therapy $`S_n`$ framework
TBD
......@@ -152,13 +152,13 @@ This last step requires a preceeding `docker login`. Ask Jannick for login crede
## Code structure
**WARNING: is not created automatically - might be out of date!**
Reverse engineered plantuml diagram of the current code structure:
![Can't load image](doc/KiT-RT.svg "UML diagram")
![Can't load image](doc/images/uml.svg "UML diagram")
<br/><br/>
Was created using [hpp2plantuml](https://github.com/thibaultmarin/hpp2plantuml) and [plantuml](https://plantuml.com/), e.g.:
```bash
cd doc
hpp2plantuml -i "../code/include/*.h" -i "../code/include/*/*.h" -o KiT-RT.puml
plantuml KiT-RT.puml -tsvg
hpp2plantuml -i "../code/include/*.h" -i "../code/include/*/*.h" -o uml.puml
plantuml uml.puml -tsvg
```
---
......
......@@ -4,8 +4,10 @@ project( KiT-RT VERSION 0.1.0 LANGUAGES CXX )
### OPTIONS #####################################
option( BUILD_TESTS "builds all available unit tests" OFF )
option( BUILD_GUI "additionally builds a user interface" OFF )
option( BUILD_DOC "builds Doxygen and Sphinx documentation" OFF )
#################################################
### COMPILER ####################################
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
......@@ -97,6 +99,8 @@ if( BUILD_TESTS )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} )
include( Catch )
set( CATCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/Catch2/single_include/catch2 )
add_compile_definitions( BUILD_TESTING )
add_compile_definitions( TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" )
add_library( Catch INTERFACE )
target_include_directories( Catch INTERFACE ${CATCH_INCLUDE_DIR} )
file( GLOB_RECURSE TEST_SRCS RELATIVE ${CMAKE_SOURCE_DIR} "tests/*.cpp" )
......@@ -138,3 +142,40 @@ if( BUILD_GUI )
target_compile_options( ${CMAKE_PROJECT_NAME}_gui PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
endif()
#################################################
### BUILD DOCUMENTATION #########################
if( BUILD_DOC )
find_package( Doxygen REQUIRED )
find_package( Sphinx REQUIRED )
file( GLOB_RECURSE DOC_HEADER RELATIVE ${CMAKE_SOURCE_DIR} "include/*.h" )
set( DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR} )
set( DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen )
set( DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html )
set( DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/../doc/Doxyfile.in )
set( DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
configure_file( ${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY )
file( MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR} )
add_custom_command( OUTPUT ${DOXYGEN_INDEX_FILE}
DEPENDS ${DOC_HEADER}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating documentaion with Doxygen"
VERBATIM )
add_custom_target( Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE} )
set( SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../doc )
set( SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx )
set( SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html )
add_custom_command( OUTPUT ${SPHINX_INDEX_FILE}
COMMAND ${SPHINX_EXECUTABLE} ${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../doc/index.rst ${DOXYGEN_INDEX_FILE}
MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py
COMMENT "Converting documentation from Doxygen to Sphinx" )
add_custom_target( Sphinx ALL DEPENDS ${SPHINX_INDEX_FILE} )
endif()
#################################################
find_program( SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable" )
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Sphinx
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE )
Subproject commit 54f38c0a6154004efa2f8cad4737d127f6dcde59
Subproject commit e1eab3b76738638e7db7a5f2bd62e72c923c717a
......@@ -87,6 +87,10 @@ class Config
std::string _oxygenFile; /*!< @brief Name of oxygen cross section file path */
std::string _stoppingPowerFile; /*!< @brief Name of stopping power file path */
// CSD
double _maxEnergyCSD; /*!< @brief Maximum energy for CSD simulation */
// --- other variables ---
// Scattering Kernel
KERNEL_NAME _kernelName; /*!< @brief Scattering Kernel Name*/
......@@ -119,9 +123,10 @@ class Config
// Data Generator Settings
/*!< @brief Check, if data generator mode is active. If yes, no solver is called, but instead the data generator is executed */
bool _dataGeneratorMode;
unsigned long _tainingSetSize; /*!< @brief Size of training data set for data generator */
unsigned long _maxValFirstMoment; /*!< @brief Size of training data set for data generator */
double _boundaryDistanceRealizableSet; /*! @brief Distance of the sampled moments to the boundary of the realizable set */
unsigned long _tainingSetSize; /*!< @brief Size of training data set for data generator */
unsigned long _maxValFirstMoment; /*!< @brief Size of training data set for data generator */
double _RealizableSetEpsilonU0; /*! @brief Distance to 0 of the sampled moments to the boundary of the realizable set */
double _RealizableSetEpsilonU1; /*!< @brief: norm(u_1)/u_0 !< _RealizableSetEpsilonU1 */
// --- Parsing Functionality and Initializing of Options ---
/*!
......@@ -279,6 +284,8 @@ class Config
// Linesource
double inline GetSigmaS() const { return _sigmaS; }
// CSD
double inline GetMaxEnergyCSD() const { return _maxEnergyCSD; }
// Optimizer
double inline GetNewtonOptimizerEpsilon() const { return _optimizerEpsilon; }
unsigned long inline GetNewtonIter() const { return _newtonIter; }
......@@ -315,7 +322,8 @@ class Config
bool inline GetDataGeneratorMode() { return _dataGeneratorMode; }
unsigned long inline GetTrainingDataSetSize() { return _tainingSetSize; }
unsigned long inline GetMaxValFirstMoment() { return _maxValFirstMoment; }
double GetBoundaryDistanceRealizableSet() { return _boundaryDistanceRealizableSet; }
double GetRealizableSetEpsilonU0() { return _RealizableSetEpsilonU0; }
double GetRealizableSetEpsilonU1() { return _RealizableSetEpsilonU1; }
// ---- Setters for option structure
// This section is dangerous
......
......@@ -6,13 +6,13 @@
class Checkerboard_SN : public ProblemBase
{
private:
Vector _scatteringXS; /*! @brief Vector of scattering crosssections */
Vector _scatteringXS; /*! @brief Vector of scattering crosssections */
Vector _totalXS; /*! @brief Vector of total crosssections */
Checkerboard_SN() = delete;
bool isAbsorption( const Vector& pos ) const; /*! @return True if pos is in absorption region, False otherwise */
bool isSource( const Vector& pos ) const; /*! @return True if pos is in source region, False otherwise */
bool isSource( const Vector& pos ) const; /*! @return True if pos is in source region, False otherwise */
public:
Checkerboard_SN( Config* settings, Mesh* mesh );
......@@ -27,13 +27,13 @@ class Checkerboard_SN : public ProblemBase
class Checkerboard_PN : public ProblemBase
{
private:
Vector _scatteringXS; /*! @brief Vector of scattering crosssections */
Vector _totalXS; /*! @brief Vector of total crosssections */
Vector _scatteringXS; /*! @brief Vector of scattering crosssections len: numCells */
Vector _totalXS; /*! @brief Vector of total crosssections. len: numCells*/
Checkerboard_PN() = delete;
bool isAbsorption( const Vector& pos ) const; /*! @return True if pos is in absorption region, False otherwise */
bool isSource( const Vector& pos ) const; /*! @return True if pos is in source region, False otherwise */
bool isSource( const Vector& pos ) const; /*! @return True if pos is in source region, False otherwise */
/**
* @brief Gets the global index for given order l of Legendre polynomials and given
......
......@@ -32,11 +32,11 @@ class Solver
double _dE; /*! @brief energy/time step size */
Vector _energies; // energy groups used in the simulation [keV]
std::vector<double> _density; // patient density, dim(_density) = _nCells
Vector _s; // stopping power, dim(_s) = _nTimeSteps
Vector _s; // stopping power, dim(_s) = _nTimeSteps (only for csdsolver)
std::vector<VectorVector> _Q; /*! @brief external source term */
VectorVector _sigmaS; /*! @brief scattering cross section for all energies */
VectorVector _sigmaT; /*! @brief total cross section for all energies */
VectorVector _sigmaS; /*! @brief scattering cross section for all energies. len: _nEnergies x numCells */
VectorVector _sigmaT; /*! @brief total cross section for all energies. len: _nEnergies x numCells*/
// quadrature related numbers
QuadratureBase* _quadrature; /*! @brief quadrature to create members below */
......
......@@ -57,7 +57,7 @@ inline void PrintVectorVector( const VectorVector vectorIn ) {
else
printf( "| %.2f ", vectorIn[idx_Outer][idx_Inner] );
}
std::cout << " |\n";
printf( " |\n" );
}
}
......
// settings Kersting
lc = 0.005;
width = 1.0;
length = 10.0;
start = -2.5;
//+
Point(1) = {start, width, 0, lc};
//+
Point(2) = {start+length, width, 0, lc};
//+
Point(3) = {start, 0, 0, lc};
//+
Point(4) = {start+length, 0, 0, lc};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 4};
//+
Line(3) = {4, 3};
//+
Line(4) = {3, 1};
//+
Curve Loop(1) = {4, 1, 2, 3};
//+
Plane Surface(1) = {1};
//+
Physical Curve("dirichlet") = {4, 2};
//+
Physical Curve("wall_low") = {1};
Physical Curve("wall_up") = {3};
//+
Transfinite Surface {1} = {1, 2, 4, 3};
//+
Transfinite Curve {4, 2} = 1 Using Progression 1;
//+
Transfinite Curve {1, 3} = 1000 Using Progression 1;
//+
Recombine Surface {1};
......@@ -7,9 +7,10 @@
%
% ---- Global settings ----
DATA_GENERATOR_MODE = YES
TRAINING_SET_SIZE = 10
MAX_VALUE_FIRST_MOMENT = 500
BOUNDARY_DISTANCE_REALIZABLE_SET = 0.01
TRAINING_SET_SIZE = 500
MAX_VALUE_FIRST_MOMENT = 20
REALIZABLE_SET_EPSILON_U0 = 0.05
REALIZABLE_SET_EPSILON_U1 = 0.97
%
% ---- File specifications ----
%
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Checkerboard Benchmarking File MN %
% Author <Steffen Schotthöfer> %
% Date 10.11.2020 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ---- File specifications ----
%
OUTPUT_DIR = ../result
% Output file
OUTPUT_FILE = MN_checkerboard_Monomials
% Log directory
LOG_DIR = ../result/logs
% Mesh File
MESH_FILE = meshes/checkerboard.su2
%MESH_FILE = meshes/checkerboard_debug.su2
%
% ---- Problem specifications ----
%
PROBLEM = CHECKERBOARD
%
% ---- Solver specifications ----
%
SPHERICAL_BASIS = SPHERICAL_MONOMIALS
%
CFL_NUMBER = 0.7
TIME_FINAL = 3
SOLVER = MN_SOLVER
RECONS_ORDER = 1
MAX_MOMENT_SOLVER = 1
%
% ---- Entropy settings ----
%
ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN
ENTROPY_OPTIMIZER = NEWTON
NEURAL_MODEL = 7
%
% ----- Newton Solver Specifications ----
%
NEWTON_FAST_MODE = NO
NEWTON_ITER = 100000
NEWTON_EPSILON = 0.0001
NEWTON_STEP_SIZE = 0.7
NEWTON_LINE_SEARCH_ITER = 10000
%
% ---- Boundary Conditions ----
%
BC_DIRICHLET = ( void )
%
% ---- Quadrature ----
%
QUAD_TYPE = GAUSS_LEGENDRE_TENSORIZED
QUAD_ORDER = 12
%
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL, MOMENTS, DUAL_MOMENTS)
VOLUME_OUTPUT_FREQUENCY = 1
SCREEN_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
SCREEN_OUTPUT_FREQUENCY = 1
HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
HISTORY_OUTPUT_FREQUENCY = 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Checkerboard Benchmarking File PN %
% Author <Steffen Schotthöfer> %
% Date 15.02.2021 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% ---- File specifications ----
%
% Output directory
OUTPUT_DIR = ../result
% Output file
OUTPUT_FILE = PN_checkerboard
% Log directory
LOG_DIR = ../result/logs
% Mesh File
MESH_FILE = meshes/checkerboard.su2
%
PROBLEM = CHECKERBOARD
%
%
% ---- Solver specifications ----
%
% Solver type
SOLVER = PN_SOLVER
% CFL number
CFL_NUMBER = 0.5
% Final time for simulation
TIME_FINAL = 2
% Maximal Moment degree
MAX_MOMENT_SOLVER = 2
% Reconstruction order
RECONS_ORDER = 1
% ---- Boundary Conditions ----
% Example: BC_DIRICLET = (dummyMarker1, dummyMarker2)
% Dirichlet Boundary
BC_DIRICHLET = ( void )
%
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL)
VOLUME_OUTPUT_FREQUENCY = 1
SCREEN_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
SCREEN_OUTPUT_FREQUENCY = 1
HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
HISTORY_OUTPUT_FREQUENCY = 1
......@@ -2,7 +2,7 @@
OUTPUT_DIR = ../result
OUTPUT_FILE = checkerboard
LOG_DIR = ../result/logs
MESH_FILE = checkerboard.su2
MESH_FILE = meshes/checkerboard.su2
% ---- Solver specifications ----
CFL_NUMBER = 0.5
......@@ -13,3 +13,12 @@ PROBLEM = CHECKERBOARD
BC_NEUMANN = ( void )
QUAD_TYPE = GAUSS_LEGENDRE_TENSORIZED
QUAD_ORDER = 10
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL)
VOLUME_OUTPUT_FREQUENCY = 1
SCREEN_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
SCREEN_OUTPUT_FREQUENCY = 1
HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
HISTORY_OUTPUT_FREQUENCY = 1
......@@ -12,7 +12,7 @@ OUTPUT_DIR = ../result
OUTPUT_FILE = example_csd1
LOG_DIR = ../result/logs
% Mesh File
MESH_FILE = 1DMesh.su2
MESH_FILE = meshes/1DMesh.su2
%
PROBLEM = WATERPHANTOM
%
......
......@@ -4,7 +4,7 @@
OUTPUT_DIR = ../result
OUTPUT_FILE = example_csdSN_1d_NOScatter
LOG_DIR = ../result/logs
MESH_FILE = 1DMesh.su2
MESH_FILE = meshes/1DMesh.su2
PROBLEM = WATERPHANTOM
SOLVER = CSD_SN_SOLVER
......
......@@ -14,8 +14,8 @@ OUTPUT_FILE = exampleMN_mono
% Log directory
LOG_DIR = ../result/logs
% Mesh File
%MESH_FILE = linesource.su2
MESH_FILE = linesource_debug.su2
MESH_FILE = meshes/linesource.su2
%MESH_FILE = meshes/linesource_debug.su2
%
% ---- Problem description ---
%
......@@ -33,7 +33,7 @@ SOLVER = MN_SOLVER
% CFL number
CFL_NUMBER = 0.7
% Final time for simulation
TIME_FINAL = 0.3
TIME_FINAL = 0.5
% Reconstruction order (spatial flux)
RECONS_ORDER = 1
......@@ -41,7 +41,7 @@ RECONS_ORDER = 1
% ---- Entropy settings ----
%
ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN
ENTROPY_OPTIMIZER = ML
ENTROPY_OPTIMIZER = NEWTON
NEURAL_MODEL = 4
%
% ----- Newton Solver Specifications ----
......
......@@ -14,8 +14,8 @@ OUTPUT_FILE = examplePN
% Log directory
LOG_DIR = ../result/logs
% Mesh File
MESH_FILE = linesource.su2
%MESH_FILE = linesource_debug.su2
MESH_FILE = meshes/linesource.su2
%MESH_FILE = meshes/linesource_debug.su2
%
PROBLEM = LINESOURCE
......
......@@ -14,7 +14,7 @@ OUTPUT_FILE = example_SN
% Log directory
LOG_DIR = ../result/logs
% Mesh File
MESH_FILE = linesource.su2
MESH_FILE = meshes/linesource.su2
%
PROBLEM = LINESOURCE
%
......
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