11import os
22import pyMagix3D as Mgx3D
33
4- def test_export_box (capfd ):
4+ def test_export_demicyl_3d (capfd ):
55 ctx = Mgx3D .getStdContext ()
66 ctx .clearSession () # Clean the session after the previous test
77
@@ -14,10 +14,10 @@ def test_export_box(capfd):
1414 ctx .getTopoManager ().splitAllBlocks ("Ar0176" ,.5 )
1515 ctx .getTopoManager ().splitAllBlocks ("Ar0175" ,.5 )
1616 ctx .getTopoManager ( ).destroy (["Bl0075" ,"Bl0076" ,"Bl0077" ,"Bl0078" ,"Bl0079" ,"Bl0080" ,"Bl0081" ,"Bl0082" ,"Bl0091" ,"Bl0092" ,"Bl0093" ,"Bl0094" ,"Bl0095" ,"Bl0096" ,"Bl0097" ,"Bl0098" ,"Bl0099" ,"Bl0100" ,"Bl0101" ,"Bl0102" ,"Bl0115" ,"Bl0116" ,"Bl0117" ,"Bl0118" ,"Bl0119" ,"Bl0120" ,"Bl0121" ,"Bl0122" ,"Bl0131" ,"Bl0132" ,"Bl0133" ,"Bl0134" ,"Bl0135" ,"Bl0136" ,"Bl0137" ,"Bl0138" ,"Bl0139" ,"Bl0140" ,"Bl0141" ,"Bl0142" ,"Bl0083" ,"Bl0084" ,"Bl0085" ,"Bl0086" ,"Bl0123" ,"Bl0124" ,"Bl0125" ,"Bl0126" ], True )
17- ctx .getTopoManager ().addToGroup (["Fa0393" , "Fa0392" , "Fa0285" , "Fa0284" , "Fa0395" , "Fa0394" , "Fa0287" , "Fa0286" , "Fa0279" , "Fa0280" , "Fa0387" , "Fa0388" , "Fa0278" , "Fa0277" , "Fa0386" , "Fa0385" ], 2 , "Paroi " )
18- ctx .getTopoManager ().addToGroup (["Fa0295" , "Fa0294" , "Fa0403" , "Fa0402" , "Fa0353" , "Fa0352" , "Fa0461" , "Fa0460" , "Fa0345" , "Fa0344" , "Fa0453" , "Fa0452" , "Fa0329" , "Fa0330" , "Fa0437" , "Fa0438" ], 2 , "Farfield " )
19- ctx .getTopoManager ().addToGroup (["Fa0096" , "Fa0097" , "Fa0136" , "Fa0137" , "Fa0129" , "Fa0130" , "Fa0125" , "Fa0124" , "Fa0094" , "Fa0095" , "Fa0134" , "Fa0135" , "Fa0128" , "Fa0127" , "Fa0122" , "Fa0123" ], 2 , "Sortie " )
20- ctx .getTopoManager ().addToGroup (["Fa0360" , "Fa0369" , "Fa0359" , "Fa0368" , "Fa0252" , "Fa0261" , "Fa0251" , "Fa0260" , "Fa0327" , "Fa0322" , "Fa0326" , "Fa0321" , "Fa0435" , "Fa0430" , "Fa0434" , "Fa0429" ], 2 , "Symetrie " )
17+ ctx .getTopoManager ().addToGroup (["Fa0393" , "Fa0392" , "Fa0285" , "Fa0284" , "Fa0395" , "Fa0394" , "Fa0287" , "Fa0286" , "Fa0279" , "Fa0280" , "Fa0387" , "Fa0388" , "Fa0278" , "Fa0277" , "Fa0386" , "Fa0385" ], 2 , "Paroi_cgns " )
18+ ctx .getTopoManager ().addToGroup (["Fa0295" , "Fa0294" , "Fa0403" , "Fa0402" , "Fa0353" , "Fa0352" , "Fa0461" , "Fa0460" , "Fa0345" , "Fa0344" , "Fa0453" , "Fa0452" , "Fa0329" , "Fa0330" , "Fa0437" , "Fa0438" ], 2 , "Farfield_cgns " )
19+ ctx .getTopoManager ().addToGroup (["Fa0096" , "Fa0097" , "Fa0136" , "Fa0137" , "Fa0129" , "Fa0130" , "Fa0125" , "Fa0124" , "Fa0094" , "Fa0095" , "Fa0134" , "Fa0135" , "Fa0128" , "Fa0127" , "Fa0122" , "Fa0123" ], 2 , "Sortie_cgns " )
20+ ctx .getTopoManager ().addToGroup (["Fa0360" , "Fa0369" , "Fa0359" , "Fa0368" , "Fa0252" , "Fa0261" , "Fa0251" , "Fa0260" , "Fa0327" , "Fa0322" , "Fa0326" , "Fa0321" , "Fa0435" , "Fa0430" , "Fa0434" , "Fa0429" ], 2 , "Symetrie_cgns " )
2121 emp = Mgx3D .EdgeMeshingPropertyUniform (10 )
2222 ctx .getTopoManager ().setParallelMeshingProperty (emp ,"Ar0363" )
2323 emp = Mgx3D .EdgeMeshingPropertyUniform (10 )
@@ -27,7 +27,43 @@ def test_export_box(capfd):
2727 emp = Mgx3D .EdgeMeshingPropertyUniform (10 )
2828 ctx .getTopoManager ().setParallelMeshingProperty (emp ,"Ar0270" )
2929 ctx .getMeshManager ().newAllBlocksMesh ()
30- ctx .getMeshManager ().exportBlocksForCGNS (cgnsfilename )
30+ ctx .getMeshManager ().exportBlocksForCGNS (3 , cgnsfilename )
31+
32+ assert os .path .exists (cgnsfilename )
33+ assert os .path .getsize (cgnsfilename ) > 0
34+ out , err = capfd .readouterr ()
35+ assert len (err ) == 0
36+
37+
38+
39+ def test_export_quad_2d (capfd ):
40+ ctx = Mgx3D .getStdContext ()
41+ ctx .clearSession () # Clean the session after the previous test
42+
43+ cgnsfilename = "quadOGrid.cgns"
44+ ctx .getGeomManager ().newVertex (Mgx3D .Point (0 , 0 , 0 ))
45+ ctx .getGeomManager ().newVertex (Mgx3D .Point (1 , 0 , 0 ))
46+ ctx .getGeomManager ().newVertex (Mgx3D .Point (1 , 1 , 0 ))
47+ ctx .getGeomManager ().newVertex (Mgx3D .Point (0 , 1 , 0 ))
48+ ctx .getGeomManager ().newSegment ("Pt0000" , "Pt0001" )
49+ ctx .getGeomManager ().newSegment ("Pt0001" , "Pt0002" )
50+ ctx .getGeomManager ().newSegment ("Pt0002" , "Pt0003" )
51+ ctx .getGeomManager ().newSegment ("Pt0003" , "Pt0000" )
52+ ctx .getGeomManager ( ).newPlanarSurface (["Crb0000" ,"Crb0001" ,"Crb0002" ,"Crb0003" ], "" )
53+ ctx .getGeomManager ().addToGroup (["Surf0000" ], 2 , "face_cgns" )
54+ ctx .getGeomManager ().addToGroup (["Crb0002" ], 1 , "haut_cgns" )
55+ ctx .getGeomManager ().addToGroup (["Crb0000" ], 1 , "bad_cgns" )
56+ ctx .getGeomManager ().addToGroup (["Crb0003" ], 1 , "gauche_cgns" )
57+ ctx .getGeomManager ().addToGroup (["Crb0001" ], 1 , "droite_cgns" )
58+ ctx .getTopoManager ().newStructuredTopoOnGeometry ("Surf0000" )
59+ emp = Mgx3D .EdgeMeshingPropertyUniform (5 )
60+ ctx .getTopoManager ().setMeshingProperty (emp , ["Ar0001" ,"Ar0003" ])
61+ ctx .getTopoManager ( ).splitFacesWithOgrid (["Fa0000" ], ["Ar0002" ,"Ar0003" ], .1 , 10 )
62+ ctx .getTopoManager ( ).setGeomAssociation (["Ar0009" ], "Crb0002" , True )
63+ ctx .getTopoManager ( ).setGeomAssociation (["Ar0010" ], "Crb0003" , True )
64+ ctx .getTopoManager ().addToGroup (["Ar0005" , "Ar0008" ], 1 , "milieu_cgns" )
65+ ctx .getMeshManager ().newAllFacesMesh ()
66+ ctx .getMeshManager ().exportBlocksForCGNS (2 ,cgnsfilename )
3167
3268 assert os .path .exists (cgnsfilename )
3369 assert os .path .getsize (cgnsfilename ) > 0
0 commit comments