mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-13 17:18:35 +05:00
contrôles
This commit is contained in:
parent
a23e1b0daf
commit
37d8c5a41c
@ -133,7 +133,7 @@ MgAdapt::~MgAdapt()
|
|||||||
void MgAdapt::buildModel()
|
void MgAdapt::buildModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
const char* boolOptionNames[] = { "compute_ridges", // yes
|
const char* boolOptionNames[] = { "compute_ridges", // yes
|
||||||
"" // mark of end
|
"" // mark of end
|
||||||
};
|
};
|
||||||
// const char* intOptionNames[] = { "max_number_of_errors_printed", // 1
|
// const char* intOptionNames[] = { "max_number_of_errors_printed", // 1
|
||||||
@ -143,8 +143,8 @@ void MgAdapt::buildModel()
|
|||||||
const char* doubleOptionNames[] = { "max_memory", // 0
|
const char* doubleOptionNames[] = { "max_memory", // 0
|
||||||
"" // mark of end
|
"" // mark of end
|
||||||
};
|
};
|
||||||
const char* charOptionNames[] = { "components", // "yes"
|
const char* charOptionNames[] = { "components", // "yes"
|
||||||
"adaptation", // both
|
"adaptation", // both
|
||||||
"" // mark of end
|
"" // mark of end
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -171,10 +171,10 @@ void MgAdapt::buildModel()
|
|||||||
|
|
||||||
// default values to be used while MG-Adapt
|
// default values to be used while MG-Adapt
|
||||||
|
|
||||||
_defaultOptionValues["adaptation" ] = "both";
|
_defaultOptionValues["adaptation" ] = "both";
|
||||||
_defaultOptionValues["components" ] = "outside components";
|
_defaultOptionValues["components" ] = "outside components";
|
||||||
_defaultOptionValues["compute_ridges" ] = "yes";
|
_defaultOptionValues["compute_ridges"] = "yes";
|
||||||
_defaultOptionValues["max_memory" ] = ToComment(defaultMaximumMemory());
|
_defaultOptionValues["max_memory" ] = ToComment(defaultMaximumMemory());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -527,6 +527,8 @@ void MgAdapt::setOptionValue(const std::string& optionName,
|
|||||||
const std::string& optionValue)
|
const std::string& optionValue)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
|
// INFOS("setOptionValue");
|
||||||
|
// std::cout << "optionName: " << optionName << ", optionValue: " << optionValue << std::endl;
|
||||||
TOptionValues::iterator op_val = _option2value.find(optionName);
|
TOptionValues::iterator op_val = _option2value.find(optionName);
|
||||||
if (op_val == _option2value.end())
|
if (op_val == _option2value.end())
|
||||||
{
|
{
|
||||||
@ -586,6 +588,7 @@ throw (std::invalid_argument)
|
|||||||
std::string value( ptr, i );
|
std::string value( ptr, i );
|
||||||
if ( _defaultOptionValues[ optionName ] == value ) value.clear();
|
if ( _defaultOptionValues[ optionName ] == value ) value.clear();
|
||||||
|
|
||||||
|
// std::cout << "==> value: " << value << std::endl;
|
||||||
op_val->second = value;
|
op_val->second = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -594,9 +597,11 @@ throw (std::invalid_argument)
|
|||||||
//! Return option value. If isDefault provided, it can be a default value,
|
//! Return option value. If isDefault provided, it can be a default value,
|
||||||
// then *isDefault == true. If isDefault is not provided, the value will be
|
// then *isDefault == true. If isDefault is not provided, the value will be
|
||||||
// empty if it equals a default one.
|
// empty if it equals a default one.
|
||||||
std::string MgAdapt::getOptionValue(const std::string& optionName, bool* isDefault) const
|
std::string MgAdapt::getOptionValue(const std::string& optionName, bool* isDefault) const
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
|
// INFOS("getOptionValue");
|
||||||
|
// std::cout << "optionName: " << optionName << ", isDefault: " << isDefault << std::endl;
|
||||||
TOptionValues::const_iterator op_val = _option2value.find(optionName);
|
TOptionValues::const_iterator op_val = _option2value.find(optionName);
|
||||||
if (op_val == _option2value.end())
|
if (op_val == _option2value.end())
|
||||||
{
|
{
|
||||||
@ -615,6 +620,8 @@ throw (std::invalid_argument)
|
|||||||
op_val = _defaultOptionValues.find( optionName );
|
op_val = _defaultOptionValues.find( optionName );
|
||||||
if (op_val != _defaultOptionValues.end()) val = op_val->second;
|
if (op_val != _defaultOptionValues.end()) val = op_val->second;
|
||||||
}
|
}
|
||||||
|
// std::cout << "==> val: " << val << std::endl;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -858,9 +865,11 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
//~{
|
//~{
|
||||||
//~// constant value TODO
|
//~// constant value TODO
|
||||||
//~}
|
//~}
|
||||||
/* sizemap file is not adapted in case of only surface adaptation see MeshGems docs */
|
|
||||||
std::string adapOp = "adaptation";
|
std::string adapOp = "adaptation";
|
||||||
std::string adpOpVal = getOptionValue(adapOp);
|
std::string adpOpVal = getOptionValue(adapOp);
|
||||||
|
// Check coherence between mesh dimension and option
|
||||||
|
// checkDimensionOption(adpOpVal);
|
||||||
|
/* sizemap file is not adapted in case of only surface adaptation see MeshGems docs */
|
||||||
std::string surfaceAdapt = "surface";
|
std::string surfaceAdapt = "surface";
|
||||||
if(surfaceAdapt != adpOpVal )
|
if(surfaceAdapt != adpOpVal )
|
||||||
{
|
{
|
||||||
@ -869,10 +878,6 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
solFormatOutput.push_back(solFileOut);
|
solFormatOutput.push_back(solFileOut);
|
||||||
tmpFilesToBeDeleted.push_back(solFileOut);
|
tmpFilesToBeDeleted.push_back(solFileOut);
|
||||||
}
|
}
|
||||||
if (verbosityLevel != defaultVerboseLevel())
|
|
||||||
{
|
|
||||||
cmd+= " --verbose "+ ToComment(verbosityLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string option, value;
|
std::string option, value;
|
||||||
bool isDefault;
|
bool isDefault;
|
||||||
@ -906,6 +911,12 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
cmd += option + " " + value;
|
cmd += option + " " + value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verbosity Level
|
||||||
|
if (verbosityLevel != defaultVerboseLevel())
|
||||||
|
{
|
||||||
|
cmd+= " --verbose "+ ToComment(verbosityLevel);
|
||||||
|
}
|
||||||
//~}
|
//~}
|
||||||
//~cmd+= " >"
|
//~cmd+= " >"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -1159,7 +1170,23 @@ std::vector<std::string> MgAdapt::getListFieldsNames(std::string fileIn)
|
|||||||
return listFieldsNames ;
|
return listFieldsNames ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MgAdapt::checkFieldName(std::string fileIn)
|
void MgAdapt::checkDimensionOption(std::string adpOpVal)
|
||||||
|
{
|
||||||
|
// Pas correct.
|
||||||
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(medFileIn);
|
||||||
|
int meshdim = mfd->getMeshes()->getMeshAtPos(0)->getMeshDimension() ;
|
||||||
|
|
||||||
|
if ( ( meshdim == 2 ) & ( adpOpVal != "surface" ) )
|
||||||
|
{
|
||||||
|
SALOME::ExceptionStruct es;
|
||||||
|
es.type = SALOME::BAD_PARAM;
|
||||||
|
std::string text = "Mesh dimension is 2; the option should be 'surface' instead of '" + adpOpVal + "'." ;
|
||||||
|
es.text = CORBA::string_dup(text.c_str());
|
||||||
|
throw SALOME::SALOME_Exception(es);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MgAdapt::checkFieldName(std::string fileIn)
|
||||||
{
|
{
|
||||||
bool ret = false ;
|
bool ret = false ;
|
||||||
std::vector<std::string> listFieldsNames = getListFieldsNames(fileIn);
|
std::vector<std::string> listFieldsNames = getListFieldsNames(fileIn);
|
||||||
@ -1183,10 +1210,9 @@ bool MgAdapt::checkFieldName(std::string fileIn)
|
|||||||
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 ret ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MgAdapt::checkTimeStepRank(std::string fileIn)
|
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);
|
||||||
@ -1215,7 +1241,6 @@ bool MgAdapt::checkTimeStepRank(std::string fileIn)
|
|||||||
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 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)
|
||||||
@ -1236,18 +1261,16 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
|
|
||||||
if (useBackgroundMap)
|
if (useBackgroundMap)
|
||||||
{
|
{
|
||||||
bool ret ;
|
checkFieldName(sizeMapFile) ;
|
||||||
ret = checkFieldName(sizeMapFile) ;
|
checkTimeStepRank(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 ;
|
checkFieldName(medFileIn) ;
|
||||||
ret = checkFieldName(medFileIn) ;
|
checkTimeStepRank(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();
|
||||||
|
@ -329,8 +329,9 @@ private :
|
|||||||
void cleanUp();
|
void cleanUp();
|
||||||
void appendMsgToLogFile(std::string& msg);
|
void appendMsgToLogFile(std::string& msg);
|
||||||
std::vector<std::string> getListFieldsNames(std::string fileIn) ;
|
std::vector<std::string> getListFieldsNames(std::string fileIn) ;
|
||||||
bool checkFieldName(std::string fileIn) ;
|
void checkDimensionOption(std::string adpOpVal) ;
|
||||||
bool checkTimeStepRank(std::string fileIn) ;
|
void checkFieldName(std::string fileIn) ;
|
||||||
|
void checkTimeStepRank(std::string fileIn) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user