mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-12 00:29:17 +05:00
Contrôle du choix des pas de temps
This commit is contained in:
parent
4c3cd911ff
commit
85b2ed944e
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <SALOME_NamingService.hxx>
|
#include <SALOME_NamingService.hxx>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
#include <Utils_SALOME_Exception.hxx>
|
||||||
|
#include "Utils_CorbaException.hxx"
|
||||||
|
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -231,15 +232,11 @@ void MgAdapt::setMedFileIn(std::string fileName)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "\nThe file " + fileName + " does not exist.\n" << std::endl;
|
SALOME::ExceptionStruct es;
|
||||||
// SALOME::ExceptionStruct es;
|
es.type = SALOME::BAD_PARAM;
|
||||||
// es.type = SALOME::BAD_PARAM;
|
std::string text = "\nThe file " + fileName + " does not exist.\n" ;
|
||||||
// std::string text = "\nThe file " + fileName + " does not exist.\n" ;
|
es.text = CORBA::string_dup(text.c_str());
|
||||||
// std::cout << text << std::endl;
|
throw SALOME::SALOME_Exception(es);
|
||||||
// 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() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,8 +384,11 @@ void MgAdapt::setSizeMapFile(std::string mapFile)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "\nThe file " + mapFile + " does not exist.\n" << std::endl;
|
SALOME::ExceptionStruct es;
|
||||||
throw SALOME_Exception(("The file " + mapFile + " does not exist." ).c_str() );
|
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()
|
std::string MgAdapt::getSizeMapFile()
|
||||||
@ -1152,6 +1152,39 @@ void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
|||||||
data->myVerboseLevel = from->myVerboseLevel;
|
data->myVerboseLevel = from->myVerboseLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MgAdapt::checkTimeStepRank(std::string fileIn)
|
||||||
|
{
|
||||||
|
INFOS("checkTimeStepRank");
|
||||||
|
bool ret = false ;
|
||||||
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(fileIn);
|
||||||
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>( mfd->getFields()->getFieldWithName(fieldName) );
|
||||||
|
// std::cout << "--- timeStep " << timeStep << std::endl;
|
||||||
|
// std::cout << "--- rank " << rank << std::endl;
|
||||||
|
std::vector<double> timevalue;
|
||||||
|
std::vector< std::pair<int,int> > timesteprank = fts->getTimeSteps(timevalue);
|
||||||
|
std::size_t jaux(timesteprank.size());
|
||||||
|
for(std::size_t j=0;j<jaux;j++)
|
||||||
|
{
|
||||||
|
// std::cout << "--- l[j]first " << timesteprank[j].first << std::endl;
|
||||||
|
// std::cout << "--- l[j]second " << timesteprank[j].second << std::endl;
|
||||||
|
if ( ( timeStep == timesteprank[j].first ) & ( rank == timesteprank[j].second ) )
|
||||||
|
{
|
||||||
|
ret = true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! ret )
|
||||||
|
{
|
||||||
|
std::cout << "Available (Time step, Rank) :" << std::endl;
|
||||||
|
for(std::size_t j=0;j<jaux;j++)
|
||||||
|
{ std::cout << "(Time step = " << timesteprank[j].first << ", Rank = " << timesteprank[j].second << ")" << std::endl;}
|
||||||
|
SALOME::ExceptionStruct es;
|
||||||
|
es.type = SALOME::BAD_PARAM;
|
||||||
|
std::string text = "(Time step = " + std::to_string(timeStep) + ", Rank = " + std::to_string(rank) + ") is not found." ;
|
||||||
|
es.text = CORBA::string_dup(text.c_str());
|
||||||
|
throw SALOME::SALOME_Exception(es);
|
||||||
|
}
|
||||||
|
return ret ;
|
||||||
|
}
|
||||||
|
|
||||||
void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& solFormatFieldFileName, std::string& meshFormatsizeMapFile)
|
void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& solFormatFieldFileName, std::string& meshFormatsizeMapFile)
|
||||||
{
|
{
|
||||||
@ -1171,12 +1204,14 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
|
|
||||||
if (useBackgroundMap)
|
if (useBackgroundMap)
|
||||||
{
|
{
|
||||||
|
bool ret = checkTimeStepRank(sizeMapFile) ;
|
||||||
meshFormatsizeMapFile = getFileName();
|
meshFormatsizeMapFile = getFileName();
|
||||||
meshFormatsizeMapFile += ".mesh";
|
meshFormatsizeMapFile += ".mesh";
|
||||||
buildBackGroundMeshAndSolFiles(fieldFileNames, meshFormatsizeMapFile);
|
buildBackGroundMeshAndSolFiles(fieldFileNames, meshFormatsizeMapFile);
|
||||||
}
|
}
|
||||||
else if(useLocalMap)
|
else if(useLocalMap)
|
||||||
{
|
{
|
||||||
|
bool ret = checkTimeStepRank(medFileIn) ;
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>( mfd->getFields()->getFieldWithName(fieldName) );
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>( mfd->getFields()->getFieldWithName(fieldName) );
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts->getTimeStep(timeStep, rank);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts->getTimeStep(timeStep, rank);
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
|
||||||
@ -1342,11 +1377,9 @@ med_idt MgAdapt::openMedFile(const std::string aFile)
|
|||||||
{
|
{
|
||||||
SALOME::ExceptionStruct es;
|
SALOME::ExceptionStruct es;
|
||||||
es.type = SALOME::BAD_PARAM;
|
es.type = SALOME::BAD_PARAM;
|
||||||
std::string text = "The med file " + aFile + " cannot be opened." ;
|
std::string text = "\nThe med file " + aFile + " cannot be opened.\n" ;
|
||||||
// es.text = "The mesh file does not exist.";
|
|
||||||
es.text = CORBA::string_dup(text.c_str());
|
es.text = CORBA::string_dup(text.c_str());
|
||||||
throw SALOME::SALOME_Exception(es);
|
throw SALOME::SALOME_Exception(es);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return medIdt;
|
return medIdt;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,6 @@ public:
|
|||||||
|
|
||||||
private :
|
private :
|
||||||
bool fromMedFile;
|
bool fromMedFile;
|
||||||
|
|
||||||
std::string medFileIn;
|
std::string medFileIn;
|
||||||
std::string medFileOut;
|
std::string medFileOut;
|
||||||
std::string meshName;
|
std::string meshName;
|
||||||
@ -329,6 +328,8 @@ private :
|
|||||||
void execCmd( const char* cmd, int& err);
|
void execCmd( const char* cmd, int& err);
|
||||||
void cleanUp();
|
void cleanUp();
|
||||||
void appendMsgToLogFile(std::string& msg);
|
void appendMsgToLogFile(std::string& msg);
|
||||||
|
bool checkTimeStepRank(std::string fileIn) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent )
|
|||||||
chosenTimeStep = new QRadioButton(tr("MG_ADAPT_CH_ST"), sizeMapField);
|
chosenTimeStep = new QRadioButton(tr("MG_ADAPT_CH_ST"), sizeMapField);
|
||||||
timeStepLabel = new QLabel(tr("MG_ADAPT_TSTP"), sizeMapField);
|
timeStepLabel = new QLabel(tr("MG_ADAPT_TSTP"), sizeMapField);
|
||||||
timeStep = new QSpinBox(sizeMapField);
|
timeStep = new QSpinBox(sizeMapField);
|
||||||
//~timeStep->setMinimum(-1);
|
timeStep->setMinimum(-1);
|
||||||
rankLabel = new QLabel(tr("MG_ADAPT_RANK"), sizeMapField);
|
rankLabel = new QLabel(tr("MG_ADAPT_RANK"), sizeMapField);
|
||||||
rankSpinBox = new QSpinBox(sizeMapField);
|
rankSpinBox = new QSpinBox(sizeMapField);
|
||||||
rankSpinBox->setMinimum(-1);
|
rankSpinBox->setMinimum(-1);
|
||||||
@ -649,8 +649,8 @@ void SMESHGUI_MgAdaptArguments::onChosenTimeStep(bool disableOther, int vmax)
|
|||||||
chosenTimeStep->setChecked(true);
|
chosenTimeStep->setChecked(true);
|
||||||
|
|
||||||
visibleTimeStepRankLabel (true);
|
visibleTimeStepRankLabel (true);
|
||||||
rankSpinBox->setValue(0);
|
rankSpinBox->setValue(-1);
|
||||||
timeStep->setValue(0);
|
timeStep->setValue(-1);
|
||||||
if (vmax) timeStep->setMaximum(vmax);
|
if (vmax) timeStep->setMaximum(vmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user