Skip to content

Commit cdaabce

Browse files
committed
Fix vtk test
1 parent 8c369bb commit cdaabce

File tree

2 files changed

+44
-39
lines changed

2 files changed

+44
-39
lines changed

tests/test_vtk_writing.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from fidimag.atomistic.hexagonal_mesh import HexagonalMesh
55
from fidimag.common.field import scalar_field, vector_field
66
from fidimag.common.vtk import VTK
7+
import pyvtk
78

89
MODULE_DIR = os.path.realpath(os.path.dirname(__file__))
9-
REF_DIR = os.path.join(os.path.dirname(os.path.dirname(MODULE_DIR)), "tests", "vtk_refs")
10-
10+
REF_DIR = os.path.dirname(__file__) + '/vtk_refs/'
1111

1212
def same_as_ref(filepath, ref_dir):
1313
"""
@@ -18,6 +18,11 @@ def same_as_ref(filepath, ref_dir):
1818
filename = os.path.basename(filepath)
1919
reference = os.path.join(ref_dir, filename)
2020
ret = subprocess.call(["diff", filepath, reference])
21+
f = open(filepath, 'r').read()
22+
print('new\n', f)
23+
f = open(reference, 'r').read()
24+
print('ref\n', f)
25+
2126
return ret == 0 # 0 means files are the same, c.f. man diff exit codes
2227

2328

tests/vtk_refs/scalar_hexagonal_000000.vtk

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@
33
ASCII
44
DATASET POLYDATA
55
POINTS 30 double
6-
2.0 1.73205080757 0.0
7-
1.0 2.30940107676 0.0
8-
-2.22044604925e-16 1.73205080757 0.0
9-
0.0 0.57735026919 0.0
10-
1.0 0.0 0.0
11-
2.0 0.57735026919 0.0
12-
4.0 1.73205080757 0.0
13-
3.0 2.30940107676 0.0
6+
2.0 1.7320508075688774 0.0
7+
1.0 2.3094010767585034 0.0
8+
-2.220446049250313e-16 1.7320508075688774 0.0
9+
0.0 0.5773502691896257 0.0
10+
0.9999999999999998 0.0 0.0
11+
1.9999999999999998 0.5773502691896253 0.0
12+
4.0 1.7320508075688774 0.0
13+
3.0 2.3094010767585034 0.0
1414
3.0 0.0 0.0
15-
4.0 0.57735026919 0.0
16-
6.0 1.73205080757 0.0
17-
5.0 2.30940107676 0.0
15+
4.0 0.5773502691896253 0.0
16+
6.0 1.7320508075688774 0.0
17+
5.0 2.3094010767585034 0.0
1818
5.0 0.0 0.0
19-
6.0 0.57735026919 0.0
20-
3.0 3.46410161514 0.0
21-
2.0 4.04145188433 0.0
22-
1.0 3.46410161514 0.0
23-
5.0 3.46410161514 0.0
24-
4.0 4.04145188433 0.0
25-
7.0 3.46410161514 0.0
26-
6.0 4.04145188433 0.0
27-
7.0 2.30940107676 0.0
28-
4.0 5.19615242271 0.0
29-
3.0 5.7735026919 0.0
30-
2.0 5.19615242271 0.0
31-
6.0 5.19615242271 0.0
32-
5.0 5.7735026919 0.0
33-
8.0 5.19615242271 0.0
34-
7.0 5.7735026919 0.0
35-
8.0 4.04145188433 0.0
19+
6.0 0.5773502691896253 0.0
20+
3.0 3.464101615137755 0.0
21+
2.0 4.041451884327381 0.0
22+
0.9999999999999998 3.464101615137755 0.0
23+
5.0 3.464101615137755 0.0
24+
4.0 4.041451884327381 0.0
25+
7.0 3.464101615137755 0.0
26+
6.0 4.041451884327381 0.0
27+
7.0 2.309401076758503 0.0
28+
4.0 5.196152422706632 0.0
29+
3.0 5.773502691896257 0.0
30+
1.9999999999999998 5.196152422706632 0.0
31+
6.0 5.196152422706632 0.0
32+
5.0 5.773502691896257 0.0
33+
8.0 5.196152422706632 0.0
34+
7.0 5.773502691896257 0.0
35+
8.0 4.04145188432738 0.0
3636
POLYGONS 9 63
3737
6 0 1 2 3 4 5
3838
6 6 7 0 5 8 9
@@ -46,12 +46,12 @@ POLYGONS 9 63
4646
CELL_DATA 9
4747
SCALARS s double 1
4848
LOOKUP_TABLE default
49-
2.15470053838
50-
4.15470053838
51-
6.15470053838
52-
4.88675134595
53-
6.88675134595
54-
8.88675134595
55-
7.61880215352
56-
9.61880215352
57-
11.6188021535
49+
2.1547005383792515
50+
4.1547005383792515
51+
6.1547005383792515
52+
4.886751345948129
53+
6.886751345948129
54+
8.886751345948129
55+
7.618802153517006
56+
9.618802153517006
57+
11.618802153517006

0 commit comments

Comments
 (0)