diff --git a/src/SMESH/MG_ADAPT.cxx b/src/SMESH/MG_ADAPT.cxx index 9a44b93d7..76934c6a7 100644 --- a/src/SMESH/MG_ADAPT.cxx +++ b/src/SMESH/MG_ADAPT.cxx @@ -32,6 +32,7 @@ #include #include +#include "Utils_CorbaException.hxx" #include #include @@ -231,15 +232,11 @@ void MgAdapt::setMedFileIn(std::string fileName) } else { - std::cout << "\nThe file " + fileName + " does not exist.\n" << std::endl; -// SALOME::ExceptionStruct es; -// es.type = SALOME::BAD_PARAM; -// std::string text = "\nThe file " + fileName + " does not exist.\n" ; -// std::cout << text << std::endl; -// es.text = "The mesh file does not exist."; -// es.text = CORBA::string_dup(text.c_str()); -// throw SALOME::SALOME_Exception(es); - throw SALOME_Exception(("The file " + fileName + " does not exist." ).c_str() ); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "\nThe file " + fileName + " does not exist.\n" ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); } } @@ -387,8 +384,11 @@ void MgAdapt::setSizeMapFile(std::string mapFile) } else { - std::cout << "\nThe file " + mapFile + " does not exist.\n" << std::endl; - throw SALOME_Exception(("The file " + mapFile + " does not exist." ).c_str() ); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "\nThe file " + mapFile + " does not exist.\n" ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); } } std::string MgAdapt::getSizeMapFile() @@ -1152,6 +1152,39 @@ void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from) data->myVerboseLevel = from->myVerboseLevel; } +bool MgAdapt::checkTimeStepRank(std::string fileIn) +{ + INFOS("checkTimeStepRank"); + bool ret = false ; + MEDCoupling::MCAuto mfd = MEDCoupling::MEDFileData::New(fileIn); + MEDCoupling::MCAuto fts = dynamic_cast( mfd->getFields()->getFieldWithName(fieldName) ); +// std::cout << "--- timeStep " << timeStep << std::endl; +// std::cout << "--- rank " << rank << std::endl; + std::vector timevalue; + std::vector< std::pair > timesteprank = fts->getTimeSteps(timevalue); + std::size_t jaux(timesteprank.size()); + for(std::size_t j=0;j fts = dynamic_cast( mfd->getFields()->getFieldWithName(fieldName) ); MEDCoupling::MCAuto f = fts->getTimeStep(timeStep, rank); MEDCoupling::MCAuto tmFts = MEDCoupling::MEDFileFieldMultiTS::New(); @@ -1342,11 +1377,9 @@ med_idt MgAdapt::openMedFile(const std::string aFile) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - std::string text = "The med file " + aFile + " cannot be opened." ; -// es.text = "The mesh file does not exist."; + std::string text = "\nThe med file " + aFile + " cannot be opened.\n" ; es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); - return 0; } return medIdt; } diff --git a/src/SMESH/MG_ADAPT.hxx b/src/SMESH/MG_ADAPT.hxx index 887d6dc25..0684c2838 100644 --- a/src/SMESH/MG_ADAPT.hxx +++ b/src/SMESH/MG_ADAPT.hxx @@ -272,7 +272,6 @@ public: private : bool fromMedFile; - std::string medFileIn; std::string medFileOut; std::string meshName; @@ -329,6 +328,8 @@ private : void execCmd( const char* cmd, int& err); void cleanUp(); void appendMsgToLogFile(std::string& msg); + bool checkTimeStepRank(std::string fileIn) ; + }; } diff --git a/src/SMESHGUI/MG_ADAPTGUI.cxx b/src/SMESHGUI/MG_ADAPTGUI.cxx index 8a31faa72..8e7a593b1 100644 --- a/src/SMESHGUI/MG_ADAPTGUI.cxx +++ b/src/SMESHGUI/MG_ADAPTGUI.cxx @@ -566,7 +566,7 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent ) chosenTimeStep = new QRadioButton(tr("MG_ADAPT_CH_ST"), sizeMapField); timeStepLabel = new QLabel(tr("MG_ADAPT_TSTP"), sizeMapField); timeStep = new QSpinBox(sizeMapField); - //~timeStep->setMinimum(-1); + timeStep->setMinimum(-1); rankLabel = new QLabel(tr("MG_ADAPT_RANK"), sizeMapField); rankSpinBox = new QSpinBox(sizeMapField); rankSpinBox->setMinimum(-1); @@ -649,8 +649,8 @@ void SMESHGUI_MgAdaptArguments::onChosenTimeStep(bool disableOther, int vmax) chosenTimeStep->setChecked(true); visibleTimeStepRankLabel (true); - rankSpinBox->setValue(0); - timeStep->setValue(0); + rankSpinBox->setValue(-1); + timeStep->setValue(-1); if (vmax) timeStep->setMaximum(vmax); }