本文整理汇总了Python中MEDLoaderDataForTest.MEDLoaderDataForTest.build3DMesh_1方法的典型用法代码示例。如果您正苦于以下问题:Python MEDLoaderDataForTest.build3DMesh_1方法的具体用法?Python MEDLoaderDataForTest.build3DMesh_1怎么用?Python MEDLoaderDataForTest.build3DMesh_1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEDLoaderDataForTest.MEDLoaderDataForTest
的用法示例。
在下文中一共展示了MEDLoaderDataForTest.build3DMesh_1方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMesh3DRW
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import build3DMesh_1 [as 别名]
def testMesh3DRW(self):
mesh=MEDLoaderDataForTest.build3DMesh_1();
mesh.checkConsistencyLight();
WriteUMeshDep("Pyfile5.med",mesh,False);
mesh_rw=ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0);
self.assertTrue(mesh.isEqual(mesh_rw,1e-12));
pass
示例2: testFieldProfilRW1
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import build3DMesh_1 [as 别名]
def testFieldProfilRW1(self):
fileName="Pyfile12.med";
mesh1=MEDLoaderDataForTest.build3DMesh_1();
da,b,newNbOfNodes=mesh1.mergeNodes(1e-12);
MEDLoader.WriteUMesh(fileName,mesh1,True);
part1=[1,2,4,13,15]
mesh2=mesh1.buildPartOfMySelf(part1,True);
mesh2.setName(mesh1.getName());#<- important for the test
#
nbOfCells=mesh2.getNumberOfCells();
self.assertEqual(5,nbOfCells);
f1=MEDLoader.MEDCouplingFieldDouble.New(MEDLoader.ON_CELLS,MEDLoader.ONE_TIME);
f1.setName("VectorFieldOnCells");
f1.setMesh(mesh2);
array=MEDLoader.DataArrayDouble.New();
array.alloc(nbOfCells,2);
f1.setArray(array);
arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.]
array.setValues(arr1,nbOfCells,2);
f1.setTime(3.14,2,7);
f1.checkConsistencyLight();
#
MEDLoader.WriteField(fileName,f1,False);#<- False important for the test
#
f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7);
tt=MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName());
self.assertEqual(tt,[MEDLoader.ON_CELLS]);
f2.checkConsistencyLight();
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
#
pass
示例3: testMesh3DRW
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import build3DMesh_1 [as 别名]
def testMesh3DRW(self):
mesh = MEDLoaderDataForTest.build3DMesh_1()
mesh.checkCoherency()
MEDLoader.WriteUMeshDep("Pyfile5.med", mesh, False)
mesh_rw = MEDLoader.ReadUMeshFromFile("Pyfile5.med", mesh.getName(), 0)
self.assertTrue(mesh.isEqual(mesh_rw, 1e-12))
pass
示例4: testMultiMeshRW1
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import build3DMesh_1 [as 别名]
def testMultiMeshRW1(self):
fileName="Pyfile10.med";
mesh1=MEDLoaderDataForTest.build3DMesh_1();
part1=[1,2,4,13,15]
mesh2=mesh1.buildPartOfMySelf(part1,True);
mesh2.setName("mesh2");
part2=[3,4,13,14]
mesh3=mesh1.buildPartOfMySelf(part2,True);
mesh3.setName("mesh3");
mesh4=MEDCouplingUMesh.New();
mesh4.setName("mesh4");
mesh4.setMeshDimension(3);
mesh4.allocateCells(1);
conn=[0,11,1,3]
mesh4.insertNextCell(NORM_TETRA4,4,conn[0:4])
mesh4.finishInsertingCells();
mesh4.setCoords(mesh1.getCoords());
meshes=[mesh1,mesh2,mesh3,mesh4]
mnane="3DToto";
WriteUMeshesPartitionDep(fileName,mnane,meshes,False);
#
mesh5=ReadUMeshFromFile(fileName,mnane);
mesh1.setName(mnane);
part3=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
mesh6=mesh5.buildPartOfMySelf(part3,True);
mesh6.setName(mnane);
self.assertTrue(mesh6.isEqual(mesh1,1e-12));
grps=GetMeshGroupsNames(fileName,mnane);
self.assertEqual(4,len(grps));
grps.index("mesh2");
grps.index("mesh3");
grps.index("mesh4");
grps.index("3DMesh_1");
#
vec=["mesh2"];
mesh2_2=ReadUMeshFromGroups(fileName,mnane,0,vec);
self.assertTrue(mesh2_2.isEqual(mesh2,1e-12));
vec=["mesh3"];
mesh3_2=ReadUMeshFromGroups(fileName,mnane,0,vec);
self.assertTrue(mesh3_2.isEqual(mesh3,1e-12));
vec=["mesh4"];
mesh4_2=ReadUMeshFromGroups(fileName,mnane,0,vec);
self.assertTrue(mesh4_2.isEqual(mesh4,1e-12));
vec=["3DMesh_1"];
mesh1_2=ReadUMeshFromGroups(fileName,mnane,0,vec);
mesh1.setName("3DMesh_1");
self.assertTrue(mesh1_2.isEqual(mesh1,1e-12));
#
vec=["Family_-5","Family_-3"];
mesh2_2=ReadUMeshFromFamilies(fileName,mnane,0,vec);
mesh2_2.setName("mesh2");
self.assertTrue(mesh2_2.isEqual(mesh2,1e-12));
pass