1 // Copyright (C) 2007-2015 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 // File : SauvReader.hxx
20 // Created : Tue Aug 16 13:04:25 2011
21 // Author : Edward AGAPOV (eap)
23 #ifndef __SAUVREADER_HXX__
24 #define __SAUVREADER_HXX__
26 #include "MEDLoaderDefines.hxx"
27 #include "InterpKernelException.hxx"
28 #include "SauvUtilities.hxx"
29 #include "MEDCouplingRefCountObject.hxx"
35 namespace SauvUtilities
38 struct IntermediateMED;
46 class SauvReader : public ParaMEDMEM::RefCountObject
49 MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName);
50 MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS();
51 MEDLOADER_EXPORT ~SauvReader();
54 std::size_t getHeapMemorySizeWithoutChildren() const;
55 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
60 int readPileNumber(int& nbNamedObjects, int& nbObjects);
61 void read_PILE_SOUS_MAILLAGE(const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
62 void read_PILE_NODES_FIELD (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
63 void read_PILE_TABLES (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
64 void read_PILE_LREEL (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
65 void read_PILE_LOGIQUES (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
66 void read_PILE_FLOATS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
67 void read_PILE_INTEGERS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
68 void read_PILE_STRINGS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
69 void read_PILE_LMOTS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
70 void read_PILE_NOEUDS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
71 void read_PILE_COORDONNEES (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
72 void read_PILE_MODL (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
73 void read_PILE_FIELD (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
75 void setFieldSupport(const std::vector<SauvUtilities::Group*>& supports,
76 SauvUtilities::DoubleField* field);
77 void setFieldNames(const std::vector<SauvUtilities::DoubleField*>& fields,
78 const std::vector<std::string>& objectNames,
79 const std::vector<int>& nameIndices);
81 bool isASCII() const { return _fileReader->isASCII(); }
82 bool isXRD() const { return !isASCII(); }
83 bool getNextLine (char* & line, bool raiseOEF = true ) { return _fileReader->getNextLine( line, raiseOEF ); }
84 void initNameReading(int nbValues, int width = 8) { _fileReader->initNameReading( nbValues, width ); }
85 void initIntReading(int nbValues) { _fileReader->initIntReading( nbValues ); }
86 void initDoubleReading(int nbValues) { _fileReader->initDoubleReading( nbValues ); }
87 bool more() const { return _fileReader->more(); }
88 void next() { _fileReader->next(); }
89 int index() const { return _fileReader->index(); }
90 int getInt() const { return _fileReader->getInt(); }
91 int getIntNext() { int i = getInt(); next(); return i; }
92 float getFloat() const { return _fileReader->getFloat(); }
93 double getDouble() const { return _fileReader->getDouble(); }
94 std::string getName() const { return _fileReader->getName(); }
95 std::string lineNb() const;
98 std::set<int> _encounteredPiles;
100 SauvUtilities::FileReader* _fileReader;
101 SauvUtilities::IntermediateMED* _iMed;