本文整理汇总了Python中MEDLoaderDataForTest.MEDLoaderDataForTest.buildVecFieldOnCells_1方法的典型用法代码示例。如果您正苦于以下问题:Python MEDLoaderDataForTest.buildVecFieldOnCells_1方法的具体用法?Python MEDLoaderDataForTest.buildVecFieldOnCells_1怎么用?Python MEDLoaderDataForTest.buildVecFieldOnCells_1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEDLoaderDataForTest.MEDLoaderDataForTest
的用法示例。
在下文中一共展示了MEDLoaderDataForTest.buildVecFieldOnCells_1方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testFieldRW2
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import buildVecFieldOnCells_1 [as 别名]
def testFieldRW2(self):
fileName="Pyfile8.med";
VAL1=12345.67890314;
VAL2=-1111111111111.;
f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
MEDLoader.WriteField(fileName,f1,True);
f1.setTime(10.,8,9);
f1.getArray().setIJ(0,0,VAL1);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(10.14,18,19);
f1.getArray().setIJ(0,0,VAL2);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#retrieving time steps...
f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),8,9);
f1.setTime(10.,8,9);
f1.getArray().setIJ(0,0,VAL1);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),0,1);
f3=MEDLoaderDataForTest.buildVecFieldOnCells_1();
self.assertTrue(f3.isEqual(f2,1e-12,1e-12));
f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),18,19);
f1.setTime(10.14,18,19);
f1.getArray().setIJ(0,0,VAL2);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
#test of throw on invalid (dt,it)
self.assertRaises(Exception,MEDLoader.ReadFieldCell,fileName,f1.getMesh().getName(),0,f1.getName(),28,19);
#ON NODES
f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
fileName2="Pyfile9.med";
MEDLoader.WriteField(fileName2,f1,True);
f1.setTime(110.,108,109);
tmp=f1.getArray().getPointer();
f1.getArray().setIJ(0,3,VAL1);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1);
f1.setTime(210.,208,209);
f1.getArray().setIJ(0,3,VAL2);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1);
f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),108,109);
f1.setTime(110.,108,109);
f1.getArray().setIJ(0,3,VAL1);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),2,3);
f3=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
self.assertTrue(f3.isEqual(f2,1e-12,1e-12));
f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),208,209);
f1.setTime(210.,208,209);
f1.getArray().setIJ(0,3,VAL2);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
pass
示例2: testFieldRW2
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import buildVecFieldOnCells_1 [as 别名]
def testFieldRW2(self):
fileName = "Pyfile8.med"
VAL1 = 12345.67890314
VAL2 = -1111111111111.0
f1 = MEDLoaderDataForTest.buildVecFieldOnCells_1()
MEDLoader.WriteFieldDep(fileName, f1, False)
f1.setTime(10.0, 8, 9)
f1.getArray().setIJ(0, 0, VAL1)
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName, f1)
f1.setTime(10.14, 18, 19)
f1.getArray().setIJ(0, 0, VAL2)
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName, f1)
# retrieving time steps...
f2 = MEDLoader.ReadFieldCell(fileName, f1.getMesh().getName(), 0, f1.getName(), 8, 9)
f1.setTime(10.0, 8, 9)
f1.getArray().setIJ(0, 0, VAL1)
self.assertTrue(f1.isEqual(f2, 1e-12, 1e-12))
f2 = MEDLoader.ReadFieldCell(fileName, f1.getMesh().getName(), 0, f1.getName(), 0, 1)
f3 = MEDLoaderDataForTest.buildVecFieldOnCells_1()
self.assertTrue(f3.isEqual(f2, 1e-12, 1e-12))
f2 = MEDLoader.ReadFieldCell(fileName, f1.getMesh().getName(), 0, f1.getName(), 18, 19)
f1.setTime(10.14, 18, 19)
f1.getArray().setIJ(0, 0, VAL2)
self.assertTrue(f1.isEqual(f2, 1e-12, 1e-12))
# ON NODES
f1 = MEDLoaderDataForTest.buildVecFieldOnNodes_1()
fileName2 = "Pyfile9.med"
MEDLoader.WriteFieldDep(fileName2, f1, False)
f1.setTime(110.0, 108, 109)
tmp = f1.getArray().getPointer()
f1.getArray().setIJ(0, 3, VAL1)
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2, f1)
f1.setTime(210.0, 208, 209)
f1.getArray().setIJ(0, 3, VAL2)
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2, f1)
f2 = MEDLoader.ReadFieldNode(fileName2, f1.getMesh().getName(), 0, f1.getName(), 108, 109)
f1.setTime(110.0, 108, 109)
f1.getArray().setIJ(0, 3, VAL1)
self.assertTrue(f1.isEqual(f2, 1e-12, 1e-12))
f2 = MEDLoader.ReadFieldNode(fileName2, f1.getMesh().getName(), 0, f1.getName(), 2, 3)
f3 = MEDLoaderDataForTest.buildVecFieldOnNodes_1()
self.assertTrue(f3.isEqual(f2, 1e-12, 1e-12))
f2 = MEDLoader.ReadFieldNode(fileName2, f1.getMesh().getName(), 0, f1.getName(), 208, 209)
f1.setTime(210.0, 208, 209)
f1.getArray().setIJ(0, 3, VAL2)
self.assertTrue(f1.isEqual(f2, 1e-12, 1e-12))
pass
示例3: testFieldRW1
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import buildVecFieldOnCells_1 [as 别名]
def testFieldRW1(self):
f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
WriteFieldDep("Pyfile6.med",f1,False);
f2=ReadFieldCell("Pyfile6.med",f1.getMesh().getName(),0,f1.getName(),0,1);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
#
f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
WriteFieldDep("Pyfile7.med",f1,False);
f2=ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
pass
示例4: testFieldRW1
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import buildVecFieldOnCells_1 [as 别名]
def testFieldRW1(self):
f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
MEDLoader.WriteField("Pyfile6.med",f1,True);
f2=MEDLoader.ReadFieldCell("Pyfile6.med",f1.getMesh().getName(),0,f1.getName(),0,1);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
#
f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
MEDLoader.WriteField("Pyfile7.med",f1,True);
f2=MEDLoader.ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
self.assertRaises(Exception,MEDLoader.ReadFieldCell,"Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3);
pass
示例5: testFieldRW3
# 需要导入模块: from MEDLoaderDataForTest import MEDLoaderDataForTest [as 别名]
# 或者: from MEDLoaderDataForTest.MEDLoaderDataForTest import buildVecFieldOnCells_1 [as 别名]
def testFieldRW3(self):
fileName="Pyfile11.med";
VAL1=12345.67890314;
VAL2=-1111111111111.;
name1="AField";
name3="AMesh1";
f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
f1.getMesh().setName(name3);
f1.setName(name1);
f1.setTime(10.,8,9);
tmp=f1.getArray().getPointer();
f1.getArray().setIJ(0,0,VAL1);
WriteFieldDep(fileName,f1,False);
f1.setTime(10.14,18,19);
f1.getArray().setIJ(0,0,VAL2);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.getMesh().setName(name3);
f1.setTime(10.55,28,29);
f1.getArray().setIJ(0,0,3*VAL1);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(10.66,38,39);
f1.getArray().setIJ(0,0,3*VAL2);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(10.77,48,49);
f1.getArray().setIJ(0,0,4*VAL2);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#ON NODES
f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
f1.setName(name1);
f1.getMesh().setName(name3);
f1.setTime(110.,8,9);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(110.,108,109);
tmp=f1.getArray().getPointer();
f1.getArray().setIJ(0,3,VAL1);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(210.,208,209);
f1.getArray().setIJ(0,3,VAL2);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#
it1=GetCellFieldIterations(fileName,name3,name1);
self.assertEqual(5,len(it1));
self.assertEqual(8,it1[0][0]); self.assertEqual(9,it1[0][1]);
self.assertEqual(18,it1[1][0]); self.assertEqual(19,it1[1][1]);
self.assertEqual(28,it1[2][0]); self.assertEqual(29,it1[2][1]);
self.assertEqual(38,it1[3][0]); self.assertEqual(39,it1[3][1]);
self.assertEqual(48,it1[4][0]); self.assertEqual(49,it1[4][1]);
it3=GetNodeFieldIterations(fileName,name3,name1);
self.assertEqual(3,len(it3));
self.assertEqual(8,it3[0][0]); self.assertEqual(9,it3[0][1]);
self.assertEqual(108,it3[1][0]); self.assertEqual(109,it3[1][1]);
self.assertEqual(208,it3[2][0]); self.assertEqual(209,it3[2][1]);
#
#
f1=ReadFieldCell(fileName,name3,0,name1,8,9);
self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,0),13);
f1=ReadFieldCell(fileName,name3,0,name1,18,19);
self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,0),13);
f1=ReadFieldCell(fileName,name3,0,name1,28,29);
self.assertAlmostEqual(3*VAL1,f1.getArray().getIJ(0,0),13);
f1=ReadFieldCell(fileName,name3,0,name1,38,39);
self.assertAlmostEqual(3*VAL2,f1.getArray().getIJ(0,0),13);
f1=ReadFieldCell(fileName,name3,0,name1,48,49);
self.assertAlmostEqual(4*VAL2,f1.getArray().getIJ(0,0),13);
#
f1=ReadFieldNode(fileName,name3,0,name1,8,9);
self.assertAlmostEqual(71.,f1.getArray().getIJ(0,3),13);
f1=ReadFieldNode(fileName,name3,0,name1,108,109);
self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,3),13);
f1=ReadFieldNode(fileName,name3,0,name1,208,209);
self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,3),13);
pass