1 // Copyright (C) 2007-2023 CEA, EDF
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 // File : SauvUtilities.hxx
20 // Created : Mon Aug 22 18:27:34 2011
21 // Author : Edward AGAPOV (eap)
23 #ifndef __SAUVUTILITIES_HXX__
24 #define __SAUVUTILITIES_HXX__
26 #include "MEDLoaderDefines.hxx"
27 #include "MEDCouplingRefCountObject.hxx"
28 #include "NormalizedUnstructuredMesh.hxx"
33 namespace SauvUtilities
35 INTERP_KERNEL::NormalizedCellType MEDLOADER_EXPORT gibi2medGeom( size_t gibiType );
36 int med2gibiGeom( INTERP_KERNEL::NormalizedCellType medGeomType );
37 const int * getGibi2MedQuadraticInterlace( INTERP_KERNEL::NormalizedCellType type );
38 unsigned getDimension( INTERP_KERNEL::NormalizedCellType type );
42 PILE_SOUS_MAILLAGE=1 ,
58 //================================================================================
60 * \brief Converts anything to string
62 //================================================================================
64 template<class T> std::string toString(const T& anything)
66 std::ostringstream s; s << anything; return s.str();
69 // ==============================================================================
70 // IMP 0020434: mapping GIBI names to MED names
74 int gibi_pile; // PILE_SOUS_MAILLAGE or PILE_FIELD/PILE_NODES_FIELD, or PILE_STRINGS(for components)
76 std::string gibi_name; // used only for components
78 // med_pile = 27; // PILE_STRINGS
79 int med_id; // used only on reading
80 std::string med_name; // used only on writing
83 // ==============================================================================
85 * \brief Base class for ASCII and XDR file readers
87 class FileReader : public MEDCoupling::RefCountObject
90 FileReader(const char* fileName);
91 virtual ~FileReader() {}
92 virtual bool isASCII() const = 0;
94 virtual bool open() = 0;
95 virtual bool getNextLine (char* & line, bool raiseOEF = true ) = 0;
96 virtual void initNameReading(int nbValues, int width = 8) = 0;
97 virtual void initIntReading(int nbValues) = 0;
98 virtual void initDoubleReading(int nbValues) = 0;
99 virtual bool more() const = 0;
100 virtual void next() = 0;
101 virtual int index() const { return _iRead; }
102 virtual int getInt() const = 0;
103 virtual float getFloat() const = 0;
104 virtual double getDouble() const = 0;
105 virtual std::string getName() const = 0;
107 std::size_t getHeapMemorySizeWithoutChildren() const { return 0; }
108 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const { return std::vector<const BigMemoryObject *>(); }
110 std::string _fileName;
111 int _iRead, _nbToRead;