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();
{
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());
{
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::MEDFileData> tmpMfd = MEDCoupling::MEDFileData::New(sizeMapFile);
MEDCoupling::MEDFileFields* tmpFields = tmpMfd->getFields();
- MEDCoupling::MEDFileAnyTypeFieldMultiTS* fts = tmpFields->getFieldWithName(fieldName);
- MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> fts1 = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>(fts);
+ MEDCoupling::MCAuto<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);
bool SMESHGUI_MG_ADAPTDRIVER::execute()
{
- int err;
- //~std::string errStr;
+ int err = 1;
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) ;
}
{
std::cerr<<e.what();
}
- return err == 0? true: false;
+ return err == 0;
}
//=================================================================================
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 = "";
- CORBA::Long ret;
try
{
- ret = myMgAdapt->compute(errStr);
+ myMgAdapt->compute(errStr);
}
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);
}
- //~errStr = err.c_str();
- return ret;
}
char* MG_ADAPT_i::getErrMsg()
{
return -1;
}
hypothesis->setPublish(publish);
- return hypothesis->compute();
+ hypothesis->compute();
+ return 0;
}
bool MG_ADAPT_OBJECT_i::checkMeshFileIn()
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 ) ;