Permalink
Browse files

Merge branch 'addtestelementvolume' into 'master'

Addtestelementvolume

See merge request !244
  • Loading branch information...
JSchoeberl committed Sep 30, 2017
2 parents af17351 + 9bde6f2 commit 0383c5843feb9a72d048695bc4611dd7c7f61896
Showing with 237 additions and 0 deletions.
  1. +2 −0 tests/catch/CMakeLists.txt
  2. +121 −0 tests/catch/cube.vol
  3. +31 −0 tests/catch/line.vol
  4. +28 −0 tests/catch/meshaccess.cpp
  5. +55 −0 tests/catch/square.vol
@@ -32,4 +32,6 @@ endmacro()
add_unit_test(finiteelement finiteelement.cpp)
add_unit_test(coefficientfunction coefficientfunction.cpp)
file(COPY line.vol square.vol cube.vol DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_unit_test(meshaccess meshaccess.cpp)
endif(ENABLE_UNIT_TESTS)
@@ -0,0 +1,121 @@
mesh3d
dimension
3
geomtype
0
# surfnr bcnr domin domout np p1 p2 p3
surfaceelements
12
1 1 1 0 3 1 2 6
1 1 1 0 3 1 6 4
3 2 1 0 3 1 3 2
3 2 1 0 3 2 3 5
2 3 1 0 3 5 7 8
2 3 1 0 3 3 7 5
4 4 1 0 3 4 8 7
4 4 1 0 3 4 6 8
5 5 1 0 3 1 7 3
5 5 1 0 3 1 4 7
6 6 1 0 3 5 8 6
6 6 1 0 3 2 5 6
# matnr np p1 p2 p3 p4
volumeelements
12
1 4 5 6 9 8
1 4 1 2 9 3
1 4 2 3 5 9
1 4 1 2 6 9
1 4 1 3 9 7
1 4 1 4 7 9
1 4 1 4 9 6
1 4 2 5 6 9
1 4 3 5 9 7
1 4 5 7 8 9
1 4 4 7 9 8
1 4 4 6 8 9
# surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2
edgesegmentsgi2
24
1 0 1 2 268846752 392874576 1 3 1 0 0 0
2 0 2 1 268846752 392874576 1 3 1 0 0 0
3 0 7 8 0 7 4 2 2 0 0 0
4 0 8 7 0 7 4 2 2 0 0 0
3 0 3 7 0 7 5 2 3 0 0 0
5 0 7 3 0 7 5 2 3 0 0 0
3 0 8 5 0 7 2 6 4 0 0 0
6 0 5 8 0 7 2 6 4 0 0 0
4 0 6 8 0 7 4 6 5 0 0 0
6 0 8 6 0 7 4 6 5 0 0 0
1 0 2 6 0 7 6 1 6 0 0 0
6 0 6 2 0 7 6 1 6 0 0 0
3 0 5 3 0 7 2 3 7 0 0 0
2 0 3 5 0 7 2 3 7 0 0 0
1 0 6 4 0 7 4 1 8 0 0 0
4 0 4 6 0 7 4 1 8 0 0 0
2 0 1 3 0 1 5 3 9 0 0 0
5 0 3 1 0 1 5 3 9 0 0 0
4 0 7 4 0 7 4 5 10 0 0 0
5 0 4 7 0 7 4 5 10 0 0 0
1 0 4 1 0 7 1 5 11 0 0 0
5 0 1 4 0 7 1 5 11 0 0 0
2 0 5 2 0 7 3 6 12 0 0 0
6 0 2 5 0 7 3 6 12 0 0 0
# X Y Z
points
9
0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 1.0000000000000000
1.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 1.0000000000000000 0.0000000000000000
1.0000000000000000 0.0000000000000000 1.0000000000000000
0.0000000000000000 1.0000000000000000 1.0000000000000000
1.0000000000000000 1.0000000000000000 0.0000000000000000
1.0000000000000000 1.0000000000000000 1.0000000000000000
0.5000000023804340 0.5000000026093593 0.5000000024337123
bcnames
6
1 back
2 left
3 front
4 right
5 bottom
6 top
# Surfnr Red Green Blue
face_colours
6
1 0.00000000 1.00000000 0.00000000
3 0.00000000 1.00000000 0.00000000
2 0.00000000 1.00000000 0.00000000
4 0.00000000 1.00000000 0.00000000
5 0.00000000 1.00000000 0.00000000
6 0.00000000 1.00000000 0.00000000
endmesh
csgsurfaces 6
plane 6
0.00000000 0.00000000 0.00000000 -1.00000000 0.00000000 0.00000000
plane 6
1.00000000 1.00000000 1.00000000 1.00000000 0.00000000 0.00000000
plane 6
0.00000000 0.00000000 0.00000000 0.00000000 -1.00000000 0.00000000
plane 6
1.00000000 1.00000000 1.00000000 0.00000000 1.00000000 0.00000000
plane 6
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 -1.00000000
plane 6
1.00000000 1.00000000 1.00000000 0.00000000 0.00000000 1.00000000
@@ -0,0 +1,31 @@
mesh3d
dimension
1
geomtype
0
# surfnr bcnr domin domout np p1 p2 p3
surfaceelements
0
# matnr np p1 p2 p3 p4
volumeelements
0
# surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2
edgesegmentsgi2
1
1 0 1 2 8 0 -1 -1 1 0 0 0
# X Y Z
points
2
0.0000000000000000 0.0000000000000000 0.0000000000000000
1.0000000000000000 0.0000000000000000 0.0000000000000000
endmesh
@@ -0,0 +1,28 @@
#include "catch.hpp"
#include <comp.hpp>
using namespace ngcomp;
TEST_CASE ("ElementVolume", "[elementvolume]")
{
netgen::printmessage_importance = 0;
SECTION ("ElementVolume", "[elementvolume]")
{
for(int dim : {1,2,3})
{
SECTION ("ElementVolume, dim = "+to_string(dim), "[elementvolume]")
{
string meshfile = dim==1 ? "line.vol" : (dim==2 ? "square.vol" : "cube.vol");
double elvol = dim==1 ? 1.0 : (dim==2 ? 1./2 : 1./12);
auto ma = MeshAccess(meshfile);
for(auto el : ma.Elements(VOL))
{
CHECK(ma.ElementVolume(el.Nr()) == Approx(elvol).epsilon(1e-9));
}
}
}
}
}
@@ -0,0 +1,55 @@
mesh3d
dimension
2
geomtype
0
# surfnr bcnr domin domout np p1 p2 p3
surfaceelements
2
2 1 0 0 3 1 2 3
2 1 0 0 3 1 3 4
# matnr np p1 p2 p3 p4
volumeelements
0
# surfid 0 p1 p2 trignum1 trignum2 domin/surfnr1 domout/surfnr2 ednr1 dist1 ednr2 dist2
edgesegmentsgi2
4
1 0 1 2 0 0 1 0 1 0 1 1
2 0 2 3 0 0 1 0 2 0 2 1
3 0 3 4 0 0 1 0 3 0 3 1
4 0 4 1 0 0 1 0 4 0 4 1
# X Y Z
points
4
0.0000000000000000 0.0000000000000000 0.0000000000000000
1.0000000000000000 0.0000000000000000 0.0000000000000000
1.0000000000000000 1.0000000000000000 0.0000000000000000
0.0000000000000000 1.0000000000000000 0.0000000000000000
bcnames
5
1 bottom
2 right
3 top
4 left
5 default
# Surfnr Red Green Blue
face_colours
1
2 0.00000000 1.00000000 0.00000000
endmesh

0 comments on commit 0383c58

Please sign in to comment.