fix: reintroduce tug namespace
This commit is contained in:
parent
ba627b6624
commit
5196c36ec5
@ -12,6 +12,8 @@
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
|
||||
namespace tug {
|
||||
|
||||
/**
|
||||
* @brief Enum defining the two implemented boundary conditions.
|
||||
*
|
||||
@ -191,7 +193,8 @@ public:
|
||||
void setBoundaryElemenClosed(BC_SIDE side, int index) {
|
||||
// tests whether the index really points to an element of the boundary side.
|
||||
if ((boundaries[side].size() < index) || index < 0) {
|
||||
throw std::invalid_argument("Index is selected either too large or too small.");
|
||||
throw std::invalid_argument(
|
||||
"Index is selected either too large or too small.");
|
||||
}
|
||||
this->boundaries[side][index].setType(BC_TYPE_CLOSED);
|
||||
}
|
||||
@ -211,7 +214,8 @@ public:
|
||||
void setBoundaryElementConstant(BC_SIDE side, int index, double value) {
|
||||
// tests whether the index really points to an element of the boundary side.
|
||||
if ((boundaries[side].size() < index) || index < 0) {
|
||||
throw std::invalid_argument("Index is selected either too large or too small.");
|
||||
throw std::invalid_argument(
|
||||
"Index is selected either too large or too small.");
|
||||
}
|
||||
this->boundaries[side][index].setType(BC_TYPE_CONSTANT);
|
||||
this->boundaries[side][index].setValue(value);
|
||||
@ -272,7 +276,8 @@ public:
|
||||
*/
|
||||
BoundaryElement<T> getBoundaryElement(BC_SIDE side, int index) const {
|
||||
if ((boundaries[side].size() < index) || index < 0) {
|
||||
throw std::invalid_argument("Index is selected either too large or too small.");
|
||||
throw std::invalid_argument(
|
||||
"Index is selected either too large or too small.");
|
||||
}
|
||||
return this->boundaries[side][index];
|
||||
}
|
||||
@ -289,7 +294,8 @@ public:
|
||||
*/
|
||||
BC_TYPE getBoundaryElementType(BC_SIDE side, int index) const {
|
||||
if ((boundaries[side].size() < index) || index < 0) {
|
||||
throw std::invalid_argument("Index is selected either too large or too small.");
|
||||
throw std::invalid_argument(
|
||||
"Index is selected either too large or too small.");
|
||||
}
|
||||
return this->boundaries[side][index].getType();
|
||||
}
|
||||
@ -308,7 +314,8 @@ public:
|
||||
*/
|
||||
T getBoundaryElementValue(BC_SIDE side, int index) const {
|
||||
if ((boundaries[side].size() < index) || index < 0) {
|
||||
throw std::invalid_argument("Index is selected either too large or too small.");
|
||||
throw std::invalid_argument(
|
||||
"Index is selected either too large or too small.");
|
||||
}
|
||||
if (boundaries[side][index].getType() != BC_TYPE_CONSTANT) {
|
||||
throw std::invalid_argument(
|
||||
@ -325,5 +332,5 @@ private:
|
||||
std::vector<std::vector<BoundaryElement<T>>>
|
||||
boundaries; // Vector with Boundary Element information
|
||||
};
|
||||
|
||||
} // namespace tug
|
||||
#endif // BOUNDARY_H_
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
#include <Eigen/Sparse>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace tug {
|
||||
|
||||
template <class T> class Grid {
|
||||
public:
|
||||
/**
|
||||
@ -321,5 +323,5 @@ private:
|
||||
|
||||
using Grid64 = Grid<double>;
|
||||
using Grid32 = Grid<float>;
|
||||
|
||||
} // namespace tug
|
||||
#endif // GRID_H_
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
#define omp_get_num_procs() 1
|
||||
#endif
|
||||
|
||||
namespace tug {
|
||||
|
||||
/**
|
||||
* @brief Enum defining the two implemented solution approaches.
|
||||
*
|
||||
@ -343,5 +345,5 @@ private:
|
||||
|
||||
const std::vector<std::string> approach_names = {"FTCS", "BTCS", "CRNI"};
|
||||
};
|
||||
|
||||
} // namespace tug
|
||||
#endif // SIMULATION_H_
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#define omp_get_thread_num() 0
|
||||
#endif
|
||||
|
||||
namespace tug {
|
||||
|
||||
// calculates coefficient for boundary in constant case
|
||||
template <class T>
|
||||
constexpr std::pair<T, T> calcBoundaryCoeffConstant(T alpha_center,
|
||||
@ -436,3 +438,4 @@ template void BTCS_LU(Grid<double> &grid, Boundary<double> &bc, double timestep,
|
||||
int numThreads);
|
||||
template void BTCS_LU(Grid<float> &grid, Boundary<float> &bc, float timestep,
|
||||
int numThreads);
|
||||
} // namespace tug
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
#define omp_get_thread_num() 0
|
||||
#endif
|
||||
|
||||
namespace tug {
|
||||
|
||||
// calculates horizontal change on one cell independent of boundary type
|
||||
template <class T>
|
||||
static inline T calcHorizontalChange(Grid<T> &grid, int &row, int &col) {
|
||||
@ -400,3 +402,4 @@ template void FTCS(Grid<double> &grid, Boundary<double> &bc, double timestep,
|
||||
int &numThreads);
|
||||
template void FTCS(Grid<float> &grid, Boundary<float> &bc, float timestep,
|
||||
int &numThreads);
|
||||
} // namespace tug
|
||||
|
||||
@ -15,17 +15,22 @@
|
||||
#include <tug/Boundary.hpp>
|
||||
#include <tug/Grid.hpp>
|
||||
|
||||
namespace tug {
|
||||
|
||||
// entry point; differentiate between 1D and 2D grid
|
||||
template <class T>
|
||||
extern void FTCS(Grid<T> &grid, Boundary<T> &bc, T timestep, int &numThreads);
|
||||
extern void FTCS(tug::Grid<T> &grid, tug::Boundary<T> &bc, T timestep,
|
||||
int &numThreads);
|
||||
|
||||
// entry point for EigenLU solver; differentiate between 1D and 2D grid
|
||||
template <class T>
|
||||
extern void BTCS_LU(Grid<T> &grid, Boundary<T> &bc, T timestep, int numThreads);
|
||||
extern void BTCS_LU(tug::Grid<T> &grid, tug::Boundary<T> &bc, T timestep,
|
||||
int numThreads);
|
||||
|
||||
// entry point for Thomas algorithm solver; differentiate 1D and 2D grid
|
||||
template <class T>
|
||||
extern void BTCS_Thomas(Grid<T> &grid, Boundary<T> &bc, T timestep,
|
||||
extern void BTCS_Thomas(tug::Grid<T> &grid, tug::Boundary<T> &bc, T timestep,
|
||||
int numThreads);
|
||||
} // namespace tug
|
||||
|
||||
#endif // SCHEMES_H_
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
#include "Schemes.hpp"
|
||||
#include "TugUtils.hpp"
|
||||
|
||||
namespace tug {
|
||||
|
||||
template <class T> void Simulation<T>::setTimestep(T timestep) {
|
||||
if (timestep <= 0) {
|
||||
throw_invalid_argument("Timestep has to be greater than zero.");
|
||||
@ -200,3 +202,4 @@ template void Simulation<float>::setTimestep(float timestep);
|
||||
|
||||
template void Simulation<double>::run();
|
||||
template void Simulation<float>::run();
|
||||
} // namespace tug
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
#include <typeinfo>
|
||||
|
||||
using namespace std;
|
||||
using namespace tug;
|
||||
|
||||
TEST_CASE("BoundaryElement") {
|
||||
|
||||
SUBCASE("Closed case") {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
using namespace tug;
|
||||
|
||||
TEST_CASE("1D Grid, too small length") {
|
||||
int l = 2;
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
using namespace tug;
|
||||
|
||||
static Grid64 setupSimulation(APPROACH approach, double timestep,
|
||||
int iterations) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user