- d=DataArrayInt([16,1,0,5,33,32,37,16,1,5,6,33,37,38,16,2,1,6,34,33,38,16,2,6,7,34,38,39,16,3,2,7,35,34,39,16,3,7,8,35,39,40,16,5,4,10,37,36,42,16,5,10,11,37,42,43,16,9,8,14,41,40,46,16,9,14,15,41,46,47,16,11,10,16,43,42,48,16,11,16,17,43,48,49,16,15,14,20,47,46,52,16,15,20,21,47,52,53,16,17,16,22,49,48,54,16,17,22,23,49,54,55,16,21,20,26,53,52,58,16,21,26,27,53,58,59,16,24,23,28,56,55,60,16,24,28,29,56,60,61,16,25,24,29,57,56,61,16,25,29,30,57,61,62,16,26,25,30,58,57,62,16,26,30,31,58,62,63,16,33,32,37,65,64,69,16,33,37,38,65,69,70,16,34,33,38,66,65,70,16,34,38,39,66,70,71,16,35,34,39,67,66,71,16,35,39,40,67,71,72,16,37,36,42,69,68,74,16,37,42,43,69,74,75,16,41,40,46,73,72,78,16,41,46,47,73,78,79,16,43,42,48,75,74,80,16,43,48,49,75,80,81,16,47,46,52,79,78,84,16,47,52,53,79,84,85,16,49,48,54,81,80,86,16,49,54,55,81,86,87,16,53,52,58,85,84,90,16,53,58,59,85,90,91,16,56,55,60,88,87,92,16,56,60,61,88,92,93,16,57,56,61,89,88,93,16,57,61,62,89,93,94,16,58,57,62,90,89,94,16,58,62,63,90,94,95,16,65,64,69,97,96,101,16,65,69,70,97,101,102,16,66,65,70,98,97,102,16,66,70,71,98,102,103,16,67,66,71,99,98,103,16,67,71,72,99,103,104,16,69,68,74,101,100,106,16,69,74,75,101,106,107,16,73,72,78,105,104,110,16,73,78,79,105,110,111,16,75,74,80,107,106,112,16,75,80,81,107,112,113,16,79,78,84,111,110,116,16,79,84,85,111,116,117,16,81,80,86,113,112,118,16,81,86,87,113,118,119,16,85,84,90,117,116,122,16,85,90,91,117,122,123,16,88,87,92,120,119,124,16,88,92,93,120,124,125,16,89,88,93,121,120,125,16,89,93,94,121,125,126,16,90,89,94,122,121,126,16,90,94,95,122,126,127,16,97,96,101,129,128,133,16,97,101,102,129,133,134,16,98,97,102,130,129,134,16,98,102,103,130,134,135,16,99,98,103,131,130,135,16,99,103,104,131,135,136,16,101,100,106,133,132,138,16,101,106,107,133,138,139,16,105,104,110,137,136,142,16,105,110,111,137,142,143,16,107,106,112,139,138,144,16,107,112,113,139,144,145,16,111,110,116,143,142,148,16,111,116,117,143,148,149,16,113,112,118,145,144,150,16,113,118,119,145,150,151,16,117,116,122,149,148,154,16,117,122,123,149,154,155,16,120,119,124,152,151,156,16,120,124,125,152,156,157,16,121,120,125,153,152,157,16,121,125,126,153,157,158,16,122,121,126,154,153,158,16,122,126,127,154,158,159,16,129,128,133,161,160,165,16,129,133,134,161,165,166,16,130,129,134,162,161,166,16,130,134,135,162,166,167,16,131,130,135,163,162,167,16,131,135,136,163,167,168,16,133,132,138,165,164,170,16,133,138,139,165,170,171,16,137,136,142,169,168,174,16,137,142,143,169,174,175,16,139,138,144,171,170,176,16,139,144,145,171,176,177,16,143,142,148,175,174,180,16,143,148,149,175,180,181,16,145,144,150,177,176,182,16,145,150,151,177,182,183,16,149,148,154,181,180,186,16,149,154,155,181,186,187,16,152,151,156,184,183,188,16,152,156,157,184,188,189,16,153,152,157,185,184,189,16,153,157,158,185,189,190,16,154,153,158,186,185,190,16,154,158,159,186,190,191,16,161,160,165,193,192,197,16,161,165,166,193,197,198,16,162,161,166,194,193,198,16,162,166,167,194,198,199,16,163,162,167,195,194,199,16,163,167,168,195,199,200,16,165,164,170,197,196,202,16,165,170,171,197,202,203,16,169,168,174,201,200,206,16,169,174,175,201,206,207,16,171,170,176,203,202,208,16,171,176,177,203,208,209,16,175,174,180,207,206,212,16,175,180,181,207,212,213,16,177,176,182,209,208,214,16,177,182,183,209,214,215,16,181,180,186,213,212,218,16,181,186,187,213,218,219,16,184,183,188,216,215,220,16,184,188,189,216,220,221,16,185,184,189,217,216,221,16,185,189,190,217,221,222,16,186,185,190,218,217,222,16,186,190,191,218,222,223,16,193,192,197,225,224,229,16,193,197,198,225,229,230,16,194,193,198,226,225,230,16,194,198,199,226,230,231,16,195,194,199,227,226,231,16,195,199,200,227,231,232,16,197,196,202,229,228,234,16,197,202,203,229,234,235,16,201,200,206,233,232,238,16,201,206,207,233,238,239,16,203,202,208,235,234,240,16,203,208,209,235,240,241,16,207,206,212,239,238,244,16,207,212,213,239,244,245,16,209,208,214,241,240,246,16,209,214,215,241,246,247,16,213,212,218,245,244,250,16,213,218,219,245,250,251,16,216,215,220,248,247,252,16,216,220,221,248,252,253,16,217,216,221,249,248,253,16,217,221,222,249,253,254,16,218,217,222,250,249,254,16,218,222,223,250,254,255,16,225,224,229,257,256,261,16,225,229,230,257,261,262,16,226,225,230,258,257,262,16,226,230,231,258,262,263,16,227,226,231,259,258,263,16,227,231,232,259,263,264,16,229,228,234,261,260,266,16,229,234,235,261,266,267,16,233,232,238,265,264,270,16,233,238,239,265,270,271,16,235,234,240,267,266,272,16,235,240,241,267,272,273,16,239,238,244,271,270,276,16,239,244,245,271,276,277,16,241,240,246,273,272,278,16,241,246,247,273,278,279,16,245,244,250,277,276,282,16,245,250,251,277,282,283,16,248,247,252,280,279,284,16,248,252,253,280,284,285,16,249,248,253,281,280,285,16,249,253,254,281,285,286,16,250,249,254,282,281,286,16,250,254,255,282,286,287,16,257,256,261,289,288,293,16,257,261,262,289,293,294,16,258,257,262,290,289,294,16,258,262,263,290,294,295,16,259,258,263,291,290,295,16,259,263,264,291,295,296,16,261,260,266,293,292,298,16,261,266,267,293,298,299,16,265,264,270,297,296,302,16,265,270,271,297,302,303,16,267,266,272,299,298,304,16,267,272,273,299,304,305,16,271,270,276,303,302,308,16,271,276,277,303,308,309,16,273,272,278,305,304,310,16,273,278,279,305,310,311,16,277,276,282,309,308,314,16,277,282,283,309,314,315,16,280,279,284,312,311,316,16,280,284,285,312,316,317,16,281,280,285,313,312,317,16,281,285,286,313,317,318,16,282,281,286,314,313,318,16,282,286,287,314,318,319,18,6,5,11,12,38,37,43,44,18,7,6,12,13,39,38,44,45,18,8,7,13,14,40,39,45,46,18,12,11,17,18,44,43,49,50,18,13,12,18,19,45,44,50,51,18,14,13,19,20,46,45,51,52,18,18,17,23,24,50,49,55,56,18,19,18,24,25,51,50,56,57,18,20,19,25,26,52,51,57,58,18,38,37,43,44,70,69,75,76,18,39,38,44,45,71,70,76,77,18,40,39,45,46,72,71,77,78,18,44,43,49,50,76,75,81,82,18,45,44,50,51,77,76,82,83,18,46,45,51,52,78,77,83,84,18,50,49,55,56,82,81,87,88,18,51,50,56,57,83,82,88,89,18,52,51,57,58,84,83,89,90,18,70,69,75,76,102,101,107,108,18,71,70,76,77,103,102,108,109,18,72,71,77,78,104,103,109,110,18,76,75,81,82,108,107,113,114,18,77,76,82,83,109,108,114,115,18,78,77,83,84,110,109,115,116,18,82,81,87,88,114,113,119,120,18,83,82,88,89,115,114,120,121,18,84,83,89,90,116,115,121,122,18,102,101,107,108,134,133,139,140,18,103,102,108,109,135,134,140,141,18,104,103,109,110,136,135,141,142,18,108,107,113,114,140,139,145,146,18,109,108,114,115,141,140,146,147,18,110,109,115,116,142,141,147,148,18,114,113,119,120,146,145,151,152,18,115,114,120,121,147,146,152,153,18,116,115,121,122,148,147,153,154,18,134,133,139,140,166,165,171,172,18,135,134,140,141,167,166,172,173,18,136,135,141,142,168,167,173,174,18,140,139,145,146,172,171,177,178,18,141,140,146,147,173,172,178,179,18,142,141,147,148,174,173,179,180,18,146,145,151,152,178,177,183,184,18,147,146,152,153,179,178,184,185,18,148,147,153,154,180,179,185,186,18,166,165,171,172,198,197,203,204,18,167,166,172,173,199,198,204,205,18,168,167,173,174,200,199,205,206,18,172,171,177,178,204,203,209,210,18,173,172,178,179,205,204,210,211,18,174,173,179,180,206,205,211,212,18,178,177,183,184,210,209,215,216,18,179,178,184,185,211,210,216,217,18,180,179,185,186,212,211,217,218,18,198,197,203,204,230,229,235,236,18,199,198,204,205,231,230,236,237,18,200,199,205,206,232,231,237,238,18,204,203,209,210,236,235,241,242,18,205,204,210,211,237,236,242,243,18,206,205,211,212,238,237,243,244,18,210,209,215,216,242,241,247,248,18,211,210,216,217,243,242,248,249,18,212,211,217,218,244,243,249,250,18,230,229,235,236,262,261,267,268,18,231,230,236,237,263,262,268,269,18,232,231,237,238,264,263,269,270,18,236,235,241,242,268,267,273,274,18,237,236,242,243,269,268,274,275,18,238,237,243,244,270,269,275,276,18,242,241,247,248,274,273,279,280,18,243,242,248,249,275,274,280,281,18,244,243,249,250,276,275,281,282,18,262,261,267,268,294,293,299,300,18,263,262,268,269,295,294,300,301,18,264,263,269,270,296,295,301,302,18,268,267,273,274,300,299,305,306,18,269,268,274,275,301,300,306,307,18,270,269,275,276,302,301,307,308,18,274,273,279,280,306,305,311,312,18,275,274,280,281,307,306,312,313,18,276,275,281,282,308,307,313,314])
- self.assertTrue(mm3D.getMeshAtLevel(0).getNodalConnectivity().isEqual(d))
- d=DataArrayInt([0,7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,287,294,301,308,315,322,329,336,343,350,357,364,371,378,385,392,399,406,413,420,427,434,441,448,455,462,469,476,483,490,497,504,511,518,525,532,539,546,553,560,567,574,581,588,595,602,609,616,623,630,637,644,651,658,665,672,679,686,693,700,707,714,721,728,735,742,749,756,763,770,777,784,791,798,805,812,819,826,833,840,847,854,861,868,875,882,889,896,903,910,917,924,931,938,945,952,959,966,973,980,987,994,1001,1008,1015,1022,1029,1036,1043,1050,1057,1064,1071,1078,1085,1092,1099,1106,1113,1120,1127,1134,1141,1148,1155,1162,1169,1176,1183,1190,1197,1204,1211,1218,1225,1232,1239,1246,1253,1260,1267,1274,1281,1288,1295,1302,1309,1316,1323,1330,1337,1344,1351,1358,1365,1372,1379,1386,1393,1400,1407,1414,1421,1428,1435,1442,1449,1456,1463,1470,1477,1484,1491,1498,1505,1512,1521,1530,1539,1548,1557,1566,1575,1584,1593,1602,1611,1620,1629,1638,1647,1656,1665,1674,1683,1692,1701,1710,1719,1728,1737,1746,1755,1764,1773,1782,1791,1800,1809,1818,1827,1836,1845,1854,1863,1872,1881,1890,1899,1908,1917,1926,1935,1944,1953,1962,1971,1980,1989,1998,2007,2016,2025,2034,2043,2052,2061,2070,2079,2088,2097,2106,2115,2124,2133,2142,2151,2160,2169,2178,2187,2196,2205,2214,2223,2232,2241])
- self.assertTrue(mm3D.getMeshAtLevel(0).getNodalConnectivityIndex().isEqual(d))
- d=DataArrayInt([4,1,0,32,33,4,0,5,37,32,4,5,1,33,37,4,5,6,38,37,4,6,1,33,38,4,2,1,33,34,4,6,2,34,38,4,6,7,39,38,4,7,2,34,39,4,3,2,34,35,4,7,3,35,39,4,7,8,40,39,4,8,3,35,40,4,5,4,36,37,4,4,10,42,36,4,10,5,37,42,4,10,11,43,42,4,11,5,37,43,4,9,8,40,41,4,8,14,46,40,4,14,9,41,46,4,14,15,47,46,4,15,9,41,47,4,10,16,48,42,4,16,11,43,48,4,16,17,49,48,4,17,11,43,49,4,14,20,52,46,4,20,15,47,52,4,20,21,53,52,4,21,15,47,53,4,16,22,54,48,4,22,17,49,54,4,22,23,55,54,4,23,17,49,55,4,20,26,58,52,4,26,21,53,58,4,26,27,59,58,4,27,21,53,59,4,24,23,55,56,4,23,28,60,55,4,28,24,56,60,4,28,29,61,60,4,29,24,56,61,4,25,24,56,57,4,29,25,57,61,4,29,30,62,61,4,30,25,57,62,4,26,25,57,58,4,30,26,58,62,4,30,31,63,62,4,31,26,58,63,4,11,12,44,43,4,12,6,38,44,4,12,13,45,44,4,13,7,39,45,4,13,14,46,45,4,17,18,50,49,4,18,12,44,50,4,18,19,51,50,4,19,13,45,51,4,19,20,52,51,4,24,18,50,56,4,25,19,51,57,4,33,32,64,65,4,32,37,69,64,4,37,33,65,69,4,37,38,70,69,4,38,33,65,70,4,34,33,65,66,4,38,34,66,70,4,38,39,71,70,4,39,34,66,71,4,35,34,66,67,4,39,35,67,71,4,39,40,72,71,4,40,35,67,72,4,37,36,68,69,4,36,42,74,68,4,42,37,69,74,4,42,43,75,74,4,43,37,69,75,4,41,40,72,73,4,40,46,78,72,4,46,41,73,78,4,46,47,79,78,4,47,41,73,79,4,42,48,80,74,4,48,43,75,80,4,48,49,81,80,4,49,43,75,81,4,46,52,84,78,4,52,47,79,84,4,52,53,85,84,4,53,47,79,85,4,48,54,86,80,4,54,49,81,86,4,54,55,87,86,4,55,49,81,87,4,52,58,90,84,4,58,53,85,90,4,58,59,91,90,4,59,53,85,91,4,56,55,87,88,4,55,60,92,87,4,60,56,88,92,4,60,61,93,92,4,61,56,88,93,4,57,56,88,89,4,61,57,89,93,4,61,62,94,93,4,62,57,89,94,4,58,57,89,90,4,62,58,90,94,4,62,63,95,94,4,63,58,90,95,4,43,44,76,75,4,44,38,70,76,4,44,45,77,76,4,45,39,71,77,4,45,46,78,77,4,49,50,82,81,4,50,44,76,82,4,50,51,83,82,4,51,45,77,83,4,51,52,84,83,4,56,50,82,88,4,57,51,83,89,4,65,64,96,97,4,64,69,101,96,4,69,65,97,101,4,69,70,102,101,4,70,65,97,102,4,66,65,97,98,4,70,66,98,102,4,70,71,103,102,4,71,66,98,103,4,67,66,98,99,4,71,67,99,103,4,71,72,104,103,4,72,67,99,104,4,69,68,100,101,4,68,74,106,100,4,74,69,101,106,4,74,75,107,106,4,75,69,101,107,4,73,72,104,105,4,72,78,110,104,4,78,73,105,110,4,78,79,111,110,4,79,73,105,111,4,74,80,112,106,4,80,75,107,112,4,80,81,113,112,4,81,75,107,113,4,78,84,116,110,4,84,79,111,116,4,84,85,117,116,4,85,79,111,117,4,80,86,118,112,4,86,81,113,118,4,86,87,119,118,4,87,81,113,119,4,84,90,122,116,4,90,85,117,122,4,90,91,123,122,4,91,85,117,123,4,88,87,119,120,4,87,92,124,119,4,92,88,120,124,4,92,93,125,124,4,93,88,120,125,4,89,88,120,121,4,93,89,121,125,4,93,94,126,125,4,94,89,121,126,4,90,89,121,122,4,94,90,122,126,4,94,95,127,126,4,95,90,122,127,4,75,76,108,107,4,76,70,102,108,4,76,77,109,108,4,77,71,103,109,4,77,78,110,109,4,81,82,114,113,4,82,76,108,114,4,82,83,115,114,4,83,77,109,115,4,83,84,116,115,4,88,82,114,120,4,89,83,115,121,4,97,96,128,129,4,96,101,133,128,4,101,97,129,133,4,101,102,134,133,4,102,97,129,134,4,98,97,129,130,4,102,98,130,134,4,102,103,135,134,4,103,98,130,135,4,99,98,130,131,4,103,99,131,135,4,103,104,136,135,4,104,99,131,136,4,101,100,132,133,4,100,106,138,132,4,106,101,133,138,4,106,107,139,138,4,107,101,133,139,4,105,104,136,137,4,104,110,142,136,4,110,105,137,142,4,110,111,143,142,4,111,105,137,143,4,106,112,144,138,4,112,107,139,144,4,112,113,145,144,4,113,107,139,145,4,110,116,148,142,4,116,111,143,148,4,116,117,149,148,4,117,111,143,149,4,112,118,150,144,4,118,113,145,150,4,118,119,151,150,4,119,113,145,151,4,116,122,154,148,4,122,117,149,154,4,122,123,155,154,4,123,117,149,155,4,120,119,151,152,4,119,124,156,151,4,124,120,152,156,4,124,125,157,156,4,125,120,152,157,4,121,120,152,153,4,125,121,153,157,4,125,126,158,157,4,126,121,153,158,4,122,121,153,154,4,126,122,154,158,4,126,127,159,158,4,127,122,154,159,4,107,108,140,139,4,108,102,134,140,4,108,109,141,140,4,109,103,135,141,4,109,110,142,141,4,113,114,146,145,4,114,108,140,146,4,114,115,147,146,4,115,109,141,147,4,115,116,148,147,4,120,114,146,152,4,121,115,147,153,4,129,128,160,161,4,128,133,165,160,4,133,129,161,165,4,133,134,166,165,4,134,129,161,166,4,130,129,161,162,4,134,130,162,166,4,134,135,167,166,4,135,130,162,167,4,131,130,162,163,4,135,131,163,167,4,135,136,168,167,4,136,131,163,168,4,133,132,164,165,4,132,138,170,164,4,138,133,165,170,4,138,139,171,170,4,139,133,165,171,4,137,136,168,169,4,136,142,174,168,4,142,137,169,174,4,142,143,175,174,4,143,137,169,175,4,138,144,176,170,4,144,139,171,176,4,144,145,177,176,4,145,139,171,177,4,142,148,180,174,4,148,143,175,180,4,148,149,181,180,4,149,143,175,181,4,144,150,182,176,4,150,145,177,182,4,150,151,183,182,4,151,145,177,183,4,148,154,186,180,4,154,149,181,186,4,154,155,187,186,4,155,149,181,187,4,152,151,183,184,4,151,156,188,183,4,156,152,184,188,4,156,157,189,188,4,157,152,184,189,4,153,152,184,185,4,157,153,185,189,4,157,158,190,189,4,158,153,185,190,4,154,153,185,186,4,158,154,186,190,4,158,159,191,190,4,159,154,186,191,4,139,140,172,171,4,140,134,166,172,4,140,141,173,172,4,141,135,167,173,4,141,142,174,173,4,145,146,178,177,4,146,140,172,178,4,146,147,179,178,4,147,141,173,179,4,147,148,180,179,4,152,146,178,184,4,153,147,179,185,4,161,160,192,193,4,160,165,197,192,4,165,161,193,197,4,165,166,198,197,4,166,161,193,198,4,162,161,193,194,4,166,162,194,198,4,166,167,199,198,4,167,162,194,199,4,163,162,194,195,4,167,163,195,199,4,167,168,200,199,4,168,163,195,200,4,165,164,196,197,4,164,170,202,196,4,170,165,197,202,4,170,171,203,202,4,171,165,197,203,4,169,168,200,201,4,168,174,206,200,4,174,169,201,206,4,174,175,207,206,4,175,169,201,207,4,170,176,208,202,4,176,171,203,208,4,176,177,209,208,4,177,171,203,209,4,174,180,212,206,4,180,175,207,212,4,180,181,213,212,4,181,175,207,213,4,176,182,214,208,4,182,177,209,214,4,182,183,215,214,4,183,177,209,215,4,180,186,218,212,4,186,181,213,218,4,186,187,219,218,4,187,181,213,219,4,184,183,215,216,4,183,188,220,215,4,188,184,216,220,4,188,189,221,220,4,189,184,216,221,4,185,184,216,217,4,189,185,217,221,4,189,190,222,221,4,190,185,217,222,4,186,185,217,218,4,190,186,218,222,4,190,191,223,222,4,191,186,218,223,4,171,172,204,203,4,172,166,198,204,4,172,173,205,204,4,173,167,199,205,4,173,174,206,205,4,177,178,210,209,4,178,172,204,210,4,178,179,211,210,4,179,173,205,211,4,179,180,212,211,4,184,178,210,216,4,185,179,211,217,4,193,192,224,225,4,192,197,229,224,4,197,193,225,229,4,197,198,230,229,4,198,193,225,230,4,194,193,225,226,4,198,194,226,230,4,198,199,231,230,4,199,194,226,231,4,195,194,226,227,4,199,195,227,231,4,199,200,232,231,4,200,195,227,232,4,197,196,228,229,4,196,202,234,228,4,202,197,229,234,4,202,203,235,234,4,203,197,229,235,4,201,200,232,233,4,200,206,238,232,4,206,201,233,238,4,206,207,239,238,4,207,201,233,239,4,202,208,240,234,4,208,203,235,240,4,208,209,241,240,4,209,203,235,241,4,206,212,244,238,4,212,207,239,244,4,212,213,245,244,4,213,207,239,245,4,208,214,246,240,4,214,209,241,246,4,214,215,247,246,4,215,209,241,247,4,212,218,250,244,4,218,213,245,250,4,218,219,251,250,4,219,213,245,251,4,216,215,247,248,4,215,220,252,247,4,220,216,248,252,4,220,221,253,252,4,221,216,248,253,4,217,216,248,249,4,221,217,249,253,4,221,222,254,253,4,222,217,249,254,4,218,217,249,250,4,222,218,250,254,4,222,223,255,254,4,223,218,250,255,4,203,204,236,235,4,204,198,230,236,4,204,205,237,236,4,205,199,231,237,4,205,206,238,237,4,209,210,242,241,4,210,204,236,242,4,210,211,243,242,4,211,205,237,243,4,211,212,244,243,4,216,210,242,248,4,217,211,243,249,4,225,224,256,257,4,224,229,261,256,4,229,225,257,261,4,229,230,262,261,4,230,225,257,262,4,226,225,257,258,4,230,226,258,262,4,230,231,263,262,4,231,226,258,263,4,227,226,258,259,4,231,227,259,263,4,231,232,264,263,4,232,227,259,264,4,229,228,260,261,4,228,234,266,260,4,234,229,261,266,4,234,235,267,266,4,235,229,261,267,4,233,232,264,265,4,232,238,270,264,4,238,233,265,270,4,238,239,271,270,4,239,233,265,271,4,234,240,272,266,4,240,235,267,272,4,240,241,273,272,4,241,235,267,273,4,238,244,276,270,4,244,239,271,276,4,244,245,277,276,4,245,239,271,277,4,240,246,278,272,4,246,241,273,278,4,246,247,279,278,4,247,241,273,279,4,244,250,282,276,4,250,245,277,282,4,250,251,283,282,4,251,245,277,283,4,248,247,279,280,4,247,252,284,279,4,252,248,280,284,4,252,253,285,284,4,253,248,280,285,4,249,248,280,281,4,253,249,281,285,4,253,254,286,285,4,254,249,281,286,4,250,249,281,282,4,254,250,282,286,4,254,255,287,286,4,255,250,282,287,4,235,236,268,267,4,236,230,262,268,4,236,237,269,268,4,237,231,263,269,4,237,238,270,269,4,241,242,274,273,4,242,236,268,274,4,242,243,275,274,4,243,237,269,275,4,243,244,276,275,4,248,242,274,280,4,249,243,275,281,4,257,256,288,289,4,256,261,293,288,4,261,257,289,293,4,261,262,294,293,4,262,257,289,294,4,258,257,289,290,4,262,258,290,294,4,262,263,295,294,4,263,258,290,295,4,259,258,290,291,4,263,259,291,295,4,263,264,296,295,4,264,259,291,296,4,261,260,292,293,4,260,266,298,292,4,266,261,293,298,4,266,267,299,298,4,267,261,293,299,4,265,264,296,297,4,264,270,302,296,4,270,265,297,302,4,270,271,303,302,4,271,265,297,303,4,266,272,304,298,4,272,267,299,304,4,272,273,305,304,4,273,267,299,305,4,270,276,308,302,4,276,271,303,308,4,276,277,309,308,4,277,271,303,309,4,272,278,310,304,4,278,273,305,310,4,278,279,311,310,4,279,273,305,311,4,276,282,314,308,4,282,277,309,314,4,282,283,315,314,4,283,277,309,315,4,280,279,311,312,4,279,284,316,311,4,284,280,312,316,4,284,285,317,316,4,285,280,312,317,4,281,280,312,313,4,285,281,313,317,4,285,286,318,317,4,286,281,313,318,4,282,281,313,314,4,286,282,314,318,4,286,287,319,318,4,287,282,314,319,4,267,268,300,299,4,268,262,294,300,4,268,269,301,300,4,269,263,295,301,4,269,270,302,301,4,273,274,306,305,4,274,268,300,306,4,274,275,307,306,4,275,269,301,307,4,275,276,308,307,4,280,274,306,312,4,281,275,307,313])
- self.assertTrue(mm3D.getMeshAtLevel(-1).getNodalConnectivity().isEqual(d))
- d=DataArrayInt(577) ; d.iota(0) ; d*=5
- self.assertTrue(mm3D.getMeshAtLevel(-1).getNodalConnectivityIndex().isEqual(d))
- #
- self.assertEqual(mm3D.getGroupArr(0,"grp0").getName(),"grp0")
- self.assertEqual(mm3D.getGroupArr(-1,"grp1").getName(),"grp1")
- self.assertTrue(mm3D.getGroupArr(0,"grp0").isEqualWithoutConsideringStr(DataArrayInt([0,1,2,3,4,5,24,25,26,27,28,29,48,49,50,51,52,53,72,73,74,75,76,77,96,97,98,99,100,101,120,121,122,123,124,125,144,145,146,147,148,149,168,169,170,171,172,173,192,193,194,195,196,197,216,217,218,225,226,227,234,235,236,243,244,245,252,253,254,261,262,263,270,271,272,279,280,281,288,289,290])))
- self.assertTrue(mm3D.getGroupArr(-1,"grp1").isEqualWithoutConsideringStr(DataArrayInt([0,1,5,9,12,13,14,18,22,23,30,31,33,37,38,40,42,46,50,51,64,65,69,73,76,77,78,82,86,87,94,95,97,101,102,104,106,110,114,115,128,129,133,137,140,141,142,146,150,151,158,159,161,165,166,168,170,174,178,179,192,193,197,201,204,205,206,210,214,215,222,223,225,229,230,232,234,238,242,243,256,257,261,265,268,269,270,274,278,279,286,287,289,293,294,296,298,302,306,307,320,321,325,329,332,333,334,338,342,343,350,351,353,357,358,360,362,366,370,371,384,385,389,393,396,397,398,402,406,407,414,415,417,421,422,424,426,430,434,435,448,449,453,457,460,461,462,466,470,471,478,479,481,485,486,488,490,494,498,499,512,513,517,521,524,525,526,530,534,535,542,543,545,549,550,552,554,558,562,563])))
+ d=DataArrayInt([16,1,0,5,33,32,37,16,1,5,6,33,37,38,16,2,1,6,34,33,38,16,2,6,7,34,38,39,16,3,2,7,35,34,39,16,3,7,8,35,39,40,16,5,4,10,37,36,42,16,5,10,11,37,42,43,16,9,8,14,41,40,46,16,9,14,15,41,46,47,16,11,10,16,43,42,48,16,11,16,17,43,48,49,16,15,14,20,47,46,52,16,15,20,21,47,52,53,16,17,16,22,49,48,54,16,17,22,23,49,54,55,16,21,20,26,53,52,58,16,21,26,27,53,58,59,16,24,23,28,56,55,60,16,24,28,29,56,60,61,16,25,24,29,57,56,61,16,25,29,30,57,61,62,16,26,25,30,58,57,62,16,26,30,31,58,62,63,16,33,32,37,65,64,69,16,33,37,38,65,69,70,16,34,33,38,66,65,70,16,34,38,39,66,70,71,16,35,34,39,67,66,71,16,35,39,40,67,71,72,16,37,36,42,69,68,74,16,37,42,43,69,74,75,16,41,40,46,73,72,78,16,41,46,47,73,78,79,16,43,42,48,75,74,80,16,43,48,49,75,80,81,16,47,46,52,79,78,84,16,47,52,53,79,84,85,16,49,48,54,81,80,86,16,49,54,55,81,86,87,16,53,52,58,85,84,90,16,53,58,59,85,90,91,16,56,55,60,88,87,92,16,56,60,61,88,92,93,16,57,56,61,89,88,93,16,57,61,62,89,93,94,16,58,57,62,90,89,94,16,58,62,63,90,94,95,18,6,5,11,12,38,37,43,44,18,7,6,12,13,39,38,44,45,18,8,7,13,14,40,39,45,46,18,12,11,17,18,44,43,49,50,18,13,12,18,19,45,44,50,51,18,14,13,19,20,46,45,51,52,18,18,17,23,24,50,49,55,56,18,19,18,24,25,51,50,56,57,18,20,19,25,26,52,51,57,58,18,38,37,43,44,70,69,75,76,18,39,38,44,45,71,70,76,77,18,40,39,45,46,72,71,77,78,18,44,43,49,50,76,75,81,82,18,45,44,50,51,77,76,82,83,18,46,45,51,52,78,77,83,84,18,50,49,55,56,82,81,87,88,18,51,50,56,57,83,82,88,89,18,52,51,57,58,84,83,89,90])
+ self.assertTrue(mm3D[0].getNodalConnectivity().isEqual(d))
+ d=DataArrayInt([0,7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,287,294,301,308,315,322,329,336,345,354,363,372,381,390,399,408,417,426,435,444,453,462,471,480,489,498])
+ self.assertTrue(mm3D[0].getNodalConnectivityIndex().isEqual(d))
+ d=DataArrayInt([3,1,0,5,3,1,5,6,3,2,1,6,3,2,6,7,3,3,2,7,3,3,7,8,3,5,4,10,3,5,10,11,3,9,8,14,3,9,14,15,3,11,10,16,3,11,16,17,3,15,14,20,3,15,20,21,3,17,16,22,3,17,22,23,3,21,20,26,3,21,26,27,3,24,23,28,3,24,28,29,3,25,24,29,3,25,29,30,3,26,25,30,3,26,30,31,3,65,64,69,3,65,69,70,3,66,65,70,3,66,70,71,3,67,66,71,3,67,71,72,3,69,68,74,3,69,74,75,3,73,72,78,3,73,78,79,3,75,74,80,3,75,80,81,3,79,78,84,3,79,84,85,3,81,80,86,3,81,86,87,3,85,84,90,3,85,90,91,3,88,87,92,3,88,92,93,3,89,88,93,3,89,93,94,3,90,89,94,3,90,94,95,4,1,0,32,33,4,0,5,37,32,4,5,1,33,37,4,5,6,38,37,4,6,1,33,38,4,2,1,33,34,4,6,2,34,38,4,6,7,39,38,4,7,2,34,39,4,3,2,34,35,4,7,3,35,39,4,7,8,40,39,4,8,3,35,40,4,5,4,36,37,4,4,10,42,36,4,10,5,37,42,4,10,11,43,42,4,11,5,37,43,4,9,8,40,41,4,8,14,46,40,4,14,9,41,46,4,14,15,47,46,4,15,9,41,47,4,10,16,48,42,4,16,11,43,48,4,16,17,49,48,4,17,11,43,49,4,14,20,52,46,4,20,15,47,52,4,20,21,53,52,4,21,15,47,53,4,16,22,54,48,4,22,17,49,54,4,22,23,55,54,4,23,17,49,55,4,20,26,58,52,4,26,21,53,58,4,26,27,59,58,4,27,21,53,59,4,24,23,55,56,4,23,28,60,55,4,28,24,56,60,4,28,29,61,60,4,29,24,56,61,4,25,24,56,57,4,29,25,57,61,4,29,30,62,61,4,30,25,57,62,4,26,25,57,58,4,30,26,58,62,4,30,31,63,62,4,31,26,58,63,4,11,12,44,43,4,12,6,38,44,4,12,13,45,44,4,13,7,39,45,4,13,14,46,45,4,17,18,50,49,4,18,12,44,50,4,18,19,51,50,4,19,13,45,51,4,19,20,52,51,4,24,18,50,56,4,25,19,51,57,4,33,32,64,65,4,32,37,69,64,4,37,33,65,69,4,37,38,70,69,4,38,33,65,70,4,34,33,65,66,4,38,34,66,70,4,38,39,71,70,4,39,34,66,71,4,35,34,66,67,4,39,35,67,71,4,39,40,72,71,4,40,35,67,72,4,37,36,68,69,4,36,42,74,68,4,42,37,69,74,4,42,43,75,74,4,43,37,69,75,4,41,40,72,73,4,40,46,78,72,4,46,41,73,78,4,46,47,79,78,4,47,41,73,79,4,42,48,80,74,4,48,43,75,80,4,48,49,81,80,4,49,43,75,81,4,46,52,84,78,4,52,47,79,84,4,52,53,85,84,4,53,47,79,85,4,48,54,86,80,4,54,49,81,86,4,54,55,87,86,4,55,49,81,87,4,52,58,90,84,4,58,53,85,90,4,58,59,91,90,4,59,53,85,91,4,56,55,87,88,4,55,60,92,87,4,60,56,88,92,4,60,61,93,92,4,61,56,88,93,4,57,56,88,89,4,61,57,89,93,4,61,62,94,93,4,62,57,89,94,4,58,57,89,90,4,62,58,90,94,4,62,63,95,94,4,63,58,90,95,4,43,44,76,75,4,44,38,70,76,4,44,45,77,76,4,45,39,71,77,4,45,46,78,77,4,49,50,82,81,4,50,44,76,82,4,50,51,83,82,4,51,45,77,83,4,51,52,84,83,4,56,50,82,88,4,57,51,83,89,4,6,5,11,12,4,7,6,12,13,4,8,7,13,14,4,12,11,17,18,4,13,12,18,19,4,14,13,19,20,4,18,17,23,24,4,19,18,24,25,4,20,19,25,26,4,70,69,75,76,4,71,70,76,77,4,72,71,77,78,4,76,75,81,82,4,77,76,82,83,4,78,77,83,84,4,82,81,87,88,4,83,82,88,89,4,84,83,89,90])
+ self.assertTrue(mm3D[-1].getNodalConnectivity().isEqual(d))
+ d=DataArrayInt([0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,197,202,207,212,217,222,227,232,237,242,247,252,257,262,267,272,277,282,287,292,297,302,307,312,317,322,327,332,337,342,347,352,357,362,367,372,377,382,387,392,397,402,407,412,417,422,427,432,437,442,447,452,457,462,467,472,477,482,487,492,497,502,507,512,517,522,527,532,537,542,547,552,557,562,567,572,577,582,587,592,597,602,607,612,617,622,627,632,637,642,647,652,657,662,667,672,677,682,687,692,697,702,707,712,717,722,727,732,737,742,747,752,757,762,767,772,777,782,787,792,797,802,807,812,817,822,827,832,837,842,847,852,857,862,867,872,877,882,887,892,897,902,907,912,917,922])
+ self.assertTrue(mm3D[-1].getNodalConnectivityIndex().isEqual(d))
+ d=DataArrayInt([1,1,0,1,0,5,1,5,1,1,5,6,1,6,1,1,2,1,1,6,2,1,6,7,1,7,2,1,3,2,1,7,3,1,7,8,1,8,3,1,5,4,1,4,10,1,10,5,1,10,11,1,11,5,1,9,8,1,8,14,1,14,9,1,14,15,1,15,9,1,10,16,1,16,11,1,16,17,1,17,11,1,14,20,1,20,15,1,20,21,1,21,15,1,16,22,1,22,17,1,22,23,1,23,17,1,20,26,1,26,21,1,26,27,1,27,21,1,24,23,1,23,28,1,28,24,1,28,29,1,29,24,1,25,24,1,29,25,1,29,30,1,30,25,1,26,25,1,30,26,1,30,31,1,31,26,1,11,12,1,12,6,1,12,13,1,13,7,1,13,14,1,17,18,1,18,12,1,18,19,1,19,13,1,19,20,1,24,18,1,25,19,1,65,64,1,64,69,1,69,65,1,69,70,1,70,65,1,66,65,1,70,66,1,70,71,1,71,66,1,67,66,1,71,67,1,71,72,1,72,67,1,69,68,1,68,74,1,74,69,1,74,75,1,75,69,1,73,72,1,72,78,1,78,73,1,78,79,1,79,73,1,74,80,1,80,75,1,80,81,1,81,75,1,78,84,1,84,79,1,84,85,1,85,79,1,80,86,1,86,81,1,86,87,1,87,81,1,84,90,1,90,85,1,90,91,1,91,85,1,88,87,1,87,92,1,92,88,1,92,93,1,93,88,1,89,88,1,93,89,1,93,94,1,94,89,1,90,89,1,94,90,1,94,95,1,95,90,1,75,76,1,76,70,1,76,77,1,77,71,1,77,78,1,81,82,1,82,76,1,82,83,1,83,77,1,83,84,1,88,82,1,89,83])
+ self.assertTrue(mm3D[-2].getNodalConnectivity().isEqual(d))
+ d=DataArrayInt(129) ; d.iota() ; d*=3
+ self.assertTrue(mm3D[-2].getNodalConnectivityIndex().isEqual(d))
+ #
+ self.assertEqual(mm3D.getGroupArr(-1,"grp0").getName(),"grp0")
+ self.assertEqual(mm3D.getGroupArr(-2,"grp1").getName(),"grp1")
+ self.assertTrue(mm3D.getGroupArr(-1,"grp0").isEqualWithoutConsideringStr(DataArrayInt([0,1,2,3,4,5,176,177,178])))
+ self.assertTrue(mm3D.getGroupArr(-1,"grp0_top").isEqualWithoutConsideringStr(DataArrayInt([24,25,26,27,28,29,185,186,187])))
+ self.assertTrue(mm3D.getGroupArr(-2,"grp1").isEqualWithoutConsideringStr(DataArrayInt([0,1,5,9,12,13,14,18,22,23,30,31,33,37,38,40,42,46,50,51])))
+ self.assertTrue(mm3D.getGroupArr(-2,"grp1_top").isEqualWithoutConsideringStr(DataArrayInt([64,65,69,73,76,77,78,82,86,87,94,95,97,101,102,104,106,110,114,115])))
+ self.assertTrue(mm3D.getGroupArr(0,"grp0_extruded").isEqualWithoutConsideringStr(DataArrayInt([0,1,2,3,4,5,24,25,26,27,28,29,48,49,50,57,58,59])))
+ self.assertTrue(mm3D.getGroupArr(-1,"grp1_extruded").isEqualWithoutConsideringStr(DataArrayInt([48,49,53,57,60,61,62,66,70,71,78,79,81,85,86,88,90,94,98,99,112,113,117,121,124,125,126,130,134,135,142,143,145,149,150,152,154,158,162,163])))
+ mm3D.setName("MeshExtruded")
+ mm3D.write(fileName,0)
+ pass
+
+ @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+ def testMEDFileUMeshPickeling1(self):
+ import cPickle
+ outFileName="Pyfile86.med"
+ c=DataArrayDouble([-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ],9,2)
+ c.setInfoOnComponents(["aa","bbb"])
+ targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
+ m=MEDCouplingUMesh();
+ m.setMeshDimension(2);
+ m.allocateCells(5);
+ m.insertNextCell(NORM_TRI3,3,targetConn[4:7])
+ m.insertNextCell(NORM_TRI3,3,targetConn[7:10])
+ m.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
+ m.insertNextCell(NORM_POLYGON,4,targetConn[10:14])
+ m.insertNextCell(NORM_POLYGON,4,targetConn[14:18])
+ m.finishInsertingCells();
+ m.setCoords(c)
+ m.checkCoherency()
+ m1=MEDCouplingUMesh.New();
+ m1.setMeshDimension(1);
+ m1.allocateCells(3);
+ m1.insertNextCell(NORM_SEG2,2,[1,4])
+ m1.insertNextCell(NORM_SEG2,2,[3,6])
+ m1.insertNextCell(NORM_SEG3,3,[2,8,5])
+ m1.finishInsertingCells();
+ m1.setCoords(c)
+ m1.checkCoherency()
+ m2=MEDCouplingUMesh.New();
+ m2.setMeshDimension(0);
+ m2.allocateCells(4);
+ m2.insertNextCell(NORM_POINT1,1,[1])
+ m2.insertNextCell(NORM_POINT1,1,[3])
+ m2.insertNextCell(NORM_POINT1,1,[2])
+ m2.insertNextCell(NORM_POINT1,1,[6])
+ m2.finishInsertingCells();
+ m2.setCoords(c)
+ m2.checkCoherency()
+ #
+ mm=MEDFileUMesh.New()
+ self.assertTrue(mm.getUnivNameWrStatus())
+ mm.setName("MyFirstMEDCouplingMEDmesh")
+ mm.setDescription("IHopeToConvinceLastMEDMEMUsers")
+ mm.setCoords(c)
+ mm[-1]=m1;
+ mm[0]=m;
+ mm.setRenumFieldArr(0,DataArrayInt([32,41,50,56,7]))
+ mm[-2]=m2;
+ mm.setRenumFieldArr(-2,DataArrayInt([102,52,45,63]))
+ # playing with groups
+ g1_2=DataArrayInt.New()
+ g1_2.setValues([1,3],2,1)
+ g1_2.setName("G1")
+ g2_2=DataArrayInt.New()
+ g2_2.setValues([1,2,3],3,1)
+ g2_2.setName("G2")
+ mm.setGroupsAtLevel(0,[g1_2,g2_2],False)
+ g1_1=DataArrayInt.New()
+ g1_1.setValues([0,1,2],3,1)
+ g1_1.setName("G1")
+ g2_1=DataArrayInt.New()
+ g2_1.setValues([0,2],2,1)
+ g2_1.setName("G2")
+ mm.setGroupsAtLevel(-1,[g1_1,g2_1],False)
+ g1_N=DataArrayInt.New()
+ g1_N.setValues(range(8),8,1)
+ g1_N.setName("G1")
+ g2_N=DataArrayInt.New()
+ g2_N.setValues(range(9),9,1)
+ g2_N.setName("G2")
+ mm.setGroupsAtLevel(1,[g1_N,g2_N],False)
+ mm.createGroupOnAll(0,"GrpOnAllCell")
+ # check content of mm
+ t=mm.getGroupArr(0,"G1",False)
+ self.assertTrue(g1_2.isEqual(t));
+ t=mm.getGroupArr(0,"G2",False)
+ self.assertTrue(g2_2.isEqual(t));
+ t=mm.getGroupArr(-1,"G1",False)
+ self.assertTrue(g1_1.isEqual(t));
+ t=mm.getGroupArr(-1,"G2",False)
+ self.assertTrue(g2_1.isEqual(t));
+ t=mm.getGroupArr(1,"G1",False)
+ self.assertTrue(g1_N.isEqual(t));
+ t=mm.getGroupArr(1,"G2",False)
+ self.assertTrue(g2_N.isEqual(t));
+ self.assertTrue(mm.existsGroup("GrpOnAllCell"));
+ t=mm.getGroupArr(0,"GrpOnAllCell")
+ #
+ st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL)
+ mm2=cPickle.loads(st)
+ self.assertTrue(mm.isEqual(mm2,1e-12)[0])
+ pass
+
+ def testMEDFileFieldsLoadSpecificEntities1(self):
+ nbNodes=11
+ fieldName="myField"
+ fileName="Pyfile87.med"
+ nbPdt=10
+ meshName="Mesh"
+ #
+ m=MEDCouplingCMesh()
+ arr=DataArrayDouble(nbNodes) ; arr.iota()
+ m.setCoords(arr)
+ m=m.buildUnstructured()
+ m.setName(meshName)
+ #
+ fmts=MEDFileFieldMultiTS()
+ for i in xrange(nbPdt):
+ f=MEDCouplingFieldDouble(ON_NODES)
+ f.setMesh(m)
+ arr=DataArrayDouble(nbNodes) ; arr.iota() ; arr*=i
+ f.setArray(arr)
+ f.setName(fieldName)
+ f.setTime(float(i),i,0)
+ fmts.appendFieldNoProfileSBT(f)
+ pass
+ #
+ mm=MEDFileUMesh() ; mm[0]=m
+ fmts.write(fileName,2)
+ mm.write(fileName,0)
+ #
+ fs=MEDFileFields(fileName,False)
+ fs2=MEDFileFields.LoadSpecificEntities(fileName,[(ON_NODES,NORM_ERROR)],False)
+ fs.loadArraysIfNecessary()
+ fs2.loadArraysIfNecessary()
+ for i in xrange(nbPdt):
+ self.assertTrue(fs[fieldName][i].getUndergroundDataArray().isEqual(fs2[fieldName][i].getUndergroundDataArray(),1e-12))
+ pass
+ m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1])) ; m1=m1.buildUnstructured() ; m1.simplexize(0)
+ m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([3,4,5]),DataArrayDouble([0,1])) ; m2=m2.buildUnstructured()
+ m3=MEDCouplingUMesh.MergeUMeshes(m1,m2) ; m3.setName(meshName)
+ fmts=MEDFileFieldMultiTS()
+ for i in xrange(nbPdt):
+ f=MEDCouplingFieldDouble(ON_CELLS)
+ f.setMesh(m3)
+ arr=DataArrayDouble(8) ; arr.iota() ; arr*=i
+ f.setArray(arr)
+ f.setName(fieldName)
+ f.setTime(float(i),i,0)
+ fmts.appendFieldNoProfileSBT(f)
+ pass
+ mm=MEDFileUMesh() ; mm[0]=m3
+ del mm[0]
+ self.assertEqual(mm.getNonEmptyLevels(),())
+ mm[0]=m3
+ self.assertEqual(mm.getNonEmptyLevels(),(0,))
+ fmts.write(fileName,2)
+ fs=MEDFileFields(fileName,False)
+ fs2=MEDFileFields.LoadSpecificEntities(fileName,[(ON_CELLS,NORM_TRI3)],False)
+ fs3=MEDFileFieldMultiTS.LoadSpecificEntities(fileName,fieldName,[(ON_CELLS,NORM_QUAD4)],False)
+ fs4=MEDFileFields.LoadSpecificEntities(fileName,[(ON_CELLS,NORM_TRI3),(ON_CELLS,NORM_QUAD4)],False)
+ fs.loadArraysIfNecessary()
+ fs2.loadArraysIfNecessary()
+ fs3.loadArraysIfNecessary()
+ fs4.loadArraysIfNecessary()
+ for i in xrange(nbPdt):
+ self.assertTrue(fs[fieldName][i].getUndergroundDataArray()[:6].isEqual(fs2[fieldName][i].getUndergroundDataArray(),1e-12))
+ self.assertTrue(fs[fieldName][i].getUndergroundDataArray()[6:8].isEqual(fs3[i].getUndergroundDataArray(),1e-12))
+ self.assertTrue(fs[fieldName][i].getUndergroundDataArray().isEqual(fs4[fieldName][i].getUndergroundDataArray(),1e-12))
+ pass
+ pass
+
+ def testMEDFileLotsOfTSRW1(self):
+ nbNodes=11
+ fieldName="myField"
+ fileName="Pyfile88.med"
+ nbPdt=300 # <- perftest = 30000
+ meshName="Mesh"
+ #
+ maxPdt=100 # <- optimum = 500
+ m=MEDCouplingCMesh()
+ arr=DataArrayDouble(nbNodes) ; arr.iota()
+ m.setCoords(arr)
+ m=m.buildUnstructured()
+ m.setName(meshName)
+ #
+ nbOfField=nbPdt/maxPdt
+ fs=MEDFileFields()
+ for j in xrange(nbOfField):
+ fmts=MEDFileFieldMultiTS()
+ s=DataArray.GetSlice(slice(0,nbPdt,1),j,nbOfField)
+ for i in xrange(s.start,s.stop,s.step):
+ f=MEDCouplingFieldDouble(ON_NODES)
+ f.setMesh(m)
+ arr=DataArrayDouble(nbNodes) ; arr.iota() ; arr*=i
+ f.setArray(arr)
+ f.setName("%s_%d"%(fieldName,j))
+ f.setTime(float(i),i,0)
+ fmts.appendFieldNoProfileSBT(f)
+ pass
+ fs.pushField(fmts)
+ pass
+ #
+ mm=MEDFileUMesh() ; mm[0]=m
+ fs.write(fileName,2)
+ mm.write(fileName,0)
+ ############
+ def appendInDict(d,key,val):
+ if key in d:
+ d[key].append(val)
+ else:
+ d[key]=[val]
+ pass
+ import re
+ allFields=MEDLoader.GetAllFieldNames(fileName)
+ allFieldsDict={}
+ pat=re.compile("([\d]+)([\s\S]+)$")
+ for st in allFields:
+ stRev=st[::-1]
+ m=pat.match(stRev)
+ if m:
+ appendInDict(allFieldsDict,m.group(2)[::-1],m.group(1)[::-1])
+ pass
+ else:
+ appendInDict(allFieldsDict,st,'')
+ pass
+ pass
+ fs2=MEDFileFields()
+ for k in allFieldsDict:
+ if allFieldsDict[k]!=['']:
+ allFieldsDict[k]=sorted(allFieldsDict[k],key=lambda x: int(x))
+ pass
+ fmts2=[]
+ for it in allFieldsDict[k]:
+ fmts2.append(MEDFileFieldMultiTS.LoadSpecificEntities(fileName,k+it,[(ON_NODES,NORM_ERROR)]))
+ pass
+ fmts2.reverse()
+ zeResu=fmts2.pop()
+ nbIter=len(fmts2)
+ for ii in xrange(nbIter):
+ zeResu.pushBackTimeSteps(fmts2.pop())
+ pass
+ zeResu.setName(k)
+ fs2.pushField(zeResu)
+ pass
+ self.assertEqual(fs2[0].getTimeSteps(),[(i,0,float(i)) for i in xrange(nbPdt)])