using namespace ParaMEDMEM;
-MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0)
+MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0xFFFFFFFF)
{
}
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
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()