Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
21120f99
Commit
21120f99
authored
Mar 08, 2021
by
Steffen Schotthöfer
Browse files
merged remote to local
parents
03bec8b6
79cb2b7f
Pipeline
#140033
passed with stage
in 20 minutes
Changes
33
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
21120f99
...
...
@@ -8,7 +8,7 @@ unit_tests:
script
:
-
git submodule update --init --recursive
-
cd code/build/debug
-
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TEST
S
=ON ../../
-
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TEST
ING=ON -DBUILD_CODE_COV
=ON ../../
-
ninja
-
OMP_NUM_THREADS=1 ./unit_tests -r junit > unit_tests_report.xml
-
gcovr -e ../../ext/ -e ../../tests/ -r ../../
...
...
code/CMakeLists.txt
View file @
21120f99
cmake_minimum_required
(
VERSION 3.1
2.4
)
cmake_minimum_required
(
VERSION 3.1
6
)
project
(
KiT-RT VERSION 0.1.0 LANGUAGES CXX
)
### OPTIONS #####################################
option
(
BUILD_TEST
S
"builds all available unit tests"
OFF
)
option
(
BUILD_TEST
ING
"builds all available unit tests"
OFF
)
option
(
BUILD_GUI
"additionally builds a user interface"
OFF
)
option
(
BUILD_DOC
"builds Doxygen and Sphinx documentation"
OFF
)
option
(
BUILD_UNITY
"enables unity build for faster compile times"
ON
)
option
(
BUILD_CODE_COV
"enables compiler option required for code coverage analysis"
OFF
)
#################################################
...
...
@@ -14,6 +16,11 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON )
set
(
KITRT_RELEASE_OPTIONS -march=native -w
)
set
(
KITRT_RELWITHDEBINFO_OPTIONS -march=native -pg -no-pie
)
set
(
KITRT_DEBUG_OPTIONS -Wall -Wextra -Wpedantic
)
if
(
BUILD_UNITY AND NOT BUILD_CODE_COV
)
message
(
STATUS
"Unity build enabled"
)
set
(
CMAKE_UNITY_BUILD ON
)
set
(
CMAKE_UNITY_BUILD_BATCH_SIZE 0
)
endif
()
#################################################
...
...
@@ -87,7 +94,7 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
### BUILD UNIT TESTS ############################
if
(
BUILD_TEST
S
)
if
(
BUILD_TEST
ING
)
include
(
CTest
)
set
(
CMAKE_MODULE_PATH
${
PROJECT_SOURCE_DIR
}
/ext/Catch2/contrib
${
CMAKE_MODULE_PATH
}
)
include
(
Catch
)
...
...
@@ -103,10 +110,16 @@ if( BUILD_TESTS )
target_compile_definitions
(
unit_tests PUBLIC TESTS_PATH=
"
${
CMAKE_SOURCE_DIR
}
/tests/"
)
target_link_libraries
(
unit_tests Catch
${
CORE_LIBRARIES
}
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:DEBUG>:
${
KITRT_DEBUG_OPTIONS
}
>"
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
set
(
CODE_COVERAGE_OPTIONS --coverage -g -O0 -w
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:DEBUG>:
${
CODE_COVERAGE_OPTIONS
}
>"
)
target_link_libraries
(
unit_tests Catch gcov
)
if
(
BUILD_CODE_COV
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
set
(
CODE_COVERAGE_OPTIONS --coverage -g -O0 -w
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:DEBUG>:
${
CODE_COVERAGE_OPTIONS
}
>"
)
target_link_libraries
(
unit_tests Catch gcov
)
else
()
message
(
FATAL_ERROR
"Code coverage is currently only supported for gcc!"
)
endif
()
else
()
target_link_libraries
(
unit_tests Catch
)
endif
()
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:RELWITHDEBINFO>:
${
KITRT_RELWITHDEBINFO_OPTIONS
}
>"
)
target_compile_options
(
unit_tests PUBLIC
"$<$<CONFIG:RELEASE>:
${
KITRT_RELEASE_OPTIONS
}
>"
)
...
...
@@ -146,7 +159,7 @@ if( BUILD_DOC )
set
(
DOXYGEN_INPUT_DIR
${
PROJECT_SOURCE_DIR
}
)
set
(
DOXYGEN_OUTPUT_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/docs/doxygen
)
set
(
DOXYGEN_INDEX_FILE
${
DOXYGEN_OUTPUT_DIR
}
/
ht
ml/index.
ht
ml
)
set
(
DOXYGEN_INDEX_FILE
${
DOXYGEN_OUTPUT_DIR
}
/
x
ml/index.
x
ml
)
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
)
...
...
code/include/common/config.h
View file @
21120f99
...
...
@@ -163,9 +163,9 @@ class Config
/*!
* @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
* @param str the input line string
* @param option_name the name of the option found at the beginning of the line
* @param 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
);
...
...
code/include/fluxes/laxfriedrichsflux.h
View file @
21120f99
...
...
@@ -5,7 +5,7 @@
class
LaxFriedrichsFlux
:
public
NumericalFlux
{
double
_dt
;
//
double _dt;
public:
/**
...
...
code/include/fluxes/upwindflux.h
View file @
21120f99
...
...
@@ -34,8 +34,7 @@ class UpwindFlux : public NumericalFlux
* @param psiL Solution state of left hand side control volume
* @param psiR Solution state of right hand side control volume
* @param n Normal vector at the edge between left and right control volume
* @param resultFlux Vector with resulting flux.
* @return void
* @return Vector with resulting flux
*/
Vector
Flux
(
const
Matrix
AxPlus
,
const
Matrix
AxMinus
,
...
...
@@ -50,12 +49,12 @@ class UpwindFlux : public NumericalFlux
/**
* @brief Flux Computes "VanLeer" upwinding scheme for given flux jacobians of the PN Solver at a given edge and stores it in
* resultFlux
* @param Ax
Plus
Positive part of the f
lux jacobian in x direction
* @param Ax
Minus Negative part
of the flux jacobian in x direction
* @param Ay
Plus
Positive part of the f
lux jacobian in y direction
* @param Ay
Minus Negative part
of the flux jacobian in y direction
* @param Az
Plus
Positive part of the f
lux jacobian in z direction
* @param Az
Minus Negative part
of the flux jacobian in z direction
* @param Ax
F
lux jacobian in x direction
* @param Ax
Abs Absolute value
of the flux jacobian in x direction
* @param Ay
F
lux jacobian in y direction
* @param Ay
Abs Absolute value
of the flux jacobian in y direction
* @param Az
F
lux jacobian in z direction
* @param Az
Abs Absolute value
of the flux jacobian in z direction
* @param psiL Solution state of left hand side control volume
* @param psiR Solution state of right hand side control volume
* @param n Normal vector at the edge between left and right control volume
...
...
code/include/quadratures/qgausschebyshev1D.h
View file @
21120f99
...
...
@@ -28,20 +28,19 @@ class QGaussChebyshev1D : public QuadratureBase
void
SetConnectivity
()
override
;
/*! @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
)
)
override
;
* @param
f
density function that depends on a three spatial dimensions.
* @returns result of the quadrature rule */
double
Integrate
(
double
(
*
f
)(
double
,
double
,
double
)
)
override
;
/*! @brief Integrates f(x,y,z) with the quadrature.
* @param
double(f)( double my, double phi ) :
density function that depends on a spherical coordinates.
* @returns
double result:
result of the quadrature rule */
double
IntegrateSpherical
(
double
(
f
)(
double
my
,
double
phi
)
)
override
;
* @param
f
density function that depends on a spherical coordinates.
* @returns result of the quadrature rule */
double
IntegrateSpherical
(
double
(
*
f
)(
double
,
double
)
)
override
;
/*! @brief Integrates vector valued f(x,y,z) with the quadrature. Each dimension is integrated by itself.
* @param : double(f)( double x0, double x1, double x2 ) : density function that depends on a three spatial dimensions.
* @param : len : lenght of vector
* @returns double result: result of the quadrature rule (vector valued) */
std
::
vector
<
double
>
Integrate
(
std
::
vector
<
double
>
(
f
)(
double
x0
,
double
x1
,
double
x2
),
unsigned
/* len */
)
override
;
* @param f density function that depends on a three spatial dimensions.
* @returns result of the quadrature rule (vector valued) */
std
::
vector
<
double
>
Integrate
(
std
::
vector
<
double
>
(
*
f
)(
double
,
double
,
double
),
unsigned
/* len */
)
override
;
};
#endif // QGAUSSCHEBYSHEV_H
code/include/quadratures/qgausslegendre1D.h
View file @
21120f99
...
...
@@ -29,20 +29,19 @@ class QGaussLegendre1D : public QuadratureBase
void
SetConnectivity
()
override
;
/*! @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
)
)
override
;
* @param
f
density function that depends on a three spatial dimensions.
* @returns result of the quadrature rule */
double
Integrate
(
double
(
*
f
)(
double
,
double
,
double
)
)
override
;
/*! @brief Integrates f(x,y,z) with the quadrature.
* @param
double(f)( double my, double phi ) :
density function that depends on a spherical coordinates.
* @returns
double result:
result of the quadrature rule */
double
IntegrateSpherical
(
double
(
f
)(
double
my
,
double
phi
)
)
override
;
* @param
f
density function that depends on a spherical coordinates.
* @returns result of the quadrature rule */
double
IntegrateSpherical
(
double
(
*
f
)(
double
,
double
)
)
override
;
/*! @brief Integrates vector valued f(x,y,z) with the quadrature. Each dimension is integrated by itself.
* @param : double(f)( double x0, double x1, double x2 ) : density function that depends on a three spatial dimensions.
* @param : len : lenght of vector
* @returns double result: result of the quadrature rule (vector valued) */
std
::
vector
<
double
>
Integrate
(
std
::
vector
<
double
>
(
f
)(
double
x0
,
double
x1
,
double
x2
),
unsigned
/* len */
)
override
;
* @param f density function that depends on a three spatial dimensions.
* @returns result of the quadrature rule (vector valued) */
std
::
vector
<
double
>
Integrate
(
std
::
vector
<
double
>
(
*
f
)(
double
,
double
,
double
),
unsigned
/* len */
)
override
;
};
#endif // QGAUSSLEGENDRE1D_H
code/include/quadratures/quadraturebase.h
View file @
21120f99
...
...
@@ -15,7 +15,7 @@ class QuadratureBase
{
public:
/*! @brief Constructor using settings class. This is the recommended constructor.
* @param
Config*
settings
:
Settings class storing all important options.
* @param settings Settings class storing all important options.
*/
QuadratureBase
(
Config
*
settings
);
/*! @brief Constructor using directly the order of the quadrature. Not applicable for GaussLegendre, that need additional options.
...
...
@@ -33,20 +33,20 @@ class QuadratureBase
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 */
virtual
double
Integrate
(
double
(
f
)(
double
x0
,
double
x1
,
double
x2
)
);
* @param
f
density function that depends on a three spatial dimensions.
* @returns result of the quadrature rule */
virtual
double
Integrate
(
double
(
*
f
)(
double
,
double
,
double
)
);
/*! @brief Integrates f(x,y,z) with the quadrature.
* @param
double(f)( double my, double phi ) :
density function that depends on a spherical coordinates.
* @returns
double result:
result of the quadrature rule */
virtual
double
IntegrateSpherical
(
double
(
f
)(
double
my
,
double
phi
)
);
* @param
f
density function that depends on a spherical coordinates.
* @returns result of the quadrature rule */
virtual
double
IntegrateSpherical
(
double
(
*
f
)(
double
,
double
)
);
/*! @brief Integrates vector valued f(x,y,z) with the quadrature. Each dimension is integrated by itself.
* @param
: double(f)( double x0, double x1, double x2 ) :
density function that depends on a three spatial dimensions.
* @param
:
len
:
lenght of vector
* @returns
double result:
result of the quadrature rule (vector valued) */
virtual
std
::
vector
<
double
>
Integrate
(
std
::
vector
<
double
>
(
f
)(
double
x0
,
double
x1
,
double
x2
),
unsigned
len
);
* @param
f
density function that depends on a three spatial dimensions.
* @param len lenght of vector
* @returns result of the quadrature rule (vector valued) */
virtual
std
::
vector
<
double
>
Integrate
(
std
::
vector
<
double
>
(
*
f
)(
double
,
double
,
double
),
unsigned
len
);
// Quadrature Hub
/*! @brief Creates a quadrature rule with a given name and a given order.
...
...
@@ -55,9 +55,9 @@ class QuadratureBase
static
QuadratureBase
*
Create
(
Config
*
settings
);
/*! @brief Creates a quadrature rule with a given name and a given order.
* @param name
:
name of quadrature as enum
* @param quadOrder
:
order of quadrature
* @returns
Quadrature* quadrature: returns
pointer to instance of the given derived quadrature class */
* @param name name of quadrature as enum
* @param quadOrder order of quadrature
* @returns pointer to instance of the given derived quadrature class */
static
QuadratureBase
*
Create
(
QUAD_NAME
name
,
unsigned
quadOrder
);
// Getter
...
...
code/include/solvers/mnsolver.h
View file @
21120f99
...
...
@@ -72,6 +72,6 @@ class MNSolver : public SolverBase
// Helper
/*! @brief Computes the radiative flux from the solution vector of the moment system */
void
ComputeRadFlux
();
void
ComputeRadFlux
()
override
;
};
#endif // MNSOLVER_H
code/include/solvers/pnsolver.h
View file @
21120f99
...
...
@@ -54,7 +54,7 @@ class PNSolver : public SolverBase
void
IterPostprocessing
(
unsigned
idx_pseudotime
)
override
;
// Helper
void
ComputeRadFlux
();
void
ComputeRadFlux
()
override
;
// Initialization of the Solver
/*! @brief parameter functions for setting up system matrix
...
...
code/include/solvers/snsolver.h
View file @
21120f99
...
...
@@ -33,7 +33,7 @@ class SNSolver : public SolverBase
void
virtual
IterPostprocessing
(
unsigned
idx_pseudotime
)
override
;
// Helper
void
ComputeRadFlux
();
void
ComputeRadFlux
()
override
;
// --- Member variables ---
};
...
...
code/include/toolboxes/datageneratorbase.h
View file @
21120f99
...
...
@@ -24,7 +24,7 @@ class DataGeneratorBase
* the options file.
* @param settings config class with global information*/
DataGeneratorBase
(
Config
*
settings
);
~
DataGeneratorBase
();
virtual
~
DataGeneratorBase
();
/*! @brief Create a datagenerator (1D or 3D)
* @param settings Pointer to the config file
...
...
code/include/toolboxes/interpolation.h
View file @
21120f99
...
...
@@ -38,56 +38,56 @@ class Interpolation
// In constructor tabulated values are initialised
/*!
* @brief constructor linear interpolation for std::vector input
* @param
[in] x -
table values for x
* @param
[in] y -
table values for y
* @param
[in]
type
-
linear or cubic interpolation
* @param
x
table values for x
* @param
y
table values for y
* @param type linear or cubic interpolation
*/
Interpolation
(
const
std
::
vector
<
double
>&
x
,
const
std
::
vector
<
double
>&
y
,
TYPE
type
=
linear
);
/*!
* @brief constructor linear interpolation for Vector input
* @param
[in] x -
table values for x
* @param
[in] y -
table values for y
* @param
[in]
type
-
linear or cubic interpolation
* @param
x
table values for x
* @param
y
table values for y
* @param type linear or cubic interpolation
*/
Interpolation
(
const
Vector
&
x
,
const
Vector
&
y
,
TYPE
type
=
linear
);
/*!
* @brief constructor cubic interpolation
* @param
[in]
x table values for x
* @param
[in]
y table values for y
* @param
[in]
data matrix w.r.t x y grid
* @param
[in]
type of interpolation (linear, loglinear, cubic)
* @param x table values for x
* @param y table values for y
* @param data matrix w.r.t x y grid
* @param type of interpolation (linear, loglinear, cubic)
*/
Interpolation
(
const
Vector
&
x
,
const
Vector
&
y
,
const
Matrix
&
data
,
TYPE
type
=
cubic
);
// Here the interpolation between the previously defined table values is performed
/*!
* @brief defines one dimensional interpolation at x
* @param
[in] x -
value at which to interpolate
* @returns
y -
corresponding interpolated y value
* @param
x
value at which to interpolate
* @returns corresponding interpolated y value
*/
double
operator
()(
double
x
)
const
;
/*!
* @brief defines interpolation for a Vector of values
* @param
[in] v -
values at which to interpolate
* @returns
y -
corresponding interpolated values
* @param
v
values at which to interpolate
* @returns corresponding interpolated values
*/
Vector
operator
()(
Vector
v
)
const
;
/*!
* @brief defines interpolation for a std::vector of values
* @param
[in] v -
values at which to interpolate
* @returns
y -
corresponding interpolated values
* @param
v
values at which to interpolate
* @returns corresponding interpolated values
*/
std
::
vector
<
double
>
operator
()(
std
::
vector
<
double
>
v
)
const
;
/*!
* @brief defines 2D interpolation at x and y
* @param
[in] x -
value at which to interpolate
* @param
[in] y -
value at which to interpolate
* @returns
data -
corresponding interpolated value
* @param
x
value at which to interpolate
* @param
y
value at which to interpolate
* @returns corresponding interpolated value
*/
double
operator
()(
double
x
,
double
y
)
const
;
};
...
...
code/include/toolboxes/reconstructor.h
View file @
21120f99
...
...
@@ -30,22 +30,14 @@ class Reconstructor
/*! Method 1: structured developing
* @brief Slope of angular flux psi inside a given cell
* @param Omega fixed ordinate for flux computation
* @param psiL left solution state
* @param psiR right solution state
* @param n scaled normal vector of given edge
* @param uL left solution state
* @param uC center solution state
* @param uR right solution state
* @param dxL left slope
* @param dxR right slope
* @param limiter name of the applied limiter (invalid argument results in disabled limiter)
* @return reconstructed slope
*/
/** Method 2: unstructured developing
* @brief Slope of angular flux psi inside a given cell
* @param Omega fixed ordinate for flux computation
* @param psiL left solution state
* @param psiR right solution state
* @param n scaled normal vector of given edge
* @return reconstructed slope
*/
virtual
double
ReconstructSlopeStruct
(
double
uL
,
double
uC
,
double
uR
,
double
dxL
,
double
dxR
,
std
::
string
limiter
)
const
;
};
...
...
code/include/toolboxes/sphericalbase.h
View file @
21120f99
...
...
@@ -18,24 +18,25 @@ class SphericalBase
virtual
~
SphericalBase
()
{}
/*! @brief Create a set of basis functions on the unit sphere defined in settings
* @param Pointer to the config file
* @returns: Pointer to the createt basis class */
* @param settings pointer to the config object
* @returns Pointer to the createt basis class
*/
static
SphericalBase
*
Create
(
Config
*
settings
);
/*! @brief
:
Computes all N basis functions at point (my, phi)
* @param
: my =
cos(theta) - spherical coordinate, -1 <= x <= 1
* @param
:
phi
-
spherical coordinate, 0 <= phi <= 2*pi
* @return
:
vector of basis functions at point (my, phi) with size N
/*! @brief Computes all N basis functions at point (my, phi)
* @param
my
cos(theta) - spherical coordinate, -1 <= x <= 1
* @param phi spherical coordinate, 0 <= phi <= 2*pi
* @return vector of basis functions at point (my, phi) with size N
*/
virtual
Vector
ComputeSphericalBasis
(
double
my
,
double
phi
)
=
0
;
/*! @brief
:
Computes all basis functions at point (x, y, z) on the unit sphere
* @param
:
x,y,z
=
coordinates on unit sphere
* @return
:
vector of basis functions at point (x,y,z) with size N
/*! @brief Computes all basis functions at point (x, y, z) on the unit sphere
* @param x,y,z coordinates on unit sphere
* @return vector of basis functions at point (x,y,z) with size N
*/
virtual
Vector
ComputeSphericalBasis
(
double
x
,
double
y
,
double
z
)
=
0
;
/*! @brief
:
Return size of complete Basisvector */
/*! @brief Return size of complete Basisvector */
virtual
unsigned
GetBasisSize
()
=
0
;
/*! @brief Return number of basis functions with degree equals to currDegree
...
...
code/include/toolboxes/sphericalharmonics.h
View file @
21120f99
...
...
@@ -52,7 +52,7 @@ class SphericalHarmonics : public SphericalBase
unsigned
GetBasisSize
()
override
final
;
/*! @brief Return number of basis functions with degree equals to currDegree
* @param currDegree
L =
degree of polynomials that are counted */
* @param currDegree degree of polynomials that are counted */
unsigned
GetCurrDegreeSize
(
unsigned
currDegree
)
override
final
;
/*! @brief helper function to get the global index for given k and l of
...
...
@@ -102,7 +102,7 @@ class SphericalHarmonics : public SphericalBase
/*! @brief Computes the spherical harmonics basis function up to degree _LmaxDegree at
* polar coordinates (theta, psi) and stores the result in _YBasis;
* @param spherical coordinate
phi
* @param
phi
spherical coordinate
*/
void
ComputeYBasis
(
const
double
phi
);
};
...
...
code/include/toolboxes/sphericalmonomials.h
View file @
21120f99
...
...
@@ -14,24 +14,24 @@
class
SphericalMonomials
:
public
SphericalBase
{
public:
/*! @brief
:
Sets up class for monomial basis on sphere up to degree L.
/*! @brief Sets up class for monomial basis on sphere up to degree L.
* The basis then consists of N = L.
* @param
:
L_degree
-
maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound
* @param L_degree maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound
* due to numerical stability)
* */
SphericalMonomials
(
unsigned
L_degree
);
/*! @brief Sets up class for monomial basis on sphere up to degree L.
* The basis then consists of N = L.
* @param L_degree
-
maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound
* @param L_degree maximum degree of spherical harmonics basis, 0 <= L <= 1000 (upper bound
* due to numerical stability)
* @param spatialDim
-
spatial dimensioniality of the simulation
* @param spatialDim spatial dimensioniality of the simulation
* */
SphericalMonomials
(
unsigned
L_degree
,
unsigned
short
spatialDim
);
/*! @brief Computes all N = L² +2L basis functions at point (my, phi)
* @param my
=
cos(theta) - spherical coordinate, -1 <= x <= 1
* @param phi
-
spherical coordinate, 0 <= phi <= 2*pi
* @param my cos(theta) - spherical coordinate, -1 <= x <= 1
* @param phi spherical coordinate, 0 <= phi <= 2*pi
* @return vector of basis functions at point (my, phi) with size N = L² +2L
*/
Vector
ComputeSphericalBasis
(
double
my
,
double
phi
)
override
;
...
...
@@ -56,8 +56,8 @@ class SphericalMonomials : public SphericalBase
unsigned
GetCurrDegreeSize
(
unsigned
currDegreeL
)
override
;
/*! @brief Computes global index of basis vector depending on order k and degree l
* @param l
=
degree of polynomials l = 0,1,2,3,...
* @param k
=
order of element of degree l. 0 <=k <=GetCurrDegreeSize(l) */
* @param l
_degree
degree of polynomials l = 0,1,2,3,...
* @param k
_order
order of element of degree l. 0 <=k <=GetCurrDegreeSize(l) */
unsigned
GetGlobalIndexBasis
(
int
l_degree
,
int
k_order
)
override
;
private:
...
...
code/include/toolboxes/textprocessingtoolbox.h
View file @
21120f99
...
...
@@ -14,15 +14,15 @@
namespace
TextProcessingToolbox
{
/*!
*
\
brief utility function for converting strings to uppercase
*
\
param
[in,out]
str - string
we want to
convert
*
@
brief utility function for converting strings to uppercase
*
@
param str - string
to be
convert
ed
*/
inline
void
StringToUpperCase
(
std
::
string
&
str
)
{
std
::
transform
(
str
.
begin
(),
str
.
end
(),
str
.
begin
(),
::
toupper
);
}
/*!
*
\
brief utility function for splitting strings to at delimiter
*
\
param
[in] str - string we want to split, delimiter - delimiter character
*
[out] vector of string tokens that were separated by the delimi
ter
*
@
brief utility function for splitting strings to at delimiter
*
@
param
s string to be split
*
@param delimiter delimiter charac
ter
*/
inline
std
::
vector
<
std
::
string
>
Split
(
const
std
::
string
&
s
,
char
delimiter
)
{
std
::
vector
<
std
::
string
>
tokens
;
...
...
@@ -35,14 +35,8 @@ inline std::vector<std::string> Split( const std::string& s, char delimiter ) {
}
/*!
* \brief utility function for getting walltime
* \param [in,out] V
*/
// TODO
/*!
* \brief utility function for printing a VectorVector
* \param vectorIn VectorVector we want to print
* @brief utility function for printing a VectorVector
* @param vectorIn VectorVector we want to print
*/
inline
void
PrintVectorVector
(
const
VectorVector
vectorIn
)
{
unsigned
dimOuter
=
vectorIn
.
size
();
...
...
@@ -60,15 +54,15 @@ inline void PrintVectorVector( const VectorVector vectorIn ) {
}
/*!
*
\
brief utility function for returning the last number in a string
*
\
param str string to be checked
*
@
brief utility function for returning the last number in a string
*
@
param str string to be checked
*/
inline
int
GetTrailingNumber
(
std
::
string
const
&
str
)
{
return
std
::
stoi
(
str
.
substr
(
str
.
find_first_of
(
"0123456789"
),
str
.
length
()
-
1
)
);
}
/*!
*
\
brief utility function for checking if a string has a certain ending
*
\
param value string to be checked
*
\
param ending string to be checked for
*
@
brief utility function for checking if a string has a certain ending
*
@
param value string to be checked
*
@
param ending string to be checked for
*/
inline
bool
StringEndsWith
(
std
::
string
const
&
value
,
std
::
string
const
&
ending
)
{
if
(
ending
.
size
()
>
value
.
size
()
)
return
false
;
...
...
code/src/common/config.cpp
View file @
21120f99
...
...
@@ -216,8 +216,9 @@ void Config::SetConfigOptions() {
AddStringOption
(
"CT_FILE"
,
_ctFile
,
string
(
"../tests/input/phantom.png"
)
);
// Quadrature relatated options
/*! @brief QUAD_TYPE \n DESCRIPTION: Type of Quadrature rule \n Options: see @link QUAD_NAME \endlink \n DEFAULT: QUAD_MonteCarlo \ingroup
* Config*/
/*! @brief QUAD_TYPE \n DESCRIPTION: Type of Quadrature rule \n Options: see @link QUAD_NAME \endlink \n DEFAULT: QUAD_MonteCarlo
* \ingroup Config
*/
AddEnumOption
(
"QUAD_TYPE"
,
_quadName
,
Quadrature_Map
,
QUAD_MonteCarlo
);
/*!\brief QUAD_ORDER \n DESCRIPTION: Order of Quadrature rule \n DEFAULT 2 \ingroup Config.*/
AddUnsignedShortOption
(
"QUAD_ORDER"
,
_quadOrder
,
1
);
...
...
@@ -278,8 +279,8 @@ void Config::SetConfigOptions() {
AddUnsignedLongOption
(
"NEWTON_ITER"
,
_newtonIter
,
100
);
/*! @brief Step Size Newton Optmizers \n DESCRIPTION: Step size for Newton optimizer \n DEFAULT 10 \ingroup Config */
AddDoubleOption
(
"NEWTON_STEP_SIZE"
,
_newtonStepSize
,
0.1
);
/*! @brief Max Iter for line search in Newton Optmizers \n DESCRIPTION: Max number of line search iter for newton optimizer \n DEFAULT 10
\ingroup
* Config */
/*! @brief Max Iter for line search in Newton Optmizers \n DESCRIPTION: Max number of line search iter for newton optimizer \n DEFAULT 10
*
\ingroup
Config */
AddUnsignedLongOption
(
"NEWTON_LINE_SEARCH_ITER"
,
_newtonLineSearchIter
,
100
);
/*! @brief Newton Fast mode \n DESCRIPTION: If true, we skip the Newton optimizer for Quadratic entropy and set alpha = u \n DEFAULT false
* \ingroup Config */
...
...
@@ -693,7 +694,7 @@ bool Config::TokenizeString( string& str, string& option_name, vector<string>& o
pos
=
str
.
find
(
"="
);
if
(
pos
==
string
::
npos
)
{
string
errmsg
=
"Error in Config::TokenizeString(): line in the configuration file with no
\"
=
\"
sign. "
;
errmsg
+=
"
\n
Look for:
\n
str.length() = "
+
str
.
length
();
errmsg
+=
"
\n
Look for:
\n
str.length() = "
+
std
::
to_string
(
str
.
length
()
)
;
spdlog
::
error
(
errmsg
);
throw
(
-
1
);
}
...
...
code/src/common/io.cpp
View file @
21120f99
...
...
@@ -22,7 +22,6 @@
#include <vtkCellDataToPointData.h>
#include <vtkDoubleArray.h>
#include <vtkPointData.h>
//#include <vtkPointDataToCellData.h>
#include <vtkQuad.h>
#include <vtkSmartPointer.h>
#include <vtkTriangle.h>
...
...
@@ -31,7 +30,6 @@
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL KITRT_IO_ARRAY_API
#include <numpy/arrayobject.h>
using
vtkPointsSP
=
vtkSmartPointer
<
vtkPoints
>
;
...
...
@@ -41,7 +39,6 @@ using vtkCellArraySP = vtkSmartPointer<vtkCellArray>;
using
vtkDoubleArraySP
=
vtkSmartPointer
<
vtkDoubleArray
>
;
using
vtkUnstructuredGridWriterSP
=
vtkSmartPointer
<
vtkUnstructuredGridWriter
>
;
using
vtkCellDataToPointDataSP
=
vtkSmartPointer
<
vtkCellDataToPointData
>
;
// using vtkPointDataToCellDataSP = vtkSmartPointer<vtkPointDataToCellData>;
void
ExportVTK
(
const
std
::
string
fileName
,
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>>>&
outputFields
,
...
...
@@ -197,7 +194,8 @@ Mesh* LoadSU2MeshFromFile( const Config* settings ) {
getline
(
ifs
,
line
);
if
(
line
.
find
(
"MARKER_TAG"
,
0
)
!=
std
::
string
::
npos
)
{
markerTag
=
line
.
substr
(
line
.
find
(
"="
)
+
1
);
auto
end_pos
=
std
::
remove_if
(
markerTag
.
begin
(),
markerTag
.
end
(),
isspace
);
auto
end_pos
=
std
::
remove_if
(
markerTag
.
begin
(),
markerTag
.
end
(),
[](
char
c
)
{
return
std
::
isspace
(
static_cast
<
unsigned
char
>
(
c
)
);
}
);
markerTag
.
erase
(
end_pos
,
markerTag
.
end
()
);