This repository has been archived by the owner on Mar 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 🎨 make new regression test separated from unit test * 🔧 change name of regression test case to cube * 🎨 regression test with input * 📎 merging to develop
- Loading branch information
Showing
6 changed files
with
213 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
$MeshFormat | ||
2.2 0 8 | ||
$EndMeshFormat | ||
$Nodes | ||
18 | ||
1 0 0 0 | ||
2 1 0 0 | ||
3 0 1 0 | ||
4 1 1 0 | ||
5 0 0 1 | ||
6 1 0 1 | ||
7 1 1 1 | ||
8 0 1 1 | ||
9 0.5 0 0 | ||
10 0.5 1 0 | ||
11 0.5 0 1 | ||
12 0.5 1 1 | ||
13 0 0 0.5 | ||
14 1 0 0.5 | ||
15 1 1 0.5 | ||
16 0 1 0.5 | ||
17 0.5 0 0.5 | ||
18 0.5 1 0.5 | ||
$EndNodes | ||
$Elements | ||
48 | ||
1 15 2 0 1 1 | ||
2 15 2 0 2 2 | ||
3 15 2 0 3 3 | ||
4 15 2 0 4 4 | ||
5 15 2 0 5 5 | ||
6 15 2 0 6 6 | ||
7 15 2 0 10 7 | ||
8 15 2 0 14 8 | ||
9 1 2 0 1 1 9 | ||
10 1 2 0 1 9 2 | ||
11 1 2 0 2 3 10 | ||
12 1 2 0 2 10 4 | ||
13 1 2 0 3 1 3 | ||
14 1 2 0 4 2 4 | ||
15 1 2 0 7 5 11 | ||
16 1 2 0 7 11 6 | ||
17 1 2 0 8 6 7 | ||
18 1 2 0 9 7 12 | ||
19 1 2 0 9 12 8 | ||
20 1 2 0 10 8 5 | ||
21 1 2 0 12 1 13 | ||
22 1 2 0 12 13 5 | ||
23 1 2 0 13 2 14 | ||
24 1 2 0 13 14 6 | ||
25 1 2 0 17 4 15 | ||
26 1 2 0 17 15 7 | ||
27 1 2 0 21 3 16 | ||
28 1 2 0 21 16 8 | ||
29 3 2 0 5 1 9 10 3 | ||
30 3 2 0 5 9 2 4 10 | ||
31 3 2 0 14 1 9 17 13 | ||
32 3 2 0 14 13 17 11 5 | ||
33 3 2 0 14 9 2 14 17 | ||
34 3 2 0 14 17 14 6 11 | ||
35 3 2 0 18 2 4 15 14 | ||
36 3 2 0 18 14 15 7 6 | ||
37 3 2 0 22 3 16 18 10 | ||
38 3 2 0 22 16 8 12 18 | ||
39 3 2 0 22 10 18 15 4 | ||
40 3 2 0 22 18 12 7 15 | ||
41 3 2 0 26 1 13 16 3 | ||
42 3 2 0 26 13 5 8 16 | ||
43 3 2 0 27 5 11 12 8 | ||
44 3 2 0 27 11 6 7 12 | ||
45 5 2 0 1 1 9 10 3 13 17 18 16 | ||
46 5 2 0 1 13 17 18 16 5 11 12 8 | ||
47 5 2 0 1 9 2 4 10 17 14 15 18 | ||
48 5 2 0 1 17 14 15 18 11 6 7 12 | ||
$EndElements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// GMSH test | ||
#include <array> | ||
#include <limits> | ||
|
||
#include <eigen3/Eigen/Dense> | ||
|
||
#include "catch.hpp" | ||
#include "material_points.h" | ||
#include "gmsh.h" | ||
#include "regression_global.h" | ||
|
||
|
||
//! Alias for JSON | ||
#include "json.hpp" | ||
using json = nlohmann::json; | ||
|
||
//! \brief Check that IO will store right values | ||
TEST_CASE("GMSH is checked in 3D", "[GMSH][3D]") { | ||
|
||
//! 3D Test of IO Class | ||
const unsigned DIM = 3; | ||
const double tolerance = 1.E-12; | ||
|
||
//! Make json object with material in it | ||
json material_json= { | ||
{"density", 2000}, | ||
{"k0", 0.5} | ||
}; | ||
|
||
//! Make pointers to mesh and MaterialProperties | ||
auto mesh = std::unique_ptr<Mesh<3, 8>> (new GMSH<3, 8>()); | ||
auto material = std::shared_ptr<MaterialProperties> (new MaterialProperties(material_json)); | ||
|
||
mesh->read_mesh(filename); | ||
mesh->compute_material_points(1); | ||
mesh->assign_material_properties(material); | ||
mesh->compute_stresses(); | ||
|
||
//! Check number of vertices | ||
REQUIRE(mesh->nvertices() == 18); | ||
|
||
//! Get coordinates and stress | ||
std::vector<Eigen::VectorXd> coordinates = mesh->coordinates(); | ||
std::vector<Eigen::VectorXd> stresses = mesh->stress(); | ||
|
||
//! Check size | ||
REQUIRE(mesh->coordinates().size() == 4); | ||
|
||
//! Check coordinates | ||
REQUIRE(coordinates.at(0)[0] == Approx(0.25).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(0)[1] == Approx(0.50).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(0)[2] == Approx(0.25).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(1)[0] == Approx(0.25).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(1)[1] == Approx(0.50).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(1)[2] == Approx(0.75).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(2)[0] == Approx(0.75).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(2)[1] == Approx(0.50).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(2)[2] == Approx(0.25).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(3)[0] == Approx(0.75).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(3)[1] == Approx(0.50).epsilon(tolerance)); | ||
REQUIRE(coordinates.at(3)[2] == Approx(0.75).epsilon(tolerance)); | ||
|
||
//! Check stress | ||
REQUIRE(stresses.at(0)[0] == Approx(-4905).epsilon(tolerance)); | ||
REQUIRE(stresses.at(0)[1] == Approx(-4905).epsilon(tolerance)); | ||
REQUIRE(stresses.at(0)[2] == Approx(-9810).epsilon(tolerance)); | ||
REQUIRE(stresses.at(0)[3] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(0)[4] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(0)[5] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(1)[0] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(1)[1] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(1)[2] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(1)[3] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(1)[4] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(1)[5] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(2)[0] == Approx(-4905).epsilon(tolerance)); | ||
REQUIRE(stresses.at(2)[1] == Approx(-4905).epsilon(tolerance)); | ||
REQUIRE(stresses.at(2)[2] == Approx(-9810).epsilon(tolerance)); | ||
REQUIRE(stresses.at(2)[3] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(2)[4] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(2)[5] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(3)[0] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(3)[1] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(3)[2] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(3)[3] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(3)[4] == Approx(0).epsilon(tolerance)); | ||
REQUIRE(stresses.at(3)[5] == Approx(0).epsilon(tolerance)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef REGRESSION_GLOBAL_H_ | ||
#define REGRESSION_GLOBAL_H_ | ||
|
||
extern std::string filename; | ||
|
||
#endif // REGRESSION_GLOBAL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#define CATCH_CONFIG_RUNNER | ||
#include "catch.hpp" | ||
#include "regression_global.h" | ||
|
||
std::string filename; | ||
|
||
int main(int argc, char** argv) { | ||
|
||
try { | ||
//! Check the number of arguments | ||
if (argc != 2) { | ||
std::cout << "Usage: ./mpm_point_generator_regression_test /path/to/meshfile.msh\n"; | ||
throw std::runtime_error("Incorrect number of input arguments"); | ||
} | ||
|
||
//! Pass the argument of the file | ||
filename = argv[1]; | ||
|
||
int result = Catch::Session().run(); | ||
|
||
return ( result < 0xff ? result : 0xff ); | ||
|
||
} catch (std::exception& except) { | ||
std::cout << "Caught exception: " << except.what() << '\n'; | ||
} | ||
|
||
} |
File renamed without changes.