/[escript]/trunk/weipa/test/python/run_savevtk_tests.py
ViewVC logotype

Contents of /trunk/weipa/test/python/run_savevtk_tests.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3969 - (show annotations)
Tue Sep 18 05:34:38 2012 UTC (7 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 87832 byte(s)
Removing reference to nose

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2012 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2012 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 import os, math
23 import unittest
24 from xml.dom import minidom
25 from esys.escript import getMPISizeWorld, saveDX
26 from esys.escript import ContinuousFunction
27 from esys.escript import Function, ReducedFunction
28 from esys.escript import FunctionOnBoundary, ReducedFunctionOnBoundary
29 from esys.escript import FunctionOnContactZero, ReducedFunctionOnContactZero
30 from esys.escript import FunctionOnContactOne, ReducedFunctionOnContactOne
31 from esys.escript import Solution, ReducedSolution
32 from esys import finley
33 from esys import dudley
34 from esys.weipa import saveVTK
35
36 try:
37 WEIPA_TEST_MESHES=os.environ['WEIPA_TEST_MESHES']
38 except KeyError:
39 WEIPA_TEST_MESHES='meshes'
40
41 try:
42 WEIPA_WORKDIR=os.environ['WEIPA_WORKDIR']
43 except KeyError:
44 WEIPA_WORKDIR='.'
45
46 class VTKParser():
47 """
48 VTU (VTK XML format) file parser.
49 """
50 def __init__(self):
51 self.doc=None
52
53 def parse(self, filename):
54 # load file and remove superfluous whitespace
55 dom=minidom.parse(filename)
56 dom=minidom.parseString(dom.toxml()
57 .replace('>\n','>').replace('\n<','<').replace('\n',' '))
58 self.doc = dom.documentElement
59 # check for general file validity
60 return self.doc.tagName=='VTKFile' and \
61 self.doc.getAttribute('type')=='UnstructuredGrid'
62
63 def getTimeAndCycle(self):
64 time=None
65 cycle=None
66 for e in self.doc.getElementsByTagName('FieldData'):
67 for d in e.childNodes:
68 if d.getAttribute('Name')=='TIME':
69 time = float(d.childNodes[0].data)
70 elif d.getAttribute('Name')=='CYCLE':
71 cycle = int(d.childNodes[0].data)
72 return time, cycle
73
74 def getNumPointsAndCells(self):
75 piece = self.doc.getElementsByTagName('Piece')[0]
76 return int(piece.getAttribute('NumberOfPoints')), int(piece.getAttribute('NumberOfCells'))
77
78 def getPoints(self):
79 points = self.doc.getElementsByTagName('Points')[0]
80 array = points.childNodes[0]
81 nComp = int(array.getAttribute('NumberOfComponents'))
82 flatlist = list(map(float, array.childNodes[0].data.split()))
83 return [flatlist[i:i+nComp] for i in range(0,len(flatlist),nComp)]
84
85 def getCellConnectivity(self):
86 conn=None
87 cells = self.doc.getElementsByTagName('Cells')[0]
88 for d in cells.childNodes:
89 if d.getAttribute('Name')=='connectivity':
90 conn = list(map(int, d.childNodes[0].data.split()))
91 return conn
92
93 def getCellOffsets(self):
94 offsets=None
95 cells = self.doc.getElementsByTagName('Cells')[0]
96 for d in cells.childNodes:
97 if d.getAttribute('Name')=='offsets':
98 offsets = list(map(int, d.childNodes[0].data.split()))
99 return offsets
100
101 def getCellTypes(self):
102 types=None
103 cells = self.doc.getElementsByTagName('Cells')[0]
104 for d in cells.childNodes:
105 if d.getAttribute('Name')=='types':
106 types = list(map(int, d.childNodes[0].data.split()))
107 return types
108
109 def getPointData(self):
110 data={}
111 pdata = self.doc.getElementsByTagName('PointData')
112 if len(pdata)>0:
113 for d in pdata[0].childNodes:
114 if d.hasChildNodes():
115 nComp = int(d.getAttribute('NumberOfComponents'))
116 flatlist = list(map(float, d.childNodes[0].data.split()))
117 if nComp==1:
118 data[d.getAttribute('Name')] = flatlist
119 else:
120 l=[flatlist[i:i+nComp] for i in range(0,len(flatlist),nComp)]
121 data[d.getAttribute('Name')] = l
122 return data
123
124 def getCellData(self):
125 data={}
126 cdata = self.doc.getElementsByTagName('CellData')
127 if len(cdata)>0:
128 for d in cdata[0].childNodes:
129 if d.hasChildNodes():
130 nComp = int(d.getAttribute('NumberOfComponents'))
131 flatlist = list(map(float, d.childNodes[0].data.split()))
132 if nComp==1:
133 data[d.getAttribute('Name')] = flatlist
134 else:
135 l=[flatlist[i:i+nComp] for i in range(0,len(flatlist),nComp)]
136 data[d.getAttribute('Name')] = l
137 return data
138
139
140 class Test_VTKSaver(unittest.TestCase):
141 # Compares two lists of numbers using the L2 norm, returns true if they
142 # match up to a tolerance TOL, false otherwise
143 def numericCompareL2(self, vector1, vector2):
144 if vector2 == None: return False
145 TOL = 2.0e-6
146 if len(vector1) != len(vector2): return False
147 diff = 0.0
148 for i in range(0, len(vector1)):
149 tmp = vector1[i] - vector2[i]
150 diff += tmp * tmp
151 if math.sqrt(diff) > TOL: return False
152 return True
153
154 # Compares two data arrays (of scalars, vectors & tensors) which may be
155 # permuted. IndexMap is used to map one value in d1 to one or more values
156 # in d2.
157 def compareDataWithMap(self, d1, d2, indexMap):
158 if len(d1) != len(d2): return False
159 for i in range(len(d1)):
160 if i in indexMap:
161 jlist=indexMap[i]
162 if type(d1[i])==list:
163 if not max([ self.numericCompareL2(d1[i], d2[j]) for j in jlist ]):
164 return False
165 else:
166 if not max([ self.numericCompareL2([d1[i]], [d2[j]]) for j in jlist ]):
167 return False
168 else:
169 return False
170 return True
171
172 # Compares two VTK files, asserts if any element is not equal.
173 # file2 is the reference file to compare against
174 def compareVTKfiles(self, file1, file2):
175 p1=VTKParser()
176 p2=VTKParser()
177 self.assertTrue(p1.parse(file1), "Invalid vtu file")
178 p2.parse(file2)
179 self.assertEquals(p1.getTimeAndCycle(), p2.getTimeAndCycle())
180 nPoints1, nCells1 = p1.getNumPointsAndCells()
181 self.assertEquals((nPoints1, nCells1), p2.getNumPointsAndCells())
182
183 nodeList1 = p1.getPoints()
184 nodeList2 = p2.getPoints()
185 self.assertEquals(len(nodeList1), nPoints1)
186
187 # Find mapping of nodes in file 1 to file 2 (they may be permuted)
188 nodeMap1to2 = {}
189 for i1 in range(len(nodeList1)):
190 indexList=[]
191 for i2 in range(len(nodeList2)):
192 if self.numericCompareL2(nodeList1[i1], nodeList2[i2]):
193 indexList.append(i2)
194 self.assertNotEquals(len(indexList), 0,
195 "Node with coordinates %s missing."%nodeList1[i1])
196 nodeMap1to2[i1]=indexList
197
198 # cells
199 offsets1 = p1.getCellOffsets()
200 offsets2 = p2.getCellOffsets()
201 self.assertEquals(len(offsets1), nCells1)
202 types1 = p1.getCellTypes()
203 types2 = p2.getCellTypes()
204 self.assertEquals(len(types1), nCells1)
205 conn1 = p1.getCellConnectivity()
206 conn2 = p2.getCellConnectivity()
207 elementList1=[]
208 elementList2=[]
209 lastOffset1=0
210 lastOffset2=0
211 for i in range(nCells1):
212 elementList1.append(conn1[lastOffset1:offsets1[i]])
213 elementList2.append(conn2[lastOffset2:offsets2[i]])
214 lastOffset1=offsets1[i]
215 lastOffset2=offsets2[i]
216 self.assertEquals(len(elementList1), len(elementList2))
217
218 # find element mapping, then compare types.
219 # offsets are compared implicitly by creating the mapping
220 elementMap1to2 = {}
221 for i1 in range(len(elementList1)):
222 index=None
223 for i2 in range(len(elementList2)):
224 mappedL1=[nodeMap1to2[i] for i in elementList1[i1]]
225 if len(mappedL1)==len(elementList2[i2]):
226 matches=[elementList2[i2][i] in mappedL1[i] for i in range(len(elementList2[i2]))]
227 if min(matches):
228 index=i2
229 break
230 self.assertNotEquals(index, None,
231 "Element %s is missing."%elementList1[i1])
232 elementMap1to2[i1]=[index]
233
234 types1n = [types1[elementMap1to2[i][0]] for i in range(nCells1)]
235 self.assertEquals(types1n, types2)
236
237 # point data
238 pdata1=p1.getPointData()
239 pdata2=p2.getPointData()
240 self.assertEquals(len(pdata1), len(pdata2))
241 for name in pdata2:
242 self.assertTrue(name in pdata1, "Point variable '%s' missing"%name)
243 self.assertEquals(len(pdata1[name]), nPoints1)
244 if not name.startswith('mesh_vars/'):
245 self.assertTrue(self.compareDataWithMap(
246 pdata1[name], pdata2[name], nodeMap1to2),
247 "Point data in '%s' does not match" % name)
248
249 # cell data
250 cdata1=p1.getCellData()
251 cdata2=p2.getCellData()
252 self.assertEquals(len(cdata1), len(cdata2))
253 for name in cdata2:
254 self.assertTrue(name in cdata1, "Cell variable '%s' missing"%name)
255 self.assertEquals(len(cdata1[name]), nCells1)
256 if not name.startswith('mesh_vars/'):
257 self.assertTrue(self.compareDataWithMap(
258 cdata1[name], cdata2[name], elementMap1to2),
259 "Cell data in '%s' does not match" % name)
260
261 def check_vtk(self, reference, fspaces=[], **data):
262 outFileBase="out_"+reference
263 saveVTK(os.path.join(WEIPA_WORKDIR, outFileBase), write_meshdata=True, **data)
264 if len(fspaces)>0:
265 for fs in fspaces:
266 ref=os.path.join(WEIPA_TEST_MESHES, reference+"_"+fs+".vtu")
267 out=os.path.join(WEIPA_WORKDIR, outFileBase+"_"+fs+".vtu")
268 self.compareVTKfiles(out, ref)
269 else:
270 ref=os.path.join(WEIPA_TEST_MESHES, reference+".vtu")
271 out=os.path.join(WEIPA_WORKDIR, outFileBase+".vtu")
272 self.compareVTKfiles(out, ref)
273
274
275 class Test_Finley_SaveVTK(Test_VTKSaver):
276
277 # === METADATA =============================================================
278
279 def test_metadata_full(self):
280 fn=os.path.join(WEIPA_WORKDIR, "metadata0.vtu")
281 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES, "hex_2D_order2.msh"), optimize=False)
282 saveVTK(fn, x=dom.getX(), metadata_schema={"gml":"http://www.opengis.net/gml"}, metadata='<dummy>hello world</dummy><timeStamp uom="s">1234</timeStamp>')
283 # testing:
284 dom=VTKParser()
285 self.assertTrue(dom.parse(fn), "Invalid vtu file")
286 self.assertEqual(dom.doc.getAttribute("xmlns:gml"), "http://www.opengis.net/gml")
287 self.assertTrue(len(dom.doc.getElementsByTagName("MetaData"))>0, "No MetaData element found")
288 mdNode = dom.doc.getElementsByTagName("MetaData")[0]
289 dummy = None
290 timestamp = None
291 for n in mdNode.childNodes:
292 if n.tagName == 'dummy':
293 dummy = n.childNodes[0].data
294 self.assertEqual(dummy, 'hello world')
295 elif n.tagName == 'timeStamp':
296 uom = n.getAttribute('uom')
297 self.assertEqual(uom, 's')
298 timestamp = n.childNodes[0].data
299 self.assertEqual(timestamp, '1234')
300 else:
301 self.fail('Unexpected metadata tag found')
302 self.assertNotEqual(dummy, None)
303 self.assertNotEqual(timestamp, None)
304
305 def test_metadata_no_schema(self):
306 fn=os.path.join(WEIPA_WORKDIR, "metadata1.vtu")
307 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES, "hex_2D_order2.msh"), optimize=False)
308 saveVTK(fn, x=dom.getX(), metadata='<dummy>hello world</dummy><timeStamp uom="s">1234</timeStamp>')
309 # testing:
310 dom=VTKParser()
311 self.assertTrue(dom.parse(fn), "Invalid vtu file")
312 self.assertTrue(len(dom.doc.getElementsByTagName("MetaData"))>0, "No MetaData element found")
313 mdNode = dom.doc.getElementsByTagName("MetaData")[0]
314 dummy=None
315 timeStamp=None
316 for n in mdNode.childNodes:
317 if n.tagName == 'dummy':
318 dummy = n.childNodes[0].data
319 self.assertEqual(dummy, 'hello world')
320 elif n.tagName == 'timeStamp':
321 uom = n.getAttribute('uom')
322 self.assertEqual(uom, 's')
323 timestamp = n.childNodes[0].data
324 self.assertEqual(timestamp, '1234')
325 else:
326 self.fail('Unexpected metadata tag found')
327 self.assertNotEqual(dummy, None)
328 self.assertNotEqual(timestamp, None)
329
330 def test_metadata_schema_only(self):
331 fn=os.path.join(WEIPA_WORKDIR, "metadata2.vtu")
332 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES, "hex_2D_order2.msh"), optimize=False)
333 saveVTK(fn, x=dom.getX(), metadata_schema={"gml":"http://www.opengis.net/gml"})
334 # testing:
335 dom=VTKParser()
336 self.assertTrue(dom.parse(fn), "Invalid vtu file")
337 self.assertEqual(dom.doc.getAttribute("xmlns:gml"), "http://www.opengis.net/gml")
338
339 # === HEX 2D macro =========================================================
340
341 def test_hex_2D_macro(self):
342 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
343 self.check_vtk("hex_2D_o2p", domain=dom)
344
345 def test_hex_2D_macro_AllPoints_Scalar(self):
346 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
347 x=Solution(dom).getX()
348 x_r=ReducedSolution(dom).getX()
349 x_n=ContinuousFunction(dom).getX()
350 self.check_vtk("hex_2D_o1_node_3xs", ['Elements','ReducedElements'], data_r=x_r[0], data_n=x_n[0], data=x[0])
351
352 def test_hex_2D_macro_02Points_Scalar(self):
353 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
354 x=Solution(dom).getX()
355 x_n=ContinuousFunction(dom).getX()
356 self.check_vtk("hex_2D_o2p_node_2xs", data_n=x_n[0], data=x[0])
357
358 def test_hex_2D_macro_2Cells_Scalar(self):
359 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
360 x=Function(dom).getX()
361 x_b=FunctionOnBoundary(dom).getX()
362 self.check_vtk("hex_2D_cell_2xs", ['Elements','FaceElements'], data_b=x_b[0], data=x[0])
363
364 def test_hex_2D_macro_BoundaryPoint_Scalar(self):
365 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
366 x=ContinuousFunction(dom).getX()
367 x_b=FunctionOnBoundary(dom).getX()
368 self.check_vtk("hex_2D_boundary_2xs", ['Elements','FaceElements'], data_b=x_b[0], data=x[0])
369
370 def test_hex_2D_macro_Cells_AllData(self):
371 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
372 x=Function(dom).getX()
373 self.check_vtk("hex_2D_macro_cell_all",
374 data_s=x[0],
375 data_v=x[0]*[1.,2.],
376 data_t=x[0]*[[11.,12.],[21.,22.]],
377 data_t2=x[0]*[[-11.,-12.],[-21.,-22.]])
378
379 def test_hex_2D_macro_CellsPoints_AllData(self):
380 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
381 x_c=Function(dom).getX()
382 x_p=ContinuousFunction(dom).getX()
383 self.check_vtk("hex_2D_macro_cellnode_all",
384 data_sp=x_p[0],
385 data_vp=x_p[0]*[1.,2.],
386 data_tp=x_p[0]*[[11.,12.],[21.,22.]],
387 data_sc=x_c[0],
388 data_vc=x_c[0]*[1.,2.],
389 data_tc=x_c[0]*[[11.,12.],[21.,22.]])
390
391 def test_hex_2D_macro_ContinuousFunction(self):
392 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
393 x=ContinuousFunction(dom).getX()
394 self.check_vtk("hex_2D_o2p_node_s", data=x[0])
395 self.check_vtk("hex_2D_o2p_node_v", data=x[0]*[1.,2.])
396 self.check_vtk("hex_2D_o2p_node_t", data=x[0]*[[11.,12.],[21.,22.]])
397
398 def test_hex_2D_macro_Solution(self):
399 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
400 x=Solution(dom).getX()
401 self.check_vtk("hex_2D_o2p_node_s", data=x[0])
402 self.check_vtk("hex_2D_o2p_node_v", data=x[0]*[1.,2.])
403 self.check_vtk("hex_2D_o2p_node_t", data=x[0]*[[11.,12.],[21.,22.]])
404
405 def test_hex_2D_macro_ReducedSolution(self):
406 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
407 x=ReducedSolution(dom).getX()
408 self.check_vtk("hex_2D_o2p_reduced_node_s", data=x[0])
409 self.check_vtk("hex_2D_o2p_reduced_node_v", data=x[0]*[1.,2.])
410 self.check_vtk("hex_2D_o2p_reduced_node_t", data=x[0]*[[11.,12.],[21.,22.]])
411
412 def test_hex_2D_macro_Function(self):
413 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
414 x=Function(dom).getX()
415 self.check_vtk("hex_2D_macro_cell_s", data=x[0])
416 self.check_vtk("hex_2D_macro_cell_v", data=x[0]*[1.,2.])
417 self.check_vtk("hex_2D_macro_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
418
419 def test_hex_2D_macro_ReducedFunction(self):
420 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
421 x=ReducedFunction(dom).getX()
422 self.check_vtk("hex_2D_macro_cell_s", data=x[0])
423 self.check_vtk("hex_2D_macro_cell_v", data=x[0]*[1.,2.])
424 self.check_vtk("hex_2D_macro_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
425
426 def test_hex_2D_macro_FunctionOnBoundary(self):
427 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
428 x=FunctionOnBoundary(dom).getX()
429 self.check_vtk("hex_2D_macro_boundary_s", data=x[0])
430 self.check_vtk("hex_2D_macro_boundary_v", data=x[0]*[1.,2.])
431 self.check_vtk("hex_2D_macro_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
432
433 def test_hex_2D_macro_ReducedFunctionOnBoundary(self):
434 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_macro.msh"),optimize=False)
435 x=ReducedFunctionOnBoundary(dom).getX()
436 self.check_vtk("hex_2D_macro_boundary_s", data=x[0])
437 self.check_vtk("hex_2D_macro_boundary_v", data=x[0]*[1.,2.])
438 self.check_vtk("hex_2D_macro_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
439
440 # === HEX 2D order 2 =======================================================
441
442 def test_hex_2D_order2(self):
443 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
444 self.check_vtk("hex_2D_o2", domain=dom)
445
446 def test_hex_2D_order2_AllPoints_Scalar(self):
447 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
448 x=Solution(dom).getX()
449 x_r=ReducedSolution(dom).getX()
450 x_n=ContinuousFunction(dom).getX()
451 self.check_vtk("hex_2D_o2_node_3xs", ['Elements','ReducedElements'], data_r=x_r[0], data_n=x_n[0], data=x[0])
452
453 def test_hex_2D_order2_02Points_Scalar(self):
454 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
455 x=Solution(dom).getX()
456 x_n=ContinuousFunction(dom).getX()
457 self.check_vtk("hex_2D_o2_node_2xs", data_n=x_n[0], data=x[0])
458
459 def test_hex_2D_order2_2Cells_Scalar(self):
460 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
461 x=Function(dom).getX()
462 x_b=FunctionOnBoundary(dom).getX()
463 self.check_vtk("hex_2D_o2_cell_2xs", ['ReducedElements','ReducedFaceElements'], data_b=x_b[0], data=x[0])
464
465 def test_hex_2D_order2_BoundaryPoint_Scalar(self):
466 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
467 x=ContinuousFunction(dom).getX()
468 x_b=FunctionOnBoundary(dom).getX()
469 self.check_vtk("hex_2D_o2_boundary_2xs", ['Elements','ReducedFaceElements'], data=x[0],data_b=x_b[0])
470
471 def test_hex_2D_order2_Cells_AllData(self):
472 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
473 x=Function(dom).getX()
474 self.check_vtk("hex_2D_o2_cell_all",
475 data_s=x[0],
476 data_v=x[0]*[1.,2.],
477 data_t=x[0]*[[11.,12.],[21.,22.]],
478 data_t2=x[0]*[[-11.,-12.],[-21.,-22.]])
479
480 def test_hex_2D_order2_CellsPoints_AllData(self):
481 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2.msh"),optimize=False)
482 x_c=Function(dom).getX()
483 x_p=ContinuousFunction(dom).getX()
484 self.check_vtk("hex_2D_o2_cellnode_all", ['Elements','ReducedElements'],
485 data_sp=x_p[0],
486 data_vp=x_p[0]*[1.,2.],
487 data_tp=x_p[0]*[[11.,12.],[21.,22.]],
488 data_sc=x_c[0],
489 data_vc=x_c[0]*[1.,2.],
490 data_tc=x_c[0]*[[11.,12.],[21.,22.]])
491
492 # === HEX 2D order 2 (full) ================================================
493
494 def test_hex_2D_order2p(self):
495 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
496 self.check_vtk("hex_2D_o2p", domain=dom)
497
498 def test_hex_2D_order2p_AllPoints_Scalar(self):
499 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
500 x=Solution(dom).getX()
501 x_r=ReducedSolution(dom).getX()
502 x_n=ContinuousFunction(dom).getX()
503 self.check_vtk("hex_2D_o1_node_3xs", ['Elements','ReducedElements'], data_r=x_r[0], data_n=x_n[0], data=x[0])
504
505 def test_hex_2D_order2p_02Points_Scalar(self):
506 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
507 x=Solution(dom).getX()
508 x_n=ContinuousFunction(dom).getX()
509 self.check_vtk("hex_2D_o2p_node_2xs", data_n=x_n[0], data=x[0])
510
511 def test_hex_2D_order2p_2Cells_Scalar(self):
512 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
513 x=Function(dom).getX()
514 x_b=FunctionOnBoundary(dom).getX()
515 self.check_vtk("hex_2D_o2p_cell_2xs", ['Elements','ReducedFaceElements'], data_b=x_b[0], data=x[0])
516
517 def test_hex_2D_order2p_BoundaryPoint_Scalar(self):
518 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
519 x=ContinuousFunction(dom).getX()
520 x_b=FunctionOnBoundary(dom).getX()
521 self.check_vtk("hex_2D_o2p_boundary_2xs", ['Elements','ReducedFaceElements'], data=x[0],data_b=x_b[0])
522
523 def test_hex_2D_order2p_Cells_AllData(self):
524 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
525 x=Function(dom).getX()
526 self.check_vtk("hex_2D_o2p_cell_all",
527 data_s=x[0],
528 data_v=x[0]*[1.,2.],
529 data_t=x[0]*[[11.,12.],[21.,22.]],
530 data_t2=x[0]*[[-11.,-12.],[-21.,-22.]])
531
532 def test_hex_2D_order2p_CellsPoints_AllData(self):
533 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
534 x_c=Function(dom).getX()
535 x_p=ContinuousFunction(dom).getX()
536 self.check_vtk("hex_2D_o2p_cellnode_all",
537 data_sp=x_p[0],
538 data_vp=x_p[0]*[1.,2.],
539 data_tp=x_p[0]*[[11.,12.],[21.,22.]],
540 data_sc=x_c[0],
541 data_vc=x_c[0]*[1.,2.],
542 data_tc=x_c[0]*[[11.,12.],[21.,22.]])
543
544 def test_hex_2D_order2p_ContinuousFunction(self):
545 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
546 x=ContinuousFunction(dom).getX()
547 self.check_vtk("hex_2D_o2p_node_s", data=x[0])
548 self.check_vtk("hex_2D_o2p_node_v", data=x[0]*[1.,2.])
549 self.check_vtk("hex_2D_o2p_node_t", data=x[0]*[[11.,12.],[21.,22.]])
550
551 def test_hex_2D_order2p_Solution(self):
552 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
553 x=Solution(dom).getX()
554 self.check_vtk("hex_2D_o2p_node_s", data=x[0])
555 self.check_vtk("hex_2D_o2p_node_v", data=x[0]*[1.,2.])
556 self.check_vtk("hex_2D_o2p_node_t", data=x[0]*[[11.,12.],[21.,22.]])
557
558 def test_hex_2D_order2p_ReducedSolution(self):
559 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
560 x=ReducedSolution(dom).getX()
561 self.check_vtk("hex_2D_o2p_reduced_node_s", data=x[0])
562 self.check_vtk("hex_2D_o2p_reduced_node_v", data=x[0]*[1.,2.])
563 self.check_vtk("hex_2D_o2p_reduced_node_t", data=x[0]*[[11.,12.],[21.,22.]])
564
565 def test_hex_2D_order2p_Function(self):
566 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
567 x=Function(dom).getX()
568 self.check_vtk("hex_2D_o2p_cell_s", data=x[0])
569 self.check_vtk("hex_2D_o2p_cell_v", data=x[0]*[1.,2.])
570 self.check_vtk("hex_2D_o2p_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
571
572 def test_hex_2D_order2p_ReducedFunction(self):
573 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
574 x=ReducedFunction(dom).getX()
575 self.check_vtk("hex_2D_o2p_cell_reduced_s", data=x[0])
576 self.check_vtk("hex_2D_o2p_cell_reduced_v", data=x[0]*[1.,2.])
577 self.check_vtk("hex_2D_o2p_cell_reduced_t", data=x[0]*[[11.,12.],[21.,22.]])
578
579 def test_hex_2D_order2p_FunctionOnBoundary(self):
580 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
581 x=FunctionOnBoundary(dom).getX()
582 self.check_vtk("hex_2D_o2p_boundary_s", data=x[0])
583 self.check_vtk("hex_2D_o2p_boundary_v", data=x[0]*[1.,2.])
584 self.check_vtk("hex_2D_o2p_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
585
586 def test_hex_2D_order2p_ReducedFunctionOnBoundary(self):
587 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_2D_order2p.msh"),optimize=False)
588 x=ReducedFunctionOnBoundary(dom).getX()
589 self.check_vtk("hex_2D_o2p_boundary_s", data=x[0])
590 self.check_vtk("hex_2D_o2p_boundary_v", data=x[0]*[1.,2.])
591 self.check_vtk("hex_2D_o2p_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
592
593 # === HEX 2D order 1 with contacts =========================================
594
595 def test_hex_contact_2D_order1_ContinuousFunction(self):
596 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
597 x=ContinuousFunction(dom).getX()
598 self.check_vtk("hex_2D_o1_node_s", data=x[0])
599 self.check_vtk("hex_2D_o1_node_v", data=x[0]*[1.,2.])
600 self.check_vtk("hex_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
601
602 def test_hex_contact_2D_order1_Solution(self):
603 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
604 x=Solution(dom).getX()
605 self.check_vtk("hex_2D_o1_node_s", data=x[0])
606 self.check_vtk("hex_2D_o1_node_v", data=x[0]*[1.,2.])
607 self.check_vtk("hex_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
608
609 def test_hex_contact_2D_order1_ReducedSolution(self):
610 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
611 x=ReducedSolution(dom).getX()
612 self.check_vtk("hex_2D_o1_node_s", data=x[0])
613 self.check_vtk("hex_2D_o1_node_v", data=x[0]*[1.,2.])
614 self.check_vtk("hex_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
615
616 def test_hex_contact_2D_order1_Function(self):
617 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
618 x=Function(dom).getX()
619 self.check_vtk("hex_2D_o1_cell_s", data=x[0])
620 self.check_vtk("hex_2D_o1_cell_v", data=x[0]*[1.,2.])
621 self.check_vtk("hex_2D_o1_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
622
623 def test_hex_contact_2D_order1_ReducedFunction(self):
624 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
625 x=ReducedFunction(dom).getX()
626 self.check_vtk("hex_2D_o1_cell_s", data=x[0])
627 self.check_vtk("hex_2D_o1_cell_v", data=x[0]*[1.,2.])
628 self.check_vtk("hex_2D_o1_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
629
630 def test_hex_contact_2D_order1_FunctionOnBoundary(self):
631 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
632 x=FunctionOnBoundary(dom).getX()
633 self.check_vtk("hex_2D_o1_boundary_s", data=x[0])
634 self.check_vtk("hex_2D_o1_boundary_v", data=x[0]*[1.,2.])
635 self.check_vtk("hex_2D_o1_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
636
637 def test_hex_contact_2D_order1_ReducedFunctionOnBoundary(self):
638 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
639 x=ReducedFunctionOnBoundary(dom).getX()
640 self.check_vtk("hex_2D_o1_boundary_s", data=x[0])
641 self.check_vtk("hex_2D_o1_boundary_v", data=x[0]*[1.,2.])
642 self.check_vtk("hex_2D_o1_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
643
644 def test_hex_contact_2D_order1_onFace_FunctionOnBoundary(self):
645 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1_onFace.msh"),optimize=False)
646 x=FunctionOnBoundary(dom).getX()
647 self.check_vtk("hex_2D_o1_f_boundary_s", data=x[0])
648 self.check_vtk("hex_2D_o1_f_boundary_v", data=x[0]*[1.,2.])
649 self.check_vtk("hex_2D_o1_f_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
650
651 def test_hex_contact_2D_order1_onFace_ReducedFunctionOnBoundary(self):
652 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1_onFace.msh"),optimize=False)
653 x=ReducedFunctionOnBoundary(dom).getX()
654 self.check_vtk("hex_2D_o1_f_boundary_s", data=x[0])
655 self.check_vtk("hex_2D_o1_f_boundary_v", data=x[0]*[1.,2.])
656 self.check_vtk("hex_2D_o1_f_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
657
658 def test_hex_contact_2D_order1_FunctionOnContactZero(self):
659 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
660 x=FunctionOnContactZero(dom).getX()
661 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
662 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
663 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
664
665 def test_hex_contact_2D_order1_ReducedFunctionOnContactZero(self):
666 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
667 x=ReducedFunctionOnContactZero(dom).getX()
668 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
669 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
670 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
671
672 def test_hex_contact_2D_order1_onFace_FunctionOnContactZero(self):
673 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1_onFace.msh"),optimize=False)
674 x=FunctionOnContactZero(dom).getX()
675 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
676 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
677 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
678
679 def test_hex_contact_2D_order1_onFace_ReducedFunctionOnContactZero(self):
680 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1_onFace.msh"),optimize=False)
681 x=ReducedFunctionOnContactZero(dom).getX()
682 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
683 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
684 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
685
686 def test_hex_contact_2D_order1_FunctionOnContactOne(self):
687 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
688 x=FunctionOnContactOne(dom).getX()
689 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
690 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
691 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
692
693 def test_hex_contact_2D_order1_ReducedFunctionOnContactOne(self):
694 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1.msh"),optimize=False)
695 x=ReducedFunctionOnContactOne(dom).getX()
696 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
697 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
698 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
699
700 def test_hex_contact_2D_order1_onFace_FunctionOnContactOne(self):
701 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1_onFace.msh"),optimize=False)
702 x=FunctionOnContactOne(dom).getX()
703 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
704 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
705 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
706
707 def test_hex_contact_2D_order1_onFace_ReducedFunctionOnContactOne(self):
708 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order1_onFace.msh"),optimize=False)
709 x=ReducedFunctionOnContactOne(dom).getX()
710 self.check_vtk("hex_2D_o1_contact_s", data=x[0])
711 self.check_vtk("hex_2D_o1_contact_v", data=x[0]*[1.,2.])
712 self.check_vtk("hex_2D_o1_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
713
714 # === HEX 2D order 2 with contacts =========================================
715
716 def test_hex_contact_2D_order2_ContinuousFunction(self):
717 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
718 x=ContinuousFunction(dom).getX()
719 self.check_vtk("hex_2D_o2_node_s", data=x[0])
720 self.check_vtk("hex_2D_o2_node_v", data=x[0]*[1.,2.])
721 self.check_vtk("hex_2D_o2_node_t", data=x[0]*[[11.,12.],[21.,22.]])
722
723 def test_hex_contact_2D_order2_Solution(self):
724 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
725 x=Solution(dom).getX()
726 self.check_vtk("hex_2D_o2_node_s", data=x[0])
727 self.check_vtk("hex_2D_o2_node_v", data=x[0]*[1.,2.])
728 self.check_vtk("hex_2D_o2_node_t", data=x[0]*[[11.,12.],[21.,22.]])
729
730 def test_hex_contact_2D_order2_ReducedSolution(self):
731 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
732 x=ReducedSolution(dom).getX()
733 self.check_vtk("hex_2D_o2_reduced_node_s", data=x[0])
734 self.check_vtk("hex_2D_o2_reduced_node_v", data=x[0]*[1.,2.])
735 self.check_vtk("hex_2D_o2_reduced_node_t", data=x[0]*[[11.,12.],[21.,22.]])
736
737 def test_hex_contact_2D_order2_Function(self):
738 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
739 x=Function(dom).getX()
740 self.check_vtk("hex_2D_o2_cell_s", data=x[0])
741 self.check_vtk("hex_2D_o2_cell_v", data=x[0]*[1.,2.])
742 self.check_vtk("hex_2D_o2_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
743
744 def test_hex_contact_2D_order2_ReducedFunction(self):
745 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
746 x=ReducedFunction(dom).getX()
747 self.check_vtk("hex_2D_o2_cell_s", data=x[0])
748 self.check_vtk("hex_2D_o2_cell_v", data=x[0]*[1.,2.])
749 self.check_vtk("hex_2D_o2_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
750
751 def test_hex_contact_2D_order2_FunctionOnBoundary(self):
752 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
753 x=FunctionOnBoundary(dom).getX()
754 self.check_vtk("hex_2D_o2_boundary_s", data=x[0])
755 self.check_vtk("hex_2D_o2_boundary_v", data=x[0]*[1.,2.])
756 self.check_vtk("hex_2D_o2_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
757
758 def test_hex_contact_2D_order2_ReducedFunctionOnBoundary(self):
759 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
760 x=ReducedFunctionOnBoundary(dom).getX()
761 self.check_vtk("hex_2D_o2_boundary_s", data=x[0])
762 self.check_vtk("hex_2D_o2_boundary_v", data=x[0]*[1.,2.])
763 self.check_vtk("hex_2D_o2_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
764
765 def test_hex_contact_2D_order2_onFace_FunctionOnBoundary(self):
766 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2_onFace.msh"),optimize=False)
767 x=FunctionOnBoundary(dom).getX()
768 self.check_vtk("hex_2D_o2_f_boundary_s", data=x[0])
769 self.check_vtk("hex_2D_o2_f_boundary_v", data=x[0]*[1.,2.])
770 self.check_vtk("hex_2D_o2_f_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
771
772 def test_hex_contact_2D_order2_onFace_ReducedFunctionOnBoundary(self):
773 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2_onFace.msh"),optimize=False)
774 x=ReducedFunctionOnBoundary(dom).getX()
775 self.check_vtk("hex_2D_o2_f_boundary_s", data=x[0])
776 self.check_vtk("hex_2D_o2_f_boundary_v", data=x[0]*[1.,2.])
777 self.check_vtk("hex_2D_o2_f_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
778
779 def test_hex_contact_2D_order2_FunctionOnContactZero(self):
780 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
781 x=FunctionOnContactZero(dom).getX()
782 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
783 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
784 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
785
786 def test_hex_contact_2D_order2_ReducedFunctionOnContactZero(self):
787 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
788 x=ReducedFunctionOnContactZero(dom).getX()
789 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
790 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
791 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
792
793 def test_hex_contact_2D_order2_onFace_FunctionOnContactZero(self):
794 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2_onFace.msh"),optimize=False)
795 x=FunctionOnContactZero(dom).getX()
796 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
797 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
798 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
799
800 def test_hex_contact_2D_order2_onFace_ReducedFunctionOnContactZero(self):
801 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2_onFace.msh"),optimize=False)
802 x=ReducedFunctionOnContactZero(dom).getX()
803 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
804 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
805 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
806
807 def test_hex_contact_2D_order2_FunctionOnContactOne(self):
808 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
809 x=FunctionOnContactOne(dom).getX()
810 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
811 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
812 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
813
814 def test_hex_contact_2D_order2_ReducedFunctionOnContactOne(self):
815 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2.msh"),optimize=False)
816 x=ReducedFunctionOnContactOne(dom).getX()
817 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
818 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
819 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
820
821 def test_hex_contact_2D_order2_onFace_FunctionOnContactOne(self):
822 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2_onFace.msh"),optimize=False)
823 x=FunctionOnContactOne(dom).getX()
824 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
825 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
826 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
827
828 def test_hex_contact_2D_order2_onFace_ReducedFunctionOnContactOne(self):
829 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_2D_order2_onFace.msh"),optimize=False)
830 x=ReducedFunctionOnContactOne(dom).getX()
831 self.check_vtk("hex_2D_o2_contact_s", data=x[0])
832 self.check_vtk("hex_2D_o2_contact_v", data=x[0]*[1.,2.])
833 self.check_vtk("hex_2D_o2_contact_t", data=x[0]*[[11.,12.],[21.,22.]])
834
835 # === HEX 3D order 1 with contacts =========================================
836
837 def test_hex_contact_3D_order1_ContinuousFunction(self):
838 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
839 x=ContinuousFunction(dom).getX()
840 self.check_vtk("hex_3D_o1_node_s", data=x[0])
841 self.check_vtk("hex_3D_o1_node_v", data=x[0]*[1.,2.,3.])
842 self.check_vtk("hex_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
843
844 def test_hex_contact_3D_order1_Solution(self):
845 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
846 x=Solution(dom).getX()
847 self.check_vtk("hex_3D_o1_node_s", data=x[0])
848 self.check_vtk("hex_3D_o1_node_v", data=x[0]*[1.,2.,3.])
849 self.check_vtk("hex_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
850
851 def test_hex_contact_3D_order1_ReducedSolution(self):
852 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
853 x=ReducedSolution(dom).getX()
854 self.check_vtk("hex_3D_o1_node_s", data=x[0])
855 self.check_vtk("hex_3D_o1_node_v", data=x[0]*[1.,2.,3.])
856 self.check_vtk("hex_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
857
858 def test_hex_contact_3D_order1_Function(self):
859 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
860 x=Function(dom).getX()
861 self.check_vtk("hex_3D_o1_cell_s", data=x[0])
862 self.check_vtk("hex_3D_o1_cell_v", data=x[0]*[1.,2.,3.])
863 self.check_vtk("hex_3D_o1_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
864
865 def test_hex_contact_3D_order1_ReducedFunction(self):
866 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
867 x=ReducedFunction(dom).getX()
868 self.check_vtk("hex_3D_o1_cell_s", data=x[0])
869 self.check_vtk("hex_3D_o1_cell_v", data=x[0]*[1.,2.,3.])
870 self.check_vtk("hex_3D_o1_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
871
872 def test_hex_contact_3D_order1_FunctionOnBoundary(self):
873 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
874 x=FunctionOnBoundary(dom).getX()
875 self.check_vtk("hex_3D_o1_boundary_s", data=x[0])
876 self.check_vtk("hex_3D_o1_boundary_v", data=x[0]*[1.,2.,3.])
877 self.check_vtk("hex_3D_o1_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
878
879 def test_hex_contact_3D_order1_ReducedFunctionOnBoundary(self):
880 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
881 x=ReducedFunctionOnBoundary(dom).getX()
882 self.check_vtk("hex_3D_o1_boundary_s", data=x[0])
883 self.check_vtk("hex_3D_o1_boundary_v", data=x[0]*[1.,2.,3.])
884 self.check_vtk("hex_3D_o1_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
885
886 def test_hex_contact_3D_order1_onFace_FunctionOnBoundary(self):
887 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1_onFace.msh"),optimize=False)
888 x=FunctionOnBoundary(dom).getX()
889 self.check_vtk("hex_3D_o1_f_boundary_s", data=x[0])
890 self.check_vtk("hex_3D_o1_f_boundary_v", data=x[0]*[1.,2.,3.])
891 self.check_vtk("hex_3D_o1_f_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
892
893 def test_hex_contact_3D_order1_onFace_ReducedFunctionOnBoundary(self):
894 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1_onFace.msh"),optimize=False)
895 x=ReducedFunctionOnBoundary(dom).getX()
896 self.check_vtk("hex_3D_o1_f_boundary_s", data=x[0])
897 self.check_vtk("hex_3D_o1_f_boundary_v", data=x[0]*[1.,2.,3.])
898 self.check_vtk("hex_3D_o1_f_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
899
900 def test_hex_contact_3D_order1_FunctionOnContactZero(self):
901 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
902 x=FunctionOnContactZero(dom).getX()
903 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
904 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
905 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
906
907 def test_hex_contact_3D_order1_ReducedFunctionOnContactZero(self):
908 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
909 x=ReducedFunctionOnContactZero(dom).getX()
910 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
911 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
912 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
913
914 def test_hex_contact_3D_order1_onFace_FunctionOnContactZero(self):
915 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1_onFace.msh"),optimize=False)
916 x=FunctionOnContactZero(dom).getX()
917 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
918 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
919 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
920
921 def test_hex_contact_3D_order1_onFace_ReducedFunctionOnContactZero(self):
922 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1_onFace.msh"),optimize=False)
923 x=ReducedFunctionOnContactZero(dom).getX()
924 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
925 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
926 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
927
928 def test_hex_contact_3D_order1_FunctionOnContactOne(self):
929 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
930 x=FunctionOnContactOne(dom).getX()
931 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
932 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
933 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
934
935 def test_hex_contact_3D_order1_ReducedFunctionOnContactOne(self):
936 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1.msh"),optimize=False)
937 x=ReducedFunctionOnContactOne(dom).getX()
938 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
939 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
940 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
941
942 def test_hex_contact_3D_order1_onFace_FunctionOnContactOne(self):
943 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1_onFace.msh"),optimize=False)
944 x=FunctionOnContactOne(dom).getX()
945 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
946 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
947 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
948
949 def test_hex_contact_3D_order1_onFace_ReducedFunctionOnContactOne(self):
950 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order1_onFace.msh"),optimize=False)
951 x=ReducedFunctionOnContactOne(dom).getX()
952 self.check_vtk("hex_3D_o1_contact_s", data=x[0])
953 self.check_vtk("hex_3D_o1_contact_v", data=x[0]*[1.,2.,3.])
954 self.check_vtk("hex_3D_o1_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
955
956 # === HEX 3D order 2 with contacts =========================================
957
958 def test_hex_contact_3D_order2_ContinuousFunction(self):
959 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
960 x=ContinuousFunction(dom).getX()
961 self.check_vtk("hex_3D_o2_node_s", data=x[0])
962 self.check_vtk("hex_3D_o2_node_v", data=x[0]*[1.,2.,3.])
963 self.check_vtk("hex_3D_o2_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
964
965 def test_hex_contact_3D_order2_Solution(self):
966 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
967 x=Solution(dom).getX()
968 self.check_vtk("hex_3D_o2_node_s", data=x[0])
969 self.check_vtk("hex_3D_o2_node_v", data=x[0]*[1.,2.,3.])
970 self.check_vtk("hex_3D_o2_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
971
972 def test_hex_contact_3D_order2_ReducedSolution(self):
973 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
974 x=ReducedSolution(dom).getX()
975 self.check_vtk("hex_3D_o2_reduced_node_s", data=x[0])
976 self.check_vtk("hex_3D_o2_reduced_node_v", data=x[0]*[1.,2.,3.])
977 self.check_vtk("hex_3D_o2_reduced_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
978
979 def test_hex_contact_3D_order2_Function(self):
980 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
981 x=Function(dom).getX()
982 self.check_vtk("hex_3D_o2_cell_s", data=x[0])
983 self.check_vtk("hex_3D_o2_cell_v", data=x[0]*[1.,2.,3.])
984 self.check_vtk("hex_3D_o2_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
985
986 def test_hex_contact_3D_order2_ReducedFunction(self):
987 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
988 x=ReducedFunction(dom).getX()
989 self.check_vtk("hex_3D_o2_cell_s", data=x[0])
990 self.check_vtk("hex_3D_o2_cell_v", data=x[0]*[1.,2.,3.])
991 self.check_vtk("hex_3D_o2_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
992
993 def test_hex_contact_3D_order2_FunctionOnBoundary(self):
994 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
995 x=FunctionOnBoundary(dom).getX()
996 self.check_vtk("hex_3D_o2_boundary_s", data=x[0])
997 self.check_vtk("hex_3D_o2_boundary_v", data=x[0]*[1.,2.,3.])
998 self.check_vtk("hex_3D_o2_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
999
1000 def test_hex_contact_3D_order2_ReducedFunctionOnBoundary(self):
1001 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
1002 x=ReducedFunctionOnBoundary(dom).getX()
1003 self.check_vtk("hex_3D_o2_boundary_s", data=x[0])
1004 self.check_vtk("hex_3D_o2_boundary_v", data=x[0]*[1.,2.,3.])
1005 self.check_vtk("hex_3D_o2_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1006
1007 def test_hex_contact_3D_order2_onFace_FunctionOnBoundary(self):
1008 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2_onFace.msh"),optimize=False)
1009 x=FunctionOnBoundary(dom).getX()
1010 self.check_vtk("hex_3D_o2_f_boundary_s", data=x[0])
1011 self.check_vtk("hex_3D_o2_f_boundary_v", data=x[0]*[1.,2.,3.])
1012 self.check_vtk("hex_3D_o2_f_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1013
1014 def test_hex_contact_3D_order2_onFace_ReducedFunctionOnBoundary(self):
1015 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2_onFace.msh"),optimize=False)
1016 x=ReducedFunctionOnBoundary(dom).getX()
1017 self.check_vtk("hex_3D_o2_f_boundary_s", data=x[0])
1018 self.check_vtk("hex_3D_o2_f_boundary_v", data=x[0]*[1.,2.,3.])
1019 self.check_vtk("hex_3D_o2_f_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1020
1021 def test_hex_contact_3D_order2_FunctionOnContactZero(self):
1022 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
1023 x=FunctionOnContactZero(dom).getX()
1024 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1025 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1026 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1027
1028 def test_hex_contact_3D_order2_ReducedFunctionOnContactZero(self):
1029 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
1030 x=ReducedFunctionOnContactZero(dom).getX()
1031 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1032 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1033 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1034
1035 def test_hex_contact_3D_order2_onFace_FunctionOnContactZero(self):
1036 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2_onFace.msh"),optimize=False)
1037 x=FunctionOnContactZero(dom).getX()
1038 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1039 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1040 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1041
1042 def test_hex_contact_3D_order2_onFace_ReducedFunctionOnContactZero(self):
1043 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2_onFace.msh"),optimize=False)
1044 x=ReducedFunctionOnContactZero(dom).getX()
1045 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1046 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1047 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1048
1049 def test_hex_contact_3D_order2_FunctionOnContactOne(self):
1050 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
1051 x=FunctionOnContactOne(dom).getX()
1052 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1053 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1054 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1055
1056 def test_hex_contact_3D_order2_ReducedFunctionOnContactOne(self):
1057 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2.msh"),optimize=False)
1058 x=ReducedFunctionOnContactOne(dom).getX()
1059 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1060 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1061 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1062
1063 def test_hex_contact_3D_order2_onFace_FunctionOnContactOne(self):
1064 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2_onFace.msh"),optimize=False)
1065 x=FunctionOnContactOne(dom).getX()
1066 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1067 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1068 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1069
1070 def test_hex_contact_3D_order2_onFace_ReducedFunctionOnContactOne(self):
1071 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_contact_3D_order2_onFace.msh"),optimize=False)
1072 x=ReducedFunctionOnContactOne(dom).getX()
1073 self.check_vtk("hex_3D_o2_contact_s", data=x[0])
1074 self.check_vtk("hex_3D_o2_contact_v", data=x[0]*[1.,2.,3.])
1075 self.check_vtk("hex_3D_o2_contact_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1076
1077 # === HEX 3D order 2 (full) ================================================
1078
1079 def test_hex_3D_order2p_ContinuousFunction(self):
1080 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1081 x=ContinuousFunction(dom).getX()
1082 self.check_vtk("hex_3D_o2p_node_s", data=x[0])
1083 self.check_vtk("hex_3D_o2p_node_v", data=x[0]*[1.,2.,3.])
1084 self.check_vtk("hex_3D_o2p_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1085
1086 def test_hex_3D_order2p_Solution(self):
1087 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1088 x=Solution(dom).getX()
1089 self.check_vtk("hex_3D_o2p_node_s", data=x[0])
1090 self.check_vtk("hex_3D_o2p_node_v", data=x[0]*[1.,2.,3.])
1091 self.check_vtk("hex_3D_o2p_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1092
1093 def test_hex_3D_order2p_ReducedSolution(self):
1094 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1095 x=ReducedSolution(dom).getX()
1096 self.check_vtk("hex_3D_o2p_reduced_node_s", data=x[0])
1097 self.check_vtk("hex_3D_o2p_reduced_node_v", data=x[0]*[1.,2.,3.])
1098 self.check_vtk("hex_3D_o2p_reduced_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1099
1100 def test_hex_3D_order2p_Function(self):
1101 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1102 x=Function(dom).getX()
1103 self.check_vtk("hex_3D_o2p_cell_s", data=x[0])
1104 self.check_vtk("hex_3D_o2p_cell_v", data=x[0]*[1.,2.,3.])
1105 self.check_vtk("hex_3D_o2p_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1106
1107 def test_hex_3D_order2p_ReducedFunction(self):
1108 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1109 x=ReducedFunction(dom).getX()
1110 self.check_vtk("hex_3D_o2p_cell_reduced_s", data=x[0])
1111 self.check_vtk("hex_3D_o2p_cell_reduced_v", data=x[0]*[1.,2.,3.])
1112 self.check_vtk("hex_3D_o2p_cell_reduced_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1113
1114 def test_hex_3D_order2p_FunctionOnBoundary(self):
1115 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1116 x=FunctionOnBoundary(dom).getX()
1117 self.check_vtk("hex_3D_o2p_boundary_s", data=x[0])
1118 self.check_vtk("hex_3D_o2p_boundary_v", data=x[0]*[1.,2.,3.])
1119 self.check_vtk("hex_3D_o2p_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1120
1121 def test_hex_3D_order2p_ReducedFunctionOnBoundary(self):
1122 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_order2p.msh"),optimize=False)
1123 x=ReducedFunctionOnBoundary(dom).getX()
1124 self.check_vtk("hex_3D_o2p_boundary_reduced_s", data=x[0])
1125 self.check_vtk("hex_3D_o2p_boundary_reduced_v", data=x[0]*[1.,2.,3.])
1126 self.check_vtk("hex_3D_o2p_boundary_reduced_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1127
1128 # === HEX 3D macro =========================================================
1129
1130 def test_hex_3D_macro_ContinuousFunction(self):
1131 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1132 x=ContinuousFunction(dom).getX()
1133 self.check_vtk("hex_3D_o2p_node_s", data=x[0])
1134 self.check_vtk("hex_3D_o2p_node_v", data=x[0]*[1.,2.,3.])
1135 self.check_vtk("hex_3D_o2p_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1136
1137 def test_hex_3D_macro_Solution(self):
1138 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1139 x=Solution(dom).getX()
1140 self.check_vtk("hex_3D_o2p_node_s", data=x[0])
1141 self.check_vtk("hex_3D_o2p_node_v", data=x[0]*[1.,2.,3.])
1142 self.check_vtk("hex_3D_o2p_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1143
1144 def test_hex_3D_macro_ReducedSolution(self):
1145 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1146 x=ReducedSolution(dom).getX()
1147 self.check_vtk("hex_3D_o2p_reduced_node_s", data=x[0])
1148 self.check_vtk("hex_3D_o2p_reduced_node_v", data=x[0]*[1.,2.,3.])
1149 self.check_vtk("hex_3D_o2p_reduced_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1150
1151 def test_hex_3D_macro_Function(self):
1152 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1153 x=Function(dom).getX()
1154 self.check_vtk("hex_3D_macro_cell_s", data=x[0])
1155 self.check_vtk("hex_3D_macro_cell_v", data=x[0]*[1.,2.,3.])
1156 self.check_vtk("hex_3D_macro_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1157
1158 def test_hex_3D_macro_ReducedFunction(self):
1159 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1160 x=ReducedFunction(dom).getX()
1161 self.check_vtk("hex_3D_macro_cell_s", data=x[0])
1162 self.check_vtk("hex_3D_macro_cell_v", data=x[0]*[1.,2.,3.])
1163 self.check_vtk("hex_3D_macro_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1164
1165 def test_hex_3D_macro_FunctionOnBoundary(self):
1166 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1167 x=FunctionOnBoundary(dom).getX()
1168 self.check_vtk("hex_3D_macro_boundary_s", data=x[0])
1169 self.check_vtk("hex_3D_macro_boundary_v", data=x[0]*[1.,2.,3.])
1170 self.check_vtk("hex_3D_macro_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1171
1172 def test_hex_3D_macro_ReducedFunctionOnBoundary(self):
1173 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"hex_3D_macro.msh"),optimize=False)
1174 x=ReducedFunctionOnBoundary(dom).getX()
1175 self.check_vtk("hex_3D_macro_boundary_s", data=x[0])
1176 self.check_vtk("hex_3D_macro_boundary_v", data=x[0]*[1.,2.,3.])
1177 self.check_vtk("hex_3D_macro_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1178
1179 # === TRI 2D order 2 =======================================================
1180
1181 def test_tet_2D_order2(self):
1182 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1183 self.check_vtk("tet_2D_o2", domain=dom)
1184
1185 def test_tet_2D_order2_AllPoints_Scalar(self):
1186 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1187 x=Solution(dom).getX()
1188 x_r=ReducedSolution(dom).getX()
1189 x_n=ContinuousFunction(dom).getX()
1190 self.check_vtk("tet_2D_o2_node_3xs", ['Elements','ReducedElements'], data_r=x_r[0], data_n=x_n[0], data=x[0])
1191
1192 def test_tet_2D_order2_02Points_Scalar(self):
1193 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1194 x=Solution(dom).getX()
1195 x_n=ContinuousFunction(dom).getX()
1196 self.check_vtk("tet_2D_o2_node_2xs", data_n=x_n[0], data=x[0])
1197
1198 def test_tet_2D_order2_2Cells_Scalar(self):
1199 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1200 x=Function(dom).getX()
1201 x_b=FunctionOnBoundary(dom).getX()
1202 self.check_vtk("tet_2D_o2_cell_2xs", ['Elements','ReducedFaceElements'], data_b=x_b[0], data=x[0])
1203
1204 def test_tet_2D_order2_BoundaryPoint_Scalar(self):
1205 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1206 x=ContinuousFunction(dom).getX()
1207 x_b=FunctionOnBoundary(dom).getX()
1208 self.check_vtk("tet_2D_o2_boundary_2xs", ['Elements','ReducedFaceElements'], data=x[0],data_b=x_b[0])
1209
1210 def test_tet_2D_order2_Cells_AllData(self):
1211 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1212 x=Function(dom).getX()
1213 self.check_vtk("tet_2D_o2_cell_all",
1214 data_s=x[0],
1215 data_v=x[0]*[1.,2.],
1216 data_t=x[0]*[[11.,12.],[21.,22.]],
1217 data_t2=x[0]*[[-11.,-12.],[-21.,-22.]])
1218
1219 def test_tet_2D_order2_CellsPoints_AllData(self):
1220 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1221 x_c=Function(dom).getX()
1222 x_p=ContinuousFunction(dom).getX()
1223 self.check_vtk("tet_2D_o2_cellnode_all",
1224 data_sp=x_p[0],
1225 data_vp=x_p[0]*[1.,2.],
1226 data_tp=x_p[0]*[[11.,12.],[21.,22.]],
1227 data_sc=x_c[0],
1228 data_vc=x_c[0]*[1.,2.],
1229 data_tc=x_c[0]*[[11.,12.],[21.,22.]])
1230
1231 def test_tet_2D_order2_ContinuousFunction(self):
1232 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1233 x=ContinuousFunction(dom).getX()
1234 self.check_vtk("tet_2D_o2_node_s", data=x[0])
1235 self.check_vtk("tet_2D_o2_node_v", data=x[0]*[1.,2.])
1236 self.check_vtk("tet_2D_o2_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1237
1238 def test_tet_2D_order2_Solution(self):
1239 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1240 x=Solution(dom).getX()
1241 self.check_vtk("tet_2D_o2_node_s", data=x[0])
1242 self.check_vtk("tet_2D_o2_node_v", data=x[0]*[1.,2.])
1243 self.check_vtk("tet_2D_o2_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1244
1245 def test_tet_2D_order2_ReducedSolution(self):
1246 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1247 x=ReducedSolution(dom).getX()
1248 self.check_vtk("tet_2D_o2_reduced_node_s", data=x[0])
1249 self.check_vtk("tet_2D_o2_reduced_node_v", data=x[0]*[1.,2.])
1250 self.check_vtk("tet_2D_o2_reduced_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1251
1252 def test_tet_2D_order2_Function(self):
1253 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1254 x=Function(dom).getX()
1255 self.check_vtk("tet_2D_o2_cell_s", data=x[0])
1256 self.check_vtk("tet_2D_o2_cell_v", data=x[0]*[1.,2.])
1257 self.check_vtk("tet_2D_o2_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1258
1259 def test_tet_2D_order2_ReducedFunction(self):
1260 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1261 x=ReducedFunction(dom).getX()
1262 self.check_vtk("tet_2D_o2_reduced_cell_s", data=x[0])
1263 self.check_vtk("tet_2D_o2_reduced_cell_v", data=x[0]*[1.,2.])
1264 self.check_vtk("tet_2D_o2_reduced_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1265
1266 def test_tet_2D_order2_FunctionOnBoundary(self):
1267 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1268 x=FunctionOnBoundary(dom).getX()
1269 self.check_vtk("tet_2D_o2_boundary_s", data=x[0])
1270 self.check_vtk("tet_2D_o2_boundary_v", data=x[0]*[1.,2.])
1271 self.check_vtk("tet_2D_o2_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1272
1273 def test_tet_2D_order2_ReducedFunctionOnBoundary(self):
1274 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order2.fly"),optimize=False)
1275 x=ReducedFunctionOnBoundary(dom).getX()
1276 self.check_vtk("tet_2D_o2_boundary_s", data=x[0])
1277 self.check_vtk("tet_2D_o2_boundary_v", data=x[0]*[1.,2.])
1278 self.check_vtk("tet_2D_o2_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1279
1280 # === TRI 2D macro =========================================================
1281
1282 def test_tet_2D_macro(self):
1283 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1284 self.check_vtk("tet_2D_o2", domain=dom)
1285
1286 def test_tet_2D_macro_AllPoints_Scalar(self):
1287 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1288 x=Solution(dom).getX()
1289 x_r=ReducedSolution(dom).getX()
1290 x_n=ContinuousFunction(dom).getX()
1291 self.check_vtk("tet_2D_o1_node_3xs", ['Elements','ReducedElements'], data_r=x_r[0], data_n=x_n[0], data=x[0])
1292
1293 def test_tet_2D_macro_02Points_Scalar(self):
1294 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1295 x=Solution(dom).getX()
1296 x_n=ContinuousFunction(dom).getX()
1297 self.check_vtk("tet_2D_macro_node_2xs", data_n=x_n[0], data=x[0])
1298
1299 def test_tet_2D_macro_2Cells_Scalar(self):
1300 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1301 x=Function(dom).getX()
1302 x_b=FunctionOnBoundary(dom).getX()
1303 self.check_vtk("tet_2D_cell_2xs", ['Elements','FaceElements'], data_b=x_b[0], data=x[0])
1304
1305 def test_tet_2D_macro_BoundaryPoint_Scalar(self):
1306 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1307 x=ContinuousFunction(dom).getX()
1308 x_b=FunctionOnBoundary(dom).getX()
1309 self.check_vtk("tet_2D_boundary_2xs", ['Elements','FaceElements'], data_b=x_b[0], data=x[0])
1310
1311 def test_tet_2D_macro_Cells_AllData(self):
1312 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1313 x=Function(dom).getX()
1314 self.check_vtk("tet_2D_macro_cell_all",
1315 data_s=x[0],
1316 data_v=x[0]*[1.,2.],
1317 data_t=x[0]*[[11.,12.],[21.,22.]],
1318 data_t2=x[0]*[[-11.,-12.],[-21.,-22.]])
1319
1320 def test_tet_2D_macro_CellsPoints_AllData(self):
1321 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1322 x_c=Function(dom).getX()
1323 x_p=ContinuousFunction(dom).getX()
1324 self.check_vtk("tet_2D_macro_cellnode_all",
1325 data_sp=x_p[0],
1326 data_vp=x_p[0]*[1.,2.],
1327 data_tp=x_p[0]*[[11.,12.],[21.,22.]],
1328 data_sc=x_c[0],
1329 data_vc=x_c[0]*[1.,2.],
1330 data_tc=x_c[0]*[[11.,12.],[21.,22.]])
1331
1332 def test_tet_2D_macro_ContinuousFunction(self):
1333 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1334 x=ContinuousFunction(dom).getX()
1335 self.check_vtk("tet_2D_o2_node_s", data=x[0])
1336 self.check_vtk("tet_2D_o2_node_v", data=x[0]*[1.,2.])
1337 self.check_vtk("tet_2D_o2_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1338
1339 def test_tet_2D_macro_Solution(self):
1340 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1341 x=Solution(dom).getX()
1342 self.check_vtk("tet_2D_o2_node_s", data=x[0])
1343 self.check_vtk("tet_2D_o2_node_v", data=x[0]*[1.,2.])
1344 self.check_vtk("tet_2D_o2_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1345
1346 def test_tet_2D_macro_ReducedSolution(self):
1347 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1348 x=ReducedSolution(dom).getX()
1349 self.check_vtk("tet_2D_o2_reduced_node_s", data=x[0])
1350 self.check_vtk("tet_2D_o2_reduced_node_v", data=x[0]*[1.,2.])
1351 self.check_vtk("tet_2D_o2_reduced_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1352
1353 def test_tet_2D_macro_Function(self):
1354 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1355 x=Function(dom).getX()
1356 self.check_vtk("tet_2D_macro_cell_s", data=x[0])
1357 self.check_vtk("tet_2D_macro_cell_v", data=x[0]*[1.,2.])
1358 self.check_vtk("tet_2D_macro_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1359
1360 def test_tet_2D_macro_ReducedFunction(self):
1361 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1362 x=ReducedFunction(dom).getX()
1363 self.check_vtk("tet_2D_macro_reduced_cell_s", data=x[0])
1364 self.check_vtk("tet_2D_macro_reduced_cell_v", data=x[0]*[1.,2.])
1365 self.check_vtk("tet_2D_macro_reduced_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1366
1367 def test_tet_2D_macro_FunctionOnBoundary(self):
1368 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1369 x=FunctionOnBoundary(dom).getX()
1370 self.check_vtk("tet_2D_macro_boundary_s", data=x[0])
1371 self.check_vtk("tet_2D_macro_boundary_v", data=x[0]*[1.,2.])
1372 self.check_vtk("tet_2D_macro_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1373
1374 def test_tet_2D_macro_ReducedFunctionOnBoundary(self):
1375 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_macro.fly"),optimize=False)
1376 x=ReducedFunctionOnBoundary(dom).getX()
1377 self.check_vtk("tet_2D_macro_boundary_s", data=x[0])
1378 self.check_vtk("tet_2D_macro_boundary_v", data=x[0]*[1.,2.])
1379 self.check_vtk("tet_2D_macro_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1380
1381 # === TRI 2D order 1 =======================================================
1382
1383 def test_tet_2D_order1_ContinuousFunction(self):
1384 reference="tet_2D_o1_node_s.vtu"
1385 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1386 x=ContinuousFunction(dom).getX()
1387 self.check_vtk("tet_2D_o1_node_s", data=x[0])
1388 self.check_vtk("tet_2D_o1_node_v", data=x[0]*[1.,2.])
1389 self.check_vtk("tet_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1390
1391 def test_tet_2D_order1_Solution(self):
1392 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1393 x=Solution(dom).getX()
1394 self.check_vtk("tet_2D_o1_node_s", data=x[0])
1395 self.check_vtk("tet_2D_o1_node_v", data=x[0]*[1.,2.])
1396 self.check_vtk("tet_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1397
1398 def test_tet_2D_order1_ReducedSolution(self):
1399 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1400 x=ReducedSolution(dom).getX()
1401 self.check_vtk("tet_2D_o1_node_s", data=x[0])
1402 self.check_vtk("tet_2D_o1_node_v", data=x[0]*[1.,2.])
1403 self.check_vtk("tet_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1404
1405 def test_tet_2D_order1_Function(self):
1406 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1407 x=Function(dom).getX()
1408 self.check_vtk("tet_2D_o1_cell_s", data=x[0])
1409 self.check_vtk("tet_2D_o1_cell_v", data=x[0]*[1.,2.])
1410 self.check_vtk("tet_2D_o1_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1411
1412 def test_tet_2D_order1_ReducedFunction(self):
1413 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1414 x=ReducedFunction(dom).getX()
1415 self.check_vtk("tet_2D_o1_cell_s", data=x[0])
1416 self.check_vtk("tet_2D_o1_cell_v", data=x[0]*[1.,2.])
1417 self.check_vtk("tet_2D_o1_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1418
1419 def test_tet_2D_order1_FunctionOnBoundary(self):
1420 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1421 x=FunctionOnBoundary(dom).getX()
1422 self.check_vtk("tet_2D_o1_boundary_s", data=x[0])
1423 self.check_vtk("tet_2D_o1_boundary_v", data=x[0]*[1.,2.])
1424 self.check_vtk("tet_2D_o1_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1425
1426 def test_tet_2D_order1_ReducedFunctionOnBoundary(self):
1427 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_order1.fly"),optimize=False)
1428 x=ReducedFunctionOnBoundary(dom).getX()
1429 self.check_vtk("tet_2D_o1_boundary_s", data=x[0])
1430 self.check_vtk("tet_2D_o1_boundary_v", data=x[0]*[1.,2.])
1431 self.check_vtk("tet_2D_o1_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1432
1433 # === TET 3D order 1 =======================================================
1434
1435 def test_tet_3D_order1_ContinuousFunction(self):
1436 reference="tet_3D_o1_node_s.vtu"
1437 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1438 x=ContinuousFunction(dom).getX()
1439 self.check_vtk("tet_3D_o1_node_s", data=x[0])
1440 self.check_vtk("tet_3D_o1_node_v", data=x[0]*[1.,2.,3.])
1441 self.check_vtk("tet_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1442
1443 def test_tet_3D_order1_Solution(self):
1444 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1445 x=Solution(dom).getX()
1446 self.check_vtk("tet_3D_o1_node_s", data=x[0])
1447 self.check_vtk("tet_3D_o1_node_v", data=x[0]*[1.,2.,3.])
1448 self.check_vtk("tet_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1449
1450 def test_tet_3D_order1_ReducedSolution(self):
1451 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1452 x=ReducedSolution(dom).getX()
1453 self.check_vtk("tet_3D_o1_node_s", data=x[0])
1454 self.check_vtk("tet_3D_o1_node_v", data=x[0]*[1.,2.,3.])
1455 self.check_vtk("tet_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1456
1457 def test_tet_3D_order1_Function(self):
1458 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1459 x=Function(dom).getX()
1460 self.check_vtk("tet_3D_o1_cell_s", data=x[0])
1461 self.check_vtk("tet_3D_o1_cell_v", data=x[0]*[1.,2.,3.])
1462 self.check_vtk("tet_3D_o1_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1463
1464 def test_tet_3D_order1_ReducedFunction(self):
1465 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1466 x=ReducedFunction(dom).getX()
1467 self.check_vtk("tet_3D_o1_cell_s", data=x[0])
1468 self.check_vtk("tet_3D_o1_cell_v", data=x[0]*[1.,2.,3.])
1469 self.check_vtk("tet_3D_o1_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1470
1471 def test_tet_3D_order1_FunctionOnBoundary(self):
1472 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1473 x=FunctionOnBoundary(dom).getX()
1474 self.check_vtk("tet_3D_o1_boundary_s", data=x[0])
1475 self.check_vtk("tet_3D_o1_boundary_v", data=x[0]*[1.,2.,3.])
1476 self.check_vtk("tet_3D_o1_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1477
1478 def test_tet_3D_order1_ReducedFunctionOnBoundary(self):
1479 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order1.fly"),optimize=False)
1480 x=ReducedFunctionOnBoundary(dom).getX()
1481 self.check_vtk("tet_3D_o1_boundary_s", data=x[0])
1482 self.check_vtk("tet_3D_o1_boundary_v", data=x[0]*[1.,2.,3.])
1483 self.check_vtk("tet_3D_o1_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1484
1485 # === TET 3D order 2 =======================================================
1486
1487 def test_tet_3D_order2_ContinuousFunction(self):
1488 reference="tet_3D_o2_node_s.vtu"
1489 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1490 x=ContinuousFunction(dom).getX()
1491 self.check_vtk("tet_3D_o2_node_s", data=x[0])
1492 self.check_vtk("tet_3D_o2_node_v", data=x[0]*[1.,2.,3.])
1493 self.check_vtk("tet_3D_o2_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1494
1495 def test_tet_3D_order2_Solution(self):
1496 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1497 x=Solution(dom).getX()
1498 self.check_vtk("tet_3D_o2_node_s", data=x[0])
1499 self.check_vtk("tet_3D_o2_node_v", data=x[0]*[1.,2.,3.])
1500 self.check_vtk("tet_3D_o2_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1501
1502 def test_tet_3D_order2_ReducedSolution(self):
1503 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1504 x=ReducedSolution(dom).getX()
1505 self.check_vtk("tet_3D_o2_reduced_node_s", data=x[0])
1506 self.check_vtk("tet_3D_o2_reduced_node_v", data=x[0]*[1.,2.,3.])
1507 self.check_vtk("tet_3D_o2_reduced_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1508
1509 def test_tet_3D_order2_Function(self):
1510 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1511 x=Function(dom).getX()
1512 self.check_vtk("tet_3D_o2_cell_s", data=x[0])
1513 self.check_vtk("tet_3D_o2_cell_v", data=x[0]*[1.,2.,3.])
1514 self.check_vtk("tet_3D_o2_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1515
1516 def test_tet_3D_order2_ReducedFunction(self):
1517 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1518 x=ReducedFunction(dom).getX()
1519 self.check_vtk("tet_3D_o2_reduced_cell_s", data=x[0])
1520 self.check_vtk("tet_3D_o2_reduced_cell_v", data=x[0]*[1.,2.,3.])
1521 self.check_vtk("tet_3D_o2_reduced_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1522
1523 def test_tet_3D_order2_FunctionOnBoundary(self):
1524 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1525 x=FunctionOnBoundary(dom).getX()
1526 self.check_vtk("tet_3D_o2_boundary_s", data=x[0])
1527 self.check_vtk("tet_3D_o2_boundary_v", data=x[0]*[1.,2.,3.])
1528 self.check_vtk("tet_3D_o2_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1529
1530 def test_tet_3D_order2_ReducedFunctionOnBoundary(self):
1531 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_order2.fly"),optimize=False)
1532 x=ReducedFunctionOnBoundary(dom).getX()
1533 self.check_vtk("tet_3D_o2_reduced_boundary_s", data=x[0])
1534 self.check_vtk("tet_3D_o2_reduced_boundary_v", data=x[0]*[1.,2.,3.])
1535 self.check_vtk("tet_3D_o2_reduced_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1536
1537 # === TET 3D macro =========================================================
1538
1539 def test_tet_3D_macro_ContinuousFunction(self):
1540 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1541 x=ContinuousFunction(dom).getX()
1542 self.check_vtk("tet_3D_o2_node_s", data=x[0])
1543 self.check_vtk("tet_3D_o2_node_v", data=x[0]*[1.,2.,3.])
1544 self.check_vtk("tet_3D_o2_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1545
1546 def test_tet_3D_macro_Solution(self):
1547 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1548 x=Solution(dom).getX()
1549 self.check_vtk("tet_3D_o2_node_s", data=x[0])
1550 self.check_vtk("tet_3D_o2_node_v", data=x[0]*[1.,2.,3.])
1551 self.check_vtk("tet_3D_o2_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1552
1553 def test_tet_3D_macro_ReducedSolution(self):
1554 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1555 x=ReducedSolution(dom).getX()
1556 self.check_vtk("tet_3D_o2_reduced_node_s", data=x[0])
1557 self.check_vtk("tet_3D_o2_reduced_node_v", data=x[0]*[1.,2.,3.])
1558 self.check_vtk("tet_3D_o2_reduced_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1559
1560 def test_tet_3D_macro_Function(self):
1561 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1562 x=Function(dom).getX()
1563 self.check_vtk("tet_3D_macro_cell_s", data=x[0])
1564 self.check_vtk("tet_3D_macro_cell_v", data=x[0]*[1.,2.,3.])
1565 self.check_vtk("tet_3D_macro_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1566
1567 def test_tet_3D_macro_ReducedFunction(self):
1568 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1569 x=ReducedFunction(dom).getX()
1570 self.check_vtk("tet_3D_macro_reduced_cell_s", data=x[0])
1571 self.check_vtk("tet_3D_macro_reduced_cell_v", data=x[0]*[1.,2.,3.])
1572 self.check_vtk("tet_3D_macro_reduced_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1573
1574 def test_tet_3D_macro_FunctionOnBoundary(self):
1575 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1576 x=FunctionOnBoundary(dom).getX()
1577 self.check_vtk("tet_3D_macro_boundary_s", data=x[0])
1578 self.check_vtk("tet_3D_macro_boundary_v", data=x[0]*[1.,2.,3.])
1579 self.check_vtk("tet_3D_macro_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1580
1581 def test_tet_3D_macro_ReducedFunctionOnBoundary(self):
1582 dom=finley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_macro.fly"),optimize=False)
1583 x=ReducedFunctionOnBoundary(dom).getX()
1584 self.check_vtk("tet_3D_macro_reduced_boundary_s", data=x[0])
1585 self.check_vtk("tet_3D_macro_reduced_boundary_v", data=x[0]*[1.,2.,3.])
1586 self.check_vtk("tet_3D_macro_reduced_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1587
1588
1589 class Test_Dudley_SaveVTK(Test_VTKSaver):
1590
1591 # === TRI 2D order 1 =======================================================
1592
1593 def test_tet_2D_dudley_ContinuousFunction(self):
1594 reference="tet_2D_o1_node_s.vtu"
1595 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1596 x=ContinuousFunction(dom).getX()
1597 self.check_vtk("tet_2D_o1_node_s", data=x[0])
1598 self.check_vtk("tet_2D_o1_node_v", data=x[0]*[1.,2.])
1599 self.check_vtk("tet_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1600
1601 def test_tet_2D_dudley_Solution(self):
1602 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1603 x=Solution(dom).getX()
1604 self.check_vtk("tet_2D_o1_node_s", data=x[0])
1605 self.check_vtk("tet_2D_o1_node_v", data=x[0]*[1.,2.])
1606 self.check_vtk("tet_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1607
1608 def test_tet_2D_dudley_ReducedSolution(self):
1609 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1610 x=ReducedSolution(dom).getX()
1611 self.check_vtk("tet_2D_o1_node_s", data=x[0])
1612 self.check_vtk("tet_2D_o1_node_v", data=x[0]*[1.,2.])
1613 self.check_vtk("tet_2D_o1_node_t", data=x[0]*[[11.,12.],[21.,22.]])
1614
1615 def test_tet_2D_dudley_Function(self):
1616 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1617 x=Function(dom).getX()
1618 self.check_vtk("tet_2D_o1_cell_s", data=x[0])
1619 self.check_vtk("tet_2D_o1_cell_v", data=x[0]*[1.,2.])
1620 self.check_vtk("tet_2D_o1_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1621
1622 def test_tet_2D_dudley_ReducedFunction(self):
1623 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1624 x=ReducedFunction(dom).getX()
1625 self.check_vtk("tet_2D_o1_cell_s", data=x[0])
1626 self.check_vtk("tet_2D_o1_cell_v", data=x[0]*[1.,2.])
1627 self.check_vtk("tet_2D_o1_cell_t", data=x[0]*[[11.,12.],[21.,22.]])
1628
1629 def test_tet_2D_dudley_FunctionOnBoundary(self):
1630 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1631 x=FunctionOnBoundary(dom).getX()
1632 self.check_vtk("tet_2D_o1_boundary_s", data=x[0])
1633 self.check_vtk("tet_2D_o1_boundary_v", data=x[0]*[1.,2.])
1634 self.check_vtk("tet_2D_o1_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1635
1636 def test_tet_2D_dudley_ReducedFunctionOnBoundary(self):
1637 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_2D_dudley.fly"),optimize=False)
1638 x=ReducedFunctionOnBoundary(dom).getX()
1639 self.check_vtk("tet_2D_o1_boundary_s", data=x[0])
1640 self.check_vtk("tet_2D_o1_boundary_v", data=x[0]*[1.,2.])
1641 self.check_vtk("tet_2D_o1_boundary_t", data=x[0]*[[11.,12.],[21.,22.]])
1642
1643 # === TET 3D order 1 =======================================================
1644
1645 def test_tet_3D_dudley_ContinuousFunction(self):
1646 reference="tet_3D_o1_node_s.vtu"
1647 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1648 x=ContinuousFunction(dom).getX()
1649 self.check_vtk("tet_3D_o1_node_s", data=x[0])
1650 self.check_vtk("tet_3D_o1_node_v", data=x[0]*[1.,2.,3.])
1651 self.check_vtk("tet_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1652
1653 def test_tet_3D_dudley_Solution(self):
1654 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1655 x=Solution(dom).getX()
1656 self.check_vtk("tet_3D_o1_node_s", data=x[0])
1657 self.check_vtk("tet_3D_o1_node_v", data=x[0]*[1.,2.,3.])
1658 self.check_vtk("tet_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1659
1660 def test_tet_3D_dudley_ReducedSolution(self):
1661 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1662 x=ReducedSolution(dom).getX()
1663 self.check_vtk("tet_3D_o1_node_s", data=x[0])
1664 self.check_vtk("tet_3D_o1_node_v", data=x[0]*[1.,2.,3.])
1665 self.check_vtk("tet_3D_o1_node_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1666
1667 def test_tet_3D_dudley_Function(self):
1668 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1669 x=Function(dom).getX()
1670 self.check_vtk("tet_3D_o1_cell_s", data=x[0])
1671 self.check_vtk("tet_3D_o1_cell_v", data=x[0]*[1.,2.,3.])
1672 self.check_vtk("tet_3D_o1_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1673
1674 def test_tet_3D_dudley_ReducedFunction(self):
1675 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1676 x=ReducedFunction(dom).getX()
1677 self.check_vtk("tet_3D_o1_cell_s", data=x[0])
1678 self.check_vtk("tet_3D_o1_cell_v", data=x[0]*[1.,2.,3.])
1679 self.check_vtk("tet_3D_o1_cell_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1680
1681 def test_tet_3D_dudley_FunctionOnBoundary(self):
1682 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1683 x=FunctionOnBoundary(dom).getX()
1684 self.check_vtk("tet_3D_o1_boundary_s", data=x[0])
1685 self.check_vtk("tet_3D_o1_boundary_v", data=x[0]*[1.,2.,3.])
1686 self.check_vtk("tet_3D_o1_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1687
1688 def test_tet_3D_dudley_ReducedFunctionOnBoundary(self):
1689 dom=dudley.ReadMesh(os.path.join(WEIPA_TEST_MESHES,"tet_3D_dudley.fly"),optimize=False)
1690 x=ReducedFunctionOnBoundary(dom).getX()
1691 self.check_vtk("tet_3D_o1_boundary_s", data=x[0])
1692 self.check_vtk("tet_3D_o1_boundary_v", data=x[0]*[1.,2.,3.])
1693 self.check_vtk("tet_3D_o1_boundary_t", data=x[0]*[[11.,12.,13.],[21.,22.,23],[31.,32.,33.]])
1694
1695
1696 if __name__ == '__main__':
1697 import sys
1698 suite = unittest.TestSuite()
1699 suite.addTest(unittest.makeSuite(Test_Finley_SaveVTK))
1700 suite.addTest(unittest.makeSuite(Test_Dudley_SaveVTK))
1701 s=unittest.TextTestRunner(verbosity=2).run(suite)
1702 if not s.wasSuccessful(): sys.exit(1)
1703

  ViewVC Help
Powered by ViewVC 1.1.26