mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 09:40:35 +05:00
Remplacement des taquets de tabulations paor des espaces
This commit is contained in:
parent
55f658966b
commit
36e723d3d3
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
// file : MG_ADAPT.cxx
|
// file : MG_ADAPT.cxx
|
||||||
|
|
||||||
#include "MG_ADAPT.hxx"
|
#include "MG_ADAPT.hxx"
|
||||||
@ -43,9 +43,8 @@ static std::string removeFile(std::string fileName, int& notOk)
|
|||||||
{
|
{
|
||||||
std::string errStr;
|
std::string errStr;
|
||||||
notOk = std::remove(fileName.c_str());
|
notOk = std::remove(fileName.c_str());
|
||||||
if (notOk) errStr = ToComment(" \n error while removing file : ")
|
if (notOk) errStr = ToComment("\n error while removing file : ") << fileName;
|
||||||
<< fileName;
|
else errStr = ToComment("\n file : ") << fileName << " succesfully deleted! \n ";
|
||||||
else errStr= ToComment("\n file : ")<< fileName << " succesfully deleted! \n ";
|
|
||||||
|
|
||||||
return errStr;
|
return errStr;
|
||||||
}
|
}
|
||||||
@ -109,7 +108,6 @@ MgAdapt::MgAdapt(MgAdaptHypothesisData* myData)
|
|||||||
|
|
||||||
MgAdapt::MgAdapt( const MgAdapt& copy)
|
MgAdapt::MgAdapt( const MgAdapt& copy)
|
||||||
{
|
{
|
||||||
|
|
||||||
data = new MgAdaptHypothesisData();
|
data = new MgAdaptHypothesisData();
|
||||||
MgAdaptHypothesisData *copyData = copy.getData();
|
MgAdaptHypothesisData *copyData = copy.getData();
|
||||||
copyMgAdaptHypothesisData(copyData);
|
copyMgAdaptHypothesisData(copyData);
|
||||||
@ -121,17 +119,12 @@ MgAdapt::MgAdapt( const MgAdapt& copy)
|
|||||||
this->_doubleOptions = copy._doubleOptions;
|
this->_doubleOptions = copy._doubleOptions;
|
||||||
this->_charOptions = copy._charOptions;
|
this->_charOptions = copy._charOptions;
|
||||||
this->_boolOptions = copy._boolOptions;
|
this->_boolOptions = copy._boolOptions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------
|
||||||
MgAdapt::~MgAdapt()
|
MgAdapt::~MgAdapt()
|
||||||
{
|
{
|
||||||
|
|
||||||
delete data;
|
delete data;
|
||||||
|
|
||||||
}
|
}
|
||||||
void MgAdapt::buildModel()
|
void MgAdapt::buildModel()
|
||||||
{
|
{
|
||||||
@ -458,7 +451,6 @@ bool MgAdapt::setAll()
|
|||||||
std::string mapfile;
|
std::string mapfile;
|
||||||
if (useBackgroundMap)
|
if (useBackgroundMap)
|
||||||
{
|
{
|
||||||
|
|
||||||
checkDirPath(data->myFileSizeMapDir);
|
checkDirPath(data->myFileSizeMapDir);
|
||||||
mapfile = data->myFileSizeMapDir+data->myMeshFileBackground;
|
mapfile = data->myFileSizeMapDir+data->myMeshFileBackground;
|
||||||
setFieldName(data->myFieldName);
|
setFieldName(data->myFieldName);
|
||||||
@ -472,7 +464,6 @@ bool MgAdapt::setAll()
|
|||||||
mapfile ="";
|
mapfile ="";
|
||||||
setConstantValue(0.0);
|
setConstantValue(0.0);
|
||||||
setFieldName(data->myFieldName);
|
setFieldName(data->myFieldName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setSizeMapFile(mapfile);
|
setSizeMapFile(mapfile);
|
||||||
@ -533,19 +524,28 @@ throw (std::invalid_argument)
|
|||||||
// check value type
|
// check value type
|
||||||
bool typeOk = true;
|
bool typeOk = true;
|
||||||
std::string typeName;
|
std::string typeName;
|
||||||
if (i == 0) {
|
if (i == 0)
|
||||||
|
{
|
||||||
// empty string
|
// empty string
|
||||||
} else if (_charOptions.count(optionName)) {
|
}
|
||||||
|
else if (_charOptions.count(optionName))
|
||||||
|
{
|
||||||
// do not check strings
|
// do not check strings
|
||||||
} else if (_doubleOptions.count(optionName)) {
|
}
|
||||||
|
else if (_doubleOptions.count(optionName))
|
||||||
|
{
|
||||||
// check if value is double
|
// check if value is double
|
||||||
toDbl(ptr, &typeOk);
|
toDbl(ptr, &typeOk);
|
||||||
typeName = "real";
|
typeName = "real";
|
||||||
} else if (_boolOptions.count(optionName)) {
|
}
|
||||||
|
else if (_boolOptions.count(optionName))
|
||||||
|
{
|
||||||
// check if value is bool
|
// check if value is bool
|
||||||
toBool(ptr, &typeOk);
|
toBool(ptr, &typeOk);
|
||||||
typeName = "bool";
|
typeName = "bool";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// check if value is int
|
// check if value is int
|
||||||
toInt(ptr, &typeOk);
|
toInt(ptr, &typeOk);
|
||||||
typeName = "integer";
|
typeName = "integer";
|
||||||
@ -559,9 +559,7 @@ throw (std::invalid_argument)
|
|||||||
throw std::invalid_argument(msg);
|
throw std::invalid_argument(msg);
|
||||||
}
|
}
|
||||||
std::string value( ptr, i );
|
std::string value( ptr, i );
|
||||||
if ( _defaultOptionValues[ optionName ] == value )
|
if ( _defaultOptionValues[ optionName ] == value ) value.clear();
|
||||||
value.clear();
|
|
||||||
|
|
||||||
|
|
||||||
op_val->second = value;
|
op_val->second = value;
|
||||||
|
|
||||||
@ -590,8 +588,7 @@ throw (std::invalid_argument)
|
|||||||
if ( val.empty() && isDefault )
|
if ( val.empty() && isDefault )
|
||||||
{
|
{
|
||||||
op_val = _defaultOptionValues.find( optionName );
|
op_val = _defaultOptionValues.find( optionName );
|
||||||
if (op_val != _defaultOptionValues.end())
|
if (op_val != _defaultOptionValues.end()) val = op_val->second;
|
||||||
val = op_val->second;
|
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -654,7 +651,8 @@ throw (std::invalid_argument)
|
|||||||
|
|
||||||
if ( isOk )
|
if ( isOk )
|
||||||
*isOk = false;
|
*isOk = false;
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
std::string msg = "Not a Boolean value:'" + str + "'";
|
std::string msg = "Not a Boolean value:'" + str + "'";
|
||||||
throw std::invalid_argument(msg);
|
throw std::invalid_argument(msg);
|
||||||
}
|
}
|
||||||
@ -719,8 +717,7 @@ int MgAdapt::compute(std::string& errStr)
|
|||||||
|
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
errStr = ToComment("system(mg-adapt.exe ...) command failed with error: ")
|
errStr = ToComment("system(mg-adapt.exe ...) command failed with error: ") << strerror( errno );
|
||||||
<< strerror( errno );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -735,7 +732,7 @@ void MgAdapt::execCmd( const char* cmd, int& err)
|
|||||||
err = 1;
|
err = 1;
|
||||||
std::array <char, 128> buffer;
|
std::array <char, 128> buffer;
|
||||||
std::streambuf* buf;
|
std::streambuf* buf;
|
||||||
outFileStream fileStream;
|
outFileStream fileStream;
|
||||||
if (printLogInFile)
|
if (printLogInFile)
|
||||||
{
|
{
|
||||||
fileStream.open(logFile);
|
fileStream.open(logFile);
|
||||||
@ -817,13 +814,10 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
tmpFilesToBeDeleted.push_back(solFileIn);
|
tmpFilesToBeDeleted.push_back(solFileIn);
|
||||||
if(useBackgroundMap && !isFileExist(sizeMapIn))
|
if(useBackgroundMap && !isFileExist(sizeMapIn))
|
||||||
{
|
{
|
||||||
|
|
||||||
errStr = ToComment(" failed to find .mesh size map file from converter ")<< strerror( errno );
|
errStr = ToComment(" failed to find .mesh size map file from converter ")<< strerror( errno );
|
||||||
return errStr;
|
return errStr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cmd+= " --in "+ meshIn;
|
cmd+= " --in "+ meshIn;
|
||||||
meshFormatOutputMesh = getFileName()+".mesh";
|
meshFormatOutputMesh = getFileName()+".mesh";
|
||||||
tmpFilesToBeDeleted.push_back(meshFormatOutputMesh);
|
tmpFilesToBeDeleted.push_back(meshFormatOutputMesh);
|
||||||
@ -852,7 +846,6 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
}
|
}
|
||||||
if (verbosityLevel != defaultVerboseLevel())
|
if (verbosityLevel != defaultVerboseLevel())
|
||||||
{
|
{
|
||||||
|
|
||||||
cmd+= " --verbose "+ ToComment(verbosityLevel);
|
cmd+= " --verbose "+ ToComment(verbosityLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,12 +890,10 @@ std::string MgAdapt::getCommandToRun()
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MgAdapt::isFileExist(const std::string& fName)
|
bool MgAdapt::isFileExist(const std::string& fName)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( fName.empty() )
|
if ( fName.empty() ) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
boost::system::error_code err;
|
boost::system::error_code err;
|
||||||
bool res = boost::filesystem::exists( fName, err );
|
bool res = boost::filesystem::exists( fName, err );
|
||||||
@ -926,14 +917,16 @@ double MgAdapt::defaultMaximumMemory()
|
|||||||
MEMORYSTATUSEX statex;
|
MEMORYSTATUSEX statex;
|
||||||
statex.dwLength = sizeof (statex);
|
statex.dwLength = sizeof (statex);
|
||||||
long err = GlobalMemoryStatusEx (&statex);
|
long err = GlobalMemoryStatusEx (&statex);
|
||||||
if (err != 0) {
|
if (err != 0)
|
||||||
|
{
|
||||||
double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
|
double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
|
||||||
return (double)( 0.7 * totMB );
|
return (double)( 0.7 * totMB );
|
||||||
}
|
}
|
||||||
#elif !defined(__APPLE__)
|
#elif !defined(__APPLE__)
|
||||||
struct sysinfo si;
|
struct sysinfo si;
|
||||||
long err = sysinfo( &si );
|
long err = sysinfo( &si );
|
||||||
if ( err == 0 ) {
|
if ( err == 0 )
|
||||||
|
{
|
||||||
long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
|
long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
|
||||||
return ( 0.7 * ramMB );
|
return ( 0.7 * ramMB );
|
||||||
}
|
}
|
||||||
@ -941,7 +934,6 @@ double MgAdapt::defaultMaximumMemory()
|
|||||||
return 1024;
|
return 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : defaultWorkingDirectory
|
//function : defaultWorkingDirectory
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -951,7 +943,8 @@ std::string MgAdapt::defaultWorkingDirectory()
|
|||||||
TCollection_AsciiString aTmpDir;
|
TCollection_AsciiString aTmpDir;
|
||||||
|
|
||||||
char *Tmp_dir = getenv("SALOME_TMP_DIR");
|
char *Tmp_dir = getenv("SALOME_TMP_DIR");
|
||||||
if(Tmp_dir != NULL) {
|
if(Tmp_dir != NULL)
|
||||||
|
{
|
||||||
aTmpDir = Tmp_dir;
|
aTmpDir = Tmp_dir;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1106,7 +1099,6 @@ std::string MgAdapt::getExeName()
|
|||||||
}
|
}
|
||||||
void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
||||||
{
|
{
|
||||||
|
|
||||||
data->myFileInDir = from->myFileInDir;
|
data->myFileInDir = from->myFileInDir;
|
||||||
data->myMeshFileIn = from->myMeshFileIn;
|
data->myMeshFileIn = from->myMeshFileIn;
|
||||||
data->myMeshFileBackground = from->myMeshFileBackground;
|
data->myMeshFileBackground = from->myMeshFileBackground;
|
||||||
@ -1133,13 +1125,11 @@ void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
|||||||
data->myKeepFiles = from->myKeepFiles;
|
data->myKeepFiles = from->myKeepFiles;
|
||||||
data->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
|
data->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
|
||||||
data->myVerboseLevel = from->myVerboseLevel;
|
data->myVerboseLevel = from->myVerboseLevel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& solFormatFieldFileName, std::string& meshFormatsizeMapFile)
|
void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& solFormatFieldFileName, std::string& meshFormatsizeMapFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::vector<std::string> fieldFileNames;
|
std::vector<std::string> fieldFileNames;
|
||||||
MEDCoupling::MeshFormatWriter writer;
|
MEDCoupling::MeshFormatWriter writer;
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(medFileIn);
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(medFileIn);
|
||||||
@ -1156,15 +1146,12 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
|
|
||||||
if (useBackgroundMap)
|
if (useBackgroundMap)
|
||||||
{
|
{
|
||||||
|
|
||||||
meshFormatsizeMapFile = getFileName();
|
meshFormatsizeMapFile = getFileName();
|
||||||
meshFormatsizeMapFile += ".mesh";
|
meshFormatsizeMapFile += ".mesh";
|
||||||
buildBackGroundMeshAndSolFiles(fieldFileNames, meshFormatsizeMapFile);
|
buildBackGroundMeshAndSolFiles(fieldFileNames, meshFormatsizeMapFile);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(useLocalMap)
|
else if(useLocalMap)
|
||||||
{
|
{
|
||||||
|
|
||||||
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();
|
||||||
@ -1174,7 +1161,6 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
|
|
||||||
writer.setFieldFileNames( fieldFileNames);
|
writer.setFieldFileNames( fieldFileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MEDCoupling::MCAuto<MEDCoupling::MEDCouplingMesh> mesh = fileMesh->getMeshAtLevel(1); // nodes mesh
|
MEDCoupling::MCAuto<MEDCoupling::MEDCouplingMesh> mesh = fileMesh->getMeshAtLevel(1); // nodes mesh
|
||||||
@ -1183,7 +1169,6 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
|||||||
int version = sizeof(double) < 8 ? 1 : 2;
|
int version = sizeof(double) < 8 ? 1 : 2;
|
||||||
mcIdType nbNodes = umesh->getNumberOfNodes();
|
mcIdType nbNodes = umesh->getNumberOfNodes();
|
||||||
buildConstantSizeMapSolFile(solFormatFieldFileName, dim, version, nbNodes);
|
buildConstantSizeMapSolFile(solFormatFieldFileName, dim, version, nbNodes);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mfd->setFields( fields );
|
mfd->setFields( fields );
|
||||||
@ -1208,7 +1193,6 @@ void MgAdapt::convertMeshFile(std::string& meshFormatIn, std::vector< std::strin
|
|||||||
mfd->write(medFileOut, 2);
|
mfd->write(medFileOut, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MgAdapt::storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh)
|
void MgAdapt::storeGroupsAndFams(MEDCoupling::MEDFileMesh* fileMesh)
|
||||||
{
|
{
|
||||||
storefams(fileMesh);
|
storefams(fileMesh);
|
||||||
@ -1316,7 +1300,6 @@ void MgAdapt::buildBackGroundMeshAndSolFiles(const std::vector<std::string>& fie
|
|||||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileFields> tmp_fields = MEDCoupling::MEDFileFields::New();
|
MEDCoupling::MCAuto<MEDCoupling::MEDFileFields> tmp_fields = MEDCoupling::MEDFileFields::New();
|
||||||
tmp_fields->pushField(tmFts);
|
tmp_fields->pushField(tmFts);
|
||||||
|
|
||||||
|
|
||||||
tmpMfd->setFields( tmp_fields );
|
tmpMfd->setFields( tmp_fields );
|
||||||
MEDCoupling::MeshFormatWriter tmpWriter;
|
MEDCoupling::MeshFormatWriter tmpWriter;
|
||||||
tmpWriter.setMeshFileName(meshFormatsizeMapFile);
|
tmpWriter.setMeshFileName(meshFormatsizeMapFile);
|
||||||
@ -1346,23 +1329,19 @@ MgAdapt::Status MgAdapt::addMessage(const std::string& msg,
|
|||||||
|
|
||||||
_myErrorMessages.push_back( msg );
|
_myErrorMessages.push_back( msg );
|
||||||
|
|
||||||
//~MESSAGE(msg);
|
//~MESSAGE(msg);
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
std::cout << msg << std::endl;
|
std::cout << msg << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return ( _myStatus = isFatal ? MgAdapt::DRS_FAIL : MgAdapt::DRS_WARN_SKIP_ELEM );
|
return ( _myStatus = isFatal ? MgAdapt::DRS_FAIL : MgAdapt::DRS_WARN_SKIP_ELEM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void MgAdapt::getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit)
|
void MgAdapt::getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit)
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
{
|
{
|
||||||
// Il faut voir si plusieurs maillages
|
// Il faut voir si plusieurs maillages
|
||||||
|
|
||||||
|
|
||||||
herr_t erreur = 0 ;
|
herr_t erreur = 0 ;
|
||||||
med_idt medIdt ;
|
med_idt medIdt ;
|
||||||
|
|
||||||
@ -1418,18 +1397,14 @@ void MgAdapt::getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit
|
|||||||
}
|
}
|
||||||
if ( erreur < 0 )
|
if ( erreur < 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
//~addMessage( ToComment(" error: error while reading field ") << nomcha << "step (numdt, numit) = " <<"("<< numdt<< ", " \
|
//~addMessage( ToComment(" error: error while reading field ") << nomcha << "step (numdt, numit) = " <<"("<< numdt<< ", " \
|
||||||
numit<< ")" <<" in file " << aFile , /*fatal=*/true );
|
numit<< ")" <<" in file " << aFile , /*fatal=*/true );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Fermeture du fichier
|
// Fermeture du fichier
|
||||||
if ( medIdt > 0 ) MEDfileClose(medIdt);
|
if ( medIdt > 0 ) MEDfileClose(medIdt);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MgAdapt::updateTimeStepRank()
|
void MgAdapt::updateTimeStepRank()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D
|
// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
@ -14,7 +14,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
// File : MG_ADAPT.hxx
|
// File : MG_ADAPT.hxx
|
||||||
//
|
//
|
||||||
@ -55,7 +55,6 @@ struct MgAdaptHypothesisData
|
|||||||
std::string myWorkingDir, myLogFile;
|
std::string myWorkingDir, myLogFile;
|
||||||
bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
|
bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
|
||||||
int myVerboseLevel;
|
int myVerboseLevel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class outFileStream : public std::ofstream{
|
class outFileStream : public std::ofstream{
|
||||||
@ -217,7 +216,6 @@ public:
|
|||||||
static int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument);
|
static int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument);
|
||||||
static std::string toLowerStr(const std::string& str);
|
static std::string toLowerStr(const std::string& str);
|
||||||
|
|
||||||
|
|
||||||
/* default values */
|
/* default values */
|
||||||
static std::string defaultWorkingDirectory();
|
static std::string defaultWorkingDirectory();
|
||||||
static std::string defaultLogFile();
|
static std::string defaultLogFile();
|
||||||
@ -237,9 +235,6 @@ public:
|
|||||||
static double defaultMaximumMemory();
|
static double defaultMaximumMemory();
|
||||||
static bool isFileExist(const std::string& fName);
|
static bool isFileExist(const std::string& fName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum Status {
|
enum Status {
|
||||||
DRS_OK,
|
DRS_OK,
|
||||||
DRS_EMPTY, // a file contains no mesh with the given name
|
DRS_EMPTY, // a file contains no mesh with the given name
|
||||||
|
@ -109,7 +109,6 @@ void SMESHGUI_MgAdaptDlg::buildDlg()
|
|||||||
setWindowTitle( tr( "ADAPT_PREF_MG_ADAPT" ) );
|
setWindowTitle( tr( "ADAPT_PREF_MG_ADAPT" ) );
|
||||||
setSizeGripEnabled( true );
|
setSizeGripEnabled( true );
|
||||||
|
|
||||||
|
|
||||||
myTabWidget = new QTabWidget( this );
|
myTabWidget = new QTabWidget( this );
|
||||||
|
|
||||||
// Arguments
|
// Arguments
|
||||||
@ -171,8 +170,8 @@ void SMESHGUI_MgAdaptDlg::buildDlg()
|
|||||||
l->addLayout( btnLayout );
|
l->addLayout( btnLayout );
|
||||||
|
|
||||||
|
|
||||||
connect( okBtn, SIGNAL( clicked() ), this, SLOT( clickOnOk() ) );
|
connect( okBtn, SIGNAL(clicked()), this, SLOT( clickOnOk() ) );
|
||||||
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( clickOnHelp() ) );
|
connect( helpBtn, SIGNAL(clicked()), this, SLOT( clickOnHelp() ) );
|
||||||
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
|
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
|
||||||
connect(buttonApply, SIGNAL(clicked()), this,SLOT(clickOnApply()));
|
connect(buttonApply, SIGNAL(clicked()), this,SLOT(clickOnApply()));
|
||||||
connect(buttonApplyAndClose, SIGNAL(clicked()), this,SLOT(clickOnOk()));
|
connect(buttonApplyAndClose, SIGNAL(clicked()), this,SLOT(clickOnOk()));
|
||||||
@ -198,7 +197,7 @@ SMESH::MG_ADAPT_ptr SMESHGUI_MgAdaptDlg::getModel() const
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
\brief Perform clean-up actions on the dialog box closing.
|
\brief Perform clean-up actions on the dialog box closing.
|
||||||
*/
|
*/
|
||||||
bool SMESHGUI_MgAdaptDlg::clickOnApply()
|
bool SMESHGUI_MgAdaptDlg::clickOnApply()
|
||||||
{
|
{
|
||||||
@ -239,7 +238,6 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
|
|||||||
{
|
{
|
||||||
*(myArgs->myFileOutDir) = QString(myData->myFileOutDir);
|
*(myArgs->myFileOutDir) = QString(myData->myFileOutDir);
|
||||||
myArgs->selectOutMedFileLineEdit->setText(QString(myData->myMeshFileOut));
|
myArgs->selectOutMedFileLineEdit->setText(QString(myData->myMeshFileOut));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -370,7 +368,6 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
aData->myWorkingDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
|
aData->myWorkingDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
|
||||||
aData->myPrintLogInFile = myAdvOpt->logInFileCheck->isChecked();
|
aData->myPrintLogInFile = myAdvOpt->logInFileCheck->isChecked();
|
||||||
aData->myVerboseLevel = myAdvOpt->verboseLevelSpin->value();
|
aData->myVerboseLevel = myAdvOpt->verboseLevelSpin->value();
|
||||||
@ -406,7 +403,8 @@ void SMESHGUI_MgAdaptDlg::clickOnHelp()
|
|||||||
}
|
}
|
||||||
bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
||||||
{
|
{
|
||||||
if ( !QFileInfo( myAdvOpt->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
|
if ( !QFileInfo( myAdvOpt->workingDirectoryLineEdit->text().trimmed() ).isWritable() )
|
||||||
|
{
|
||||||
SUIT_MessageBox::warning( this,
|
SUIT_MessageBox::warning( this,
|
||||||
tr( "SMESH_WRN_WARNING" ),
|
tr( "SMESH_WRN_WARNING" ),
|
||||||
tr( "GHS3D_PERMISSION_DENIED" ) );
|
tr( "GHS3D_PERMISSION_DENIED" ) );
|
||||||
@ -431,7 +429,8 @@ bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
|||||||
if ( isDefault ) // not selected option
|
if ( isDefault ) // not selected option
|
||||||
value.clear();
|
value.clear();
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
model->setOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
|
model->setOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
|
||||||
}
|
}
|
||||||
catch ( const SALOME::SALOME_Exception& ex )
|
catch ( const SALOME::SALOME_Exception& ex )
|
||||||
@ -442,7 +441,6 @@ bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +452,6 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent )
|
|||||||
:QWidget(parent)
|
:QWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
myFileInDir = new QString("");
|
myFileInDir = new QString("");
|
||||||
myFileOutDir = new QString("");
|
myFileOutDir = new QString("");
|
||||||
myFileSizeMapDir = new QString("");
|
myFileSizeMapDir = new QString("");
|
||||||
@ -576,7 +573,6 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent )
|
|||||||
sizeMapFieldGroupLayout->addWidget(rankLabel, 2,2);
|
sizeMapFieldGroupLayout->addWidget(rankLabel, 2,2);
|
||||||
sizeMapFieldGroupLayout->addWidget(rankSpinBox, 2,3);
|
sizeMapFieldGroupLayout->addWidget(rankSpinBox, 2,3);
|
||||||
|
|
||||||
|
|
||||||
QGridLayout* argumentsLayout = new QGridLayout( this );
|
QGridLayout* argumentsLayout = new QGridLayout( this );
|
||||||
argumentsLayout->setMargin( MARGIN );
|
argumentsLayout->setMargin( MARGIN );
|
||||||
argumentsLayout->setSpacing( SPACING );
|
argumentsLayout->setSpacing( SPACING );
|
||||||
@ -657,8 +653,7 @@ void SMESHGUI_MgAdaptArguments::onSelectOutMedFilebutton()
|
|||||||
|
|
||||||
QString filtre = QString("Med") ;
|
QString filtre = QString("Med") ;
|
||||||
filtre += QString(" files (*.") + QString("med") + QString(");;");
|
filtre += QString(" files (*.") + QString("med") + QString(");;");
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("SAVE_MED"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("SAVE_MED"), QString(""), filtre);
|
||||||
QString(""), filtre);
|
|
||||||
QFileInfo myFileInfo(fileName);
|
QFileInfo myFileInfo(fileName);
|
||||||
selectOutMedFileLineEdit->setText(myFileInfo.fileName());
|
selectOutMedFileLineEdit->setText(myFileInfo.fileName());
|
||||||
*myFileOutDir = myFileInfo.path();
|
*myFileOutDir = myFileInfo.path();
|
||||||
@ -688,9 +683,7 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFileBackgroundbutton()
|
|||||||
int typeStepInField = it->second > 2 ? 2 : it->second ;
|
int typeStepInField = it->second > 2 ? 2 : it->second ;
|
||||||
timeStepGroupChanged(typeStepInField, false);
|
timeStepGroupChanged(typeStepInField, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -748,14 +741,12 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFilebuttonClicked()
|
|||||||
ADAPTATION_MODE aMode = meshDim == 3 ? ADAPTATION_MODE::BOTH : ADAPTATION_MODE::SURFACE; // and when dimesh 3 without 2D mesh?
|
ADAPTATION_MODE aMode = meshDim == 3 ? ADAPTATION_MODE::BOTH : ADAPTATION_MODE::SURFACE; // and when dimesh 3 without 2D mesh?
|
||||||
emit meshDimSignal(aMode);
|
emit meshDimSignal(aMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QFileInfo myFileInfo(fileName);
|
QFileInfo myFileInfo(fileName);
|
||||||
*myFileInDir = myFileInfo.path();
|
*myFileInDir = myFileInfo.path();
|
||||||
*myFileOutDir = myFileInfo.path();
|
*myFileOutDir = myFileInfo.path();
|
||||||
@ -776,7 +767,6 @@ void SMESHGUI_MgAdaptArguments::onLocalSelected(QString filePath)
|
|||||||
{
|
{
|
||||||
fieldNameCmb->clear();
|
fieldNameCmb->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -791,7 +781,6 @@ void SMESHGUI_MgAdaptArguments::onLocalSelected(QString filePath)
|
|||||||
// std::cout << "SMESHGUI_MgAdaptArguments::onLocalSelected typeStepInField : " << typeStepInField << std::endl;
|
// std::cout << "SMESHGUI_MgAdaptArguments::onLocalSelected typeStepInField : " << typeStepInField << std::endl;
|
||||||
timeStepGroupChanged(typeStepInField, false);
|
timeStepGroupChanged(typeStepInField, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -816,11 +805,13 @@ void SMESHGUI_MgAdaptArguments::setMode(const Mode theMode, const SIZEMAP theSiz
|
|||||||
{
|
{
|
||||||
QRadioButton* aButton = qobject_cast<QRadioButton*>( meshInGroup->button( theMode ) );
|
QRadioButton* aButton = qobject_cast<QRadioButton*>( meshInGroup->button( theMode ) );
|
||||||
QRadioButton* bButton = qobject_cast<QRadioButton*>( sizeMapDefGroup->button( theSizeMap ) );
|
QRadioButton* bButton = qobject_cast<QRadioButton*>( sizeMapDefGroup->button( theSizeMap ) );
|
||||||
if ( aButton ) {
|
if ( aButton )
|
||||||
|
{
|
||||||
aButton->setChecked( true );
|
aButton->setChecked( true );
|
||||||
modeChanged( theMode );
|
modeChanged( theMode );
|
||||||
}
|
}
|
||||||
if ( bButton ) {
|
if ( bButton )
|
||||||
|
{
|
||||||
bButton->setChecked( true );
|
bButton->setChecked( true );
|
||||||
sizeMapDefChanged( theSizeMap );
|
sizeMapDefChanged( theSizeMap );
|
||||||
}
|
}
|
||||||
@ -845,9 +836,6 @@ void SMESHGUI_MgAdaptArguments::modeChanged( int theMode )
|
|||||||
sizeMapDefChanged(Background);
|
sizeMapDefChanged(Background);
|
||||||
emit updateSelection();
|
emit updateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int theSizeMap )
|
void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int theSizeMap )
|
||||||
@ -892,10 +880,7 @@ void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int theSizeMap )
|
|||||||
valueLabel->show();
|
valueLabel->show();
|
||||||
dvalue->show();
|
dvalue->show();
|
||||||
sizeMapField->setEnabled(false);
|
sizeMapField->setEnabled(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void SMESHGUI_MgAdaptArguments::timeStepGroupChanged(int timeStepType, bool disableOther, int vmax)
|
void SMESHGUI_MgAdaptArguments::timeStepGroupChanged(int timeStepType, bool disableOther, int vmax)
|
||||||
{
|
{
|
||||||
@ -949,7 +934,7 @@ MgAdaptAdvWidget::MgAdaptAdvWidget( QWidget* parent, std::vector <std::string>*
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect( myOptionTable, SIGNAL( itemChanged(QTreeWidgetItem *, int)), SLOT( itemChanged(QTreeWidgetItem *, int )));
|
connect( myOptionTable, SIGNAL( itemChanged(QTreeWidgetItem *, int)), SLOT( itemChanged(QTreeWidgetItem *, int )));
|
||||||
connect( addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
|
connect( addBtn, SIGNAL(clicked()), this, SLOT( onAddOption() ) );
|
||||||
connect(workingDirectoryPushButton, SIGNAL(pressed()), this, SLOT(_onWorkingDirectoryPushButton()));
|
connect(workingDirectoryPushButton, SIGNAL(pressed()), this, SLOT(_onWorkingDirectoryPushButton()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,8 +944,6 @@ MgAdaptAdvWidget::~MgAdaptAdvWidget()
|
|||||||
|
|
||||||
void MgAdaptAdvWidget::AddOption( const char* option, bool isCustom )
|
void MgAdaptAdvWidget::AddOption( const char* option, bool isCustom )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
QString name, value;
|
QString name, value;
|
||||||
bool isDefault = false;
|
bool isDefault = false;
|
||||||
if ( option )
|
if ( option )
|
||||||
@ -972,7 +955,6 @@ void MgAdaptAdvWidget::AddOption( const char* option, bool isCustom )
|
|||||||
value = name_value_type[1];
|
value = name_value_type[1];
|
||||||
if ( name_value_type.size() > 2 )
|
if ( name_value_type.size() > 2 )
|
||||||
isDefault = !name_value_type[2].toInt();
|
isDefault = !name_value_type[2].toInt();
|
||||||
|
|
||||||
}
|
}
|
||||||
QTreeWidget* table = myOptionTable;
|
QTreeWidget* table = myOptionTable;
|
||||||
//table->setExpanded( true );
|
//table->setExpanded( true );
|
||||||
@ -1029,7 +1011,6 @@ void MgAdaptAdvWidget::GetOptionAndValue( QTreeWidgetItem * tblRow,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MgAdaptAdvWidget::itemChanged(QTreeWidgetItem* tblRow, int column)
|
void MgAdaptAdvWidget::itemChanged(QTreeWidgetItem* tblRow, int column)
|
||||||
{
|
{
|
||||||
if ( tblRow )
|
if ( tblRow )
|
||||||
@ -1141,11 +1122,6 @@ void MgAdaptAdvWidget::setupWidget()
|
|||||||
|
|
||||||
gridLayout_4->addWidget(logGroupBox, 3, 0, 1, 2);
|
gridLayout_4->addWidget(logGroupBox, 3, 0, 1, 2);
|
||||||
|
|
||||||
|
|
||||||
// retranslateUi(this);
|
|
||||||
|
|
||||||
// QMetaObject::connectSlotsByName(this);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void MgAdaptAdvWidget::_onWorkingDirectoryPushButton()
|
void MgAdaptAdvWidget::_onWorkingDirectoryPushButton()
|
||||||
{
|
{
|
||||||
@ -1154,7 +1130,7 @@ void MgAdaptAdvWidget::_onWorkingDirectoryPushButton()
|
|||||||
}
|
}
|
||||||
void MgAdaptAdvWidget::onMeshDimChanged(ADAPTATION_MODE aMode)
|
void MgAdaptAdvWidget::onMeshDimChanged(ADAPTATION_MODE aMode)
|
||||||
{
|
{
|
||||||
/* default adaptation mode
|
/* default adaptation mode
|
||||||
* assume that if meshDim == 2 -->adaptation surface
|
* assume that if meshDim == 2 -->adaptation surface
|
||||||
* if meshDim == 3 and if there is not 2D mesh -->VOLUME
|
* if meshDim == 3 and if there is not 2D mesh -->VOLUME
|
||||||
* else BOTH
|
* else BOTH
|
||||||
@ -1185,7 +1161,6 @@ void MgAdaptAdvWidget::onMeshDimChanged(ADAPTATION_MODE aMode)
|
|||||||
}
|
}
|
||||||
void MgAdaptAdvWidget::setOptionValue(QString& option, QString& value)
|
void MgAdaptAdvWidget::setOptionValue(QString& option, QString& value)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::map<QString, QTreeWidgetItem *>::iterator it = optionTreeWidgetItem.find(option);
|
std::map<QString, QTreeWidgetItem *>::iterator it = optionTreeWidgetItem.find(option);
|
||||||
if (it != optionTreeWidgetItem.end())
|
if (it != optionTreeWidgetItem.end())
|
||||||
{
|
{
|
||||||
@ -1216,28 +1191,28 @@ QModelIndex MgAdaptAdvWidgetTreeWidget::moveCursor( CursorAction action, Qt::Key
|
|||||||
{
|
{
|
||||||
QModelIndex current = currentIndex();
|
QModelIndex current = currentIndex();
|
||||||
int column = current.column();
|
int column = current.column();
|
||||||
if ( action == MoveNext ) {
|
if ( action == MoveNext )
|
||||||
if ( column < columnCount()-1 ) {
|
{
|
||||||
|
if ( column < columnCount()-1 )
|
||||||
|
{
|
||||||
QModelIndex next = current.sibling( current.row(), column+1 );
|
QModelIndex next = current.sibling( current.row(), column+1 );
|
||||||
if ( isEditable( next ) )
|
if ( isEditable( next ) ) return next;
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
QModelIndex next = current.sibling( current.row()+1, 0 );
|
QModelIndex next = current.sibling( current.row()+1, 0 );
|
||||||
if ( isEditable( next ) )
|
if ( isEditable( next ) ) return next;
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( action == MovePrevious ) {
|
else if ( action == MovePrevious )
|
||||||
|
{
|
||||||
if ( column == 0 ) {
|
if ( column == 0 ) {
|
||||||
QModelIndex next = current.sibling( current.row()-1, columnCount()-1 );
|
QModelIndex next = current.sibling( current.row()-1, columnCount()-1 );
|
||||||
if ( isEditable( next ) )
|
if ( isEditable( next ) ) return next;
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QModelIndex next = current.sibling( current.row(), column-1 );
|
QModelIndex next = current.sibling( current.row(), column-1 );
|
||||||
if ( isEditable( next ) )
|
if ( isEditable( next ) ) return next;
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QTreeWidget::moveCursor( action, modifiers );
|
return QTreeWidget::moveCursor( action, modifiers );
|
||||||
@ -1245,7 +1220,8 @@ QModelIndex MgAdaptAdvWidgetTreeWidget::moveCursor( CursorAction action, Qt::Key
|
|||||||
|
|
||||||
void MgAdaptAdvWidgetTreeWidget::keyPressEvent( QKeyEvent* e )
|
void MgAdaptAdvWidgetTreeWidget::keyPressEvent( QKeyEvent* e )
|
||||||
{
|
{
|
||||||
switch ( e->key() ) {
|
switch ( e->key() )
|
||||||
|
{
|
||||||
case Qt::Key_F2:
|
case Qt::Key_F2:
|
||||||
{
|
{
|
||||||
QModelIndex index = currentIndex();
|
QModelIndex index = currentIndex();
|
||||||
@ -1253,8 +1229,7 @@ void MgAdaptAdvWidgetTreeWidget::keyPressEvent( QKeyEvent* e )
|
|||||||
for ( int i = 0; i < columnCount(); i++ ) {
|
for ( int i = 0; i < columnCount(); i++ ) {
|
||||||
QModelIndex sibling = index.sibling( index.row(), i );
|
QModelIndex sibling = index.sibling( index.row(), i );
|
||||||
if ( isEditable( sibling ) ) {
|
if ( isEditable( sibling ) ) {
|
||||||
if ( !edit( sibling, EditKeyPressed, e ) )
|
if ( !edit( sibling, EditKeyPressed, e ) ) e->ignore();
|
||||||
e->ignore();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1363,8 +1338,6 @@ QString lireNomMaillage2(med_idt medIdt,int meshId, med_int& meshdim )
|
|||||||
return NomMaillage;
|
return NomMaillage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -1437,10 +1410,10 @@ std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
|||||||
return ListeChamp;
|
return ListeChamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string remove_extension(const std::string& filename) {
|
std::string remove_extension(const std::string& filename)
|
||||||
|
{
|
||||||
size_t lastdot = filename.find_last_of(".");
|
size_t lastdot = filename.find_last_of(".");
|
||||||
if (lastdot == std::string::npos) return filename;
|
if (lastdot == std::string::npos) return filename;
|
||||||
return filename.substr(0, lastdot);
|
return filename.substr(0, lastdot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
// Copyright (C) 2011-2020 CEA/DEN, EDF R&D
|
// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
@ -16,7 +19,6 @@
|
|||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
|
// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
|
||||||
// File : MG_ADAPTGUI.hxx
|
// File : MG_ADAPTGUI.hxx
|
||||||
//
|
//
|
||||||
@ -130,10 +132,10 @@ public slots:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
virtual bool clickOnApply();
|
virtual bool clickOnApply();
|
||||||
private slots:
|
private slots:
|
||||||
virtual void clickOnHelp();
|
virtual void clickOnHelp();
|
||||||
virtual void clickOnOk();
|
virtual void clickOnOk();
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
SMESHGUI_MgAdaptArguments* myArgs;
|
SMESHGUI_MgAdaptArguments* myArgs;
|
||||||
@ -144,7 +146,6 @@ protected :
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */
|
SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
QTabWidget* myTabWidget;
|
QTabWidget* myTabWidget;
|
||||||
|
|
||||||
@ -247,7 +248,6 @@ private:
|
|||||||
med_int meshDim;
|
med_int meshDim;
|
||||||
std::map<QString, int> myFieldList;
|
std::map<QString, int> myFieldList;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
OPTION_ID_COLUMN = 0,
|
OPTION_ID_COLUMN = 0,
|
||||||
@ -288,8 +288,8 @@ public:
|
|||||||
void AddOption( const char* name_value_type, bool isCustom = false );
|
void AddOption( const char* name_value_type, bool isCustom = false );
|
||||||
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
|
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
|
||||||
void setupWidget();
|
void setupWidget();
|
||||||
public slots:
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
void onAddOption();
|
void onAddOption();
|
||||||
void itemChanged(QTreeWidgetItem * tblRow, int column);
|
void itemChanged(QTreeWidgetItem * tblRow, int column);
|
||||||
void onMeshDimChanged(ADAPTATION_MODE aMode);
|
void onMeshDimChanged(ADAPTATION_MODE aMode);
|
||||||
@ -307,8 +307,6 @@ enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
|
|||||||
NAME_COL = 0, VALUE_COL
|
NAME_COL = 0, VALUE_COL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ItemDelegate: public QItemDelegate
|
class ItemDelegate: public QItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -328,5 +326,4 @@ protected:
|
|||||||
void keyPressEvent( QKeyEvent* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // MG_ADAPTGUI_HXX
|
#endif // MG_ADAPTGUI_HXX
|
||||||
|
@ -159,13 +159,15 @@ bool createAndPublishMed(QString fileName)
|
|||||||
_PTR(Study) aStudy = SMESH::getStudy();
|
_PTR(Study) aStudy = SMESH::getStudy();
|
||||||
QStringList anEntryList;
|
QStringList anEntryList;
|
||||||
// bool isEmpty;
|
// bool isEmpty;
|
||||||
if ( aMeshSO ) {
|
if ( aMeshSO )
|
||||||
|
{
|
||||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||||
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
||||||
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
|
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
|
||||||
anEntryList.append( aMeshSO->GetID().c_str() );
|
anEntryList.append( aMeshSO->GetID().c_str() );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// isEmpty = true;
|
// isEmpty = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -298,7 +300,6 @@ void SMESHGUI_MG_ADAPTDRIVER::selectionChanged()
|
|||||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
|
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
|
||||||
if ( mySelectedObject->_is_nil() )
|
if ( mySelectedObject->_is_nil() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
@ -367,7 +368,6 @@ bool SMESHGUI_MG_ADAPTDRIVER::clickOnApply()
|
|||||||
|
|
||||||
bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
||||||
{
|
{
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
//~std::string errStr;
|
//~std::string errStr;
|
||||||
char* errStr;
|
char* errStr;
|
||||||
@ -430,11 +430,9 @@ void SMESHGUI_MG_ADAPTDRIVER::onConstructor( int withGeom )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~void SMESHGUI_MG_ADAPTDRIVER::onSelectIdSource( bool )
|
//~void SMESHGUI_MG_ADAPTDRIVER::onSelectIdSource( bool )
|
||||||
//~{}
|
//~{}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -463,7 +461,8 @@ void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
|
|||||||
if ( e->isAccepted() )
|
if ( e->isAccepted() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( e->key() == Qt::Key_F1 ) {
|
if ( e->key() == Qt::Key_F1 )
|
||||||
|
{
|
||||||
e->accept();
|
e->accept();
|
||||||
clickOnHelp();
|
clickOnHelp();
|
||||||
}
|
}
|
||||||
@ -489,8 +488,7 @@ void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp()
|
|||||||
#endif
|
#endif
|
||||||
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
||||||
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
||||||
arg(app->resourceMgr()->stringValue("ExternalBrowser",
|
arg(app->resourceMgr()->stringValue("ExternalBrowser",platform)).
|
||||||
platform)).
|
|
||||||
arg(myHelpFileName));
|
arg(myHelpFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,13 +604,15 @@ bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
|
|||||||
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
|
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
|
||||||
{
|
{
|
||||||
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
|
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
|
||||||
if ( aMeshSO ) {
|
if ( aMeshSO )
|
||||||
|
{
|
||||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||||
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
||||||
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
|
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
|
||||||
anEntryList.append( aMeshSO->GetID().c_str() );
|
anEntryList.append( aMeshSO->GetID().c_str() );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
isEmpty = true;
|
isEmpty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -663,8 +663,8 @@ bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
|
void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
|
||||||
{
|
{
|
||||||
|
if (ConstructorsBox->isEnabled())
|
||||||
if (ConstructorsBox->isEnabled()) {
|
{
|
||||||
ConstructorsBox->setEnabled(false);
|
ConstructorsBox->setEnabled(false);
|
||||||
GroupArguments->setEnabled(false);
|
GroupArguments->setEnabled(false);
|
||||||
GroupButtons->setEnabled(false);
|
GroupButtons->setEnabled(false);
|
||||||
@ -701,7 +701,8 @@ void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_MG_ADAPTDRIVER::setFilters()
|
void SMESHGUI_MG_ADAPTDRIVER::setFilters()
|
||||||
{
|
{
|
||||||
if(myMesh->_is_nil()) {
|
if(myMesh->_is_nil())
|
||||||
|
{
|
||||||
SUIT_MessageBox::critical(this,
|
SUIT_MessageBox::critical(this,
|
||||||
tr("SMESH_ERROR"),
|
tr("SMESH_ERROR"),
|
||||||
tr("NO_MESH_SELECTED"));
|
tr("NO_MESH_SELECTED"));
|
||||||
|
@ -111,13 +111,13 @@ SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateAdaptationHypothesis()
|
|||||||
SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType)
|
SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!strcmp(adaptationType, "MG_Adapt")){
|
if (!strcmp(adaptationType, "MG_Adapt"))
|
||||||
|
{
|
||||||
SMESH::MG_ADAPT_OBJECT_i* mg_adapt_object = new SMESH::MG_ADAPT_OBJECT_i();
|
SMESH::MG_ADAPT_OBJECT_i* mg_adapt_object = new SMESH::MG_ADAPT_OBJECT_i();
|
||||||
SMESH::MG_ADAPT_OBJECT_var anObj = mg_adapt_object->_this();
|
SMESH::MG_ADAPT_OBJECT_var anObj = mg_adapt_object->_this();
|
||||||
return anObj._retn();
|
return anObj._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT()
|
//~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT()
|
||||||
//~{
|
//~{
|
||||||
@ -307,7 +307,6 @@ bool MG_ADAPT_i::getUseConstantValue()
|
|||||||
{
|
{
|
||||||
return myMgAdapt->getUseConstantValue();
|
return myMgAdapt->getUseConstantValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MG_ADAPT_i::setConstantSize(double value)
|
void MG_ADAPT_i::setConstantSize(double value)
|
||||||
{
|
{
|
||||||
myMgAdapt->setConstantValue(value);
|
myMgAdapt->setConstantValue(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user