/[escript]/trunk/finley/test/python/run_visualization_interface.py
ViewVC logotype

Contents of /trunk/finley/test/python/run_visualization_interface.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4938 - (show annotations)
Wed May 14 01:13:23 2014 UTC (5 years, 3 months ago) by jfenwick
File MIME type: text/x-python
File size: 43345 byte(s)
Modify unit tests to read their classes from
esys.escriptcore.utestselect

Change the line in that file to switch between unittest and unittest2


1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 import esys.escriptcore.utestselect as unittest
25 from esys.escript import *
26 from esys.finley import ReadMesh
27
28 try:
29 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
30 except KeyError:
31 FINLEY_TEST_DATA='.'
32
33 try:
34 FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
35 except KeyError:
36 FINLEY_WORKDIR='.'
37
38 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
39 # if os.name == "nt":
40 # FINLEY_TEST_MESH_PATH = os.path.join(FINLEY_TEST_MESH_PATH,"win32")
41 FINLEY_WORKDIR_PATH=FINLEY_WORKDIR
42
43 class Test_VisualizationInterface(unittest.TestCase):
44 def check_dx(self,f,reference_f):
45 out_string=open(os.path.join(FINLEY_WORKDIR_PATH,f)).read().splitlines()
46 ref_string=open(os.path.join(FINLEY_TEST_MESH_PATH,reference_f)).read().splitlines()
47 c=0
48 for l in range(0,len(ref_string)):
49 if not ref_string[l].strip()[0]=="#":
50 line=out_string[c].strip()
51 if os.name == "nt":
52 line=line.replace("e+00","e+0").replace("e-00","e-0")
53 line=line.replace("e-00","e+00").replace("-0.000000e+00","0.000000e+00")
54 self.assertEqual(line,ref_string[l].strip(),"line %d (%s) in dx file does not match reference (%s)"%(c,line,ref_string[l].strip()))
55 c+=1
56
57 class Test_DXFiles(Test_VisualizationInterface):
58 # ===========================================================================
59 def test_hex_2D_order2_dx(self):
60 reference="hex_2D_o1.dx"
61 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
62 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2.dx"),domain=dom)
63 self.check_dx("hex_2D_order2.dx",reference)
64
65 def test_hex_2D_order2_AllPoints_Scalar_dx(self):
66 reference="hex_2D_o1_node_3xs.dx"
67 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
68 x=Solution(dom).getX()
69 x_r=ReducedSolution(dom).getX()
70 x_n=ContinuousFunction(dom).getX()
71 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2_AllPoints_Scalar.dx"),data_r=x_r[0],data_n=x_n[0],data=x[0])
72 self.check_dx("hex_2D_order2_AllPoints_Scalar.dx",reference)
73 def test_hex_2D_order2_02Points_Scalar_dx(self):
74 reference="hex_2D_o1_node_2xs.dx"
75 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
76 x=Solution(dom).getX()
77 x_n=ContinuousFunction(dom).getX()
78 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2_O2Points_Scalar.dx"),data_n=x_n[0],data=x[0])
79 self.check_dx("hex_2D_order2_O2Points_Scalar.dx",reference)
80 def test_hex_2D_order2_2Cells_Scalar_dx(self):
81 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
82 x=Function(dom).getX()
83 x_b=FunctionOnBoundary(dom).getX()
84 try:
85 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2_2Cells_Scalar.dx"),data=x[0],data_b=x_b[0])
86 self.fail("non-matching data not detected.")
87 except Exception:
88 pass
89 def test_hex_2D_order2_BoundaryPoint_Scalar_dx(self):
90 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
91 x=ContinuousFunction(dom).getX()
92 x_b=FunctionOnBoundary(dom).getX()
93 try:
94 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2_BoundaryPoint_Scalar.dx"),data=x[0],data_b=x_b[0])
95 self.fail("non-matching data not detected.")
96 except Exception:
97 pass
98 def test_hex_2D_order2_Cells_AllData_dx(self):
99 reference="hex_2D_o1_cell_all.dx"
100 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
101 x=Function(dom).getX()
102 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2_Cells_AllData.dx"),data_s=x[0],data_v=x[0]*[1.,2.],data_t=x[0]*[[11.,12.],[21.,22.]],data_t2=x[0]*[[-11.,-12.],[-21.,-22.]])
103 self.check_dx("hex_2D_order2_Cells_AllData.dx",reference)
104
105 def test_hex_2D_order2_CellsPoints_AllData_dx(self):
106 reference="hex_2D_o1_cellnode_all.dx"
107 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_2D_order2.msh"),optimize=False)
108 x_c=Function(dom).getX()
109 x_p=ContinuousFunction(dom).getX()
110 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_2D_order2_CellsPoints_AllData.dx"),data_sp=x_p[0],
111 data_vp=x_p[0]*[1.,2.],
112 data_tp=x_p[0]*[[11.,12.],[21.,22.]],
113 data_sc=x_c[0],
114 data_vc=x_c[0]*[1.,2.],
115 data_tc=x_c[0]*[[11.,12.],[21.,22.]])
116 self.check_dx("hex_2D_order2_CellsPoints_AllData.dx",reference)
117 # ======================================================================================================================
118 def test_hex_contact_2D_order1_ContinuousFunction_Scalar_dx(self):
119 reference="hex_2D_o1_node_s.dx"
120 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
121 x=ContinuousFunction(dom).getX()
122 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ContinuousFunction_Scalar.dx"),data=x[0])
123 self.check_dx("hex_contact_2D_order1_ContinuousFunction_Scalar.dx",reference)
124 def test_hex_contact_2D_order1_ContinuousFunction_Vector_dx(self):
125 reference="hex_2D_o1_node_v.dx"
126 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
127 x=ContinuousFunction(dom).getX()
128 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ContinuousFunction_Vector.dx"),data=x[0]*[1.,2.])
129 self.check_dx("hex_contact_2D_order1_ContinuousFunction_Vector.dx",reference)
130 def test_hex_contact_2D_order1_ContinuousFunction_Tensor_dx(self):
131 reference="hex_2D_o1_node_t.dx"
132 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
133 x=ContinuousFunction(dom).getX()
134 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ContinuousFunction_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
135 self.check_dx("hex_contact_2D_order1_ContinuousFunction_Tensor.dx",reference)
136 def test_hex_contact_2D_order1_Solution_Scalar_dx(self):
137 reference="hex_2D_o1_node_s.dx"
138 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
139 x=Solution(dom).getX()
140 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_Solution_Scalar.dx"),data=x[0])
141 self.check_dx("hex_contact_2D_order1_Solution_Scalar.dx",reference)
142 def test_hex_contact_2D_order1_Solution_Vector_dx(self):
143 reference="hex_2D_o1_node_v.dx"
144 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
145 x=Solution(dom).getX()
146 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_Solution_Vector.dx"),data=x[0]*[1.,2.])
147 self.check_dx("hex_contact_2D_order1_Solution_Vector.dx",reference)
148 def test_hex_contact_2D_order1_Solution_Tensor_dx(self):
149 reference="hex_2D_o1_node_t.dx"
150 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
151 x=Solution(dom).getX()
152 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_Solution_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
153 self.check_dx("hex_contact_2D_order1_Solution_Tensor.dx",reference)
154 def test_hex_contact_2D_order1_ReducedSolution_Scalar_dx(self):
155 reference="hex_2D_o1_node_s.dx"
156 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
157 x=ReducedSolution(dom).getX()
158 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedSolution_Scalar.dx"),data=x[0])
159 self.check_dx("hex_contact_2D_order1_ReducedSolution_Scalar.dx",reference)
160 def test_hex_contact_2D_order1_ReducedSolution_Vector_dx(self):
161 reference="hex_2D_o1_node_v.dx"
162 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
163 x=ReducedSolution(dom).getX()
164 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedSolution_Vector.dx"),data=x[0]*[1.,2.])
165 self.check_dx("hex_contact_2D_order1_ReducedSolution_Vector.dx",reference)
166 def test_hex_contact_2D_order1_ReducedSolution_Tensor_dx(self):
167 reference="hex_2D_o1_node_t.dx"
168 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
169 x=ReducedSolution(dom).getX()
170 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedSolution_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
171 self.check_dx("hex_contact_2D_order1_ReducedSolution_Tensor.dx",reference)
172 def test_hex_contact_2D_order1_Function_Scalar_dx(self):
173 reference="hex_2D_o1_cell_s.dx"
174 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
175 x=Function(dom).getX()
176 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_Function_Scalar.dx"),data=x[0])
177 self.check_dx("hex_contact_2D_order1_Function_Scalar.dx",reference)
178 def test_hex_contact_2D_order1_Function_Vector_dx(self):
179 reference="hex_2D_o1_cell_v.dx"
180 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
181 x=Function(dom).getX()
182 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_Function_Vector.dx"),data=x[0]*[1.,2.])
183 self.check_dx("hex_contact_2D_order1_Function_Vector.dx",reference)
184 def test_hex_contact_2D_order1_Function_Tensor_dx(self):
185 reference="hex_2D_o1_cell_t.dx"
186 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
187 x=Function(dom).getX()
188 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_Function_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
189 self.check_dx("hex_contact_2D_order1_Function_Tensor.dx",reference)
190 def test_hex_contact_2D_order1_ReducedFunction_Scalar_dx(self):
191 reference="hex_2D_o1_cell_s.dx"
192 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
193 x=ReducedFunction(dom).getX()
194 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedFunction_Scalar.dx"),data=x[0])
195 self.check_dx("hex_contact_2D_order1_ReducedFunction_Scalar.dx",reference)
196 def test_hex_contact_2D_order1_ReducedFunction_Vector_dx(self):
197 reference="hex_2D_o1_cell_v.dx"
198 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
199 x=ReducedFunction(dom).getX()
200 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedFunction_Vector.dx"),data=x[0]*[1.,2.])
201 self.check_dx("hex_contact_2D_order1_ReducedFunction_Vector.dx",reference)
202 def test_hex_contact_2D_order1_ReducedFunction_Tensor_dx(self):
203 reference="hex_2D_o1_cell_t.dx"
204 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
205 x=ReducedFunction(dom).getX()
206 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedFunction_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
207 self.check_dx("hex_contact_2D_order1_ReducedFunction_Tensor.dx",reference)
208 def test_hex_contact_2D_order1_FunctionOnBoundary_Scalar_dx(self):
209 reference="hex_2D_o1_boundary_s.dx"
210 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
211 x=FunctionOnBoundary(dom).getX()
212 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_FunctionOnBoundary_Scalar.dx"),data=x[0])
213 self.check_dx("hex_contact_2D_order1_FunctionOnBoundary_Scalar.dx",reference)
214 def test_hex_contact_2D_order1_FunctionOnBoundary_Vector_dx(self):
215 reference="hex_2D_o1_boundary_v.dx"
216 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
217 x=FunctionOnBoundary(dom).getX()
218 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_FunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.])
219 self.check_dx("hex_contact_2D_order1_FunctionOnBoundary_Vector.dx",reference)
220 def test_hex_contact_2D_order1_FunctionOnBoundary_Tensor_dx(self):
221 reference="hex_2D_o1_boundary_t.dx"
222 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
223 x=FunctionOnBoundary(dom).getX()
224 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_FunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
225 self.check_dx("hex_contact_2D_order1_FunctionOnBoundary_Tensor.dx",reference)
226 def test_hex_contact_2D_order1_ReducedFunctionOnBoundary_Scalar_dx(self):
227 reference="hex_2D_o1_boundary_s.dx"
228 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
229 x=ReducedFunctionOnBoundary(dom).getX()
230 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedFunctionOnBoundary_Scalar.dx"),data=x[0])
231 self.check_dx("hex_contact_2D_order1_ReducedFunctionOnBoundary_Scalar.dx",reference)
232 def test_hex_contact_2D_order1_ReducedFunctionOnBoundary_Vector_dx(self):
233 reference="hex_2D_o1_boundary_v.dx"
234 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
235 x=ReducedFunctionOnBoundary(dom).getX()
236 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedFunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.])
237 self.check_dx("hex_contact_2D_order1_ReducedFunctionOnBoundary_Vector.dx",reference)
238 def test_hex_contact_2D_order1_ReducedFunctionOnBoundary_Tensor_dx(self):
239 reference="hex_2D_o1_boundary_t.dx"
240 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order1.msh"),optimize=False)
241 x=ReducedFunctionOnBoundary(dom).getX()
242 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order1_ReducedFunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
243 self.check_dx("hex_contact_2D_order1_ReducedFunctionOnBoundary_Tensor.dx",reference)
244 # ======================================================================================================================
245 def test_hex_contact_2D_order2_ContinuousFunction_Scalar_dx(self):
246 reference="hex_2D_o2_node_s.dx"
247 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
248 x=ContinuousFunction(dom).getX()
249 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ContinuousFunction_Scalar.dx"),data=x[0])
250 self.check_dx("hex_contact_2D_order2_ContinuousFunction_Scalar.dx",reference)
251 def test_hex_contact_2D_order2_ContinuousFunction_Vector_dx(self):
252 reference="hex_2D_o2_node_v.dx"
253 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
254 x=ContinuousFunction(dom).getX()
255 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ContinuousFunction_Vector.dx"),data=x[0]*[1.,2.])
256 self.check_dx("hex_contact_2D_order2_ContinuousFunction_Vector.dx",reference)
257 def test_hex_contact_2D_order2_ContinuousFunction_Tensor_dx(self):
258 reference="hex_2D_o2_node_t.dx"
259 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
260 x=ContinuousFunction(dom).getX()
261 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ContinuousFunction_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
262 self.check_dx("hex_contact_2D_order2_ContinuousFunction_Tensor.dx",reference)
263 def test_hex_contact_2D_order2_Solution_Scalar_dx(self):
264 reference="hex_2D_o2_node_s.dx"
265 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
266 x=Solution(dom).getX()
267 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_Solution_Scalar.dx"),data=x[0])
268 self.check_dx("hex_contact_2D_order2_Solution_Scalar.dx",reference)
269 def test_hex_contact_2D_order2_Solution_Vector_dx(self):
270 reference="hex_2D_o2_node_v.dx"
271 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
272 x=Solution(dom).getX()
273 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_Solution_Vector.dx"),data=x[0]*[1.,2.])
274 self.check_dx("hex_contact_2D_order2_Solution_Vector.dx",reference)
275 def test_hex_contact_2D_order2_Solution_Tensor_dx(self):
276 reference="hex_2D_o2_node_t.dx"
277 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
278 x=Solution(dom).getX()
279 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_Solution_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
280 self.check_dx("hex_contact_2D_order2_Solution_Tensor.dx",reference)
281 def test_hex_contact_2D_order2_ReducedSolution_Scalar_dx(self):
282 reference="hex_2D_o1_node_s.dx"
283 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
284 x=ReducedSolution(dom).getX()
285 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedSolution_Scalar.dx"),data=x[0])
286 self.check_dx("hex_contact_2D_order2_ReducedSolution_Scalar.dx",reference)
287 def test_hex_contact_2D_order2_ReducedSolution_Vector_dx(self):
288 reference="hex_2D_o1_node_v.dx"
289 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
290 x=ReducedSolution(dom).getX()
291 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedSolution_Vector.dx"),data=x[0]*[1.,2.])
292 self.check_dx("hex_contact_2D_order2_ReducedSolution_Vector.dx",reference)
293 def test_hex_contact_2D_order2_ReducedSolution_Tensor_dx(self):
294 reference="hex_2D_o1_node_t.dx"
295 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
296 x=ReducedSolution(dom).getX()
297 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedSolution_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
298 self.check_dx("hex_contact_2D_order2_ReducedSolution_Tensor.dx",reference)
299 def test_hex_contact_2D_order2_Function_Scalar_dx(self):
300 reference="hex_2D_o2_cell_s.dx"
301 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
302 x=Function(dom).getX()
303 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_Function_Scalar.dx"),data=x[0])
304 self.check_dx("hex_contact_2D_order2_Function_Scalar.dx",reference)
305 def test_hex_contact_2D_order2_Function_Vector_dx(self):
306 reference="hex_2D_o2_cell_v.dx"
307 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
308 x=Function(dom).getX()
309 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_Function_Vector.dx"),data=x[0]*[1.,2.])
310 self.check_dx("hex_contact_2D_order2_Function_Vector.dx",reference)
311 def test_hex_contact_2D_order2_Function_Tensor_dx(self):
312 reference="hex_2D_o2_cell_t.dx"
313 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
314 x=Function(dom).getX()
315 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_Function_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
316 self.check_dx("hex_contact_2D_order2_Function_Tensor.dx",reference)
317 def test_hex_contact_2D_order2_ReducedFunction_Scalar_dx(self):
318 reference="hex_2D_o2_cell_s.dx"
319 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
320 x=ReducedFunction(dom).getX()
321 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedFunction_Scalar.dx"),data=x[0])
322 self.check_dx("hex_contact_2D_order2_ReducedFunction_Scalar.dx",reference)
323 def test_hex_contact_2D_order2_ReducedFunction_Vector_dx(self):
324 reference="hex_2D_o2_cell_v.dx"
325 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
326 x=ReducedFunction(dom).getX()
327 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedFunction_Vector.dx"),data=x[0]*[1.,2.])
328 self.check_dx("hex_contact_2D_order2_ReducedFunction_Vector.dx",reference)
329 def test_hex_contact_2D_order2_ReducedFunction_Tensor_dx(self):
330 reference="hex_2D_o2_cell_t.dx"
331 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
332 x=ReducedFunction(dom).getX()
333 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedFunction_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
334 self.check_dx("hex_contact_2D_order2_ReducedFunction_Tensor.dx",reference)
335 def test_hex_contact_2D_order2_FunctionOnBoundary_Scalar_dx(self):
336 reference="hex_2D_o2_boundary_s.dx"
337 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
338 x=FunctionOnBoundary(dom).getX()
339 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_FunctionOnBoundary_Scalar.dx"),data=x[0])
340 self.check_dx("hex_contact_2D_order2_FunctionOnBoundary_Scalar.dx",reference)
341 def test_hex_contact_2D_order2_FunctionOnBoundary_Vector_dx(self):
342 reference="hex_2D_o2_boundary_v.dx"
343 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
344 x=FunctionOnBoundary(dom).getX()
345 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_FunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.])
346 self.check_dx("hex_contact_2D_order2_FunctionOnBoundary_Vector.dx",reference)
347 def test_hex_contact_2D_order2_FunctionOnBoundary_Tensor_dx(self):
348 reference="hex_2D_o2_boundary_t.dx"
349 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
350 x=FunctionOnBoundary(dom).getX()
351 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_FunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
352 self.check_dx("hex_contact_2D_order2_FunctionOnBoundary_Tensor.dx",reference)
353 def test_hex_contact_2D_order2_ReducedFunctionOnBoundary_Scalar_dx(self):
354 reference="hex_2D_o2_boundary_s.dx"
355 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
356 x=ReducedFunctionOnBoundary(dom).getX()
357 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedFunctionOnBoundary_Scalar.dx"),data=x[0])
358 self.check_dx("hex_contact_2D_order2_ReducedFunctionOnBoundary_Scalar.dx",reference)
359 def test_hex_contact_2D_order2_ReducedFunctionOnBoundary_Vector_dx(self):
360 reference="hex_2D_o2_boundary_v.dx"
361 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
362 x=ReducedFunctionOnBoundary(dom).getX()
363 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedFunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.])
364 self.check_dx("hex_contact_2D_order2_ReducedFunctionOnBoundary_Vector.dx",reference)
365 def test_hex_contact_2D_order2_ReducedFunctionOnBoundary_Tensor_dx(self):
366 reference="hex_2D_o2_boundary_t.dx"
367 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_2D_order2.msh"),optimize=False)
368 x=ReducedFunctionOnBoundary(dom).getX()
369 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_2D_order2_ReducedFunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.],[21.,22.]])
370 self.check_dx("hex_contact_2D_order2_ReducedFunctionOnBoundary_Tensor.dx",reference)
371 # ======================================================================================================================
372 def test_hex_contact_3D_order1_ContinuousFunction_Scalar_dx(self):
373 reference="hex_3D_o1_node_s.dx"
374 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
375 x=ContinuousFunction(dom).getX()
376 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ContinuousFunction_Scalar.dx"),data=x[0])
377 self.check_dx("hex_contact_3D_order1_ContinuousFunction_Scalar.dx",reference)
378 def test_hex_contact_3D_order1_ContinuousFunction_Vector_dx(self):
379 reference="hex_3D_o1_node_v.dx"
380 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
381 x=ContinuousFunction(dom).getX()
382 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ContinuousFunction_Vector.dx"),data=x[0]*[1.,2.,3.])
383 self.check_dx("hex_contact_3D_order1_ContinuousFunction_Vector.dx",reference)
384 def test_hex_contact_3D_order1_ContinuousFunction_Tensor_dx(self):
385 reference="hex_3D_o1_node_t.dx"
386 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
387 x=ContinuousFunction(dom).getX()
388 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ContinuousFunction_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
389 self.check_dx("hex_contact_3D_order1_ContinuousFunction_Tensor.dx",reference)
390 def test_hex_contact_3D_order1_Solution_Scalar_dx(self):
391 reference="hex_3D_o1_node_s.dx"
392 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
393 x=Solution(dom).getX()
394 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_Solution_Scalar.dx"),data=x[0])
395 self.check_dx("hex_contact_3D_order1_Solution_Scalar.dx",reference)
396 def test_hex_contact_3D_order1_Solution_Vector_dx(self):
397 reference="hex_3D_o1_node_v.dx"
398 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
399 x=Solution(dom).getX()
400 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_Solution_Vector.dx"),data=x[0]*[1.,2.,3.])
401 self.check_dx("hex_contact_3D_order1_Solution_Vector.dx",reference)
402 def test_hex_contact_3D_order1_Solution_Tensor_dx(self):
403 reference="hex_3D_o1_node_t.dx"
404 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
405 x=Solution(dom).getX()
406 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_Solution_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
407 self.check_dx("hex_contact_3D_order1_Solution_Tensor.dx",reference)
408 def test_hex_contact_3D_order1_ReducedSolution_Scalar_dx(self):
409 reference="hex_3D_o1_node_s.dx"
410 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
411 x=ReducedSolution(dom).getX()
412 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedSolution_Scalar.dx"),data=x[0])
413 self.check_dx("hex_contact_3D_order1_ReducedSolution_Scalar.dx",reference)
414 def test_hex_contact_3D_order1_ReducedSolution_Vector_dx(self):
415 reference="hex_3D_o1_node_v.dx"
416 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
417 x=ReducedSolution(dom).getX()
418 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedSolution_Vector.dx"),data=x[0]*[1.,2.,3.])
419 self.check_dx("hex_contact_3D_order1_ReducedSolution_Vector.dx",reference)
420 def test_hex_contact_3D_order1_ReducedSolution_Tensor_dx(self):
421 reference="hex_3D_o1_node_t.dx"
422 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
423 x=ReducedSolution(dom).getX()
424 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedSolution_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
425 self.check_dx("hex_contact_3D_order1_ReducedSolution_Tensor.dx",reference)
426 def test_hex_contact_3D_order1_Function_Scalar_dx(self):
427 reference="hex_3D_o1_cell_s.dx"
428 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
429 x=Function(dom).getX()
430 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_Function_Scalar.dx"),data=x[0])
431 self.check_dx("hex_contact_3D_order1_Function_Scalar.dx",reference)
432 def test_hex_contact_3D_order1_Function_Vector_dx(self):
433 reference="hex_3D_o1_cell_v.dx"
434 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
435 x=Function(dom).getX()
436 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_Function_Vector.dx"),data=x[0]*[1.,2.,3.])
437 self.check_dx("hex_contact_3D_order1_Function_Vector.dx",reference)
438 def test_hex_contact_3D_order1_Function_Tensor_dx(self):
439 reference="hex_3D_o1_cell_t.dx"
440 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
441 x=Function(dom).getX()
442 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_Function_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
443 self.check_dx("hex_contact_3D_order1_Function_Tensor.dx",reference)
444 def test_hex_contact_3D_order1_ReducedFunction_Scalar_dx(self):
445 reference="hex_3D_o1_cell_s.dx"
446 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
447 x=ReducedFunction(dom).getX()
448 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedFunction_Scalar.dx"),data=x[0])
449 self.check_dx("hex_contact_3D_order1_ReducedFunction_Scalar.dx",reference)
450 def test_hex_contact_3D_order1_ReducedFunction_Vector_dx(self):
451 reference="hex_3D_o1_cell_v.dx"
452 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
453 x=ReducedFunction(dom).getX()
454 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedFunction_Vector.dx"),data=x[0]*[1.,2.,3.])
455 self.check_dx("hex_contact_3D_order1_ReducedFunction_Vector.dx",reference)
456 def test_hex_contact_3D_order1_ReducedFunction_Tensor_dx(self):
457 reference="hex_3D_o1_cell_t.dx"
458 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
459 x=ReducedFunction(dom).getX()
460 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedFunction_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
461 self.check_dx("hex_contact_3D_order1_ReducedFunction_Tensor.dx",reference)
462 def test_hex_contact_3D_order1_FunctionOnBoundary_Scalar_dx(self):
463 reference="hex_3D_o1_boundary_s.dx"
464 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
465 x=FunctionOnBoundary(dom).getX()
466 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_FunctionOnBoundary_Scalar.dx"),data=x[0])
467 self.check_dx("hex_contact_3D_order1_FunctionOnBoundary_Scalar.dx",reference)
468 def test_hex_contact_3D_order1_FunctionOnBoundary_Vector_dx(self):
469 reference="hex_3D_o1_boundary_v.dx"
470 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
471 x=FunctionOnBoundary(dom).getX()
472 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_FunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.,3.])
473 self.check_dx("hex_contact_3D_order1_FunctionOnBoundary_Vector.dx",reference)
474 def test_hex_contact_3D_order1_FunctionOnBoundary_Tensor_dx(self):
475 reference="hex_3D_o1_boundary_t.dx"
476 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
477 x=FunctionOnBoundary(dom).getX()
478 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_FunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
479 self.check_dx("hex_contact_3D_order1_FunctionOnBoundary_Tensor.dx",reference)
480 def test_hex_contact_3D_order1_ReducedFunctionOnBoundary_Scalar_dx(self):
481 reference="hex_3D_o1_boundary_s.dx"
482 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
483 x=ReducedFunctionOnBoundary(dom).getX()
484 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedFunctionOnBoundary_Scalar.dx"),data=x[0])
485 self.check_dx("hex_contact_3D_order1_ReducedFunctionOnBoundary_Scalar.dx",reference)
486 def test_hex_contact_3D_order1_ReducedFunctionOnBoundary_Vector_dx(self):
487 reference="hex_3D_o1_boundary_v.dx"
488 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
489 x=ReducedFunctionOnBoundary(dom).getX()
490 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedFunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.,3.])
491 self.check_dx("hex_contact_3D_order1_ReducedFunctionOnBoundary_Vector.dx",reference)
492 def test_hex_contact_3D_order1_ReducedFunctionOnBoundary_Tensor_dx(self):
493 reference="hex_3D_o1_boundary_t.dx"
494 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order1.msh"),optimize=False)
495 x=ReducedFunctionOnBoundary(dom).getX()
496 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order1_ReducedFunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
497 self.check_dx("hex_contact_3D_order1_ReducedFunctionOnBoundary_Tensor.dx",reference)
498 # ======================================================================================================================
499 def test_hex_contact_3D_order2_ContinuousFunction_Scalar_dx(self):
500 reference="hex_3D_o1_node_s.dx"
501 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
502 x=ContinuousFunction(dom).getX()
503 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ContinuousFunction_Scalar.dx"),data=x[0])
504 self.check_dx("hex_contact_3D_order2_ContinuousFunction_Scalar.dx",reference)
505 def test_hex_contact_3D_order2_ContinuousFunction_Vector_dx(self):
506 reference="hex_3D_o1_node_v.dx"
507 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
508 x=ContinuousFunction(dom).getX()
509 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ContinuousFunction_Vector.dx"),data=x[0]*[1.,2.,3.])
510 self.check_dx("hex_contact_3D_order2_ContinuousFunction_Vector.dx",reference)
511 def test_hex_contact_3D_order2_ContinuousFunction_Tensor_dx(self):
512 reference="hex_3D_o1_node_t.dx"
513 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
514 x=ContinuousFunction(dom).getX()
515 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ContinuousFunction_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
516 self.check_dx("hex_contact_3D_order2_ContinuousFunction_Tensor.dx",reference)
517 def test_hex_contact_3D_order2_Solution_Scalar_dx(self):
518 reference="hex_3D_o1_node_s.dx"
519 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
520 x=Solution(dom).getX()
521 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_Solution_Scalar.dx"),data=x[0])
522 self.check_dx("hex_contact_3D_order2_Solution_Scalar.dx",reference)
523 def test_hex_contact_3D_order2_Solution_Vector_dx(self):
524 reference="hex_3D_o1_node_v.dx"
525 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
526 x=Solution(dom).getX()
527 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_Solution_Vector.dx"),data=x[0]*[1.,2.,3.])
528 self.check_dx("hex_contact_3D_order2_Solution_Vector.dx",reference)
529 def test_hex_contact_3D_order2_Solution_Tensor_dx(self):
530 reference="hex_3D_o1_node_t.dx"
531 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
532 x=Solution(dom).getX()
533 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_Solution_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
534 self.check_dx("hex_contact_3D_order2_Solution_Tensor.dx",reference)
535 def test_hex_contact_3D_order2_ReducedSolution_Scalar_dx(self):
536 reference="hex_3D_o1_node_s.dx"
537 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
538 x=ReducedSolution(dom).getX()
539 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedSolution_Scalar.dx"),data=x[0])
540 self.check_dx("hex_contact_3D_order2_ReducedSolution_Scalar.dx",reference)
541 def test_hex_contact_3D_order2_ReducedSolution_Vector_dx(self):
542 reference="hex_3D_o1_node_v.dx"
543 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
544 x=ReducedSolution(dom).getX()
545 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedSolution_Vector.dx"),data=x[0]*[1.,2.,3.])
546 self.check_dx("hex_contact_3D_order2_ReducedSolution_Vector.dx",reference)
547 def test_hex_contact_3D_order2_ReducedSolution_Tensor_dx(self):
548 reference="hex_3D_o1_node_t.dx"
549 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
550 x=ReducedSolution(dom).getX()
551 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedSolution_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
552 self.check_dx("hex_contact_3D_order2_ReducedSolution_Tensor.dx",reference)
553 def test_hex_contact_3D_order2_Function_Scalar_dx(self):
554 reference="hex_3D_o1_cell_s.dx"
555 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
556 x=Function(dom).getX()
557 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_Function_Scalar.dx"),data=x[0])
558 self.check_dx("hex_contact_3D_order2_Function_Scalar.dx",reference)
559 def test_hex_contact_3D_order2_Function_Vector_dx(self):
560 reference="hex_3D_o1_cell_v.dx"
561 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
562 x=Function(dom).getX()
563 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_Function_Vector.dx"),data=x[0]*[1.,2.,3.])
564 self.check_dx("hex_contact_3D_order2_Function_Vector.dx",reference)
565 def test_hex_contact_3D_order2_Function_Tensor_dx(self):
566 reference="hex_3D_o1_cell_t.dx"
567 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
568 x=Function(dom).getX()
569 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_Function_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
570 self.check_dx("hex_contact_3D_order2_Function_Tensor.dx",reference)
571 def test_hex_contact_3D_order2_ReducedFunction_Scalar_dx(self):
572 reference="hex_3D_o1_cell_s.dx"
573 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
574 x=ReducedFunction(dom).getX()
575 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedFunction_Scalar.dx"),data=x[0])
576 self.check_dx("hex_contact_3D_order2_ReducedFunction_Scalar.dx",reference)
577 def test_hex_contact_3D_order2_ReducedFunction_Vector_dx(self):
578 reference="hex_3D_o1_cell_v.dx"
579 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
580 x=ReducedFunction(dom).getX()
581 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedFunction_Vector.dx"),data=x[0]*[1.,2.,3.])
582 self.check_dx("hex_contact_3D_order2_ReducedFunction_Vector.dx",reference)
583 def test_hex_contact_3D_order2_ReducedFunction_Tensor_dx(self):
584 reference="hex_3D_o1_cell_t.dx"
585 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
586 x=ReducedFunction(dom).getX()
587 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedFunction_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
588 self.check_dx("hex_contact_3D_order2_ReducedFunction_Tensor.dx",reference)
589 def test_hex_contact_3D_order2_FunctionOnBoundary_Scalar_dx(self):
590 reference="hex_3D_o1_boundary_s.dx"
591 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
592 x=FunctionOnBoundary(dom).getX()
593 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_FunctionOnBoundary_Scalar.dx"),data=x[0])
594 self.check_dx("hex_contact_3D_order2_FunctionOnBoundary_Scalar.dx",reference)
595 def test_hex_contact_3D_order2_FunctionOnBoundary_Vector_dx(self):
596 reference="hex_3D_o1_boundary_v.dx"
597 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
598 x=FunctionOnBoundary(dom).getX()
599 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_FunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.,3.])
600 self.check_dx("hex_contact_3D_order2_FunctionOnBoundary_Vector.dx",reference)
601 def test_hex_contact_3D_order2_FunctionOnBoundary_Tensor_dx(self):
602 reference="hex_3D_o1_boundary_t.dx"
603 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
604 x=FunctionOnBoundary(dom).getX()
605 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_FunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
606 self.check_dx("hex_contact_3D_order2_FunctionOnBoundary_Tensor.dx",reference)
607 def test_hex_contact_3D_order2_ReducedFunctionOnBoundary_Scalar_dx(self):
608 reference="hex_3D_o1_boundary_s.dx"
609 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
610 x=ReducedFunctionOnBoundary(dom).getX()
611 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedFunctionOnBoundary_Scalar.dx"),data=x[0])
612 self.check_dx("hex_contact_3D_order2_ReducedFunctionOnBoundary_Scalar.dx",reference)
613 def test_hex_contact_3D_order2_ReducedFunctionOnBoundary_Vector_dx(self):
614 reference="hex_3D_o1_boundary_v.dx"
615 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
616 x=ReducedFunctionOnBoundary(dom).getX()
617 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedFunctionOnBoundary_Vector.dx"),data=x[0]*[1.,2.,3.])
618 self.check_dx("hex_contact_3D_order2_ReducedFunctionOnBoundary_Vector.dx",reference)
619 def test_hex_contact_3D_order2_ReducedFunctionOnBoundary_Tensor_dx(self):
620 reference="hex_3D_o1_boundary_t.dx"
621 dom=ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"hex_contact_3D_order2.msh"),optimize=False)
622 x=ReducedFunctionOnBoundary(dom).getX()
623 saveDX(os.path.join(FINLEY_WORKDIR_PATH,"hex_contact_3D_order2_ReducedFunctionOnBoundary_Tensor.dx"),data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
624 self.check_dx("hex_contact_3D_order2_ReducedFunctionOnBoundary_Tensor.dx",reference)
625
626 if __name__ == '__main__':
627 import sys
628 suite = unittest.TestSuite()
629 # saveDX is not MPI parallel
630 if getMPISizeWorld() == 1:
631 suite.addTest(unittest.makeSuite(Test_DXFiles))
632 pass
633 else:
634 print("Test_DXFiles is dropped as number of processors >1")
635 s=unittest.TextTestRunner(verbosity=2).run(suite)
636 if not s.wasSuccessful(): sys.exit(1)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26