mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 01:10:35 +05:00
contrôle du nom du champ de la carte de taille
This commit is contained in:
parent
85b2ed944e
commit
58ca79c858
@ -1152,9 +1152,33 @@ void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
|||||||
data->myVerboseLevel = from->myVerboseLevel;
|
data->myVerboseLevel = from->myVerboseLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MgAdapt::checkFieldName(std::string fileIn)
|
||||||
|
{
|
||||||
|
bool ret = false ;
|
||||||
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(fileIn);
|
||||||
|
std::vector<std::string> fieldNames(mfd->getFields()->getFieldsNames());
|
||||||
|
std::size_t jaux(fieldNames.size());
|
||||||
|
for(std::size_t j=0;j<jaux;j++)
|
||||||
|
{
|
||||||
|
if ( fieldName == fieldNames[j] )
|
||||||
|
{ ret = true ; }
|
||||||
|
}
|
||||||
|
if ( ! ret )
|
||||||
|
{
|
||||||
|
std::cout << "Available field names:" << std::endl;
|
||||||
|
for(std::size_t j=0;j<jaux;j++)
|
||||||
|
{ std::cout << fieldNames[j] << std::endl;}
|
||||||
|
SALOME::ExceptionStruct es;
|
||||||
|
es.type = SALOME::BAD_PARAM;
|
||||||
|
std::string text = "Field " + fieldName + " is not found." ;
|
||||||
|
es.text = CORBA::string_dup(text.c_str());
|
||||||
|
throw SALOME::SALOME_Exception(es);
|
||||||
|
}
|
||||||
|
return ret ;
|
||||||
|
}
|
||||||
|
|
||||||
bool MgAdapt::checkTimeStepRank(std::string fileIn)
|
bool MgAdapt::checkTimeStepRank(std::string fileIn)
|
||||||
{
|
{
|
||||||
INFOS("checkTimeStepRank");
|
|
||||||
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 = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>( mfd->getFields()->getFieldWithName(fieldName) );
|
||||||
@ -1165,12 +1189,8 @@ bool MgAdapt::checkTimeStepRank(std::string fileIn)
|
|||||||
std::size_t jaux(timesteprank.size());
|
std::size_t jaux(timesteprank.size());
|
||||||
for(std::size_t j=0;j<jaux;j++)
|
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 ) )
|
if ( ( timeStep == timesteprank[j].first ) & ( rank == timesteprank[j].second ) )
|
||||||
{
|
{ ret = true ; }
|
||||||
ret = true ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( ! ret )
|
if ( ! ret )
|
||||||
{
|
{
|
||||||
@ -1204,14 +1224,18 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
|
|
||||||
if (useBackgroundMap)
|
if (useBackgroundMap)
|
||||||
{
|
{
|
||||||
bool ret = checkTimeStepRank(sizeMapFile) ;
|
bool ret ;
|
||||||
|
ret = checkFieldName(sizeMapFile) ;
|
||||||
|
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) ;
|
bool ret ;
|
||||||
|
ret = checkFieldName(medFileIn) ;
|
||||||
|
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();
|
||||||
|
@ -328,6 +328,7 @@ 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 checkFieldName(std::string fileIn) ;
|
||||||
bool checkTimeStepRank(std::string fileIn) ;
|
bool checkTimeStepRank(std::string fileIn) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user