Salome HOME
projects
/
modules
/
smesh.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4092d89
)
Forward medcoupling exception thrown in case of problem of conversion
author
Anthony Geay
<anthony.geay@edf.fr>
Wed, 17 Feb 2021 21:22:22 +0000
(22:22 +0100)
committer
Anthony Geay
<anthony.geay@edf.fr>
Wed, 17 Feb 2021 21:22:22 +0000
(22:22 +0100)
idl/MG_ADAPT.idl
patch
|
blob
|
history
src/SMESH/MG_ADAPT.cxx
patch
|
blob
|
history
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
patch
|
blob
|
history
src/SMESH_I/MG_ADAPT_i.cxx
patch
|
blob
|
history
src/SMESH_I/MG_ADAPT_i.hxx
patch
|
blob
|
history
diff --git
a/idl/MG_ADAPT.idl
b/idl/MG_ADAPT.idl
index 6a4c7c98328b0dad7d85e224ca79dfb487b8aed9..7608ab67ace39abad6458263884c3f0a78c79e6d 100644
(file)
--- a/
idl/MG_ADAPT.idl
+++ b/
idl/MG_ADAPT.idl
@@
-122,8
+122,7
@@
module SMESH{
void setSizeMapType(in string f);
boolean setAll();
string getCommandToRun() ;
void setSizeMapType(in string f);
boolean setAll();
string getCommandToRun() ;
- //long compute(out string errStr);
- long compute();
+ void compute() raises(SALOME::SALOME_Exception);
string getErrMsg();
string getFileName() ;
string getExeName();
string getErrMsg();
string getFileName() ;
string getExeName();
diff --git
a/src/SMESH/MG_ADAPT.cxx
b/src/SMESH/MG_ADAPT.cxx
index c3e95da76d5e71a0bb34b567a885b36bca4329fa..f0accd50d3023fe943cc881c82d36ead378ae13f 100644
(file)
--- a/
src/SMESH/MG_ADAPT.cxx
+++ b/
src/SMESH/MG_ADAPT.cxx
@@
-1244,9
+1244,7
@@
void MgAdapt::checkTimeStepRank(std::string fileIn)
{
bool ret = false ;
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(fileIn);
{
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;
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts( mfd->getFields()->getFieldWithName(fieldName) );
std::vector<double> timevalue;
std::vector< std::pair<int,int> > timesteprank = fts->getTimeSteps(timevalue);
std::size_t jaux(timesteprank.size());
std::vector<double> timevalue;
std::vector< std::pair<int,int> > timesteprank = fts->getTimeSteps(timevalue);
std::size_t jaux(timesteprank.size());
@@
-1299,7
+1297,7
@@
void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
{
checkFieldName(medFileIn) ;
checkTimeStepRank(medFileIn) ;
{
checkFieldName(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::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
tmFts->pushBackTimeStep(f);
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts->getTimeStep(timeStep, rank);
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
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::MEDFileFields* tmpFields = tmpMfd->getFields();
{
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> tmpMfd = MEDCoupling::MEDFileData::New(sizeMapFile);
MEDCoupling::MEDFileFields* tmpFields = tmpMfd->getFields();
- MEDCoupling::M
EDFileAnyTypeFieldMultiTS* fts = tmpFields->getFieldWithName(fieldName
);
- MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> fts1 =
dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *
>(fts);
+ MEDCoupling::M
CAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts( tmpFields->getFieldWithName(fieldName)
);
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> fts1 =
MEDCoupling::DynamicCastSafe<MEDCoupling::MEDFileAnyTypeFieldMultiTS,MEDCoupling::MEDFileFieldMultiTS
>(fts);
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts1->getTimeStep(timeStep, rank);
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
tmFts->pushBackTimeStep(f);
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts1->getTimeStep(timeStep, rank);
MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
tmFts->pushBackTimeStep(f);
diff --git
a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
index fc1496380c1b6462edd792630a65e42ce29ac4e4..d3bed87fdecc983aef5a4ada9b116ddb36f32db2 100644
(file)
--- a/
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
+++ b/
src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx
@@
-385,12
+385,12
@@
bool SMESHGUI_MG_ADAPTDRIVER::PushOnApply()
bool SMESHGUI_MG_ADAPTDRIVER::execute()
{
bool SMESHGUI_MG_ADAPTDRIVER::execute()
{
- int err;
- //~std::string errStr;
+ int err = 1;
char* errStr;
try
{
char* errStr;
try
{
- err = getModel()->compute();
+ getModel()->compute();
+ err = 0;
errStr = getModel()->getErrMsg();
std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ;
}
errStr = getModel()->getErrMsg();
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;
}
//=================================================================================
}
//=================================================================================
diff --git
a/src/SMESH_I/MG_ADAPT_i.cxx
b/src/SMESH_I/MG_ADAPT_i.cxx
index fbe27fd473246ce4eb130d3273bf7855a30d9be6..188a3523659271c089883d98bd624d1a446f84dd 100644
(file)
--- a/
src/SMESH_I/MG_ADAPT_i.cxx
+++ b/
src/SMESH_I/MG_ADAPT_i.cxx
@@
-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)
-//~{
- //~std::string err("");
- //~CORBA::Long ret = myMgAdapt->compute(err);
- //~errStr = err.c_str();
- //~return ret;
-//~}
-CORBA::Long MG_ADAPT_i::compute()
+void 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();
- ret = -1;
+ std::ostringstream oss; oss << "Exception thrown on MG_ADAPT_i::compute invocation with error message \"" << errStr
+ << "\" 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::DriverMED_ReadStatus theStatus;
smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus);
}
{
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
SMESH::DriverMED_ReadStatus 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;
}
hypothesis->setPublish(publish);
return -1;
}
hypothesis->setPublish(publish);
- return hypothesis->compute();
+ hypothesis->compute();
+ return 0;
}
bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
}
bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
diff --git
a/src/SMESH_I/MG_ADAPT_i.hxx
b/src/SMESH_I/MG_ADAPT_i.hxx
index b259531754582e992e8b64311c3c1c3bc28650cb..edc398d0792d39566f02264e02a212117905b41d 100644
(file)
--- a/
src/SMESH_I/MG_ADAPT_i.hxx
+++ b/
src/SMESH_I/MG_ADAPT_i.hxx
@@
-109,8
+109,7
@@
public:
bool setAll();
char* getCommandToRun() ;
bool setAll();
char* getCommandToRun() ;
- //~CORBA::Long compute(::CORBA::String_out errStr);
- CORBA::Long compute();
+ void compute();
char* getFileName();
char* getExeName();
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;
char* getFileName();
char* getExeName();
void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;