From: ageay Date: Mon, 1 Jul 2013 08:39:58 +0000 (+0000) Subject: MED file mesh loading on demand. X-Git-Tag: B4CMakeModifs~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=99f9dbfc42ab94bca4f2f8546cde619be061f99b;p=modules%2Fmed.git MED file mesh loading on demand. --- diff --git a/src/MEDLoader/MEDFileMeshReadSelector.cxx b/src/MEDLoader/MEDFileMeshReadSelector.cxx index 9aad4e952..945d02b16 100644 --- a/src/MEDLoader/MEDFileMeshReadSelector.cxx +++ b/src/MEDLoader/MEDFileMeshReadSelector.cxx @@ -22,7 +22,7 @@ using namespace ParaMEDMEM; -MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0) +MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0xFFFFFFFF) { } @@ -62,18 +62,38 @@ bool MEDFileMeshReadSelector::isNodeNameFieldReading() const void MEDFileMeshReadSelector::setCellFamilyFieldReading(bool b) { + unsigned int code(_code & 0xFFFFFFFE); + unsigned int b2=b?1:0; + //b2<<=0; + code+=b2; + _code=code; } void MEDFileMeshReadSelector::setNodeFamilyFieldReading(bool b) { + unsigned int code(_code & 0xFFFFFFFD); + unsigned int b2=b?1:0; + b2<<=1; + code+=b2; + _code=code; } void MEDFileMeshReadSelector::setCellNameFieldReading(bool b) { + unsigned int code(_code & 0xFFFFFFFB); + unsigned int b2=b?1:0; + b2<<=2; + code+=b2; + _code=code; } void MEDFileMeshReadSelector::setNodeNameFieldReading(bool b) { + unsigned int code(_code & 0xFFFFFFF7); + unsigned int b2=b?1:0; + b2<<=3; + code+=b2; + _code=code; } void MEDFileMeshReadSelector::reprAll(std::ostream& str) const diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index e7a06d17a..580dd906a 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -2964,6 +2964,63 @@ class MEDLoaderTest(unittest.TestCase): ffs.loadArrays() self.assertEqual(ffs.getHeapMemorySize()-heap_memory_ref,20*70*8*2+70*8*2+50*8*2) pass + + def testMEDFileMeshReadSelector1(self): + mrs=MEDFileMeshReadSelector() + self.assertTrue(mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + # + mrs=MEDFileMeshReadSelector(0) + self.assertTrue(not mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(1) + self.assertTrue(mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(2) + self.assertTrue(not mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(3) + self.assertTrue(mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(4) + self.assertTrue(not mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(5) + self.assertTrue(mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(6) + self.assertTrue(not mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(7) + self.assertTrue(mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and not mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(8) + self.assertTrue(not mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(9) + self.assertTrue(mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(10) + self.assertTrue(not mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(11) + self.assertTrue(mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and not mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(12) + self.assertTrue(not mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(13) + self.assertTrue(mrs.isCellFamilyFieldReading() and not mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(14) + self.assertTrue(not mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + mrs=MEDFileMeshReadSelector(15) + self.assertTrue(mrs.isCellFamilyFieldReading() and mrs.isNodeFamilyFieldReading() and mrs.isCellNameFieldReading() and mrs.isNodeNameFieldReading()) + # + mrs=MEDFileMeshReadSelector(15) + mrs.setCellFamilyFieldReading(False) + self.assertEqual(mrs.getCode(),14) + mrs.setCellFamilyFieldReading(True) + self.assertEqual(mrs.getCode(),15) + mrs.setNodeFamilyFieldReading(False) + self.assertEqual(mrs.getCode(),13) + mrs.setNodeFamilyFieldReading(True) + self.assertEqual(mrs.getCode(),15) + mrs.setCellNameFieldReading(False) + self.assertEqual(mrs.getCode(),11) + mrs.setCellNameFieldReading(True) + self.assertEqual(mrs.getCode(),15) + mrs.setNodeNameFieldReading(False) + self.assertEqual(mrs.getCode(),7) + mrs.setNodeNameFieldReading(True) + self.assertEqual(mrs.getCode(),15) + pass + pass unittest.main()