mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-26 07:40:34 +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
|
||||
// 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
|
||||
|
||||
#include "MG_ADAPT.hxx"
|
||||
@ -43,8 +43,7 @@ static std::string removeFile(std::string fileName, int& notOk)
|
||||
{
|
||||
std::string errStr;
|
||||
notOk = std::remove(fileName.c_str());
|
||||
if (notOk) errStr = ToComment(" \n error while removing file : ")
|
||||
<< fileName;
|
||||
if (notOk) errStr = ToComment("\n error while removing file : ") << fileName;
|
||||
else errStr = ToComment("\n file : ") << fileName << " succesfully deleted! \n ";
|
||||
|
||||
return errStr;
|
||||
@ -109,7 +108,6 @@ MgAdapt::MgAdapt(MgAdaptHypothesisData* myData)
|
||||
|
||||
MgAdapt::MgAdapt( const MgAdapt& copy)
|
||||
{
|
||||
|
||||
data = new MgAdaptHypothesisData();
|
||||
MgAdaptHypothesisData *copyData = copy.getData();
|
||||
copyMgAdaptHypothesisData(copyData);
|
||||
@ -121,17 +119,12 @@ MgAdapt::MgAdapt( const MgAdapt& copy)
|
||||
this->_doubleOptions = copy._doubleOptions;
|
||||
this->_charOptions = copy._charOptions;
|
||||
this->_boolOptions = copy._boolOptions;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
MgAdapt::~MgAdapt()
|
||||
{
|
||||
|
||||
delete data;
|
||||
|
||||
}
|
||||
void MgAdapt::buildModel()
|
||||
{
|
||||
@ -458,7 +451,6 @@ bool MgAdapt::setAll()
|
||||
std::string mapfile;
|
||||
if (useBackgroundMap)
|
||||
{
|
||||
|
||||
checkDirPath(data->myFileSizeMapDir);
|
||||
mapfile = data->myFileSizeMapDir+data->myMeshFileBackground;
|
||||
setFieldName(data->myFieldName);
|
||||
@ -472,7 +464,6 @@ bool MgAdapt::setAll()
|
||||
mapfile ="";
|
||||
setConstantValue(0.0);
|
||||
setFieldName(data->myFieldName);
|
||||
|
||||
}
|
||||
|
||||
setSizeMapFile(mapfile);
|
||||
@ -533,19 +524,28 @@ throw (std::invalid_argument)
|
||||
// check value type
|
||||
bool typeOk = true;
|
||||
std::string typeName;
|
||||
if (i == 0) {
|
||||
if (i == 0)
|
||||
{
|
||||
// empty string
|
||||
} else if (_charOptions.count(optionName)) {
|
||||
}
|
||||
else if (_charOptions.count(optionName))
|
||||
{
|
||||
// do not check strings
|
||||
} else if (_doubleOptions.count(optionName)) {
|
||||
}
|
||||
else if (_doubleOptions.count(optionName))
|
||||
{
|
||||
// check if value is double
|
||||
toDbl(ptr, &typeOk);
|
||||
typeName = "real";
|
||||
} else if (_boolOptions.count(optionName)) {
|
||||
}
|
||||
else if (_boolOptions.count(optionName))
|
||||
{
|
||||
// check if value is bool
|
||||
toBool(ptr, &typeOk);
|
||||
typeName = "bool";
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if value is int
|
||||
toInt(ptr, &typeOk);
|
||||
typeName = "integer";
|
||||
@ -559,9 +559,7 @@ throw (std::invalid_argument)
|
||||
throw std::invalid_argument(msg);
|
||||
}
|
||||
std::string value( ptr, i );
|
||||
if ( _defaultOptionValues[ optionName ] == value )
|
||||
value.clear();
|
||||
|
||||
if ( _defaultOptionValues[ optionName ] == value ) value.clear();
|
||||
|
||||
op_val->second = value;
|
||||
|
||||
@ -590,8 +588,7 @@ throw (std::invalid_argument)
|
||||
if ( val.empty() && isDefault )
|
||||
{
|
||||
op_val = _defaultOptionValues.find( optionName );
|
||||
if (op_val != _defaultOptionValues.end())
|
||||
val = op_val->second;
|
||||
if (op_val != _defaultOptionValues.end()) val = op_val->second;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@ -654,7 +651,8 @@ throw (std::invalid_argument)
|
||||
|
||||
if ( isOk )
|
||||
*isOk = false;
|
||||
else {
|
||||
else
|
||||
{
|
||||
std::string msg = "Not a Boolean value:'" + str + "'";
|
||||
throw std::invalid_argument(msg);
|
||||
}
|
||||
@ -719,8 +717,7 @@ int MgAdapt::compute(std::string& errStr)
|
||||
|
||||
if ( err )
|
||||
{
|
||||
errStr = ToComment("system(mg-adapt.exe ...) command failed with error: ")
|
||||
<< strerror( errno );
|
||||
errStr = ToComment("system(mg-adapt.exe ...) command failed with error: ") << strerror( errno );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -817,13 +814,10 @@ std::string MgAdapt::getCommandToRun()
|
||||
tmpFilesToBeDeleted.push_back(solFileIn);
|
||||
if(useBackgroundMap && !isFileExist(sizeMapIn))
|
||||
{
|
||||
|
||||
errStr = ToComment(" failed to find .mesh size map file from converter ")<< strerror( errno );
|
||||
return errStr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
cmd+= " --in "+ meshIn;
|
||||
meshFormatOutputMesh = getFileName()+".mesh";
|
||||
tmpFilesToBeDeleted.push_back(meshFormatOutputMesh);
|
||||
@ -852,7 +846,6 @@ std::string MgAdapt::getCommandToRun()
|
||||
}
|
||||
if (verbosityLevel != defaultVerboseLevel())
|
||||
{
|
||||
|
||||
cmd+= " --verbose "+ ToComment(verbosityLevel);
|
||||
}
|
||||
|
||||
@ -897,12 +890,10 @@ std::string MgAdapt::getCommandToRun()
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
bool MgAdapt::isFileExist(const std::string& fName)
|
||||
{
|
||||
|
||||
if ( fName.empty() )
|
||||
return false;
|
||||
if ( fName.empty() ) return false;
|
||||
|
||||
boost::system::error_code err;
|
||||
bool res = boost::filesystem::exists( fName, err );
|
||||
@ -926,14 +917,16 @@ double MgAdapt::defaultMaximumMemory()
|
||||
MEMORYSTATUSEX statex;
|
||||
statex.dwLength = sizeof (statex);
|
||||
long err = GlobalMemoryStatusEx (&statex);
|
||||
if (err != 0) {
|
||||
if (err != 0)
|
||||
{
|
||||
double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
|
||||
return (double)( 0.7 * totMB );
|
||||
}
|
||||
#elif !defined(__APPLE__)
|
||||
struct sysinfo si;
|
||||
long err = sysinfo( &si );
|
||||
if ( err == 0 ) {
|
||||
if ( err == 0 )
|
||||
{
|
||||
long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
|
||||
return ( 0.7 * ramMB );
|
||||
}
|
||||
@ -941,7 +934,6 @@ double MgAdapt::defaultMaximumMemory()
|
||||
return 1024;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : defaultWorkingDirectory
|
||||
//=======================================================================
|
||||
@ -951,7 +943,8 @@ std::string MgAdapt::defaultWorkingDirectory()
|
||||
TCollection_AsciiString aTmpDir;
|
||||
|
||||
char *Tmp_dir = getenv("SALOME_TMP_DIR");
|
||||
if(Tmp_dir != NULL) {
|
||||
if(Tmp_dir != NULL)
|
||||
{
|
||||
aTmpDir = Tmp_dir;
|
||||
}
|
||||
else {
|
||||
@ -1106,7 +1099,6 @@ std::string MgAdapt::getExeName()
|
||||
}
|
||||
void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
||||
{
|
||||
|
||||
data->myFileInDir = from->myFileInDir;
|
||||
data->myMeshFileIn = from->myMeshFileIn;
|
||||
data->myMeshFileBackground = from->myMeshFileBackground;
|
||||
@ -1133,13 +1125,11 @@ void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from)
|
||||
data->myKeepFiles = from->myKeepFiles;
|
||||
data->myRemoveLogOnSuccess = from->myRemoveLogOnSuccess;
|
||||
data->myVerboseLevel = from->myVerboseLevel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& solFormatFieldFileName, std::string& meshFormatsizeMapFile)
|
||||
{
|
||||
|
||||
std::vector<std::string> fieldFileNames;
|
||||
MEDCoupling::MeshFormatWriter writer;
|
||||
MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(medFileIn);
|
||||
@ -1156,15 +1146,12 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
||||
|
||||
if (useBackgroundMap)
|
||||
{
|
||||
|
||||
meshFormatsizeMapFile = getFileName();
|
||||
meshFormatsizeMapFile += ".mesh";
|
||||
buildBackGroundMeshAndSolFiles(fieldFileNames, meshFormatsizeMapFile);
|
||||
|
||||
}
|
||||
else if(useLocalMap)
|
||||
{
|
||||
|
||||
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::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
|
||||
@ -1174,7 +1161,6 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s
|
||||
|
||||
writer.setFieldFileNames( fieldFileNames);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
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;
|
||||
mcIdType nbNodes = umesh->getNumberOfNodes();
|
||||
buildConstantSizeMapSolFile(solFormatFieldFileName, dim, version, nbNodes);
|
||||
|
||||
}
|
||||
|
||||
mfd->setFields( fields );
|
||||
@ -1208,7 +1193,6 @@ void MgAdapt::convertMeshFile(std::string& meshFormatIn, std::vector< std::strin
|
||||
mfd->write(medFileOut, 2);
|
||||
}
|
||||
|
||||
|
||||
void MgAdapt::storeGroupsAndFams(MEDCoupling::MEDFileMesh* 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();
|
||||
tmp_fields->pushField(tmFts);
|
||||
|
||||
|
||||
tmpMfd->setFields( tmp_fields );
|
||||
MEDCoupling::MeshFormatWriter tmpWriter;
|
||||
tmpWriter.setMeshFileName(meshFormatsizeMapFile);
|
||||
@ -1353,16 +1336,12 @@ MgAdapt::Status MgAdapt::addMessage(const std::string& msg,
|
||||
return ( _myStatus = isFatal ? MgAdapt::DRS_FAIL : MgAdapt::DRS_WARN_SKIP_ELEM );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================================
|
||||
void MgAdapt::getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit)
|
||||
// =======================================================================
|
||||
{
|
||||
// Il faut voir si plusieurs maillages
|
||||
|
||||
|
||||
herr_t erreur = 0 ;
|
||||
med_idt medIdt ;
|
||||
|
||||
@ -1418,18 +1397,14 @@ void MgAdapt::getTimeStepInfos(std::string aFile, med_int& numdt, med_int& numit
|
||||
}
|
||||
if ( erreur < 0 )
|
||||
{
|
||||
|
||||
//~addMessage( ToComment(" error: error while reading field ") << nomcha << "step (numdt, numit) = " <<"("<< numdt<< ", " \
|
||||
numit<< ")" <<" in file " << aFile , /*fatal=*/true );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Fermeture du fichier
|
||||
if ( medIdt > 0 ) MEDfileClose(medIdt);
|
||||
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
// 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
|
||||
// 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
|
||||
//
|
||||
@ -55,7 +55,6 @@ struct MgAdaptHypothesisData
|
||||
std::string myWorkingDir, myLogFile;
|
||||
bool myPrintLogInFile, myKeepFiles, myRemoveLogOnSuccess;
|
||||
int myVerboseLevel;
|
||||
|
||||
};
|
||||
|
||||
class outFileStream : public std::ofstream{
|
||||
@ -217,7 +216,6 @@ public:
|
||||
static int toInt(const std::string&, bool* isOk = 0 ) throw (std::invalid_argument);
|
||||
static std::string toLowerStr(const std::string& str);
|
||||
|
||||
|
||||
/* default values */
|
||||
static std::string defaultWorkingDirectory();
|
||||
static std::string defaultLogFile();
|
||||
@ -237,9 +235,6 @@ public:
|
||||
static double defaultMaximumMemory();
|
||||
static bool isFileExist(const std::string& fName);
|
||||
|
||||
|
||||
|
||||
|
||||
enum Status {
|
||||
DRS_OK,
|
||||
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" ) );
|
||||
setSizeGripEnabled( true );
|
||||
|
||||
|
||||
myTabWidget = new QTabWidget( this );
|
||||
|
||||
// Arguments
|
||||
@ -239,7 +238,6 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromHypo( ) const
|
||||
{
|
||||
*(myArgs->myFileOutDir) = QString(myData->myFileOutDir);
|
||||
myArgs->selectOutMedFileLineEdit->setText(QString(myData->myMeshFileOut));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -370,7 +368,6 @@ bool SMESHGUI_MgAdaptDlg::readParamsFromWidgets()
|
||||
|
||||
}
|
||||
|
||||
|
||||
aData->myWorkingDir = CORBA::string_dup(myAdvOpt->workingDirectoryLineEdit->text().toStdString().c_str());
|
||||
aData->myPrintLogInFile = myAdvOpt->logInFileCheck->isChecked();
|
||||
aData->myVerboseLevel = myAdvOpt->verboseLevelSpin->value();
|
||||
@ -406,7 +403,8 @@ void SMESHGUI_MgAdaptDlg::clickOnHelp()
|
||||
}
|
||||
bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
||||
{
|
||||
if ( !QFileInfo( myAdvOpt->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
|
||||
if ( !QFileInfo( myAdvOpt->workingDirectoryLineEdit->text().trimmed() ).isWritable() )
|
||||
{
|
||||
SUIT_MessageBox::warning( this,
|
||||
tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "GHS3D_PERMISSION_DENIED" ) );
|
||||
@ -431,7 +429,8 @@ bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
||||
if ( isDefault ) // not selected option
|
||||
value.clear();
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
model->setOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
|
||||
}
|
||||
catch ( const SALOME::SALOME_Exception& ex )
|
||||
@ -442,7 +441,6 @@ bool SMESHGUI_MgAdaptDlg::checkParams(QString& msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -454,7 +452,6 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent )
|
||||
:QWidget(parent)
|
||||
{
|
||||
|
||||
|
||||
myFileInDir = new QString("");
|
||||
myFileOutDir = new QString("");
|
||||
myFileSizeMapDir = new QString("");
|
||||
@ -576,7 +573,6 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent )
|
||||
sizeMapFieldGroupLayout->addWidget(rankLabel, 2,2);
|
||||
sizeMapFieldGroupLayout->addWidget(rankSpinBox, 2,3);
|
||||
|
||||
|
||||
QGridLayout* argumentsLayout = new QGridLayout( this );
|
||||
argumentsLayout->setMargin( MARGIN );
|
||||
argumentsLayout->setSpacing( SPACING );
|
||||
@ -657,8 +653,7 @@ void SMESHGUI_MgAdaptArguments::onSelectOutMedFilebutton()
|
||||
|
||||
QString filtre = QString("Med") ;
|
||||
filtre += QString(" files (*.") + QString("med") + QString(");;");
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("SAVE_MED"),
|
||||
QString(""), filtre);
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("SAVE_MED"), QString(""), filtre);
|
||||
QFileInfo myFileInfo(fileName);
|
||||
selectOutMedFileLineEdit->setText(myFileInfo.fileName());
|
||||
*myFileOutDir = myFileInfo.path();
|
||||
@ -688,9 +683,7 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFileBackgroundbutton()
|
||||
int typeStepInField = it->second > 2 ? 2 : it->second ;
|
||||
timeStepGroupChanged(typeStepInField, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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?
|
||||
emit meshDimSignal(aMode);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QFileInfo myFileInfo(fileName);
|
||||
*myFileInDir = myFileInfo.path();
|
||||
*myFileOutDir = myFileInfo.path();
|
||||
@ -776,7 +767,6 @@ void SMESHGUI_MgAdaptArguments::onLocalSelected(QString filePath)
|
||||
{
|
||||
fieldNameCmb->clear();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -791,7 +781,6 @@ void SMESHGUI_MgAdaptArguments::onLocalSelected(QString filePath)
|
||||
// std::cout << "SMESHGUI_MgAdaptArguments::onLocalSelected typeStepInField : " << typeStepInField << std::endl;
|
||||
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* bButton = qobject_cast<QRadioButton*>( sizeMapDefGroup->button( theSizeMap ) );
|
||||
if ( aButton ) {
|
||||
if ( aButton )
|
||||
{
|
||||
aButton->setChecked( true );
|
||||
modeChanged( theMode );
|
||||
}
|
||||
if ( bButton ) {
|
||||
if ( bButton )
|
||||
{
|
||||
bButton->setChecked( true );
|
||||
sizeMapDefChanged( theSizeMap );
|
||||
}
|
||||
@ -845,9 +836,6 @@ void SMESHGUI_MgAdaptArguments::modeChanged( int theMode )
|
||||
sizeMapDefChanged(Background);
|
||||
emit updateSelection();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int theSizeMap )
|
||||
@ -892,10 +880,7 @@ void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int theSizeMap )
|
||||
valueLabel->show();
|
||||
dvalue->show();
|
||||
sizeMapField->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void SMESHGUI_MgAdaptArguments::timeStepGroupChanged(int timeStepType, bool disableOther, int vmax)
|
||||
{
|
||||
@ -959,8 +944,6 @@ MgAdaptAdvWidget::~MgAdaptAdvWidget()
|
||||
|
||||
void MgAdaptAdvWidget::AddOption( const char* option, bool isCustom )
|
||||
{
|
||||
|
||||
|
||||
QString name, value;
|
||||
bool isDefault = false;
|
||||
if ( option )
|
||||
@ -972,7 +955,6 @@ void MgAdaptAdvWidget::AddOption( const char* option, bool isCustom )
|
||||
value = name_value_type[1];
|
||||
if ( name_value_type.size() > 2 )
|
||||
isDefault = !name_value_type[2].toInt();
|
||||
|
||||
}
|
||||
QTreeWidget* table = myOptionTable;
|
||||
//table->setExpanded( true );
|
||||
@ -1029,7 +1011,6 @@ void MgAdaptAdvWidget::GetOptionAndValue( QTreeWidgetItem * tblRow,
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MgAdaptAdvWidget::itemChanged(QTreeWidgetItem* tblRow, int column)
|
||||
{
|
||||
if ( tblRow )
|
||||
@ -1141,11 +1122,6 @@ void MgAdaptAdvWidget::setupWidget()
|
||||
|
||||
gridLayout_4->addWidget(logGroupBox, 3, 0, 1, 2);
|
||||
|
||||
|
||||
// retranslateUi(this);
|
||||
|
||||
// QMetaObject::connectSlotsByName(this);
|
||||
|
||||
}
|
||||
void MgAdaptAdvWidget::_onWorkingDirectoryPushButton()
|
||||
{
|
||||
@ -1185,7 +1161,6 @@ void MgAdaptAdvWidget::onMeshDimChanged(ADAPTATION_MODE aMode)
|
||||
}
|
||||
void MgAdaptAdvWidget::setOptionValue(QString& option, QString& value)
|
||||
{
|
||||
|
||||
std::map<QString, QTreeWidgetItem *>::iterator it = optionTreeWidgetItem.find(option);
|
||||
if (it != optionTreeWidgetItem.end())
|
||||
{
|
||||
@ -1216,28 +1191,28 @@ QModelIndex MgAdaptAdvWidgetTreeWidget::moveCursor( CursorAction action, Qt::Key
|
||||
{
|
||||
QModelIndex current = currentIndex();
|
||||
int column = current.column();
|
||||
if ( action == MoveNext ) {
|
||||
if ( column < columnCount()-1 ) {
|
||||
if ( action == MoveNext )
|
||||
{
|
||||
if ( column < columnCount()-1 )
|
||||
{
|
||||
QModelIndex next = current.sibling( current.row(), column+1 );
|
||||
if ( isEditable( next ) )
|
||||
return next;
|
||||
if ( isEditable( next ) ) return next;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QModelIndex next = current.sibling( current.row()+1, 0 );
|
||||
if ( isEditable( next ) )
|
||||
return next;
|
||||
if ( isEditable( next ) ) return next;
|
||||
}
|
||||
}
|
||||
else if ( action == MovePrevious ) {
|
||||
else if ( action == MovePrevious )
|
||||
{
|
||||
if ( column == 0 ) {
|
||||
QModelIndex next = current.sibling( current.row()-1, columnCount()-1 );
|
||||
if ( isEditable( next ) )
|
||||
return next;
|
||||
if ( isEditable( next ) ) return next;
|
||||
}
|
||||
else {
|
||||
QModelIndex next = current.sibling( current.row(), column-1 );
|
||||
if ( isEditable( next ) )
|
||||
return next;
|
||||
if ( isEditable( next ) ) return next;
|
||||
}
|
||||
}
|
||||
return QTreeWidget::moveCursor( action, modifiers );
|
||||
@ -1245,7 +1220,8 @@ QModelIndex MgAdaptAdvWidgetTreeWidget::moveCursor( CursorAction action, Qt::Key
|
||||
|
||||
void MgAdaptAdvWidgetTreeWidget::keyPressEvent( QKeyEvent* e )
|
||||
{
|
||||
switch ( e->key() ) {
|
||||
switch ( e->key() )
|
||||
{
|
||||
case Qt::Key_F2:
|
||||
{
|
||||
QModelIndex index = currentIndex();
|
||||
@ -1253,8 +1229,7 @@ void MgAdaptAdvWidgetTreeWidget::keyPressEvent( QKeyEvent* e )
|
||||
for ( int i = 0; i < columnCount(); i++ ) {
|
||||
QModelIndex sibling = index.sibling( index.row(), i );
|
||||
if ( isEditable( sibling ) ) {
|
||||
if ( !edit( sibling, EditKeyPressed, e ) )
|
||||
e->ignore();
|
||||
if ( !edit( sibling, EditKeyPressed, e ) ) e->ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1363,8 +1338,6 @@ QString lireNomMaillage2(med_idt medIdt,int meshId, med_int& meshdim )
|
||||
return NomMaillage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// =======================================================================
|
||||
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
||||
// =======================================================================
|
||||
@ -1437,10 +1410,10 @@ std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
||||
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(".");
|
||||
if (lastdot == std::string::npos) return filename;
|
||||
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
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESHGUI : GUI for the adaptation in the SMESH component
|
||||
// File : MG_ADAPTGUI.hxx
|
||||
//
|
||||
@ -144,7 +146,6 @@ protected :
|
||||
|
||||
private:
|
||||
|
||||
|
||||
SalomeApp_Module* mySMESHGUI; /* Current SMESHGUI object */
|
||||
QTabWidget* myTabWidget;
|
||||
|
||||
@ -247,7 +248,6 @@ private:
|
||||
med_int meshDim;
|
||||
std::map<QString, int> myFieldList;
|
||||
|
||||
|
||||
};
|
||||
enum {
|
||||
OPTION_ID_COLUMN = 0,
|
||||
@ -288,8 +288,8 @@ public:
|
||||
void AddOption( const char* name_value_type, bool isCustom = false );
|
||||
void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
|
||||
void setupWidget();
|
||||
public slots:
|
||||
|
||||
public slots:
|
||||
void onAddOption();
|
||||
void itemChanged(QTreeWidgetItem * tblRow, int column);
|
||||
void onMeshDimChanged(ADAPTATION_MODE aMode);
|
||||
@ -307,8 +307,6 @@ enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
|
||||
NAME_COL = 0, VALUE_COL
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ItemDelegate: public QItemDelegate
|
||||
{
|
||||
public:
|
||||
@ -328,5 +326,4 @@ protected:
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
};
|
||||
|
||||
|
||||
#endif // MG_ADAPTGUI_HXX
|
||||
|
@ -159,13 +159,15 @@ bool createAndPublishMed(QString fileName)
|
||||
_PTR(Study) aStudy = SMESH::getStudy();
|
||||
QStringList anEntryList;
|
||||
// bool isEmpty;
|
||||
if ( aMeshSO ) {
|
||||
if ( aMeshSO )
|
||||
{
|
||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
||||
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
|
||||
anEntryList.append( aMeshSO->GetID().c_str() );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// isEmpty = true;
|
||||
return false;
|
||||
}
|
||||
@ -298,7 +300,6 @@ void SMESHGUI_MG_ADAPTDRIVER::selectionChanged()
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
|
||||
if ( mySelectedObject->_is_nil() )
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
return;
|
||||
@ -367,7 +368,6 @@ bool SMESHGUI_MG_ADAPTDRIVER::clickOnApply()
|
||||
|
||||
bool SMESHGUI_MG_ADAPTDRIVER::execute()
|
||||
{
|
||||
|
||||
int err;
|
||||
//~std::string errStr;
|
||||
char* errStr;
|
||||
@ -430,11 +430,9 @@ void SMESHGUI_MG_ADAPTDRIVER::onConstructor( int withGeom )
|
||||
|
||||
}
|
||||
|
||||
|
||||
//~void SMESHGUI_MG_ADAPTDRIVER::onSelectIdSource( bool )
|
||||
//~{}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
@ -463,7 +461,8 @@ void SMESHGUI_MG_ADAPTDRIVER::keyPressEvent( QKeyEvent* e )
|
||||
if ( e->isAccepted() )
|
||||
return;
|
||||
|
||||
if ( e->key() == Qt::Key_F1 ) {
|
||||
if ( e->key() == Qt::Key_F1 )
|
||||
{
|
||||
e->accept();
|
||||
clickOnHelp();
|
||||
}
|
||||
@ -489,8 +488,7 @@ void SMESHGUI_MG_ADAPTDRIVER::clickOnHelp()
|
||||
#endif
|
||||
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
||||
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
||||
arg(app->resourceMgr()->stringValue("ExternalBrowser",
|
||||
platform)).
|
||||
arg(app->resourceMgr()->stringValue("ExternalBrowser",platform)).
|
||||
arg(myHelpFileName));
|
||||
}
|
||||
|
||||
@ -606,13 +604,15 @@ bool SMESHGUI_MG_ADAPTDRIVER::createMeshInObjectBrowser()
|
||||
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ )
|
||||
{
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
|
||||
if ( aMeshSO ) {
|
||||
if ( aMeshSO )
|
||||
{
|
||||
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
|
||||
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
|
||||
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); // put REFINED mesh ico
|
||||
anEntryList.append( aMeshSO->GetID().c_str() );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
isEmpty = true;
|
||||
}
|
||||
}
|
||||
@ -663,8 +663,8 @@ bool SMESHGUI_MG_ADAPTDRIVER::isApplyAndClose() const
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::deactivateActiveDialog()
|
||||
{
|
||||
|
||||
if (ConstructorsBox->isEnabled()) {
|
||||
if (ConstructorsBox->isEnabled())
|
||||
{
|
||||
ConstructorsBox->setEnabled(false);
|
||||
GroupArguments->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
@ -701,7 +701,8 @@ void SMESHGUI_MG_ADAPTDRIVER::activateThisDialog()
|
||||
//=================================================================================
|
||||
void SMESHGUI_MG_ADAPTDRIVER::setFilters()
|
||||
{
|
||||
if(myMesh->_is_nil()) {
|
||||
if(myMesh->_is_nil())
|
||||
{
|
||||
SUIT_MessageBox::critical(this,
|
||||
tr("SMESH_ERROR"),
|
||||
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)
|
||||
{
|
||||
|
||||
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_var anObj = mg_adapt_object->_this();
|
||||
return anObj._retn();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//~SMESH::MG_ADAPT_ptr MG_ADAPT_i::CreateMG_ADAPT()
|
||||
//~{
|
||||
@ -307,7 +307,6 @@ bool MG_ADAPT_i::getUseConstantValue()
|
||||
{
|
||||
return myMgAdapt->getUseConstantValue();
|
||||
}
|
||||
|
||||
void MG_ADAPT_i::setConstantSize(double value)
|
||||
{
|
||||
myMgAdapt->setConstantValue(value);
|
||||
|
Loading…
Reference in New Issue
Block a user