Salome HOME
Introduced check functions in MEDFileUMesh:
[tools/medcoupling.git] / src / MEDLoader / MEDFileMeshReadSelector.cxx
index 9aad4e952e8d40017ce813cc8236b58dfbd383ff..878ecdb11e3d7640a89804e53f81635c3326be72 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,9 @@
 
 #include "MEDFileMeshReadSelector.hxx"
 
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
 
-MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0)
+MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0xFFFFFFFF)
 {
 }
 
@@ -60,20 +60,68 @@ bool MEDFileMeshReadSelector::isNodeNameFieldReading() const
   return _code & 0x00000008;
 }
 
+bool MEDFileMeshReadSelector::isCellNumFieldReading() const
+{
+  return _code & 0x00000010;
+}
+
+bool MEDFileMeshReadSelector::isNodeNumFieldReading() const
+{
+  return _code & 0x00000020;
+}
+
 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::setCellNumFieldReading(bool b)
+{
+  unsigned int code(_code & 0xFFFFFFEF);
+  unsigned int b2=b?1:0;
+  b2<<=4;
+  code+=b2;
+  _code=code;
+}
+
+void MEDFileMeshReadSelector::setNodeNumFieldReading(bool b)
+{
+  unsigned int code(_code & 0xFFFFFFDF);
+  unsigned int b2=b?1:0;
+  b2<<=5;
+  code+=b2;
+  _code=code;
 }
 
 void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
@@ -81,8 +129,10 @@ void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
   str << "MEDFileMeshReadSelector (code=" << _code << ") : \n";
   str << "Read family field on cells : " << ReprStatus(isCellFamilyFieldReading()) << std::endl;
   str << "Read family field on nodes : " << ReprStatus(isNodeFamilyFieldReading()) << std::endl;
-  str << "Read family name on cells : " << ReprStatus(isCellNameFieldReading()) << std::endl;
-  str << "Read family name on nodes : " << ReprStatus(isNodeNameFieldReading());
+  str << "Read name field on cells : " << ReprStatus(isCellNameFieldReading()) << std::endl;
+  str << "Read name field on nodes : " << ReprStatus(isNodeNameFieldReading()) << std::endl;
+  str << "Read number field on cells : " << ReprStatus(isCellNumFieldReading()) << std::endl;
+  str << "Read number field name on nodes : " << ReprStatus(isNodeNumFieldReading());
 }
 
 std::string MEDFileMeshReadSelector::ReprStatus(bool v)