X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FMG_ADAPT.hxx;h=97a23375c30b68031d58c96d99a4dccb64a32e08;hp=ba128314bd9f15c6eddcaf1879379f499315fe60;hb=d9f4b53e489dd5857db264ede6acded7b076c9f1;hpb=f5e84513cda0eda53672cc9d3b1124323b4aa26d diff --git a/src/SMESH/MG_ADAPT.hxx b/src/SMESH/MG_ADAPT.hxx index ba128314b..97a23375c 100644 --- a/src/SMESH/MG_ADAPT.hxx +++ b/src/SMESH/MG_ADAPT.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2020-2022 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 @@ -16,32 +16,29 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : MG_ADAPT.hxx -// + #ifndef MG_ADAPT_HXX #define MG_ADAPT_HXX + #include -# include #include #include #include -#include -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "MEDFileMesh.hxx" +#include "SMESH_SMESH.hxx" -#include -// SMESH includes - -//~#include -std::string remove_extension(const std::string& filename); -namespace MG_ADAPT{ -class MgAdapt; +namespace MEDCoupling +{ + class MEDFileMesh; +} +namespace MG_ADAPT +{ typedef std::map< std::string, std::string > TOptionValues; typedef std::set< std::string > TOptionNames; +std::string remove_extension(const std::string& filename); + struct MgAdaptHypothesisData { std::string myFileInDir, myMeshFileIn, myInMeshName, myMeshFileBackground, myOutMeshName, @@ -57,57 +54,8 @@ struct MgAdaptHypothesisData int myVerboseLevel; }; -class outFileStream : public std::ofstream{ -public: - ~outFileStream(){close();} //to close file at dtor -}; -/*! - * \brief Class to generate string from any type - */ -class ToComment : public std::string -{ - std::ostringstream _s ; - -public : - - ToComment():std::string("") {} - - ToComment(const ToComment& c):std::string() { - _s << c.c_str() ; - this->std::string::operator=( _s.str() ); - } - - ToComment & operator=(const ToComment& c) { - _s << c.c_str() ; - this->std::string::operator=( _s.str() ); - return *this; - } - - template - ToComment( const T &anything ) { - _s << anything ; - this->std::string::operator=( _s.str() ); - } - - template - ToComment & operator<<( const T &anything ) { - _s << anything ; - this->std::string::operator=( _s.str() ); - return *this ; - } - - operator char*() const { - return (char*)c_str(); - } - - std::ostream& Stream() { - return _s; - } -}; - - -class MgAdapt +class SMESH_EXPORT MgAdapt { public: @@ -202,18 +150,18 @@ public: bool hasOptionDefined( const std::string& optionName ) const; void setOptionValue(const std::string& optionName, - const std::string& optionValue) throw (std::invalid_argument); + const std::string& optionValue); std::string getOptionValue(const std::string& optionName, - bool* isDefault=0) const throw (std::invalid_argument); + bool* isDefault=0) const; std::vector getCustomOptionValuesStrVec() const; std::vector getOptionValuesStrVec() const; TOptionValues getOptionValues() const; const TOptionValues& getCustomOptionValues() const ; - static double toDbl(const std::string&, bool* isOk = 0) throw (std::invalid_argument); - static bool toBool(const std::string&, bool* isOk = 0) throw (std::invalid_argument); - static int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument); + static double toDbl(const std::string&, bool* isOk = 0); + static bool toBool(const std::string&, bool* isOk = 0); + static int toInt(const std::string&, bool* isOk = 0 ); static std::string toLowerStr(const std::string& str); /* default values */ @@ -233,7 +181,6 @@ public: static bool defaultUseLastTimeStep(); static bool defaultUseChosenTimeStep(); static double defaultMaximumMemory(); - static bool isFileExist(const std::string& fName); enum Status { DRS_OK, @@ -246,27 +193,20 @@ public: DRS_NO_TIME_STEP // general failure (exception etc.) }; - struct group { - - std::string _name; - std::vector _famListId; + struct group + { + std::string _name; + std::vector _famListId; std::vector _famNames; - group(std::string name, std::vector famListId, std::vector famNames):_name(name) - { - std::vector::iterator it = famListId.begin(); - for (; it!=famListId.end(); ++it) - _famListId.push_back(*it); - - std::vector::iterator itt = famNames.begin(); - for (; itt!=famNames.end(); ++itt) - _famNames.push_back(*itt); - } + group(std::string name, std::vector famListId, std::vector famNames) + :_name(name), _famListId( famListId ), _famNames( famNames ) {} }; - struct family { + struct family + { std::string _famName; - mcIdType _famId; - family(std::string famName, MEDCoupling::mcIdType famId):_famName(famName), _famId(famId) {} + int _famId; + family(std::string famName, int famId):_famName(famName), _famId(famId) {} }; @@ -303,8 +243,8 @@ private : TOptionValues _defaultOptionValues; // default values TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option - std::vector _myErrorMessages; - Status _myStatus; + std::vector _errorMessages; + Status _status; std::string meshFormatOutputMesh; std::vector< std::string> solFormatOutput; std::vector groupVec; @@ -320,11 +260,9 @@ private : void storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh); void restoreGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh) const; void convertMeshFile(std::string& meshFormatIn, std::vector< std::string>& solFieldFileNames) const ; - void buildConstantSizeMapSolFile(const std::string& solFormatFieldFileName, const int dim, const int version, const mcIdType nbNodes) const; + void buildConstantSizeMapSolFile(const std::string& solFormatFieldFileName, const int dim, const int version, const size_t nbNodes) const; void buildBackGroundMeshAndSolFiles(const std::vector& fieldFileNames, const std::string& meshFormatsizeMapFile) const; - void getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit); Status addMessage(const std::string& msg, const bool isFatal = false); - med_idt openMedFile(const std::string aFile) ; void execCmd( const char* cmd, int& err); void cleanUp(); void appendMsgToLogFile(std::string& msg); @@ -335,6 +273,6 @@ private : }; -} +} // namespace MG_ADAPT #endif // MG_ADAPT_HXX