mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
Option d'adaptation enfocntion de la dimension des maillages
This commit is contained in:
parent
37d8c5a41c
commit
af3f09b843
@ -539,7 +539,6 @@ throw (std::invalid_argument)
|
|||||||
|
|
||||||
if (op_val->second != optionValue)
|
if (op_val->second != optionValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string lowerOptionValue = toLowerStr(optionValue);
|
std::string lowerOptionValue = toLowerStr(optionValue);
|
||||||
const char* ptr = lowerOptionValue.c_str();
|
const char* ptr = lowerOptionValue.c_str();
|
||||||
// strip white spaces
|
// strip white spaces
|
||||||
@ -586,11 +585,11 @@ throw (std::invalid_argument)
|
|||||||
throw std::invalid_argument(msg);
|
throw std::invalid_argument(msg);
|
||||||
}
|
}
|
||||||
std::string value( ptr, i );
|
std::string value( ptr, i );
|
||||||
|
// std::cout << "==> value: " << value << std::endl;
|
||||||
if ( _defaultOptionValues[ optionName ] == value ) value.clear();
|
if ( _defaultOptionValues[ optionName ] == value ) value.clear();
|
||||||
|
|
||||||
// std::cout << "==> value: " << value << std::endl;
|
// std::cout << "==> value: " << value << std::endl;
|
||||||
op_val->second = value;
|
op_val->second = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -744,6 +743,8 @@ std::string MgAdapt::getCommandToRun(MgAdapt* hyp)
|
|||||||
int MgAdapt::compute(std::string& errStr)
|
int MgAdapt::compute(std::string& errStr)
|
||||||
{
|
{
|
||||||
std::string cmd = getCommandToRun();
|
std::string cmd = getCommandToRun();
|
||||||
|
// std::cout << cmd << std::endl;
|
||||||
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
execCmd( cmd.c_str(), err ); // run
|
execCmd( cmd.c_str(), err ); // run
|
||||||
|
|
||||||
@ -865,13 +866,11 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
//~{
|
//~{
|
||||||
//~// constant value TODO
|
//~// constant value TODO
|
||||||
//~}
|
//~}
|
||||||
std::string adapOp = "adaptation";
|
// Check coherence between mesh dimension and option fo adaptation
|
||||||
std::string adpOpVal = getOptionValue(adapOp);
|
checkDimensionOptionAdaptation();
|
||||||
// Check coherence between mesh dimension and option
|
|
||||||
// checkDimensionOption(adpOpVal);
|
// sizemap file is written only if level is higher than 3
|
||||||
/* sizemap file is not adapted in case of only surface adaptation see MeshGems docs */
|
if ( verbosityLevel > 3)
|
||||||
std::string surfaceAdapt = "surface";
|
|
||||||
if(surfaceAdapt != adpOpVal )
|
|
||||||
{
|
{
|
||||||
std::string solFileOut = getFileName()+".sol";
|
std::string solFileOut = getFileName()+".sol";
|
||||||
cmd+= " --write_sizemap "+ solFileOut;
|
cmd+= " --write_sizemap "+ solFileOut;
|
||||||
@ -908,6 +907,7 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
cmd += " --";
|
cmd += " --";
|
||||||
else
|
else
|
||||||
cmd += " ";
|
cmd += " ";
|
||||||
|
// std::cout << "--- option: '" << option << ", value: '" << value <<"'"<< std::endl;
|
||||||
cmd += option + " " + value;
|
cmd += option + " " + value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -922,6 +922,8 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
cmd += " < NUL";
|
cmd += " < NUL";
|
||||||
#endif
|
#endif
|
||||||
|
// std::cout << "--- cmd :"<< std::endl;
|
||||||
|
// std::cout << cmd << std::endl;
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
@ -1170,21 +1172,47 @@ std::vector<std::string> MgAdapt::getListFieldsNames(std::string fileIn)
|
|||||||
return listFieldsNames ;
|
return listFieldsNames ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MgAdapt::checkDimensionOption(std::string adpOpVal)
|
void MgAdapt::checkDimensionOptionAdaptation()
|
||||||
{
|
{
|
||||||
// Pas correct.
|
// Quand le maillage est 3D, tout est possible
|
||||||
|
// Quand le maillage est 2D, il faut 'surface' sauf si carte de fonds 3D
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(medFileIn);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(medFileIn);
|
||||||
int meshdim = mfd->getMeshes()->getMeshAtPos(0)->getMeshDimension() ;
|
int meshdim = mfd->getMeshes()->getMeshAtPos(0)->getMeshDimension() ;
|
||||||
|
// std::cout << "meshdim = " << meshdim << std::endl;
|
||||||
|
|
||||||
if ( ( meshdim == 2 ) & ( adpOpVal != "surface" ) )
|
if ( meshdim == 2 )
|
||||||
|
{
|
||||||
|
std::string optionName = "adaptation";
|
||||||
|
std::string optionValue = getOptionValue(optionName);
|
||||||
|
// std::cout << "optionValue = '" << optionValue <<"'"<< std::endl;
|
||||||
|
bool a_tester = false ;
|
||||||
|
// carte locale ou constante : impératif d'avoir "surface"
|
||||||
|
if ( useLocalMap || useConstantValue) a_tester = true ;
|
||||||
|
// carte de fond : impératif d'avoir "surface" si le fonds est aussi 2D
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfdbg = MEDCoupling::MEDFileData::New(sizeMapFile);
|
||||||
|
int meshdimbg = mfdbg->getMeshes()->getMeshAtPos(0)->getMeshDimension() ;
|
||||||
|
// std::cout << "meshdimbg = " << meshdimbg << std::endl;
|
||||||
|
if ( meshdimbg == 2 ) a_tester = true ;
|
||||||
|
}
|
||||||
|
if ( a_tester )
|
||||||
|
{
|
||||||
|
if ( optionValue == "" ) setOptionValue (optionName, "surface");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( optionValue != "surface" )
|
||||||
{
|
{
|
||||||
SALOME::ExceptionStruct es;
|
SALOME::ExceptionStruct es;
|
||||||
es.type = SALOME::BAD_PARAM;
|
es.type = SALOME::BAD_PARAM;
|
||||||
std::string text = "Mesh dimension is 2; the option should be 'surface' instead of '" + adpOpVal + "'." ;
|
std::string text = "Mesh dimension is 2; the option should be 'surface' instead of '" + optionValue + "'." ;
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MgAdapt::checkFieldName(std::string fileIn)
|
void MgAdapt::checkFieldName(std::string fileIn)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,7 @@ 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) ;
|
||||||
void checkDimensionOption(std::string adpOpVal) ;
|
void checkDimensionOptionAdaptation() ;
|
||||||
void checkFieldName(std::string fileIn) ;
|
void checkFieldName(std::string fileIn) ;
|
||||||
void checkTimeStepRank(std::string fileIn) ;
|
void checkTimeStepRank(std::string fileIn) ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user