Commit d3b5fd20 authored by jannick.wolters's avatar jannick.wolters
Browse files

applied clang-format to all files - please use the provided format file!; updated uml diagram

parent e0d6f29f
Pipeline #87785 passed with stages
in 6 minutes and 20 seconds
#ifndef LAXFRIEDRICHSFLUX_H
#define LAXFRIEDRICHSFLUX_H
#include "typedef.h"
#include "numericalflux.h"
#include "typedef.h"
class LaxFriedrichsFlux : public NumericalFlux
{
double _dt;
public:
public:
/**
* @brief LaxFriedrichsFlux
* @param settings
*/
LaxFriedrichsFlux(Config* settings);
LaxFriedrichsFlux( Config* settings );
/**
* @brief Flux computes flux on edge for fixed ordinate at a given edge
......@@ -22,7 +23,7 @@ public:
* @param n scaled normal vector of given edge
* @return numerical flux value
*/
virtual double Flux(const Vector& Omega, double psiL, double psiR, const Vector& n)const;
virtual double Flux( const Vector& Omega, double psiL, double psiR, const Vector& n ) const;
};
#endif // LAXFRIEDRICHSFLUX_H
#endif // LAXFRIEDRICHSFLUX_H
#ifndef NUMERICALFLUX_H
#define NUMERICALFLUX_H
#include "typedef.h"
#include "settings/config.h"
#include "typedef.h"
class NumericalFlux
{
public:
NumericalFlux(Config* settings);
public:
NumericalFlux( Config* settings );
static NumericalFlux* Create( Config* settings );
/**
* @brief Flux computes flux on edge for fixed ordinate at a given edge
......@@ -17,7 +17,7 @@ public:
* @param n scaled normal vector of given edge
* @return numerical flux value
*/
virtual double Flux(const Vector& Omega, double psiL, double psiR, const Vector& n)const = 0;
virtual double Flux( const Vector& Omega, double psiL, double psiR, const Vector& n ) const = 0;
};
#endif // NUMERICALFLUX_H
#endif // NUMERICALFLUX_H
......@@ -2,13 +2,13 @@
#define PHYSICS_H
// include Matrix, Vector definitions
#include "typedef.h"
#include "settings/config.h"
#include "typedef.h"
class Physics {
class Physics
{
private:
private:
Matrix _xsH2O;
Matrix _totalxsH2O;
/**
......@@ -16,23 +16,23 @@ private:
* @param fileName1 is name of cross section file
* @param fileName2 is name of total cross section file
*/
void LoadXSH2O (std::string fileName1,std::string fileName2);
void LoadXSH2O( std::string fileName1, std::string fileName2 );
public:
/**
public:
/**
* @brief GetScatteringXS gives back vector of vectors of scattering cross sections for materials defined by density and energies in vector energy
* @param energies is vector with energies
* @param density is vector with patient densities (at different spatial cells)
* @param Omega are scattering angles
*/
VectorVector GetScatteringXS (std::vector<double> energies,std::vector<double> density, std::vector<double> Omegas);
VectorVector GetScatteringXS( std::vector<double> energies, std::vector<double> density, std::vector<double> Omegas );
/**
* @brief GetTotalXS gives back vector of vectors of total cross sections for materials defined by density and energies in vector energy
* @param energies is vector with energies
* @param density is vector with patient densities (at different spatial cells)
*/
VectorVector GetTotalXS (std::vector<double> energies,std::vector<double> density);
VectorVector GetTotalXS( std::vector<double> energies, std::vector<double> density );
/**
* @brief GetStoppingPower gives back vector of vectors of stopping powers for materials defined by density and energies in vector energy
......@@ -40,21 +40,20 @@ public:
* @param density is vector with patient densities (at different spatial cells)
* @param sH2O is vector of stopping powers in water
*/
VectorVector GetStoppingPower (std::vector<double> energies,std::vector<double> sH2O);
VectorVector GetStoppingPower( std::vector<double> energies, std::vector<double> sH2O );
/**
* @brief Physics constructor
* @param settings stores all needed user information
*/
Physics ( Config* settings );
Physics( Config* settings );
/**
* @brief Create constructor
* @param settings stores all needed information
* @return pointer to Physics
*/
static Physics* Create (Config* settings);
static Physics* Create( Config* settings );
};
#endif
......@@ -23,7 +23,7 @@ class QDummy : public QuadratureBase
void SetName() override;
void SetNq() override;
void SetPointsAndWeights() override;
void SetConnectivity()override;
void SetConnectivity() override;
};
#endif // QDUMMY_H
......@@ -9,8 +9,8 @@ class QGaussLegendreTensorized : public QuadratureBase
QGaussLegendreTensorized( unsigned order );
virtual ~QGaussLegendreTensorized() {}
inline void SetName() override { _name = "Tensorized Gauss-Legendre quadrature."; }
inline void SetNq() override { _nq = pow( GetOrder(), 2 ); }
inline void SetName() override { _name = "Tensorized Gauss-Legendre quadrature."; }
inline void SetNq() override { _nq = pow( GetOrder(), 2 ); }
void SetPointsAndWeights() override;
void SetConnectivity() override;
};
......
......@@ -9,11 +9,11 @@ class QLDFESA : public QLookupQuadrature
QLDFESA( unsigned order );
virtual ~QLDFESA() {}
inline void SetName() override { _name = "LDFESA quadrature"; }
inline void SetName() override { _name = "LDFESA quadrature"; }
void SetAvailOrders() override;
void SetConnectivity() override;
std::string GetLookupTable() override;
};
#endif // QLDFESA_H
#endif // QLDFESA_H
......@@ -9,12 +9,11 @@ class QLebedev : public QLookupQuadrature
QLebedev( unsigned order );
virtual ~QLebedev() {}
inline void SetName() override { _name = "Lebedev quadrature"; }
inline void SetName() override { _name = "Lebedev quadrature"; }
void SetAvailOrders() override;
void SetConnectivity() override;
std::string GetLookupTable() override;
};
#endif // QLEBEDEV_H
#endif // QLEBEDEV_H
......@@ -9,7 +9,7 @@ class QLevelSymmetric : public QLookupQuadrature
QLevelSymmetric( unsigned order );
virtual ~QLevelSymmetric() {}
inline void SetName() override { _name = "Level Symmetric quadrature"; }
inline void SetName() override { _name = "Level Symmetric quadrature"; }
void SetAvailOrders() override;
void SetConnectivity() override;
......
......@@ -9,13 +9,15 @@ class QLookupQuadrature : public QuadratureBase
QLookupQuadrature( unsigned order );
virtual ~QLookupQuadrature() {}
//helper
inline std::vector<unsigned> getAvailOrders() const {return _availableOrders;} /*! @returns: Vector with avalable orders for level symmetric quadrature */
// helper
inline std::vector<unsigned> getAvailOrders() const {
return _availableOrders;
} /*! @returns: Vector with avalable orders for level symmetric quadrature */
void printAvailOrders() const; /*! @brief: prints available orders */
protected:
bool CheckOrder(); /*! @brief checks if given order is available for this quadrature rule. */
void SetNq() override; /*! @brief: Assumes, that _order is available in lookup table */
bool CheckOrder(); /*! @brief checks if given order is available for this quadrature rule. */
void SetNq() override; /*! @brief: Assumes, that _order is available in lookup table */
void SetPointsAndWeights() override; /*! @brief reads in n_points gridpoints and -weights from given filename. */
virtual void SetAvailOrders() = 0; /*! @brief Sets vector with avaialbe Orders and corresponding vector with Nq. */
......@@ -23,6 +25,6 @@ class QLookupQuadrature : public QuadratureBase
virtual std::string GetLookupTable() = 0; /*! @brief returns lookuptable of _order. Assumes order is available */
std::vector<unsigned> _availableOrders; /*! @brief: Vector with available orders for lookup table */
std::vector<unsigned> _nqByOrder; /*! @brief: Vector with number of quadrature points of each listed order */
std::vector<unsigned> _nqByOrder; /*! @brief: Vector with number of quadrature points of each listed order */
};
#endif // QLOOKUPQUADRATURE_H
#endif // QLOOKUPQUADRATURE_H
......@@ -9,10 +9,10 @@ class QMonteCarlo : public QuadratureBase
QMonteCarlo( unsigned order );
virtual ~QMonteCarlo() {}
inline void SetName() override { _name = "Monte Carlo Quadrature."; }
inline void SetNq() override { _nq = GetOrder(); }
inline void SetName() override { _name = "Monte Carlo Quadrature."; }
inline void SetNq() override { _nq = GetOrder(); }
void SetPointsAndWeights() override;
void SetConnectivity()override;
void SetConnectivity() override;
};
#endif // QMONTECARLO_H
#ifndef QUADRATURE_H
#define QUADRATURE_H
#include <iostream>
#include <string>
#include "settings/globalconstants.h"
#include "typedef.h"
#include <iostream>
#include <string>
class QuadratureBase
{
public:
QuadratureBase( unsigned order );
virtual ~QuadratureBase(){}
virtual ~QuadratureBase() {}
// Aux functions
void PrintWeights(); /*! @brief prints: Weight vector */
void PrintPoints(); /*! @brief prints: Point vectorVector */
void PrintPointsAndWeights(); /*! @brief prints: Point vectorVector with corresponding weight vector */
void PrintWeights(); /*! @brief prints: Weight vector */
void PrintPoints(); /*! @brief prints: Point vectorVector */
void PrintPointsAndWeights(); /*! @brief prints: Point vectorVector with corresponding weight vector */
/*! @brief sums up all entries of the weight vector.
* @returns sum of all weights */
/*! @brief sums up all entries of the weight vector.
* @returns sum of all weights */
double SumUpWeights();
/*! @brief Integrates f(x,y,z) with the quadrature.
* @param double(f)( double x0, double x1, double x2 ) : density function that depends on a three spatial dimensions.
* @returns double result: result of the quadrature rule */
/*! @brief Integrates f(x,y,z) with the quadrature.
* @param double(f)( double x0, double x1, double x2 ) : density function that depends on a three spatial dimensions.
* @returns double result: result of the quadrature rule */
double Integrate( double( f )( double x0, double x1, double x2 ) );
// Quadrature Hub
......@@ -39,28 +39,29 @@ class QuadratureBase
inline unsigned GetNq() const { return _nq; } /*! @returns unsigned _nq: number of gridpoints of the quadrature */
inline VectorVector GetPoints() const { return _points; } /*! @returns VectorVector _points: coordinates of gridpoints of the quadrature */
inline Vector GetWeights() const { return _weights; } /*! @returns Vector _weights: weights of gridpoints of the quadrature */
inline VectorVectorU GetConnectivity() const { return _connectivity; } /*! @returns VectorVectorU _connectivity: connectivity of gridpoints of the quadrature */
inline VectorVectorU GetConnectivity() const {
return _connectivity;
} /*! @returns VectorVectorU _connectivity: connectivity of gridpoints of the quadrature */
protected:
// Setter
inline void SetOrder( unsigned order ) { _order = order; } /*! @brief sets: order of the quadrature */
virtual void SetName() = 0; /*! @brief Sets: name of the quadrature */
virtual void SetNq() = 0; /*! @brief sets: number of gridpoints of the quadrature */
virtual void SetConnectivity() = 0; /*! @brief sets: Connectivity Adjacency Matrix as VektorVektor*/
virtual void SetName() = 0; /*! @brief Sets: name of the quadrature */
virtual void SetNq() = 0; /*! @brief sets: number of gridpoints of the quadrature */
virtual void SetConnectivity() = 0; /*! @brief sets: Connectivity Adjacency Matrix as VektorVektor*/
/*! @brief Computes the a vector (length: nq) of (coordinates of) gridpoints used for the quadrature rule.
* Computes the a vector (length: nq) of weights for the gridpoints. The indices match the gridpoints VectorVector.
* Sets computed values for _points and _weights. */
virtual void SetPointsAndWeights() = 0;
virtual void SetPointsAndWeights() = 0;
// Member variables
std::string _name; /*! @brief name of the quadrature */
unsigned _order; /*! @brief order of the quadrature */
unsigned _nq; /*! @brief number of gridpoints of the quadrature */
VectorVector _points; /*! @brief gridpoints of the quadrature */
Vector _weights; /*! @brief weights of the gridpoints of the quadrature */
VectorVectorU _connectivity;/*! @brief connectivity of the gripoints of the quadrature */
std::string _name; /*! @brief name of the quadrature */
unsigned _order; /*! @brief order of the quadrature */
unsigned _nq; /*! @brief number of gridpoints of the quadrature */
VectorVector _points; /*! @brief gridpoints of the quadrature */
Vector _weights; /*! @brief weights of the gridpoints of the quadrature */
VectorVectorU _connectivity; /*! @brief connectivity of the gripoints of the quadrature */
};
#endif // QUADRATURE_H
......@@ -32,8 +32,15 @@ class Reconstructor
*/
virtual double ReconstructSlopeStruct( double uL, double uC, double uR, double dxL, double dxR, std::string limiter ) const;
virtual void ReconstructSlopeUnstruct( unsigned nq, unsigned ncell, VectorVector& psi, VectorVector& psiDerX, VectorVector& psiDerY, Vector& area, VectorVector& neighbor, VectorVector& nx, VectorVector& ny ) const;
virtual void ReconstructSlopeUnstruct( unsigned nq,
unsigned ncell,
VectorVector& psi,
VectorVector& psiDerX,
VectorVector& psiDerY,
Vector& area,
VectorVector& neighbor,
VectorVector& nx,
VectorVector& ny ) const;
};
#endif // RECONSTRUCTOR_H
#endif // RECONSTRUCTOR_H
......@@ -16,8 +16,8 @@
#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/spdlog.h"
#include "optionstructure.h"
#include "globalconstants.h"
#include "optionstructure.h"
/*!
* \class Config
......@@ -25,173 +25,166 @@
* stores all the information.
*/
class Config {
private:
std::string _fileName; /*!< \brief Name of the current file without extension */
bool _baseConfig;
int _commRank, _commSize; /*!< \brief MPI rank and size.*/ //Not yet used!!
// --- Options ---
// File Structure
std::string _inputDir; /*!< \brief Directory for input files*/
std::string _outputDir; /*!< \brief Directory for output files*/
std::string _outputFile; /*!< \brief Name of output file*/
std::string _logDir; /*!< \brief Directory of log file*/
std::string _meshFile; /*!< \brief Name of mesh file*/
// Quadrature
QUAD_NAME _quadName; /*!< \brief Quadrature Name*/
unsigned short _quadOrder; /*!< \brief Quadrature Order*/
// Solver
double _CFL; /*!< \brief CFL Number for Solver*/
double _tEnd; /*!< \brief Final Time for Simulation */
// 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 */
std::vector<std::string> _MarkerDirichlet; /*!< \brief Dirichlet BC markers. */
// --- Parsing Functionality and Initializing of Options ---
/*!
* \brief Set default values for all options not yet set.
*/
void SetDefault(void);
/*!
* \brief Set the config options.
* ==> Set new config options here.
*/
void SetConfigOptions(void);
/*!
* \brief Set the config file parsing.
*/
void SetConfigParsing(char case_filename[MAX_STRING_SIZE]);
/*!
* \brief Config file screen output.
*/
void SetOutput(void);
/*!
* \brief Initializes pointers to null
*/
void SetPointersNull(void);
/*!
* \brief Config file postprocessing.
*/
void SetPostprocessing(void);
/*!
* \brief breaks an input line from the config file into a set of tokens
* \param[in] str - the input line string
* \param[out] option_name - the name of the option found at the beginning of the line
* \param[out] option_value - the tokens found after the "=" sign on the line
* \return false if the line is empty or a commment, true otherwise
*/
bool TokenizeString(std::string & str, std::string & option_name,
std::vector<std::string> & option_value);
/*--- all_options is a map containing all of the options. This is used during config file parsing
to track the options which have not been set (so the default values can be used). Without this map
there would be no list of all the config file options. ---*/
std::map<std::string, bool> _allOptions;
/*--- brief param is a map from the option name (config file string) to its decoder (the specific child
class of COptionBase that turns the string into a value) ---*/
std::map<std::string, OptionBase*> _optionMap;
// ---- Option Types ----
class Config
{
private:
std::string _fileName; /*!< \brief Name of the current file without extension */
bool _baseConfig;
int _commRank, _commSize; /*!< \brief MPI rank and size.*/ // Not yet used!!
// --- Options ---
// File Structure
std::string _inputDir; /*!< \brief Directory for input files*/
std::string _outputDir; /*!< \brief Directory for output files*/
std::string _outputFile; /*!< \brief Name of output file*/
std::string _logDir; /*!< \brief Directory of log file*/
std::string _meshFile; /*!< \brief Name of mesh file*/
// Quadrature
QUAD_NAME _quadName; /*!< \brief Quadrature Name*/
unsigned short _quadOrder; /*!< \brief Quadrature Order*/
// Solver
double _CFL; /*!< \brief CFL Number for Solver*/
double _tEnd; /*!< \brief Final Time for Simulation */
// 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 */
std::vector<std::string> _MarkerDirichlet; /*!< \brief Dirichlet BC markers. */
// --- Parsing Functionality and Initializing of Options ---
/*!
* \brief Set default values for all options not yet set.
*/
void SetDefault( void );
/*!
* \brief Set the config options.
* ==> Set new config options here.
*/
void SetConfigOptions( void );
/*!
* \brief Set the config file parsing.
*/
void SetConfigParsing( char case_filename[MAX_STRING_SIZE] );
/*!
* \brief Config file screen output.
*/
void SetOutput( void );
/*!
* \brief Initializes pointers to null
*/
void SetPointersNull( void );
/*!
* \brief Config file postprocessing.
*/
void SetPostprocessing( void );
/*!
* \brief breaks an input line from the config file into a set of tokens
* \param[in] str - the input line string
* \param[out] option_name - the name of the option found at the beginning of the line
* \param[out] option_value - the tokens found after the "=" sign on the line
* \return false if the line is empty or a commment, true otherwise
*/
bool TokenizeString( std::string& str, std::string& option_name, std::vector<std::string>& option_value );
/*--- all_options is a map containing all of the options. This is used during config file parsing
to track the options which have not been set (so the default values can be used). Without this map
there would be no list of all the config file options. ---*/
std::map<std::string, bool> _allOptions;
/*--- brief param is a map from the option name (config file string) to its decoder (the specific child
class of COptionBase that turns the string into a value) ---*/
std::map<std::string, OptionBase*> _optionMap;
// ---- Option Types ----
// All of the addXxxOptions take in the name of the option, and a refernce to the field of that option
// in the option structure. Depending on the specific type, it may take in a default value, and may
// take in extra options. The addXxxOptions mostly follow the same pattern, so please see addDoubleOption
// for detailed comments.
//
// List options are those that can be an unknown number of elements, and also take in a reference to
// an integer. This integer will be populated with the number of elements of that type unmarshaled.
//
// Array options are those with a fixed number of elements.
//
// List and Array options should also be able to be specified with the string "NONE" indicating that there
// are no elements. This allows the option to be present in a config file but left blank.
/*!< \brief addDoubleOption creates a config file parser for an option with the given name whose
value can be represented by a su2double.*/
// Simple Options
void AddBoolOption( const std::string name, bool& option_field, bool default_value );
void AddDoubleOption( const std::string name, double& option_field, double default_value );
void AddIntegerOption( const std::string name, int& option_field, int default_value );
void AddLongOption( const std::string name, long& option_field, long default_value );
void AddStringOption( const std::string name, std::string& option_field, std::string default_value );
void AddUnsignedLongOption( const std::string name, unsigned long& option_field, unsigned long default_value );
void AddUnsignedShortOption( const std::string name, unsigned short& option_field, unsigned short default_value );
// enum types work differently than all of the others because there are a small number of valid
// string entries for the type. One must also provide a list of all the valid strings of that type.
template <class Tenum>
void AddEnumOption( const std::string name, Tenum& option_field, const std::map<std::string, Tenum>& enum_map, Tenum default_value );
// List Options
void AddStringListOption( const std::string name, unsigned short& num_marker, std::vector<std::string>& option_field );
// Initialize the cmdline and file logger
void InitLogger( spdlog::level::level_enum terminalLogLvl, spdlog::level::level_enum fileLogLvl );
public:
/*!
* \brief Constructor of the class which reads the input file.
*/
Config( char case_filename[MAX_STRING_SIZE] );
/*!
* \brief Destructor of the class.
*/
~Config( void );
// ---- Getters for option values ----
// All of the addXxxOptions take in the name of the option, and a refernce to the field of that option
// in the option structure. Depending on the specific type, it may take in a default value, and may
// take in extra options. The addXxxOptions mostly follow the same pattern, so please see addDoubleOption
// for detailed comments.
//
// List options are those that can be an unknown number of elements, and also take in a reference to
// an integer. This integer will be populated with the number of elements of that type unmarshaled.
//
// Array options are those with a fixed number of elements.
//
// List and Array options should also be able to be specified with the string "NONE" indicating that there
// are no elements. This allows the option to be present in a config file but left blank.
/*!
* \brief Get Value of this option.
* Please keep alphabetical order within each subcategory
*/
// File structure
std::string inline GetMeshFile() const { return _meshFile; }
std::string inline GetOutputDir() const { return _outputDir; }
std::string inline GetOutputFile() const { return _outputFile; }
std::string inline GetLogDir() const { return _logDir; }
/*!< \brief addDoubleOption creates a config file parser for an option with the given name whose
value can be represented by a su2double.*/
// Quadrature Structure
QUAD_NAME inline GetQuadName() const { return _quadName; }
unsigned short inline GetQuadOrder() const { return _quadOrder; }
// Simple Options
void AddBoolOption(const std::string name, bool & option_field, bool default_value);