本文整理汇总了Python中MEDLoaderDataForTest.MEDLoaderDataForTest.build3DMesh_2方法的典型用法代码示例。如果您正苦于以下问题:Python MEDLoaderDataForTest.build3DMesh_2方法的具体用法?Python MEDLoaderDataForTest.build3DMesh_2怎么用?Python MEDLoaderDataForTest.build3DMesh_2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEDLoaderDataForTest.MEDLoaderDataForTest
的用法示例。
在下文中一共展示了MEDLoaderDataForTest.build3DMesh_2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWriteUMeshesRW1
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import build3DMesh_2 [as 别名]
def testWriteUMeshesRW1(self):
fileName="Pyfile18.med";
m3d=MEDLoaderDataForTest.build3DMesh_2();
pt=[0.,0.,-0.3]
vec=[0.,0.,1.]
nodes=m3d.findNodesOnPlane(pt,vec,1e-12);
m2d=m3d.buildFacePartOfMySelfNode(nodes,True);
renumber=[1,2,0,4,3]
m2d.renumberCells(renumber,False);
m2d.setName("ExampleOfMultiDimW");
meshes=[m2d,m3d]
WriteUMeshes(fileName,meshes,False);
m3d_bis=ReadUMeshFromFile(fileName,m2d.getName(),0);
self.assertTrue(not m3d_bis.isEqual(m3d,1e-12));
m3d_bis.setName(m3d.getName());
self.assertTrue(m3d_bis.isEqual(m3d,1e-12));
m2d_bis=ReadUMeshFromFile(fileName,m2d.getName(),-1);#-1 for faces
self.assertTrue(m2d_bis.isEqual(m2d,1e-12));
# Creation of a field on faces.
f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
f1.setName("FieldOnFacesShuffle");
f1.setMesh(m2d);
array=DataArrayDouble.New();
arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.]
array.setValues(arr1,m2d.getNumberOfCells(),2);
array.setInfoOnComponent(0,"plkj [mm]");
array.setInfoOnComponent(1,"pqqqss [mm]");
f1.setArray(array);
tmp=array.setValues(arr1,m2d.getNumberOfCells(),2);
f1.setTime(3.14,2,7);
f1.checkConsistencyLight();
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f2=ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7);
self.assertTrue(f2.isEqual(f1,1e-12,1e-12));
pass
示例2: testMultiFieldShuffleRW1
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import build3DMesh_2 [as 别名]
def testMultiFieldShuffleRW1(self):
fileName="Pyfile17.med";
m=MEDLoaderDataForTest.build3DMesh_2();
self.assertEqual(20,m.getNumberOfCells());
self.assertEqual(45,m.getNumberOfNodes());
polys=[1,4,6]
m.convertToPolyTypes(polys);
renum=[1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11]
m.renumberCells(renum,False);
m.orientCorrectlyPolyhedrons();
# Writing
WriteUMeshDep(fileName,m,False);
f1Tmp=m.getMeasureField(False);
f1=f1Tmp.buildNewTimeReprFromThis(ONE_TIME,False);
f1.setTime(0.,1,2);
f_1=f1.cloneWithMesh(True);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.applyFunc("2*x");
f1.setTime(0.01,3,4);
f_2=f1.cloneWithMesh(True);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.applyFunc("2*x/3");
f1.setTime(0.02,5,6);
f_3=f1.cloneWithMesh(True);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
# Reading
its=[(1,2),(3,4),(5,6)];
fs=ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1.getMesh().getName(),0,f_1.getName(),its);
self.assertEqual(3,len(fs));
self.assertTrue(fs[0].isEqual(f_1,1e-12,1e-12));
self.assertTrue(fs[1].isEqual(f_2,1e-12,1e-12));
self.assertTrue(fs[2].isEqual(f_3,1e-12,1e-12));
pass