Salome HOME
Copyright update 2021
[tools/medcoupling.git] / src / MEDLoader / MEDFileMeshReadSelector.cxx
index 9aad4e952e8d40017ce813cc8236b58dfbd383ff..55b1bab34d17270718b3fd3bde3032832f6ca9d4 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2021  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
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #include "MEDFileMeshReadSelector.hxx"
 
-using namespace ParaMEDMEM;
+#include "InterpKernelException.hxx"
 
-MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0)
+#include <sstream>
+
+using namespace MEDCoupling;
+
+MEDFileMeshReadSelector::MEDFileMeshReadSelector():_nb_coords_load_sessions(1),_code(0xFFFFFFFF)
 {
 }
 
@@ -40,6 +44,13 @@ void MEDFileMeshReadSelector::setCode(unsigned int newCode)
   _code=newCode;
 }
 
+void MEDFileMeshReadSelector::setNumberOfCoordsLoadSessions(mcIdType newNbOfCoordsLoadSessions)
+{
+  if(newNbOfCoordsLoadSessions < 1)
+    throw INTERP_KERNEL::Exception("MEDFileMeshReadSelector::setNumberOfCoordsLoadSessions : input must be >= 1 !");
+  _nb_coords_load_sessions = newNbOfCoordsLoadSessions;
+}
+
 bool MEDFileMeshReadSelector::isCellFamilyFieldReading() const
 {
   return _code & 0x00000001;
@@ -60,29 +71,95 @@ bool MEDFileMeshReadSelector::isNodeNameFieldReading() const
   return _code & 0x00000008;
 }
 
+bool MEDFileMeshReadSelector::isCellNumFieldReading() const
+{
+  return _code & 0x00000010;
+}
+
+bool MEDFileMeshReadSelector::isNodeNumFieldReading() const
+{
+  return _code & 0x00000020;
+}
+
+bool MEDFileMeshReadSelector::isGlobalNodeNumFieldReading() const
+{
+  return _code & 0x00000040;
+}
+
 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::setGlobalNodeNumFieldReading(bool b)
+{
+  unsigned int code(_code & 0xFFFFFFBF);
+  unsigned int b2=b?1:0;
+  b2<<=6;
+  code+=b2;
+  _code=code;
 }
 
 void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
 {
   str << "MEDFileMeshReadSelector (code=" << _code << ") : \n";
+  str << "Number of coords load part sessions : " << this->_nb_coords_load_sessions << std::endl;
   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::endl;
+  str << "Read global number field name on nodes : " << ReprStatus(isGlobalNodeNumFieldReading());
 }
 
 std::string MEDFileMeshReadSelector::ReprStatus(bool v)