mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-13 17:18:35 +05:00
Forward medcoupling exception thrown in case of problem of conversion
This commit is contained in:
parent
4092d89107
commit
ded5e634c9
@ -122,8 +122,7 @@ module SMESH{
|
|||||||
void setSizeMapType(in string f);
|
void setSizeMapType(in string f);
|
||||||
boolean setAll();
|
boolean setAll();
|
||||||
string getCommandToRun() ;
|
string getCommandToRun() ;
|
||||||
//long compute(out string errStr);
|
void compute() raises(SALOME::SALOME_Exception);
|
||||||
long compute();
|
|
||||||
string getErrMsg();
|
string getErrMsg();
|
||||||
string getFileName() ;
|
string getFileName() ;
|
||||||
string getExeName();
|
string getExeName();
|
||||||
|
@ -1244,9 +1244,7 @@ void MgAdapt::checkTimeStepRank(std::string fileIn)
|
|||||||
{
|
{
|
||||||
bool ret = false ;
|
bool ret = false ;
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(fileIn);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(fileIn);
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>( mfd->getFields()->getFieldWithName(fieldName) );
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts( mfd->getFields()->getFieldWithName(fieldName) );
|
||||||
// std::cout << "--- timeStep " << timeStep << std::endl;
|
|
||||||
// std::cout << "--- rank " << rank << std::endl;
|
|
||||||
std::vector<double> timevalue;
|
std::vector<double> timevalue;
|
||||||
std::vector< std::pair<int,int> > timesteprank = fts->getTimeSteps(timevalue);
|
std::vector< std::pair<int,int> > timesteprank = fts->getTimeSteps(timevalue);
|
||||||
std::size_t jaux(timesteprank.size());
|
std::size_t jaux(timesteprank.size());
|
||||||
@ -1299,7 +1297,7 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
{
|
{
|
||||||
checkFieldName(medFileIn) ;
|
checkFieldName(medFileIn) ;
|
||||||
checkTimeStepRank(medFileIn) ;
|
checkTimeStepRank(medFileIn) ;
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>( mfd->getFields()->getFieldWithName(fieldName) );
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts( 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();
|
||||||
tmFts->pushBackTimeStep(f);
|
tmFts->pushBackTimeStep(f);
|
||||||
@ -1438,8 +1436,8 @@ void MgAdapt::buildBackGroundMeshAndSolFiles(const std::vector<std::string>& fie
|
|||||||
{
|
{
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> tmpMfd = MEDCoupling::MEDFileData::New(sizeMapFile);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> tmpMfd = MEDCoupling::MEDFileData::New(sizeMapFile);
|
||||||
MEDCoupling::MEDFileFields* tmpFields = tmpMfd->getFields();
|
MEDCoupling::MEDFileFields* tmpFields = tmpMfd->getFields();
|
||||||
MEDCoupling::MEDFileAnyTypeFieldMultiTS* fts = tmpFields->getFieldWithName(fieldName);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts( tmpFields->getFieldWithName(fieldName) );
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> fts1 = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>(fts);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> fts1 = MEDCoupling::DynamicCastSafe<MEDCoupling::MEDFileAnyTypeFieldMultiTS,MEDCoupling::MEDFileFieldMultiTS>(fts);
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts1->getTimeStep(timeStep, rank);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts1->getTimeStep(timeStep, rank);
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
|
||||||
tmFts->pushBackTimeStep(f);
|
tmFts->pushBackTimeStep(f);
|
||||||
|
@ -385,12 +385,12 @@ bool SMESHGUI_MG_ADAPTDRIVER::PushOnApply()
|
|||||||
|
|
||||||
bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
||||||
{
|
{
|
||||||
int err;
|
int err = 1;
|
||||||
//~std::string errStr;
|
|
||||||
char* errStr;
|
char* errStr;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
err = getModel()->compute();
|
getModel()->compute();
|
||||||
|
err = 0;
|
||||||
errStr = getModel()->getErrMsg();
|
errStr = getModel()->getErrMsg();
|
||||||
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ;
|
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ;
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
|||||||
{
|
{
|
||||||
std::cerr<<e.what();
|
std::cerr<<e.what();
|
||||||
}
|
}
|
||||||
return err == 0? true: false;
|
return err == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -372,34 +372,25 @@ char* MG_ADAPT_i::getCommandToRun()
|
|||||||
return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str());
|
return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//~CORBA::Long MG_ADAPT_i::compute(::CORBA::String_out errStr)
|
void MG_ADAPT_i::compute()
|
||||||
//~{
|
|
||||||
//~std::string err("");
|
|
||||||
//~CORBA::Long ret = myMgAdapt->compute(err);
|
|
||||||
//~errStr = err.c_str();
|
|
||||||
//~return ret;
|
|
||||||
//~}
|
|
||||||
CORBA::Long MG_ADAPT_i::compute()
|
|
||||||
{
|
{
|
||||||
errStr = "";
|
errStr = "";
|
||||||
CORBA::Long ret;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = myMgAdapt->compute(errStr);
|
myMgAdapt->compute(errStr);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
std::cerr<<e.what();
|
std::ostringstream oss; oss << "Exception thrown on MG_ADAPT_i::compute invocation with error message \"" << errStr
|
||||||
ret = -1;
|
<< "\" with exception message \"" << e.what() << "\"";
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION(oss.str().c_str(),SALOME::INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
if(ret!=-1 && myMgAdapt->getPublish())
|
if(myMgAdapt->getPublish())
|
||||||
{
|
{
|
||||||
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
|
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
|
||||||
SMESH::DriverMED_ReadStatus theStatus;
|
SMESH::DriverMED_ReadStatus theStatus;
|
||||||
smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus);
|
smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus);
|
||||||
}
|
}
|
||||||
//~errStr = err.c_str();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
char* MG_ADAPT_i::getErrMsg()
|
char* MG_ADAPT_i::getErrMsg()
|
||||||
{
|
{
|
||||||
@ -510,7 +501,8 @@ CORBA::Long MG_ADAPT_OBJECT_i::Compute(bool publish)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
hypothesis->setPublish(publish);
|
hypothesis->setPublish(publish);
|
||||||
return hypothesis->compute();
|
hypothesis->compute();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
|
bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
|
||||||
|
@ -109,8 +109,7 @@ public:
|
|||||||
|
|
||||||
bool setAll();
|
bool setAll();
|
||||||
char* getCommandToRun() ;
|
char* getCommandToRun() ;
|
||||||
//~CORBA::Long compute(::CORBA::String_out errStr);
|
void compute();
|
||||||
CORBA::Long compute();
|
|
||||||
char* getFileName();
|
char* getFileName();
|
||||||
char* getExeName();
|
char* getExeName();
|
||||||
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
|
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user