1 // Copyright (C) 2007-2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #include "MEDFileMeshReadSelector.hxx"
23 #include "InterpKernelException.hxx"
27 using namespace MEDCoupling;
29 MEDFileMeshReadSelector::MEDFileMeshReadSelector():_nb_coords_load_sessions(1),_code(0xFFFFFFFF)
33 MEDFileMeshReadSelector::MEDFileMeshReadSelector(unsigned int code):_code(code)
37 unsigned int MEDFileMeshReadSelector::getCode() const
42 void MEDFileMeshReadSelector::setCode(unsigned int newCode)
47 void MEDFileMeshReadSelector::setNumberOfCoordsLoadSessions(mcIdType newNbOfCoordsLoadSessions)
49 if(newNbOfCoordsLoadSessions < 1)
50 throw INTERP_KERNEL::Exception("MEDFileMeshReadSelector::setNumberOfCoordsLoadSessions : input must be >= 1 !");
51 _nb_coords_load_sessions = newNbOfCoordsLoadSessions;
54 bool MEDFileMeshReadSelector::isCellFamilyFieldReading() const
56 return _code & 0x00000001;
59 bool MEDFileMeshReadSelector::isNodeFamilyFieldReading() const
61 return _code & 0x00000002;
64 bool MEDFileMeshReadSelector::isCellNameFieldReading() const
66 return _code & 0x00000004;
69 bool MEDFileMeshReadSelector::isNodeNameFieldReading() const
71 return _code & 0x00000008;
74 bool MEDFileMeshReadSelector::isCellNumFieldReading() const
76 return _code & 0x00000010;
79 bool MEDFileMeshReadSelector::isNodeNumFieldReading() const
81 return _code & 0x00000020;
84 bool MEDFileMeshReadSelector::isGlobalNodeNumFieldReading() const
86 return _code & 0x00000040;
89 void MEDFileMeshReadSelector::setCellFamilyFieldReading(bool b)
91 unsigned int code(_code & 0xFFFFFFFE);
92 unsigned int b2=b?1:0;
98 void MEDFileMeshReadSelector::setNodeFamilyFieldReading(bool b)
100 unsigned int code(_code & 0xFFFFFFFD);
101 unsigned int b2=b?1:0;
107 void MEDFileMeshReadSelector::setCellNameFieldReading(bool b)
109 unsigned int code(_code & 0xFFFFFFFB);
110 unsigned int b2=b?1:0;
116 void MEDFileMeshReadSelector::setNodeNameFieldReading(bool b)
118 unsigned int code(_code & 0xFFFFFFF7);
119 unsigned int b2=b?1:0;
125 void MEDFileMeshReadSelector::setCellNumFieldReading(bool b)
127 unsigned int code(_code & 0xFFFFFFEF);
128 unsigned int b2=b?1:0;
134 void MEDFileMeshReadSelector::setNodeNumFieldReading(bool b)
136 unsigned int code(_code & 0xFFFFFFDF);
137 unsigned int b2=b?1:0;
143 void MEDFileMeshReadSelector::setGlobalNodeNumFieldReading(bool b)
145 unsigned int code(_code & 0xFFFFFFBF);
146 unsigned int b2=b?1:0;
152 void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
154 str << "MEDFileMeshReadSelector (code=" << _code << ") : \n";
155 str << "Number of coords load part sessions : " << this->_nb_coords_load_sessions << std::endl;
156 str << "Read family field on cells : " << ReprStatus(isCellFamilyFieldReading()) << std::endl;
157 str << "Read family field on nodes : " << ReprStatus(isNodeFamilyFieldReading()) << std::endl;
158 str << "Read name field on cells : " << ReprStatus(isCellNameFieldReading()) << std::endl;
159 str << "Read name field on nodes : " << ReprStatus(isNodeNameFieldReading()) << std::endl;
160 str << "Read number field on cells : " << ReprStatus(isCellNumFieldReading()) << std::endl;
161 str << "Read number field name on nodes : " << ReprStatus(isNodeNumFieldReading()) << std::endl;
162 str << "Read global number field name on nodes : " << ReprStatus(isGlobalNodeNumFieldReading());
165 std::string MEDFileMeshReadSelector::ReprStatus(bool v)
168 return std::string("ON");
170 return std::string("OFF");