X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSauvReader.cxx;h=30a62fecbe913530f3a61ad35fe08233e0120b63;hb=844b1a4785909ad42206965838a6d0f826dfb5c1;hp=f530d1f2d1b7169e0981f3092796873e4024c96e;hpb=30e370a928f879a1c9be2bd685cda6cabec223cf;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index f530d1f2d..30a62fecb 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 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 @@ -24,7 +24,7 @@ #include "SauvReader.hxx" #include "SauvMedConvertor.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "MEDCouplingRefCountObject.hxx" @@ -32,7 +32,7 @@ #include #include -using namespace ParaMEDMEM; +using namespace MEDCoupling; using namespace SauvUtilities; using namespace std; @@ -48,7 +48,7 @@ SauvReader* SauvReader::New(const std::string& fileName) { if ( fileName.empty() ) THROW_IK_EXCEPTION("Invalid file name"); - ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr< SauvUtilities::FileReader> parser; + MEDCoupling::MCAuto< SauvUtilities::FileReader> parser; // try to open as XRD parser = new XDRReader( fileName.c_str() ); @@ -112,7 +112,7 @@ std::string SauvReader::lineNb() const */ //================================================================================ -ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS() +MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS() { SauvUtilities::IntermediateMED iMed; // intermadiate DS _iMed = &iMed; @@ -139,6 +139,8 @@ ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS() readRecord4(); else if (recordNumber == 7 ) readRecord7(); + else if (recordNumber == 8 ) + readRecord8(); else if (recordNumber == 5 ) break; // stop reading else @@ -146,7 +148,7 @@ ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS() THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!"); } - ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS(); + MEDCoupling::MEDFileData* medFileData = iMed.convertInMEDFileDS(); return medFileData; } @@ -212,6 +214,38 @@ void SauvReader::readRecord7() } } +//================================================================================ +/*! + * \brief Reads "ENREGISTREMENT DE TYPE 8" + */ +//================================================================================ + +void SauvReader::readRecord8() +{ + // This record is useless (a constant table) + // => we skip it + int info; + int nbIntToSkip; + if ( !isASCII() ) + { + getInt(); + info = getInt(); + int i = 0; + if (info == 3) { + // castem >= 18 + // 1 more line + nbIntToSkip = 145; + } + else + nbIntToSkip = 141; + + while (i <= nbIntToSkip) { + getInt(); + i ++; + } + } +} + //================================================================================ /*! * \brief Reads the pile number, nb of objects and nb named of objects @@ -220,7 +254,7 @@ void SauvReader::readRecord7() int SauvReader::readPileNumber(int& nbNamedObjects, int& nbObjects) { - // FORMAT(' PILE NUMERO',I4,'NBRE ObjectS NOMMES',I8,'NBRE ObjectS',I8) + // FORMAT(' PILE NUMERO',I4,'NBRE OBJETS NOMMES',I8,'NBRE OBJETS',I8) int pileNumber; if ( !isASCII() ) { @@ -233,7 +267,7 @@ int SauvReader::readPileNumber(int& nbNamedObjects, int& nbObjects) { char* line; getNextLine(line); - const char *s1 = " PILE NUMERO", *s2 = "NBRE ObjectS NOMMES", *s3 = "NBRE ObjectS"; + const char *s1 = " PILE NUMERO", *s2 = "NBRE OBJETS NOMMES", *s3 = "NBRE OBJETS"; if ( ! GIBI_EQUAL( line, s1 ) ) THROW_IK_EXCEPTION("Could not read the pile number " << lineNb() ); line = line + strlen(s1);