Commit 95321051 authored by steffen.schotthoefer's avatar steffen.schotthoefer
Browse files

added FileNotFound Error message. Added option to specify data directory....

added FileNotFound Error message. Added option to specify data directory. Added checks if datafiles exists in ICRU reader class
parent 13a93f43
...@@ -7,17 +7,17 @@ unit_tests: ...@@ -7,17 +7,17 @@ unit_tests:
stage: unit_tests stage: unit_tests
script: script:
- git submodule update --init --recursive - git submodule update --init --recursive
- cd code/build/release - cd code/build/debug
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../../ - cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON ../../
- ninja - ninja
- OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml - OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml
- gcovr -e ../../ext/ -e ../../tests/ -r ../../ - gcovr -e ../../ext/ -e ../../tests/ -r ../../
artifacts: artifacts:
when: always when: always
paths: paths:
- code/build/release/unit_tests_report.xml - code/build/debug/unit_tests_report.xml
reports: reports:
junit: code/build/release/unit_tests_report.xml junit: code/build/debug/unit_tests_report.xml
timeout: 4h timeout: 4h
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop" - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"
......
...@@ -10,3 +10,6 @@ ...@@ -10,3 +10,6 @@
[submodule "code/ext/parmetis"] [submodule "code/ext/parmetis"]
path = code/ext/parmetis path = code/ext/parmetis
url = https://github.com/slydex/parmetis.git url = https://github.com/slydex/parmetis.git
[submodule "code/ext/neuralEntropy"]
path = code/ext/neuralEntropy
url = https://github.com/ScSteffen/neuralEntropy.git
FROM ubuntu:20.04
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" \
PYTHONPATH=/usr/local/gmsh/lib:$PYTHONPATH \
PATH=/opt/conda/bin:/usr/local/gmsh/bin:$PATH
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -qq \
gcc \
g++ \
libopenmpi-dev \
openmpi-bin \
libblas-dev \
liblapack-dev \
git \
make \
ninja-build \
cmake \
wget \
ssh \
libssl-dev \
libxt-dev \
libgl1-mesa-dev \
libglu1 \
libxrender1 \
libxcursor-dev \
libxft-dev \
libxinerama-dev\
python3\
python3-pip\
vim
RUN pip3 install tensorflow==2.2.2\
pygmsh==6.1.1 Pillow pydicom gcovr \
matplotlib\
scipy
RUN cd /usr/local \
&& wget -nc --quiet http://gmsh.info/bin/Linux/gmsh-4.7.0-Linux64-sdk.tgz \
&& tar xzf gmsh-4.7.0-Linux64-sdk.tgz \
&& mv gmsh-4.7.0-Linux64-sdk gmsh \
&& rm gmsh-4.7.0-Linux64-sdk.tgz
RUN wget -nc --no-check-certificate --quiet https://www.vtk.org/files/release/8.2/VTK-8.2.0.tar.gz \
&& tar xzf VTK-8.2.0.tar.gz \
&& mkdir VTK-8.2.0/build \
&& cd VTK-8.2.0/build \
&& cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=OFF -DBUILD_TESTING=OFF ../ \
&& ninja \
&& ninja install > /dev/null \
&& cd - \
&& rm -rf VTK-*
RUN apt-get clean \
&& apt-get autoremove --purge \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /home
...@@ -20,6 +20,11 @@ TBD ...@@ -20,6 +20,11 @@ TBD
- VTK - VTK
- git - git
- ninja or make - ninja or make
- gmsh
### Python dependencies
- pygmsh version 6.1.1 'pip install pygmsh==6.1.1' (note that newer versions are not yet supported)
### Obtain submodules ### Obtain submodules
Note that an **active internet connection is required for the first build** in order to download the latest versions of the required submodules! Note that an **active internet connection is required for the first build** in order to download the latest versions of the required submodules!
...@@ -98,7 +103,7 @@ Append `HINTS VTK_INSTALL_DIR` to the `find_package( VTK ... )` line in the CMak ...@@ -98,7 +103,7 @@ Append `HINTS VTK_INSTALL_DIR` to the `find_package( VTK ... )` line in the CMak
find_package( VTK REQUIRED COMPONENTS vtkIOGeometry vtkFiltersCore HINTS ~/VTK-install ) find_package( VTK REQUIRED COMPONENTS vtkIOGeometry vtkFiltersCore HINTS ~/VTK-install )
``` ```
Compile it Compile it (make sure you use GCC as compiler: module load compiler/gnu/10.2)
```bash ```bash
module load devel/cmake/3.16 module load devel/cmake/3.16
module load compiler/gnu/9.2 module load compiler/gnu/9.2
...@@ -164,6 +169,8 @@ Please stick to the following coding style for easier code readability: ...@@ -164,6 +169,8 @@ Please stick to the following coding style for easier code readability:
- class variables start with an underscore and lowercase letters e.g. `_foo` - class variables start with an underscore and lowercase letters e.g. `_foo`
- functions start with a capital letter e.g. `GetSettings()` - functions start with a capital letter e.g. `GetSettings()`
- any variable/function names have capital letters at each individual word e.g. `GetAllCellsAdjacentTo(Cell i)` - any variable/function names have capital letters at each individual word e.g. `GetAllCellsAdjacentTo(Cell i)`
- Abstract base classes for inheritance structures end with the suffix "Base" e.g. QuadratureBase, whith child classes
QGaussLegendre or QProduct
Please also use the provided `code/.clang-format` style format to format your code before pushing your latest commits. Please also use the provided `code/.clang-format` style format to format your code before pushing your latest commits.
Some editors offer to automatically apply the style format upon saving a file (e.g. `Qtcreator`). Some editors offer to automatically apply the style format upon saving a file (e.g. `Qtcreator`).
cmake_minimum_required( VERSION 3.12.4 ) cmake_minimum_required( VERSION 3.12.4 )
project( KiT-RT VERSION 0.1.0 LANGUAGES CXX ) 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 )
#################################################
### COMPILER #################################### ### COMPILER ####################################
set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_CXX_STANDARD 17 )
...@@ -24,7 +28,7 @@ include_directories( ${LAPACK_INCLUDE_DIR} ) ...@@ -24,7 +28,7 @@ include_directories( ${LAPACK_INCLUDE_DIR} )
find_package( BLAS ) find_package( BLAS )
find_package( VTK REQUIRED COMPONENTS vtkIOGeometry vtkFiltersCore ) find_package( VTK COMPONENTS vtkIOGeometry vtkFiltersCore REQUIRED )
find_package( Python3 COMPONENTS Interpreter Development NumPy REQUIRED ) find_package( Python3 COMPONENTS Interpreter Development NumPy REQUIRED )
include_directories( ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS} ) include_directories( ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS} )
...@@ -70,6 +74,13 @@ add_compile_definitions( GIT_HASH="${GIT_HASH}" ) ...@@ -70,6 +74,13 @@ add_compile_definitions( GIT_HASH="${GIT_HASH}" )
### BUILD KIT-RT ################################ ### BUILD KIT-RT ################################
file( GLOB_RECURSE SRCS RELATIVE ${CMAKE_SOURCE_DIR} "src/*.cpp" "include/*.h" ) file( GLOB_RECURSE SRCS RELATIVE ${CMAKE_SOURCE_DIR} "src/*.cpp" "include/*.h" )
set( EXCLUDE_DIR "/gui/" )
foreach( TMP_PATH ${SRCS} )
string( FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND )
if( NOT ${EXCLUDE_DIR_FOUND} EQUAL -1 )
list( REMOVE_ITEM SRCS ${TMP_PATH} )
endif()
endforeach( TMP_PATH )
include_directories( ${CMAKE_SOURCE_DIR}/include ) include_directories( ${CMAKE_SOURCE_DIR}/include )
add_executable( ${CMAKE_PROJECT_NAME} ${SRCS} ${EXT_SRCS} ) add_executable( ${CMAKE_PROJECT_NAME} ${SRCS} ${EXT_SRCS} )
target_link_libraries( ${CMAKE_PROJECT_NAME} ${CORE_LIBRARIES} ) target_link_libraries( ${CMAKE_PROJECT_NAME} ${CORE_LIBRARIES} )
...@@ -81,26 +92,49 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR ...@@ -81,26 +92,49 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
### BUILD UNIT TESTS ############################ ### BUILD UNIT TESTS ############################
include( CTest ) if( BUILD_TESTS )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} ) include( CTest )
include( Catch ) set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} )
set( CATCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/Catch2/single_include/catch2 ) include( Catch )
add_compile_definitions( BUILD_TESTING ) set( CATCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/Catch2/single_include/catch2 )
add_compile_definitions( TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" ) add_library( Catch INTERFACE )
add_library( Catch INTERFACE ) target_include_directories( Catch INTERFACE ${CATCH_INCLUDE_DIR} )
target_include_directories( Catch INTERFACE ${CATCH_INCLUDE_DIR} ) file( GLOB_RECURSE TEST_SRCS RELATIVE ${CMAKE_SOURCE_DIR} "tests/*.cpp" )
file( GLOB_RECURSE TEST_SRCS RELATIVE ${CMAKE_SOURCE_DIR} "tests/*.cpp" ) list( REMOVE_ITEM SRCS "src/main.cpp" )
list( REMOVE_ITEM SRCS "src/main.cpp" ) add_executable( unit_tests ${TEST_SRCS} ${SRCS} ${EXT_SRCS} )
add_executable( unit_tests ${TEST_SRCS} ${SRCS} ${EXT_SRCS} ) target_compile_definitions( unit_tests PUBLIC BUILD_TESTING )
target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} ) target_compile_definitions( unit_tests PUBLIC TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" ) target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} )
if( CMAKE_COMPILER_IS_GNUCXX ) target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w ) if( CMAKE_COMPILER_IS_GNUCXX )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" ) set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w )
target_link_libraries( unit_tests Catch gcov ) target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" )
target_link_libraries( unit_tests Catch gcov )
endif()
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
catch_discover_tests( unit_tests )
endif()
#################################################
### BUILD GUI ###################################
if( BUILD_GUI )
find_package( Qt5 COMPONENTS Core Widgets Gui OpenGL REQUIRED )
find_package( VTK COMPONENTS vtkGUISupportQt vtkInteractionStyle vtkInteractionWidgets vtkRenderingAnnotation vtkRenderingCore vtkRenderingFreeType vtkRenderingOpenGL2 REQUIRED )
include_directories( ${CMAKE_SOURCE_DIR}/include/gui )
file( GLOB_RECURSE GUI_SRCS RELATIVE ${CMAKE_SOURCE_DIR} "src/gui/*" )
file( GLOB_RECURSE GUI_INCL RELATIVE ${CMAKE_SOURCE_DIR} "include/gui/*" )
add_executable( ${CMAKE_PROJECT_NAME}_gui ${SRCS} ${EXT_SRCS} ${GUI_SRCS} ${GUI_INCL})
target_compile_definitions( ${CMAKE_PROJECT_NAME}_gui PUBLIC BUILD_GUI )
set_target_properties( ${CMAKE_PROJECT_NAME}_gui PROPERTIES AUTOMOC ON )
set_target_properties( ${CMAKE_PROJECT_NAME}_gui PROPERTIES AUTOUIC ON )
set_target_properties( ${CMAKE_PROJECT_NAME}_gui PROPERTIES AUTORCC ON )
set( GUI_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL ${VTK_LIBRARIES} )
target_link_libraries( ${CMAKE_PROJECT_NAME}_gui ${CORE_LIBRARIES} ${GUI_LIBRARIES} )
set_target_properties( ${CMAKE_PROJECT_NAME}_gui PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin" )
target_compile_options( ${CMAKE_PROJECT_NAME}_gui PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
target_compile_options( ${CMAKE_PROJECT_NAME}_gui PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( ${CMAKE_PROJECT_NAME}_gui PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
endif() endif()
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
catch_discover_tests( unit_tests )
enable_testing()
################################################# #################################################
Subproject commit ff349a50bfc6214b4081f4ca63c7de35e2162f60 Subproject commit 0e9bae1cdb5d7bcd967bcab10539805cc3bccb32
blaze @ 69e2fe55
Subproject commit 0380370f0626de2ad0ec7ea815803e22bbf6b42e Subproject commit 69e2fe554e72d90efc39ceec72d8cbddf88802a8
Subproject commit 54f38c0a6154004efa2f8cad4737d127f6dcde59
Subproject commit cbe9448650176797739dbab13961ef4c07f4290f Subproject commit 83b9149930f392d7797b54fe97a66ab3f2120671
/*! /*!
* @file config.h * @file config.h
* @brief Class to handle all options and their pre and postprocessing. * @brief: Class to handle all options and their pre and postprocessing.
* DO NOT CREATE SETTERS FOR THIS CLASS! ALL OPTIONS ARE CONSTANT (after SetPostprocessing).
*
* @author S. Schotthöfer * @author S. Schotthöfer
* *
* Disclaimer: This class structure was copied and modifed with open source permission from SU2 v7.0.3 https://su2code.github.io/ * Disclaimer: This class structure was copied and (heavily) modifed with open source permission from SU2 v7.0.3 https://su2code.github.io/
*/ */
#ifndef CONFIG_H #ifndef CONFIG_H
...@@ -48,7 +50,17 @@ class Config ...@@ -48,7 +50,17 @@ class Config
unsigned _nQuadPoints; unsigned _nQuadPoints;
// Mesh // Mesh
unsigned _nCells; unsigned _nCells; /*!< @brief: Number of cells in the mesh */
unsigned short _dim; /*!< @brief: spatial dimensionality of the mesh/test case */
// Boundary Conditions
/*!< @brief List of all Pairs (marker, BOUNDARY_TYPE), e.g. (farfield,DIRICHLET).
Each Boundary Conditions must have an entry in enum BOUNDARY_TYPE*/
std::vector<std::pair<std::string, BOUNDARY_TYPE>> _boundaries;
unsigned short _nMarkerDirichlet; /*!< @brief Number of Dirichlet BC markers. Enum entry: DIRICHLET */
unsigned short _nMarkerNeumann; /*!< @brief Number of Neumann BC markers. Enum entry: Neumann */
std::vector<std::string> _MarkerDirichlet; /*!< @brief Dirichlet BC markers. */
std::vector<std::string> _MarkerNeumann; /*!< @brief Neumann BC markers. */
// Solver // Solver
double _CFL; /*!< @brief CFL Number for Solver*/ double _CFL; /*!< @brief CFL Number for Solver*/
...@@ -59,38 +71,40 @@ class Config ...@@ -59,38 +71,40 @@ class Config
unsigned short _maxMomentDegree; /*!< @brief Maximal Order of Moments for PN and MN Solver */ unsigned short _maxMomentDegree; /*!< @brief Maximal Order of Moments for PN and MN Solver */
unsigned short _reconsOrder; /*!< @brief Spatial Order of Accuracy for Solver */ unsigned short _reconsOrder; /*!< @brief Spatial Order of Accuracy for Solver */
// Linesource
double _sigmaS; /*!< @brief Scattering coeffient for Linesource test case */
/*!< @brief If true, very low entries (10^-10 or smaller) of the flux matrices will be set to zero, /*!< @brief If true, very low entries (10^-10 or smaller) of the flux matrices will be set to zero,
* to improve floating point accuracy */ * to improve floating point accuracy */
bool _cleanFluxMat; bool _cleanFluxMat;
bool _allGaussPts; /*!< @brief If true, the SN Solver uses all Gauss pts in the quadrature */ bool _allGaussPts; /*!< @brief If true, the SN Solver uses all Gauss pts in the quadrature */
bool _csd; /*!< @brief If true, continuous slowing down approximation will be used */
bool _csd; /*!< @brief If true, continuous slowing down approximation will be used */ // --- Problems ---
std::string _hydrogenFile; /*!< @brief Name of hydrogen cross section file */
std::string _oxygenFile; /*!< @brief Name of oxygen cross section file */
// Boundary Conditions // Linesource
/*!< @brief List of all Pairs (marker, BOUNDARY_TYPE), e.g. (farfield,DIRICHLET). double _sigmaS; /*!< @brief Scattering coeffient for Linesource test case */
Each Boundary Conditions must have an entry in enum BOUNDARY_TYPE*/
std::vector<std::pair<std::string, BOUNDARY_TYPE>> _boundaries; // Database ICRU
unsigned short _nMarkerDirichlet; /*!< @brief Number of Dirichlet BC markers. Enum entry: DIRICHLET */ std::string _dataDir; /*!< @brief material directory */
unsigned short _nMarkerNeumann; /*!< @brief Number of Neumann BC markers. Enum entry: Neumann */ // ElectronRT
std::vector<std::string> _MarkerDirichlet; /*!< @brief Dirichlet BC markers. */ std::string _hydrogenFile; /*!< @brief Name of hydrogen cross section file path*/
std::vector<std::string> _MarkerNeumann; /*!< @brief Neumann BC markers. */ std::string _oxygenFile; /*!< @brief Name of oxygen cross section file path */
std::string _stoppingPowerFile; /*!< @brief Name of stopping power file path */
// Scattering Kernel // Scattering Kernel
KERNEL_NAME _kernelName; /*!< @brief Scattering Kernel Name*/ KERNEL_NAME _kernelName; /*!< @brief Scattering Kernel Name*/
// Spherical Basis
SPHERICAL_BASIS_NAME _sphericalBasisName; /*!< @brief: Name of the basis on the unit sphere */
// Optimizer // Optimizer
OPTIMIZER_NAME _entropyOptimizerName; /*!< @brief Choice of optimizer */ OPTIMIZER_NAME _entropyOptimizerName; /*!< @brief Choice of optimizer */
double _optimizerEpsilon; /*!< @brief termination criterion epsilon for Newton Optmizer */ double _optimizerEpsilon; /*!< @brief termination criterion epsilon for Newton Optmizer */
unsigned short _newtonIter; /*!< @brief Maximal Number of newton iterations */ unsigned long _newtonIter; /*!< @brief Maximal Number of newton iterations */
double _newtonStepSize; /*!< @brief Stepsize factor for newton optimizer */ double _newtonStepSize; /*!< @brief Stepsize factor for newton optimizer */
unsigned short _newtonLineSearchIter; /*!< @brief Maximal Number of line search iterations for newton optimizer */ unsigned long _newtonLineSearchIter; /*!< @brief Maximal Number of line search iterations for newton optimizer */
bool _newtonFastMode; /*!< @brief If true, we skip the NewtonOptimizer for quadratic entropy and assign alpha = u */ bool _newtonFastMode; /*!< @brief If true, we skip the NewtonOptimizer for quadratic entropy and assign alpha = u */
// NeuralModel
unsigned short _neuralModel; /*!< @brief: Version number of the employed neural model */
// Output Options // Output Options
unsigned short _nVolumeOutput; /*!< @brief Number of volume outputs */ unsigned short _nVolumeOutput; /*!< @brief Number of volume outputs */
std::vector<VOLUME_OUTPUT> _volumeOutput; /*!< @brief Output groups for volume output*/ std::vector<VOLUME_OUTPUT> _volumeOutput; /*!< @brief Output groups for volume output*/
...@@ -104,6 +118,13 @@ class Config ...@@ -104,6 +118,13 @@ class Config
std::vector<SCALAR_OUTPUT> _historyOutput; /*!< @brief Output groups for screen output*/ std::vector<SCALAR_OUTPUT> _historyOutput; /*!< @brief Output groups for screen output*/
unsigned short _historyOutputFrequency; /*!< @brief Frequency of screen output*/ unsigned short _historyOutputFrequency; /*!< @brief Frequency of screen output*/
// 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 */
// --- Parsing Functionality and Initializing of Options --- // --- Parsing Functionality and Initializing of Options ---
/*! /*!
* @brief Set default values for all options not yet set. * @brief Set default values for all options not yet set.
...@@ -223,13 +244,18 @@ class Config ...@@ -223,13 +244,18 @@ class Config
*/ */
// File structure // File structure
std::string inline GetCTFile() const { return std::filesystem::path( _ctFile ).lexically_normal(); } std::string inline GetCTFile() const { return std::filesystem::path( _ctFile ).lexically_normal(); }
std::string inline GetHydrogenFile() const { return std::filesystem::path( _hydrogenFile ).lexically_normal(); }
std::string inline GetLogDir() const { return std::filesystem::path( _logDir ).lexically_normal(); } std::string inline GetLogDir() const { return std::filesystem::path( _logDir ).lexically_normal(); }
std::string inline GetLogFile() const { return std::filesystem::path( _logFileName ).lexically_normal(); } std::string inline GetLogFile() const { return std::filesystem::path( _logFileName ).lexically_normal(); }
std::string inline GetMeshFile() const { return std::filesystem::path( _meshFile ).lexically_normal(); } std::string inline GetMeshFile() const { return std::filesystem::path( _meshFile ).lexically_normal(); }
std::string inline GetOutputDir() const { return std::filesystem::path( _outputDir ).lexically_normal(); } std::string inline GetOutputDir() const { return std::filesystem::path( _outputDir ).lexically_normal(); }
std::string inline GetOutputFile() const { return std::filesystem::path( _outputFile ).lexically_normal(); } std::string inline GetOutputFile() const { return std::filesystem::path( _outputFile ).lexically_normal(); }
// Problem Files
std::string inline GetHydrogenFile() const { return std::filesystem::path( _hydrogenFile ).lexically_normal(); }
std::string inline GetOxygenFile() const { return std::filesystem::path( _oxygenFile ).lexically_normal(); } std::string inline GetOxygenFile() const { return std::filesystem::path( _oxygenFile ).lexically_normal(); }
std::string inline GetStoppingPowerFile() const { return std::filesystem::path( _stoppingPowerFile ).lexically_normal(); }
std::string inline GetDataDir() const { return std::filesystem::path( _dataDir ).lexically_normal(); }
// Quadrature Structure // Quadrature Structure
unsigned GetNQuadPoints() { return _nQuadPoints; } unsigned GetNQuadPoints() { return _nQuadPoints; }
...@@ -238,6 +264,7 @@ class Config ...@@ -238,6 +264,7 @@ class Config
// Mesh Structure // Mesh Structure
unsigned GetNCells() { return _nCells; } unsigned GetNCells() { return _nCells; }
unsigned short GetDim() { return _dim; }
// Solver Structure // Solver Structure
double inline GetCFL() const { return _CFL; } double inline GetCFL() const { return _CFL; }
...@@ -256,18 +283,23 @@ class Config ...@@ -256,18 +283,23 @@ class Config
// Optimizer // Optimizer
double inline GetNewtonOptimizerEpsilon() const { return _optimizerEpsilon; } double inline GetNewtonOptimizerEpsilon() const { return _optimizerEpsilon; }
unsigned inline GetNewtonIter() const { return _newtonIter; } unsigned long inline GetNewtonIter() const { return _newtonIter; }
double inline GetNewtonStepSize() const { return _newtonStepSize; } double inline GetNewtonStepSize() const { return _newtonStepSize; }
unsigned inline GetNewtonMaxLineSearches() const { return _newtonLineSearchIter; } unsigned long inline GetNewtonMaxLineSearches() const { return _newtonLineSearchIter; }
bool inline GetNewtonFastMode() const { return _newtonFastMode; } bool inline GetNewtonFastMode() const { return _newtonFastMode; }
OPTIMIZER_NAME inline GetOptimizerName() const { return _entropyOptimizerName; } OPTIMIZER_NAME inline GetOptimizerName() const { return _entropyOptimizerName; }
// Neural Closure
unsigned short inline GetNeuralModel() { return _neuralModel; }
// Boundary Conditions // Boundary Conditions
BOUNDARY_TYPE GetBoundaryType( std::string nameMarker ) const; /*! @brief Get Boundary Type of given marker */ BOUNDARY_TYPE GetBoundaryType( std::string nameMarker ) const; /*! @brief Get Boundary Type of given marker */
// Scattering Kernel // Scattering Kernel
KERNEL_NAME inline GetKernelName() const { return _kernelName; } KERNEL_NAME inline GetKernelName() const { return _kernelName; }
// Basis name
SPHERICAL_BASIS_NAME inline GetSphericalBasisName() const { return _sphericalBasisName; }
// Output Structure // Output Structure
std::vector<VOLUME_OUTPUT> inline GetVolumeOutput() { return _volumeOutput; } std::vector<VOLUME_OUTPUT> inline GetVolumeOutput() { return _volumeOutput; }
unsigned short inline GetNVolumeOutput() { return _nVolumeOutput; } unsigned short inline GetNVolumeOutput() { return _nVolumeOutput; }
...@@ -280,10 +312,17 @@ class Config ...@@ -280,10 +312,17 @@ class Config
std::vector<SCALAR_OUTPUT> inline GetHistoryOutput() { return _historyOutput; } std::vector<SCALAR_OUTPUT> inline GetHistoryOutput() { return _historyOutput; }
unsigned short inline GetNHistoryOutput() { return _nHistoryOutput; } unsigned short inline GetNHistoryOutput() { return _nHistoryOutput; }
unsigned short inline GetHistoryOutputFrequency() { return _historyOutputFrequency; } unsigned short inline GetHistoryOutputFrequency() { return _historyOutputFrequency; }
// ---- Setters for option structure
// Data generator
bool inline GetDataGeneratorMode() { return _dataGeneratorMode; }
unsigned long inline GetTrainingDataSetSize() { return _tainingSetSize; }
unsigned long inline GetMaxValFirstMoment() { return _maxValFirstMoment; }
double GetBoundaryDistanceRealizableSet() { return _boundaryDistanceRealizableSet; }
// ---- Setters for option structure
// This section is dangerous
// Quadrature Structure // Quadrature Structure
void SetNQuadPoints( unsigned nq ) { _nQuadPoints = nq; } void SetNQuadPoints( unsigned nq ) { _nQuadPoints = nq; } /*! @brief Never change the nq! This is only for the test framework. */
void SetQuadName( QUAD_NAME quadName ) { _quadName = quadName; } /*! @brief Never change the quadName! This is only for the test framework. */ void SetQuadName( QUAD_NAME quadName ) { _quadName = quadName; } /*! @brief Never change the quadName! This is only for the test framework. */
void SetQuadOrder( unsigned quadOrder ) { _quadOrder = quadOrder; } /*! @brief Never change the quadOrder! This is only for the test framework. */ void SetQuadOrder( unsigned quadOrder ) { _quadOrder = quadOrder; } /*! @brief Never change the quadOrder! This is only for the test framework. */
void SetSNAllGaussPts( bool useall ) { _allGaussPts = useall; } /*! @brief Never change the this! This is only for the test framework. */ void SetSNAllGaussPts( bool useall ) { _allGaussPts = useall; } /*! @brief Never change the this! This is only for the test framework. */
......
/*! /*!
* \file GlobalConstants.h * \file GlobalConstants.h
* \brief All global defined (physical) constants, enums etc * \brief All global defined (physical) constants, enums etc
* \author <blank> * \author <blank>
...@@ -55,7 +55,16 @@ enum BOUNDARY_TYPE { DIRICHLET, NEUMANN, NONE, INVALID }; ...@@ -55,7 +55,16 @@ enum BOUNDARY_TYPE { DIRICHLET, NEUMANN, NONE, INVALID };
/*! @brief Enum for all currently available quadratures in rtsn. /*! @brief Enum for all currently available quadratures in rtsn.
* Option enums are written in capital letters with underscores as spaces (e.g option "time integration" has option enum "TIME_INTEGRATION") * Option enums are written in capital letters with underscores as spaces (e.g option "time integration" has option enum "TIME_INTEGRATION")
*/ */
enum QUAD_NAME { QUAD_MonteCarlo, QUAD_GaussLegendreTensorized, QUAD_GaussLegendre1D, QUAD_LevelSymmetric, QUAD_Lebedev, QUAD_LDFESA, QUAD_Product }; enum QUAD_NAME {
QUAD_MonteCarlo,
QUAD_GaussLegendreTensorized,
QUAD_GaussLegendre1D,
QUAD_LevelSymmetric,
QUAD_Lebedev,
QUAD_LDFESA,
QUAD_Product,
QUAD_GaussChebyshev1D
};
/*! @brief Conversion Map String to enum /*! @brief Conversion Map String to enum
*/ */
...@@ -77,7 +86,8 @@ enum PROBLEM_NAME { ...@@ -77,7 +86,8 @@ enum PROBLEM_NAME {
PROBLEM_LineSource_Pseudo_1D_Physics, PROBLEM_LineSource_Pseudo_1D_Physics,
PROBLEM_AirCavity, PROBLEM_AirCavity,
PROBLEM_MuscleBoneLung, PROBLEM_MuscleBoneLung,
PROBLEM_Phantom2D PROBLEM_Phantom2D,
PROBLEM_IsotropicSource_2D
}; };
inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_LineSource }, inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_LineSource },
...@@ -87,6 +97,7 @@ inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_ ...@@ -87,6 +97,7 @@ inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_
{ "AIRCAVITY", PROBLEM_AirCavity }, { "AIRCAVITY", PROBLEM_AirCavity },
{ "MUSCLEBONELUNG", PROBLEM_MuscleBoneLung }, { "MUSCLEBONELUNG", PROBLEM_MuscleBoneLung },
{ "PHANTOM2D", PROBLEM_Phantom2D }, { "PHANTOM2D", PROBLEM_Phantom2D },
{ "ISOTROPICPOINTSOURCE2D", PROBLEM_IsotropicSource_2D },
{ "LINESOURCE_PSEUDO_1D", PROBLEM_LineSource_Pseudo_1D }, { "LINESOURCE_PSEUDO_1D", PROBLEM_LineSource_Pseudo_1D },
{ "LINESOURCE_PSEUDO_1D_PHYSICS", PROBLEM_LineSource_Pseudo_1D_Physics } }; { "LINESOURCE_PSEUDO_1D_PHYSICS", PROBLEM_LineSource_Pseudo_1D_Physics } };
...@@ -130,10 +141,10 @@ enum OPTIMIZER_NAME { NEWTON, ML }; ...@@ -130,10 +141,10 @@ enum OPTIMIZER_NAME { NEWTON, ML };
inline std::map<std::string, OPTIMIZER_NAME> Optimizer_Map{ { "NEWTON", NEWTON }, { "ML", ML } }; inline std::map<std::string, OPTIMIZER_NAME> Optimizer_Map{ { "NEWTON", NEWTON }, { "ML", ML } };
// Volume output // Volume output
enum VOLUME_OUTPUT { ANALYTIC, MINIMAL, MOMENTS, DUAL_MOMENTS, DOSE }; enum VOLUME_OUTPUT { ANALYTIC, MINIMAL, MOMENTS, DUAL_MOMENTS, MEDICAL };
inline std::map<std::string, VOLUME_OUTPUT> VolOutput_Map{ inline std::map<std::string, VOLUME_OUTPUT> VolOutput_Map{
{ "ANALYTIC", ANALYTIC }, { "MINIMAL", MINIMAL }, { "MOMENTS", MOMENTS }, { "DUAL_MOMENTS", DUAL_MOMENTS }, { "DOSE", DOSE } }; { "ANALYTIC", ANALYTIC }, { "MINIMAL", MINIMAL }, { "MOMENTS", MOMENTS }, { "DUAL_MOMENTS", DUAL_MOMENTS }, { "MEDICAL", MEDICAL } };
// Scalar output // Scalar output
enum SCALAR_OUTPUT { ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT }; enum SCALAR_OUTPUT { ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT };
...@@ -141,4 +152,10 @@ enum SCALAR_OUTPUT { ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT }; ...@@ -141,4 +152,10 @@ enum SCALAR_OUTPUT { ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT };
inline std::map<std::string, SCALAR_OUTPUT> ScalarOutput_Map{ inline std::map<std::string, SCALAR_OUTPUT> ScalarOutput_Map{
{ "ITER", ITER }, { "MASS", MASS }, { "RMS_FLUX", RMS_FLUX }, { "VTK_OUTPUT", VTK_OUTPUT }, { "CSV_OUTPUT", CSV_OUTPUT } }; { "ITER", ITER }, { "MASS", MASS }, { "RMS_FLUX", RMS_FLUX }, { "VTK_OUTPUT", VTK_OUTPUT }, { "CSV_OUTPUT", CSV_OUTPUT } };
// Spherical Basis Name
enum SPHERICAL_BASIS_NAME { SPHERICAL_HARMONICS, SPHERICAL_MONOMIALS };
inline std::map<std::string, SPHERICAL_BASIS_NAME> SphericalBasis_Map{ { "SPHERICAL_HARMONICS", SPHERICAL_HARMONICS },
{ "SPHERICAL_MONOMIALS", SPHERICAL_MONOMIALS } };
#endif // GLOBAL_CONSTANTS_H