1 // Copyright (C) 2007-2016 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 MEDCoupling::RefCountObject
49 MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName);
50 MEDLOADER_EXPORT MEDCoupling::MEDFileData * loadInMEDFileDS();
51 MEDLOADER_EXPORT ~SauvReader();
54 std::size_t getHeapMemorySizeWithoutChildren() const;
55 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
61 int readPileNumber(int& nbNamedObjects, int& nbObjects);
62 void read_PILE_SOUS_MAILLAGE(const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
63 void read_PILE_NODES_FIELD (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
64 void read_PILE_TABLES (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
65 void read_PILE_LREEL (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
66 void read_PILE_LOGIQUES (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
67 void read_PILE_FLOATS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
68 void read_PILE_INTEGERS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
69 void read_PILE_STRINGS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
70 void read_PILE_LMOTS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
71 void read_PILE_NOEUDS (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
72 void read_PILE_COORDONNEES (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
73 void read_PILE_MODL (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
74 void read_PILE_FIELD (const int nbObjects, std::vector<std::string>& objectNames, std::vector<int>& nameIndices);
76 void setFieldSupport(const std::vector<SauvUtilities::Group*>& supports,
77 SauvUtilities::DoubleField* field);
78 void setFieldNames(const std::vector<SauvUtilities::DoubleField*>& fields,
79 const std::vector<std::string>& objectNames,
80 const std::vector<int>& nameIndices);
82 bool isASCII() const { return _fileReader->isASCII(); }
83 bool isXRD() const { return !isASCII(); }
84 bool getNextLine (char* & line, bool raiseOEF = true ) { return _fileReader->getNextLine( line, raiseOEF ); }
85 void initNameReading(int nbValues, int width = 8) { _fileReader->initNameReading( nbValues, width ); }
86 void initIntReading(int nbValues) { _fileReader->initIntReading( nbValues ); }
87 void initDoubleReading(int nbValues) { _fileReader->initDoubleReading( nbValues ); }
88 bool more() const { return _fileReader->more(); }
89 void next() { _fileReader->next(); }
90 int index() const { return _fileReader->index(); }
91 int getInt() const { return _fileReader->getInt(); }
92 int getIntNext() { int i = getInt(); next(); return i; }
93 float getFloat() const { return _fileReader->getFloat(); }
94 double getDouble() const { return _fileReader->getDouble(); }
95 std::string getName() const { return _fileReader->getName(); }
96 std::string lineNb() const;
99 std::set<int> _encounteredPiles;
101 SauvUtilities::FileReader* _fileReader;
102 SauvUtilities::IntermediateMED* _iMed;