mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
fix: add namespaces to executables
This commit is contained in:
parent
2096ee5cc3
commit
8af03777b8
@ -6,24 +6,21 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
inline Eigen::MatrixXd CSV2Eigen(std::string file2Convert) {
|
||||
|
||||
inline MatrixXd CSV2Eigen(string file2Convert) {
|
||||
std::vector<double> matrixEntries;
|
||||
|
||||
vector<double> matrixEntries;
|
||||
|
||||
ifstream matrixDataFile(file2Convert);
|
||||
std::ifstream matrixDataFile(file2Convert);
|
||||
if (matrixDataFile.fail()) {
|
||||
throw invalid_argument("File probably non-existent!");
|
||||
throw std::invalid_argument("File probably non-existent!");
|
||||
}
|
||||
|
||||
string matrixRowString;
|
||||
string matrixEntry;
|
||||
std::string matrixRowString;
|
||||
std::string matrixEntry;
|
||||
int matrixRowNumber = 0;
|
||||
|
||||
while (getline(matrixDataFile, matrixRowString)) {
|
||||
stringstream matrixRowStringStream(matrixRowString);
|
||||
std::stringstream matrixRowStringStream(matrixRowString);
|
||||
while (getline(matrixRowStringStream, matrixEntry, ' ')) {
|
||||
matrixEntries.push_back(stod(matrixEntry));
|
||||
}
|
||||
@ -32,18 +29,21 @@ inline MatrixXd CSV2Eigen(string file2Convert) {
|
||||
}
|
||||
}
|
||||
|
||||
return Map<Matrix<double, Dynamic, Dynamic, RowMajor>>(
|
||||
return Eigen::Map<
|
||||
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
|
||||
matrixEntries.data(), matrixRowNumber,
|
||||
matrixEntries.size() / matrixRowNumber);
|
||||
}
|
||||
|
||||
inline bool checkSimilarity(MatrixXd a, MatrixXd b, double precision = 1e-5) {
|
||||
inline bool checkSimilarity(Eigen::MatrixXd a, Eigen::MatrixXd b,
|
||||
double precision = 1e-5) {
|
||||
return a.isApprox(b, precision);
|
||||
}
|
||||
|
||||
inline bool checkSimilarityV2(MatrixXd a, MatrixXd b, double maxDiff) {
|
||||
inline bool checkSimilarityV2(Eigen::MatrixXd a, Eigen::MatrixXd b,
|
||||
double maxDiff) {
|
||||
|
||||
MatrixXd diff = a - b;
|
||||
Eigen::MatrixXd diff = a - b;
|
||||
double maxCoeff = diff.maxCoeff();
|
||||
return abs(maxCoeff) < maxDiff;
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
#include <tug/Boundary.hpp>
|
||||
#include <typeinfo>
|
||||
|
||||
using namespace std;
|
||||
|
||||
TEST_CASE("BoundaryElement") {
|
||||
|
||||
SUBCASE("Closed case") {
|
||||
@ -71,4 +73,4 @@ TEST_CASE("Boundary Class") {
|
||||
CHECK_EQ(boundary2D.getBoundaryElement(BC_SIDE_LEFT, 0).getType(),
|
||||
boundary1DVector[0].getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
#include <doctest/doctest.h>
|
||||
#include <tug/Grid.hpp>
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
|
||||
TEST_CASE("1D Grid, too small length") {
|
||||
int l = 2;
|
||||
CHECK_THROWS(Grid(l));
|
||||
@ -246,4 +250,4 @@ TEST_CASE("2D Grid non-quadratic") {
|
||||
dr = -2;
|
||||
CHECK_THROWS(grid.setDomain(dr, dc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
// include the configured header file
|
||||
#include <testSimulation.hpp>
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
static Grid setupSimulation(APPROACH approach, double timestep,
|
||||
int iterations) {
|
||||
int row = 11;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user