Commit 96ad94b5 authored by jannick.wolters's avatar jannick.wolters
Browse files

merged current master


Former-commit-id: a54b06bb
parents 2360c430 7590242d
...@@ -8,7 +8,7 @@ unit_tests: ...@@ -8,7 +8,7 @@ unit_tests:
script: script:
- git submodule update --init --recursive - git submodule update --init --recursive
- cd code/build/release - cd code/build/release
- 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 ../../
......
cmake_minimum_required( VERSION 3.12.4 ) cmake_minimum_required( VERSION 3.12.4 )
project( KiT-RT VERSION 0.0.2 LANGUAGES CXX ) project( KiT-RT VERSION 0.1.0 LANGUAGES CXX )
### OPTIONS ##################################### ### OPTIONS #####################################
option( build_tests "enables compiling of unit_tests" OFF ) option( build_tests "enables compiling of unit_tests" OFF )
......
...@@ -22,7 +22,7 @@ class OptionBase ...@@ -22,7 +22,7 @@ class OptionBase
std::vector<std::string> _value; /*! @brief: String name of the option */ std::vector<std::string> _value; /*! @brief: String name of the option */
public: public:
OptionBase(){}; OptionBase() {}
virtual ~OptionBase() = 0; virtual ~OptionBase() = 0;
virtual std::string SetValue( std::vector<std::string> value ); /*! @brief: Set string name of the option */ virtual std::string SetValue( std::vector<std::string> value ); /*! @brief: Set string name of the option */
...@@ -45,7 +45,7 @@ class OptionDouble : public OptionBase ...@@ -45,7 +45,7 @@ class OptionDouble : public OptionBase
public: public:
OptionDouble( std::string option_field_name, double& option_field, double default_value ); OptionDouble( std::string option_field_name, double& option_field, double default_value );
~OptionDouble() override{}; ~OptionDouble() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -61,7 +61,7 @@ class OptionString : public OptionBase ...@@ -61,7 +61,7 @@ class OptionString : public OptionBase
public: public:
OptionString( std::string option_field_name, std::string& option_field, std::string default_value ); OptionString( std::string option_field_name, std::string& option_field, std::string default_value );
~OptionString() override{}; ~OptionString() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -77,7 +77,7 @@ class OptionInt : public OptionBase ...@@ -77,7 +77,7 @@ class OptionInt : public OptionBase
public: public:
OptionInt( std::string option_field_name, int& option_field, int default_value ); OptionInt( std::string option_field_name, int& option_field, int default_value );
~OptionInt() override{}; ~OptionInt() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -93,7 +93,7 @@ class OptionULong : public OptionBase ...@@ -93,7 +93,7 @@ class OptionULong : public OptionBase
public: public:
OptionULong( std::string option_field_name, unsigned long& option_field, unsigned long default_value ); OptionULong( std::string option_field_name, unsigned long& option_field, unsigned long default_value );
~OptionULong() override{}; ~OptionULong() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -109,7 +109,7 @@ class OptionUShort : public OptionBase ...@@ -109,7 +109,7 @@ class OptionUShort : public OptionBase
public: public:
OptionUShort( std::string option_field_name, unsigned short& option_field, unsigned short default_value ); OptionUShort( std::string option_field_name, unsigned short& option_field, unsigned short default_value );
~OptionUShort() override{}; ~OptionUShort() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -125,7 +125,7 @@ class OptionLong : public OptionBase ...@@ -125,7 +125,7 @@ class OptionLong : public OptionBase
public: public:
OptionLong( std::string option_field_name, long& option_field, long default_value ); OptionLong( std::string option_field_name, long& option_field, long default_value );
~OptionLong() override{}; ~OptionLong() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -141,7 +141,7 @@ class OptionBool : public OptionBase ...@@ -141,7 +141,7 @@ class OptionBool : public OptionBase
public: public:
OptionBool( std::string option_field_name, bool& option_field, bool default_value ); OptionBool( std::string option_field_name, bool& option_field, bool default_value );
~OptionBool() override{}; ~OptionBool() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
...@@ -157,7 +157,7 @@ class OptionStringList : public OptionBase ...@@ -157,7 +157,7 @@ class OptionStringList : public OptionBase
public: public:
OptionStringList( std::string option_field_name, unsigned short& list_size, std::vector<std::string>& option_field ); OptionStringList( std::string option_field_name, unsigned short& list_size, std::vector<std::string>& option_field );
~OptionStringList() override{}; ~OptionStringList() override {}
std::string SetValue( std::vector<std::string> option_value ) override; std::string SetValue( std::vector<std::string> option_value ) override;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Disclaimer: This is copied from the code distributed with the ICRU 77 report * Disclaimer: This is copied from the code distributed with the ICRU 77 report
* Link: https://icru.org/home/reports/elastic-scattering-of-electrons-and-positrons-icru-report-77 * Link: https://icru.org/home/reports/elastic-scattering-of-electrons-and-positrons-icru-report-77
*/ */
#ifndef ICRU_H #ifndef ICRU_H
#define ICRU_H #define ICRU_H
......
/*! @file: qproduct.h
* @brief: Product quadrature implementation. Implementation is done accordingly to Kendall Atkinson 1981, Australian Matematical Society.
* @author: J. Kusch
*/
#ifndef PRODUCTQUADRATURE_H #ifndef PRODUCTQUADRATURE_H
#define PRODUCTQUADRATURE_H #define PRODUCTQUADRATURE_H
#include "quadraturebase.h" #include "quadraturebase.h"
class ProductQuadrature : public QuadratureBase class QProduct : public QuadratureBase
{ {
// Implementation is done accordingly to Kendall Atkinson 1981, Australian Matematical Society.
private: private:
double Pythag( const double a, const double b ); double Pythag( const double a, const double b );
std::pair<Vector, Matrix> ComputeEigenValTriDiagMatrix( const Matrix& mat ); std::pair<Vector, Matrix> ComputeEigenValTriDiagMatrix( const Matrix& mat );
bool CheckOrder(); bool CheckOrder();
public: public:
ProductQuadrature( Config* settings ); QProduct( Config* settings );
ProductQuadrature( unsigned order ); QProduct( unsigned order );
virtual ~ProductQuadrature() {} virtual ~QProduct() {}
inline void SetName() override { _name = "Product quadrature"; } inline void SetName() override { _name = "Product quadrature"; }
inline void SetNq() override { _nq = 4 * pow( GetOrder(), 2 ); } inline void SetNq() override { _nq = 4 * pow( GetOrder(), 2 ); }
......
/*! @file: quadraturebase.h
* @brief: Base class for all quadrature rules in KiT-RT
* @author: S. Schotthöfer
*/
#ifndef QUADRATURE_H #ifndef QUADRATURE_H
#define QUADRATURE_H #define QUADRATURE_H
...@@ -9,8 +14,13 @@ class Config; ...@@ -9,8 +14,13 @@ class Config;
class QuadratureBase class QuadratureBase
{ {
public: public:
/*! @brief: Constructor using settings class. This is the recommended constructor.
* @param: Config* settings: Settings class storing all important options.
*/
QuadratureBase( Config* settings ); QuadratureBase( Config* settings );
QuadratureBase( unsigned order ); // Only for productquadrature... refactor this! /*! @brief: Constructor using directly the order of the quadrature. Not applicable for GaussLegendre, that need additional options.
It sets member _settings = nulltpr.*/
QuadratureBase( unsigned order );
virtual ~QuadratureBase() {} virtual ~QuadratureBase() {}
// Aux functions // Aux functions
...@@ -37,13 +47,13 @@ class QuadratureBase ...@@ -37,13 +47,13 @@ class QuadratureBase
/*! @brief Creates a quadrature rule with a given name and a given order. /*! @brief Creates a quadrature rule with a given name and a given order.
* @param: Config* settings: Settings to handle quadrature options * @param: Config* settings: Settings to handle quadrature options
* @returns Quadrature* quadrature: returns pointer to instance of the given derived quadrature class */ * @returns Quadrature* quadrature: returns pointer to instance of the given derived quadrature class */
static QuadratureBase* CreateQuadrature( Config* settings ); static QuadratureBase* Create( Config* settings );
/*! @brief Creates a quadrature rule with a given name and a given order. /*! @brief Creates a quadrature rule with a given name and a given order.
* @param: name: name of quadrature as enum * @param: name: name of quadrature as enum
* @param: quadOrder: order of quadrature * @param: quadOrder: order of quadrature
* @returns Quadrature* quadrature: returns pointer to instance of the given derived quadrature class */ * @returns Quadrature* quadrature: returns pointer to instance of the given derived quadrature class */
static QuadratureBase* CreateQuadrature( QUAD_NAME name, unsigned quadOrder ); static QuadratureBase* Create( QUAD_NAME name, unsigned quadOrder );
// Getter // Getter
inline std::string GetName() const { return _name; } /*! @returns std::string _name: name of the quadrature */ inline std::string GetName() const { return _name; } /*! @returns std::string _name: name of the quadrature */
......
#ifndef CSDSNSOLVER_H #ifndef CSDSNSOLVER_H
#define CSDSNSOLVER_H #define CSDSNSOLVER_H
#include "icru.h"
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
class CSDSNSolver : public SNSolver class CSDSNSolver : public SNSolver
......
#ifndef CSDSNSOLVERFP_H #ifndef CSDSNSOLVERFP_H
#define CSDSNSOLVERFP_H #define CSDSNSOLVERFP_H
#include "icru.h"
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
class Physics; class Physics;
......
#ifndef CSDSNSOLVERNOTRAFO_H #ifndef CSDSNSOLVERNOTRAFO_H
#define CSDSNSOLVERNOTRAFO_H #define CSDSNSOLVERNOTRAFO_H
#include "icru.h"
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
class Physics; class Physics;
......
#ifndef CSDSOLVERTRAFOFP_H #ifndef CSDSOLVERTRAFOFP_H
#define CSDSOLVERTRAFOFP_H #define CSDSOLVERTRAFOFP_H
#include "icru.h"
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
class Physics; class Physics;
...@@ -29,7 +28,8 @@ class CSDSolverTrafoFP : public SNSolver ...@@ -29,7 +28,8 @@ class CSDSolverTrafoFP : public SNSolver
Vector _xi1; Vector _xi1;
Vector _xi2; Vector _xi2;
unsigned _FPMethod; /*! @brief Encodes different ways of computing coefficients alpha, alpha2 & beta, _FPMethod == 1, 2 ,3 stand for methods with increasing accuracy (see Olbrant 2010, Appendix B)*/ unsigned _FPMethod; /*! @brief Encodes different ways of computing coefficients alpha, alpha2 & beta, _FPMethod == 1, 2 ,3 stand for methods with
increasing accuracy (see Olbrant 2010, Appendix B)*/
bool _RT; /*! @brief radiotherapy application (on/off), if true use crosssections + stopping powers from database */ bool _RT; /*! @brief radiotherapy application (on/off), if true use crosssections + stopping powers from database */
......
#ifndef CSDSOLVERTRAFOFP2D_H #ifndef CSDSOLVERTRAFOFP2D_H
#define CSDSOLVERTRAFOFP2D_H #define CSDSOLVERTRAFOFP2D_H
#include "icru.h"
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
class Physics; class Physics;
......
...@@ -8,12 +8,11 @@ ...@@ -8,12 +8,11 @@
#include "common/config.h" #include "common/config.h"
#include "common/io.h" #include "common/io.h"
#include "fluxes/numericalflux.h" #include "fluxes/numericalflux.h"
#include "icru.h"
#include "kernels/scatteringkernelbase.h" #include "kernels/scatteringkernelbase.h"
#include "problems/problembase.h" #include "problems/problembase.h"
#include "quadratures/quadraturebase.h" #include "quadratures/quadraturebase.h"
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
#include "sphericalharmonics.h" #include "toolboxes/sphericalharmonics.h"
class Physics; class Physics;
......
...@@ -42,6 +42,9 @@ class MNSolver : public Solver ...@@ -42,6 +42,9 @@ class MNSolver : public Solver
Layout: _nCells x _nTotalEntries*/ Layout: _nCells x _nTotalEntries*/
OptimizerBase* _optimizer; /*! @brief: Class to solve minimal entropy problem */ OptimizerBase* _optimizer; /*! @brief: Class to solve minimal entropy problem */
VectorVector _solDx; /*! @brief: temporary storage of x-derivatives of alpha */
VectorVector _solDy; /*! @brief: temporary storage of y-derivatives of alpha */
// ---- Private Member functions --- // ---- Private Member functions ---
// IO // IO
......
#ifndef PNSOLVER_H #ifndef PNSOLVER_H
#define PNSOLVER_H #define PNSOLVER_H
#include "solverbase.h" #include "solvers/solverbase.h"
class PNSolver : public Solver class PNSolver : public Solver
{ {
...@@ -38,6 +38,9 @@ class PNSolver : public Solver ...@@ -38,6 +38,9 @@ class PNSolver : public Solver
Vector _scatterMatDiag; /*! @brief: diagonal of the scattering matrix (its a diagonal matrix by construction). Contains eigenvalues of the Vector _scatterMatDiag; /*! @brief: diagonal of the scattering matrix (its a diagonal matrix by construction). Contains eigenvalues of the
scattering kernel. */ scattering kernel. */
VectorVector _solDx; /*! @brief: temporary storage of x-derivatives of solution */
VectorVector _solDy; /*! @brief: temporary storage of y-derivatives of solution */
// ---- Member functions ---- // ---- Member functions ----
// IO // IO
......
...@@ -14,6 +14,7 @@ class Mesh; ...@@ -14,6 +14,7 @@ class Mesh;
class Config; class Config;
class ProblemBase; class ProblemBase;
class QuadratureBase; class QuadratureBase;
class Reconstructor;
class Solver class Solver
{ {
...@@ -51,6 +52,14 @@ class Solver ...@@ -51,6 +52,14 @@ class Solver
/*! @brief edge neighbor cell ids, dim(_neighbors) = (_NCells,nEdgesPerCell) */ /*! @brief edge neighbor cell ids, dim(_neighbors) = (_NCells,nEdgesPerCell) */
std::vector<std::vector<unsigned>> _neighbors; std::vector<std::vector<unsigned>> _neighbors;
// slope related params
Reconstructor* _reconstructor; /*! @brief reconstructor object for high-order scheme */
unsigned _reconsOrder; /*! @brief reconstruction order (current: 1 & 2) */
VectorVector _psiDx; /*! @brief slope of solutions in X direction */
VectorVector _psiDy; /*! @brief slope of solutions in Y direction */
VectorVector _cellMidPoints; /*! @brief middle point locations of elements */
std::vector<std::vector<Vector>> _interfaceMidPoints; /*! @brief middle point locations of edges */
// Solution related members // Solution related members
VectorVector _sol; /*! @brief solution of the PDE, e.g. angular flux or moments */ VectorVector _sol; /*! @brief solution of the PDE, e.g. angular flux or moments */
std::vector<double> _solverOutput; /*! @brief LEGACY: Outputfield for solver ==> Will be replaced by _outputFields in the near future */ std::vector<double> _solverOutput; /*! @brief LEGACY: Outputfield for solver ==> Will be replaced by _outputFields in the near future */
......
...@@ -15,12 +15,18 @@ class Config; ...@@ -15,12 +15,18 @@ class Config;
class Reconstructor class Reconstructor
{ {
protected:
unsigned _reconsOrder;
public: public:
/** /**
* @brief Reconstruction * @brief Reconstruction
* @param settings * @param settings
*/ */
Reconstructor( Config* settings ); Reconstructor( Config* settings );
static Reconstructor* Create( Config* settings );
unsigned inline GetReconsOrder() { return _reconsOrder; }
/*! Method 1: structured developing /*! Method 1: structured developing
* @brief Slope of angular flux psi inside a given cell * @brief Slope of angular flux psi inside a given cell
......
...@@ -36,6 +36,8 @@ MAX_MOMENT_SOLVER = 0 ...@@ -36,6 +36,8 @@ MAX_MOMENT_SOLVER = 0
%% Entropy settings %% Entropy settings
ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN
ENTROPY_OPTIMIZER = NEWTON ENTROPY_OPTIMIZER = NEWTON
% Reconstruction order
RECONS_ORDER = 2
% %
% ----- Newton Solver Specifications ---- % ----- Newton Solver Specifications ----
% %
......
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