From 0920f32e32e44bdf2c3f56ea577c9a722654266f Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 16 Aug 2010 13:27:36 +0000 Subject: [PATCH] Strong test for polyhedrons. --- .../Test/MEDCouplingBasicsTest2.cxx | 117 ++++++++++++++---- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 87 +++++++++++++ 2 files changed, 181 insertions(+), 23 deletions(-) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 046ef0337..e854bb1bc 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -261,24 +261,6 @@ void MEDCouplingBasicsTest::testCellOrientation2() */ void MEDCouplingBasicsTest::testPolyhedronBarycenter() { - /*double coords [] = { 0.241310763507,0.0504777305619,0.0682283524903, 0.252501053866,-0.0625176732937,0.137272639894, 0.152262663601,0.241816569527,0.133812556197, 0.18047750211,-0.0789949051358,0.339098173401, 0.151741971857,0.238885278571,0.137715037333, 0.242532155481,-0.0928169086456,0.0678043417367, 0.240941965335,-0.015461491464,0.0617186345825, 0.24127650112,0.0499427876717,0.0679634099148, -0.145828917428,0.206291632565,0.0310071927543, 0.0125651775307,0.266262085828,0.105228430543, -0.0994066533286,0.233224271238,0.0572213839567, -0.0951345338317,0.234819509426,0.0592126284538, 0.136580574205,-0.205486212579,0.0572866072014, 0.0637270784978,-0.168886355238,0.446614057077, 0.041337157151,-0.213402568198,0.372407095999, 0.0411601970268,-0.202387875756,0.411334979491, -0.108355701857,0.193636239335,0.204886756738, 0.00639779029829,0.155296981517,0.252585892979, 0.0262473111702,-0.112919732543,0.424286639249, -0.224103052733,-0.139430015438,-0.0122352295701, -0.0312760589481,-0.274272003594,0.0323959636568, -0.166663422532,-0.217754445175,0.00392109070364, -0.30586619777,-0.0475168041091,-0.0144585228182, -0.280881480586,0.135571293538,0.00623923647986, -0.25548538234,0.156819217766,0.0645277879769, -0.131567009284,0.184133752309,0.206021802753, -0.196204010965,0.151602971681,0.212974777736, -0.183713879463,0.0802946639531,0.260115662599, -0.244241178767,-0.0738873389604,0.144590565817, -0.155804057829,-0.164892720025,0.210613950558, -0.170950800428,-0.215099334026,0.00610122860092, -0.30552634869,-0.0490020791904,-0.0132786533145, 0.271831011884,0.15105657296,0.0230534827908, 0.281919192283,0.0898544306288,-0.0625201489143, 0.260240727276,-0.0120688706637,-0.0532316588626, 0.244947737722,0.0197984684293,0.0309341209233, 0.23439631578,0.229825279875,0.0508520585381, 0.160921316875,0.265078502128,0.121716560626, -0.315088694175,0.0747700471918,-0.245836615071, -0.327728781776,0.0857114674649,-0.239431905957, -0.308385460634,0.145142997084,-0.149886828433, 0.0488236045164,0.309462801914,0.0849169148265, -0.0244964803395,0.33145611751,-0.0476415818061, 0.0060567994229,0.32418412014,0.0367779543812, -0.0950221448063,0.236675326003,0.0572594453983, 0.248723023186,0.0886648784791,-0.176629430538, 0.116796984,0.256596599567,-0.292863523603, 0.118024552914,0.229154257843,-0.34233232501, 0.217507892549,-0.0417822335742,-0.176771782888, -0.224429321304,0.0125595300114,-0.362064725588, 0.0937301100955,-0.0500824832657,-0.299713548444, -0.244162220397,0.0383853931293,-0.389856984411, -0.0281989366102,0.097392811563,-0.458244577284, -0.385010847162,0.10122766194,-0.140052859922, -0.377936358012,0.110875172128,-0.176207095463, 0.244483045556,-0.0991073977045,0.0575134372934, 0.262605120167,-0.100243191645,-0.0495620806935, 0.240306880972,-0.136153701579,-0.114745281696, 0.215763176129,-0.0836766059189,-0.183249640616, 0.237870396603,-0.132449578286,-0.121598854639, -0.0637683083097,-0.27921020214,-0.149112321992, -0.0856211014977,-0.2973233473,-0.0446878139589, 0.104675342288,-0.0625908305324,-0.290346256534, 0.0248264249186,-0.247797708548,-0.165830884019, 0.0719302438309,-0.178468260473,-0.211432157345, 0.142871843159,-0.208769948542,0.0454101128246, 0.167803379307,-0.207851396623,-0.088802726124, 0.12868717152,-0.230920439715,0.00760508389036, -0.0372812069535,-0.286740286332,0.00963701291166 }; - - int connN [347] = { - //polyhedron 0 - 0, 1, 2, 3, 4, -1, 1, 5, 0, 6, 7, -1, 0, 7, 2, 8, 9, 10, 11, -1, 1, 5, 3, 12, 13, 14, 15, -1, 16, 9, 17, 2, 4, -1, 4, 3, 17, 13, 18, -1, 5, 6, 12, 19, 20, 21, -1, 6, 7, 19, 8, 22, 23, -1, 23, 24, 8, 10, -1, 25, 11, 16, 9, -1, 24, 26, 10, 25, 11, -1, 12, 14, 20, -1, 27, 28, 18, 29, 13, 15, -1, 14, 15, 20, 29, 21, 30, -1, 26, 27, 25, 18, 16, 17, -1, 22, 19, 31, 21, 30, -1, 22, 31, 23, 28, 24, 27, 26, -1, 31, 30, 28, 29, - //polyhedron 1 - 0, 7, 2, 8, 9, 10, 11, -1, 32, 0, 33, 7, 34, 35, -1, 32, 0, 36, 2, 37, -1, 35, 7, 38, 8, 39, 40, -1, 2, 37, 9, 41, -1, 40, 8, 42, 10, 43, 44, -1, 41, 9, 43, 11, 44, -1, 44, 11, 10, -1, 32, 33, 36, 45, 46, 47, -1, 33, 34, 45, 48, -1, 35, 34, 38, 48, 49, 50, -1, 41, 43, 37, 42, 36, 46, -1, 38, 39, 49, 51, -1, 39, 40, 51, 42, 52, 46, 47, -1, 45, 47, 48, 52, 50, -1, 52, 51, 50, 49, - //polyhedron 2 - 6, 7, 19, 8, 22, 23, -1, 6, 35, 7, -1, 6, 35, 19, 38, -1, 35, 7, 38, 8, 39, 40, -1, 53, 22, 54, 19, 39, 38, -1, 23, 53, 8, 54, 40, -1, 53, 22, 23, -1, 39, 54, 40, - //polyhedron 3 - 35, 34, 38, 48, 49, 50, -1, 6, 35, 5, 34, 55, 56, -1, 6, 35, 19, 38, -1, 34, 56, 48, 57, 58, 59, -1, 60, 61, 49, 21, 38, 19, -1, 62, 50, 58, 48, -1, 60, 63, 49, 64, 50, 62, -1, 5, 6, 12, 19, 20, 21, -1, 55, 5, 65, 12, -1, 66, 67, 57, 65, 56, 55, -1, 63, 66, 64, 57, 59, -1, 64, 62, 59, 58, -1, 60, 63, 61, 66, 68, 67, -1, 61, 68, 21, 20, -1, 67, 68, 65, 20, 12}; - - - //{ 0,113,212,255,347 }; - - double barys [] = { -0.0165220465527,-0.0190922868195,0.158882733414, 0.0287618656076,0.135874379934,-0.14601588119, -0.147128055553,0.0465995097041,-0.049391174453, -0.00142506732317,-0.0996953090351,-0.115159183132 };*/ - - int connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0}; double coords[]={0.,0.,0., 1.,0.,0., 1.,1.,0., 0.,1.,0., 0.,0.,1., 1.,0.,1., 1.,1.,1., 0.,1.,1., 0.5, 0.5, 0.5}; MEDCouplingUMesh *meshN=MEDCouplingUMesh::New(); @@ -286,13 +268,9 @@ void MEDCouplingBasicsTest::testPolyhedronBarycenter() meshN->setMeshDimension(3); meshN->allocateCells(4); meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,29,connN); - /*meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,113,connN); - meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,99,connN+113); - meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,43,connN+212); - meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,92,connN+255);*/ meshN->finishInsertingCells(); DataArrayDouble *myCoords=DataArrayDouble::New(); - myCoords->alloc(9,3);//9,3 + myCoords->alloc(9,3); std::copy(coords,coords+27,myCoords->getPointer()); meshN->setCoords(myCoords); myCoords->decrRef(); @@ -525,8 +503,101 @@ void MEDCouplingBasicsTest::testAreaBary2D() m1->decrRef(); } +/*! + * This test check polyhedron true barycenter computation 2. + */ void MEDCouplingBasicsTest::testAreaBary3D() { + double coords [] = { 0.241310763507 , 0.0504777305619 , 0.0682283524903 , 0.252501053866 , -0.0625176732937 , 0.137272639894 , + 0.152262663601 , 0.241816569527 , 0.133812556197 , 0.18047750211 , -0.0789949051358 , 0.339098173401 , + 0.151741971857 , 0.238885278571 , 0.137715037333 , 0.242532155481 , -0.0928169086456 , 0.0678043417367 , + 0.240941965335 , -0.015461491464 , 0.0617186345825 , 0.24127650112 , 0.0499427876717 , 0.0679634099148 , + -0.145828917428 , 0.206291632565 , 0.0310071927543 , 0.0125651775307 , 0.266262085828 , 0.105228430543 , + -0.0994066533286 , 0.233224271238 , 0.0572213839567 , -0.0951345338317 , 0.234819509426 , 0.0592126284538 , + 0.136580574205 , -0.205486212579 , 0.0572866072014 , 0.0637270784978 , -0.168886355238 , 0.446614057077 , + 0.041337157151 , -0.213402568198 , 0.372407095999 , 0.0411601970268 , -0.202387875756 , 0.411334979491 , + -0.108355701857 , 0.193636239335 , 0.204886756738 , 0.00639779029829 , 0.155296981517 , 0.252585892979 , + 0.0262473111702 , -0.112919732543 , 0.424286639249 ,-0.224103052733 , -0.139430015438 , -0.0122352295701 , + -0.0312760589481 , -0.274272003594 , 0.0323959636568 , -0.166663422532 , -0.217754445175 , 0.00392109070364 , + -0.30586619777 , -0.0475168041091 , -0.0144585228182 , -0.280881480586 , 0.135571293538 , 0.00623923647986 , + -0.25548538234 , 0.156819217766 , 0.0645277879769 , -0.131567009284 , 0.184133752309 , 0.206021802753 , + -0.196204010965 , 0.151602971681 , 0.212974777736 , -0.183713879463 , 0.0802946639531 , 0.260115662599 , + -0.244241178767 , -0.0738873389604 , 0.144590565817 , -0.155804057829 , -0.164892720025 , 0.210613950558 , + -0.170950800428 , -0.215099334026 , 0.00610122860092 , -0.30552634869 , -0.0490020791904 , -0.0132786533145 , + 0.271831011884 , 0.15105657296 , 0.0230534827908 , 0.281919192283 , 0.0898544306288 , -0.0625201489143 , + 0.260240727276 , -0.0120688706637 , -0.0532316588626 , 0.244947737722 , 0.0197984684293 , 0.0309341209233 , + 0.23439631578 , 0.229825279875 , 0.0508520585381 , 0.160921316875 , 0.265078502128 , 0.121716560626 , + -0.315088694175 , 0.0747700471918 , -0.245836615071 , -0.327728781776 , 0.0857114674649 , -0.239431905957 , + -0.308385460634 , 0.145142997084 , -0.149886828433 , 0.0488236045164 , 0.309462801914 , 0.0849169148265 , + -0.0244964803395 , 0.33145611751 , -0.0476415818061 , 0.0060567994229 , 0.32418412014 , 0.0367779543812 , + -0.0950221448063 , 0.236675326003 , 0.0572594453983 , 0.248723023186 , 0.0886648784791 , -0.176629430538 , + 0.116796984 , 0.256596599567 , -0.292863523603 , 0.118024552914 , 0.229154257843 , -0.34233232501 , + 0.217507892549 , -0.0417822335742 , -0.176771782888 , -0.224429321304 , 0.0125595300114 , -0.362064725588 , + 0.0937301100955 , -0.0500824832657 , -0.299713548444 , -0.244162220397 , 0.0383853931293 , -0.389856984411 , + -0.0281989366102 , 0.097392811563 , -0.458244577284 , -0.385010847162 , 0.10122766194 , -0.140052859922 , + -0.377936358012 , 0.110875172128 , -0.176207095463 , 0.244483045556 , -0.0991073977045 , 0.0575134372934 , + 0.262605120167 , -0.100243191645 , -0.0495620806935 , 0.240306880972 , -0.136153701579 , -0.114745281696 , + 0.215763176129 , -0.0836766059189 , -0.183249640616 , 0.237870396603 , -0.132449578286 , -0.121598854639 , + -0.0637683083097 , -0.27921020214 , -0.149112321992 , -0.0856211014977 , -0.2973233473 , -0.0446878139589 , + 0.104675342288 , -0.0625908305324 , -0.290346256534 , 0.0248264249186 , -0.247797708548 , -0.165830884019 , + 0.0719302438309 , -0.178468260473 , -0.211432157345 , 0.142871843159 , -0.208769948542 , 0.0454101128246 , + 0.167803379307 , -0.207851396623 , -0.088802726124 , 0.12868717152 , -0.230920439715 , 0.00760508389036 , + -0.0372812069535 , -0.286740286332 , 0.00963701291166 }; + + int connN [] = { /*polyhedron 0*/ + 0 , 1 , 3 , 4 , 2 , -1 , 1 , 5 , 6 , 7 , 0 , -1 , 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 1 , 5 , 12 , 14 , 15 , 13 , 3 , -1 , 16 , 9 , 2 , 4 , 17 , -1 + , 4 , 3 , 13 , 18 , 17 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 , 6 , 7 , 8 , 23 , 22 , 19 , -1 , 23 , 24 , 10 , 8 , -1 , 25 , 11 , 9 , 16 , -1 + , 24 , 26 , 25 , 11 , 10 , -1 , 12 , 14 , 20 , -1 , 27 , 28 , 29 , 15 , 13 , 18 , -1 , 14 , 15 , 29 , 30 , 21 , 20 , -1 , 26 , 27 , 18 , 17 , 16 , 25 , -1 + , 22 , 19 , 21 , 30 , 31 , -1 , 22 , 31 , 28 , 27 , 26 , 24 , 23 , -1 , 31 , 30 , 29 , 28, + /* polyhedron 1*/ + 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 32 , 0 , 7 , 35 , 34 , 33 , -1 , 32 , 0 , 2 , 37 , 36 , -1 , 35 , 7 , 8 , 40 , 39 , 38 , -1 + , 2 , 37 , 41 , 9 , -1 , 40 , 8 , 10 , 44 , 43 , 42 , -1 , 41 , 9 , 11 , 44 , 43 , -1 , 44 , 11 , 10 , -1 , 32 , 33 , 45 , 47 , 46 , 36 , -1 + , 33 , 34 , 48 , 45 , -1 , 35 , 34 , 48 , 50 , 49 , 38 , -1 , 41 , 43 , 42 , 46 , 36 , 37 , -1 , 38 , 39 , 51 , 49 , -1 + , 39 , 40 , 42 , 46 , 47 , 52 , 51 , -1 , 45 , 47 , 52 , 50 , 48 , -1 , 52 , 51 , 49 , 50, + /* polyhedron 2*/ + 6 , 7 , 8 , 23 , 22 , 19 , -1 , 6 , 35 , 7 , -1 , 6 , 35 , 38 , 19 , -1 , 35 , 7 , 8 , 40 , 39 , 38 , -1 , 53 , 22 , 19 , 38 , 39 , 54 , -1 + , 23 , 53 , 54 , 40 , 8 , -1 , 53 , 22 , 23 , -1 , 39 , 54 , 40, + /*polyhedron 3*/ + 35 , 34 , 48 , 50 , 49 , 38 , -1 , 6 , 35 , 34 , 56 , 55 , 5 , -1 , 6 , 35 , 38 , 19 , -1 , 34 , 56 , 57 , 59 , 58 , 48 , -1 + , 60 , 61 , 21 , 19 , 38 , 49 , -1 , 62 , 50 , 48 , 58 , -1 , 60 , 63 , 64 , 62 , 50 , 49 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 + , 55 , 5 , 12 , 65 , -1 , 66 , 67 , 65 , 55 , 56 , 57 , -1 , 63 , 66 , 57 , 59 , 64 , -1 , 64 , 62 , 58 , 59 , -1 + , 60 , 63 , 66 , 67 , 68 , 61 , -1 , 61 , 68 , 20 , 21 , -1 , 67 , 68 , 20 , 12 , 65}; + + double barys[]={ -0.0165220465527 , -0.0190922868195 , 0.158882733414 , + 0.0287618656076 , 0.135874379934 , -0.14601588119 , + -0.147128055553 , 0.0465995097041 , -0.049391174453 , + -0.00142506732317 , -0.0996953090351 , -0.115159183132 }; + MEDCouplingUMesh *meshN=MEDCouplingUMesh::New(); + meshN->setName("ForBary"); + meshN->setMeshDimension(3); + meshN->allocateCells(4); + meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,113,connN); + meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,99,connN+113); + meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,43,connN+212); + meshN->insertNextCell(INTERP_KERNEL::NORM_POLYHED,92,connN+255); + meshN->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(69,3); + std::copy(coords,coords+207,myCoords->getPointer()); + meshN->setCoords(myCoords); + myCoords->decrRef(); + meshN->checkCoherency(); + std::vector res1; + meshN->arePolyhedronsNotCorrectlyOriented(res1); + meshN->orientCorrectlyPolyhedrons(); + res1.clear(); + meshN->arePolyhedronsNotCorrectlyOriented(res1); + CPPUNIT_ASSERT(res1.empty()); + // + DataArrayDouble *da=meshN->getBarycenterAndOwner(); + CPPUNIT_ASSERT_EQUAL(4,da->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(3,da->getNumberOfComponents()); + const double *daPtr=da->getConstPointer(); + for(int i=0;i<12;i++) + CPPUNIT_ASSERT_DOUBLES_EQUAL(barys[i],daPtr[i],1e-8); + da->decrRef(); + // + meshN->decrRef(); } void MEDCouplingBasicsTest::testRenumberCellsForFields() diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index e57506296..e6399f28d 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -2117,6 +2117,93 @@ class MEDCouplingBasicsTest(unittest.TestCase): pass pass + def testAreaBary3D(self): + coords=[ 0.241310763507 , 0.0504777305619 , 0.0682283524903 , 0.252501053866 , -0.0625176732937 , 0.137272639894 , + 0.152262663601 , 0.241816569527 , 0.133812556197 , 0.18047750211 , -0.0789949051358 , 0.339098173401 , + 0.151741971857 , 0.238885278571 , 0.137715037333 , 0.242532155481 , -0.0928169086456 , 0.0678043417367 , + 0.240941965335 , -0.015461491464 , 0.0617186345825 , 0.24127650112 , 0.0499427876717 , 0.0679634099148 , + -0.145828917428 , 0.206291632565 , 0.0310071927543 , 0.0125651775307 , 0.266262085828 , 0.105228430543 , + -0.0994066533286 , 0.233224271238 , 0.0572213839567 , -0.0951345338317 , 0.234819509426 , 0.0592126284538 , + 0.136580574205 , -0.205486212579 , 0.0572866072014 , 0.0637270784978 , -0.168886355238 , 0.446614057077 , + 0.041337157151 , -0.213402568198 , 0.372407095999 , 0.0411601970268 , -0.202387875756 , 0.411334979491 , + -0.108355701857 , 0.193636239335 , 0.204886756738 , 0.00639779029829 , 0.155296981517 , 0.252585892979 , + 0.0262473111702 , -0.112919732543 , 0.424286639249 ,-0.224103052733 , -0.139430015438 , -0.0122352295701 , + -0.0312760589481 , -0.274272003594 , 0.0323959636568 , -0.166663422532 , -0.217754445175 , 0.00392109070364 , + -0.30586619777 , -0.0475168041091 , -0.0144585228182 , -0.280881480586 , 0.135571293538 , 0.00623923647986 , + -0.25548538234 , 0.156819217766 , 0.0645277879769 , -0.131567009284 , 0.184133752309 , 0.206021802753 , + -0.196204010965 , 0.151602971681 , 0.212974777736 , -0.183713879463 , 0.0802946639531 , 0.260115662599 , + -0.244241178767 , -0.0738873389604 , 0.144590565817 , -0.155804057829 , -0.164892720025 , 0.210613950558 , + -0.170950800428 , -0.215099334026 , 0.00610122860092 , -0.30552634869 , -0.0490020791904 , -0.0132786533145 , + 0.271831011884 , 0.15105657296 , 0.0230534827908 , 0.281919192283 , 0.0898544306288 , -0.0625201489143 , + 0.260240727276 , -0.0120688706637 , -0.0532316588626 , 0.244947737722 , 0.0197984684293 , 0.0309341209233 , + 0.23439631578 , 0.229825279875 , 0.0508520585381 , 0.160921316875 , 0.265078502128 , 0.121716560626 , + -0.315088694175 , 0.0747700471918 , -0.245836615071 , -0.327728781776 , 0.0857114674649 , -0.239431905957 , + -0.308385460634 , 0.145142997084 , -0.149886828433 , 0.0488236045164 , 0.309462801914 , 0.0849169148265 , + -0.0244964803395 , 0.33145611751 , -0.0476415818061 , 0.0060567994229 , 0.32418412014 , 0.0367779543812 , + -0.0950221448063 , 0.236675326003 , 0.0572594453983 , 0.248723023186 , 0.0886648784791 , -0.176629430538 , + 0.116796984 , 0.256596599567 , -0.292863523603 , 0.118024552914 , 0.229154257843 , -0.34233232501 , + 0.217507892549 , -0.0417822335742 , -0.176771782888 , -0.224429321304 , 0.0125595300114 , -0.362064725588 , + 0.0937301100955 , -0.0500824832657 , -0.299713548444 , -0.244162220397 , 0.0383853931293 , -0.389856984411 , + -0.0281989366102 , 0.097392811563 , -0.458244577284 , -0.385010847162 , 0.10122766194 , -0.140052859922 , + -0.377936358012 , 0.110875172128 , -0.176207095463 , 0.244483045556 , -0.0991073977045 , 0.0575134372934 , + 0.262605120167 , -0.100243191645 , -0.0495620806935 , 0.240306880972 , -0.136153701579 , -0.114745281696 , + 0.215763176129 , -0.0836766059189 , -0.183249640616 , 0.237870396603 , -0.132449578286 , -0.121598854639 , + -0.0637683083097 , -0.27921020214 , -0.149112321992 , -0.0856211014977 , -0.2973233473 , -0.0446878139589 , + 0.104675342288 , -0.0625908305324 , -0.290346256534 , 0.0248264249186 , -0.247797708548 , -0.165830884019 , + 0.0719302438309 , -0.178468260473 , -0.211432157345 , 0.142871843159 , -0.208769948542 , 0.0454101128246 , + 0.167803379307 , -0.207851396623 , -0.088802726124 , 0.12868717152 , -0.230920439715 , 0.00760508389036 , + -0.0372812069535 , -0.286740286332 , 0.00963701291166 ] + + connN = [ #polyhedron 0 + 0 , 1 , 3 , 4 , 2 , -1 , 1 , 5 , 6 , 7 , 0 , -1 , 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 1 , 5 , 12 , 14 , 15 , 13 , 3 , -1 , 16 , 9 , 2 , 4 , 17 , -1 + , 4 , 3 , 13 , 18 , 17 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 , 6 , 7 , 8 , 23 , 22 , 19 , -1 , 23 , 24 , 10 , 8 , -1 , 25 , 11 , 9 , 16 , -1 + , 24 , 26 , 25 , 11 , 10 , -1 , 12 , 14 , 20 , -1 , 27 , 28 , 29 , 15 , 13 , 18 , -1 , 14 , 15 , 29 , 30 , 21 , 20 , -1 , 26 , 27 , 18 , 17 , 16 , 25 , -1 + , 22 , 19 , 21 , 30 , 31 , -1 , 22 , 31 , 28 , 27 , 26 , 24 , 23 , -1 , 31 , 30 , 29 , 28, + # polyhedron 1 + 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 32 , 0 , 7 , 35 , 34 , 33 , -1 , 32 , 0 , 2 , 37 , 36 , -1 , 35 , 7 , 8 , 40 , 39 , 38 , -1 + , 2 , 37 , 41 , 9 , -1 , 40 , 8 , 10 , 44 , 43 , 42 , -1 , 41 , 9 , 11 , 44 , 43 , -1 , 44 , 11 , 10 , -1 , 32 , 33 , 45 , 47 , 46 , 36 , -1 + , 33 , 34 , 48 , 45 , -1 , 35 , 34 , 48 , 50 , 49 , 38 , -1 , 41 , 43 , 42 , 46 , 36 , 37 , -1 , 38 , 39 , 51 , 49 , -1 + , 39 , 40 , 42 , 46 , 47 , 52 , 51 , -1 , 45 , 47 , 52 , 50 , 48 , -1 , 52 , 51 , 49 , 50, + # polyhedron 2 + 6 , 7 , 8 , 23 , 22 , 19 , -1 , 6 , 35 , 7 , -1 , 6 , 35 , 38 , 19 , -1 , 35 , 7 , 8 , 40 , 39 , 38 , -1 , 53 , 22 , 19 , 38 , 39 , 54 , -1 + , 23 , 53 , 54 , 40 , 8 , -1 , 53 , 22 , 23 , -1 , 39 , 54 , 40, + # polyhedron 3 + 35 , 34 , 48 , 50 , 49 , 38 , -1 , 6 , 35 , 34 , 56 , 55 , 5 , -1 , 6 , 35 , 38 , 19 , -1 , 34 , 56 , 57 , 59 , 58 , 48 , -1 + , 60 , 61 , 21 , 19 , 38 , 49 , -1 , 62 , 50 , 48 , 58 , -1 , 60 , 63 , 64 , 62 , 50 , 49 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 + , 55 , 5 , 12 , 65 , -1 , 66 , 67 , 65 , 55 , 56 , 57 , -1 , 63 , 66 , 57 , 59 , 64 , -1 , 64 , 62 , 58 , 59 , -1 + , 60 , 63 , 66 , 67 , 68 , 61 , -1 , 61 , 68 , 20 , 21 , -1 , 67 , 68 , 20 , 12 , 65] + + barys = [ -0.0165220465527 , -0.0190922868195 , 0.158882733414 , + 0.0287618656076 , 0.135874379934 , -0.14601588119 , + -0.147128055553 , 0.0465995097041 , -0.049391174453 , + -0.00142506732317 , -0.0996953090351 , -0.115159183132 ] + meshN=MEDCouplingUMesh.New(); + meshN.setName("ForBary"); + meshN.setMeshDimension(3); + meshN.allocateCells(4); + meshN.insertNextCell(NORM_POLYHED,113,connN); + meshN.insertNextCell(NORM_POLYHED,99,connN[113:]); + meshN.insertNextCell(NORM_POLYHED,43,connN[212:]); + meshN.insertNextCell(NORM_POLYHED,92,connN[255:]); + meshN.finishInsertingCells(); + myCoords=DataArrayDouble.New(); + myCoords.setValues(coords,69,3); + meshN.setCoords(myCoords); + meshN.checkCoherency(); + res1=meshN.arePolyhedronsNotCorrectlyOriented(); + meshN.orientCorrectlyPolyhedrons(); + res1=meshN.arePolyhedronsNotCorrectlyOriented(); + self.assertTrue(len(res1)==0); + # + da=meshN.getBarycenterAndOwner(); + self.assertEqual(4,da.getNumberOfTuples()); + self.assertEqual(3,da.getNumberOfComponents()); + daPtr=da.getValues(); + for i in xrange(12): + self.assertTrue(abs(barys[i]-daPtr[i])<1e-8); + pass + pass + def testRenumberCellsForFields(self): m=MEDCouplingDataForTest.build2DTargetMesh_1(); f=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME); -- 2.39.2