// Copyright (C) 2012-2015 ALNEOS
-// Copyright (C) 2016-2021 EDF R&D
+// Copyright (C) 2016-2023 EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
delaunay,
frontal,
delaunayforquad,
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ packingparallelograms,
+ quadqs
+#else
packingparallelograms
+#endif
};
enum Algo3D
delaunay3,
frontal3,
mmg3d,
- rtree
+ rtree,
+ hxt
};
#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8
myGeomSelectionTools = NULL;
myCompoundSet.clear();
myIs2D = ( theHypType.endsWith("2D"));
+ myIs3D = (theHypType.endsWith("3D"));
}
GMSHPluginGUI_HypothesisCreator::~GMSHPluginGUI_HypothesisCreator()
row++;
}
- aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_ALGO" ), GroupC1 ), row, 0 );
- my2DAlgo = new QComboBox( GroupC1 );
- QStringList types2DAlgo;
- types2DAlgo << tr( "GMSH_AUTOMATIC" ) << tr( "GMSH_MESH_ADAPT" ) << tr( "GMSH_DELAUNAY" ) <<
- tr( "GMSH_FRONTAL" ) << tr( "GMSH_DELAUNAY_FOR_QUAD" ) << tr( "GMSH_PACKING_OF_PARALLELOGRAMS" );
- my2DAlgo->addItems( types2DAlgo );
- aGroupLayout->addWidget( my2DAlgo, row, 1 );
- row++;
+ my2DAlgo = 0;
+ if (!myIs3D)
+ {
+ aGroupLayout->addWidget(new QLabel(tr("GMSH_2D_ALGO"), GroupC1), row, 0);
+ my2DAlgo = new QComboBox(GroupC1);
+ QStringList types2DAlgo;
+ types2DAlgo << tr("GMSH_AUTOMATIC")
+ << tr("GMSH_MESH_ADAPT")
+ << tr("GMSH_DELAUNAY")
+ << tr("GMSH_FRONTAL")
+ << tr("GMSH_DELAUNAY_FOR_QUAD")
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ << tr("GMSH_PACKING_OF_PARALLELOGRAMS")
+ << tr("GMSH_QUASI_STRUCTURED_QUAD");
+#else
+ << tr("GMSH_PACKING_OF_PARALLELOGRAMS");
+#endif
+ my2DAlgo->addItems(types2DAlgo);
+ aGroupLayout->addWidget(my2DAlgo, row, 1);
+ row++;
+ }
my3DAlgo = 0;
if ( !myIs2D )
aGroupLayout->addWidget( new QLabel( tr( "GMSH_3D_ALGO" ), GroupC1 ), row, 0 );
my3DAlgo = new QComboBox( GroupC1 );
QStringList types3DAlgo;
- types3DAlgo << tr("GMSH_DELAUNAY3") << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_MMG3D" ) <<
- tr( "GMSH_R_TREE" );
+ types3DAlgo << tr( "GMSH_DELAUNAY3" ) << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_MMG3D" ) <<
+ tr( "GMSH_R_TREE" ) << tr( "GMSH_HXT" );
my3DAlgo->addItems( types3DAlgo );
aGroupLayout->addWidget( my3DAlgo, row, 1 );
row++;
}
- aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_RECOMB_ALGO" ), GroupC1 ), row, 0 );
- myRecomb2DAlgo = new QComboBox( GroupC1 );
- QStringList typesRecomb2DAlgo;
+ myRecomb2DAlgo = 0;
+ if (!myIs3D)
+ {
+ aGroupLayout->addWidget(new QLabel(tr("GMSH_2D_RECOMB_ALGO"), GroupC1), row, 0);
+ myRecomb2DAlgo = new QComboBox(GroupC1);
+ QStringList typesRecomb2DAlgo;
#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8
- typesRecomb2DAlgo << tr( "GMSH_SIMPLE" ) << tr( "GMSH_BLOSSOM" ) << tr( "GMSH_SIMPLE_FULL_QUADS" ) << tr( "GMSH_BLOSSOM_FULL_QUADS" );
+ typesRecomb2DAlgo << tr("GMSH_SIMPLE") << tr("GMSH_BLOSSOM") << tr("GMSH_SIMPLE_FULL_QUADS") << tr("GMSH_BLOSSOM_FULL_QUADS");
#else
- typesRecomb2DAlgo << tr( "GMSH_STANDARD" ) << tr( "GMSH_BLOSSOM" );
+ typesRecomb2DAlgo << tr("GMSH_STANDARD") << tr("GMSH_BLOSSOM");
#endif
- myRecomb2DAlgo->addItems( typesRecomb2DAlgo );
- aGroupLayout->addWidget( myRecomb2DAlgo, row, 1 );
- row++;
-
+ myRecomb2DAlgo->addItems(typesRecomb2DAlgo);
+ aGroupLayout->addWidget(myRecomb2DAlgo, row, 1);
+ row++;
+ }
myRecombineAll = new QCheckBox( tr( "GMSH_RECOMBINE_ALL" ), GroupC1 );
aGroupLayout->addWidget( myRecombineAll, row, 0 );
row++;
- aGroupLayout->addWidget( new QLabel( tr( "GMSH_SUBDIV_ALGO" ), GroupC1 ), row, 0 );
- mySubdivAlgo = new QComboBox( GroupC1 );
+ mySubdivAlgo = 0;
+
+ aGroupLayout->addWidget(new QLabel(tr("GMSH_SUBDIV_ALGO"), GroupC1), row, 0);
+ mySubdivAlgo = new QComboBox(GroupC1);
QStringList typesSubdivAlgo;
- typesSubdivAlgo << tr( "GMSH_NONE" ) << tr( "GMSH_ALL_QUADS" ) << tr( "GMSH_ALL_HEXAS" );
- mySubdivAlgo->addItems( typesSubdivAlgo );
- aGroupLayout->addWidget( mySubdivAlgo, row, 1 );
+ typesSubdivAlgo << tr("GMSH_NONE") << tr("GMSH_ALL_QUADS") << tr("GMSH_ALL_HEXAS");
+ mySubdivAlgo->addItems(typesSubdivAlgo);
+ aGroupLayout->addWidget(mySubdivAlgo, row, 1);
row++;
- aGroupLayout->addWidget( new QLabel( tr( "GMSH_REMESH_ALGO" ), GroupC1 ), row, 0 );
- myRemeshAlgo = new QComboBox( GroupC1 );
- QStringList typesRemeshAlgo;
- typesRemeshAlgo << tr( "GMSH_NO_SPLIT" ) << tr( "GMSH_AUTO" ) << tr( "GMSH_AUTO_ONLY_WITH_METIS" );
- myRemeshAlgo->addItems( typesRemeshAlgo );
- aGroupLayout->addWidget( myRemeshAlgo, row, 1 );
- row++;
+ myRemeshAlgo = 0;
+ myRemeshPara = 0;
+ if (!myIs3D)
+ {
+ aGroupLayout->addWidget(new QLabel(tr("GMSH_REMESH_ALGO"), GroupC1), row, 0);
+ myRemeshAlgo = new QComboBox(GroupC1);
+ QStringList typesRemeshAlgo;
+ typesRemeshAlgo << tr("GMSH_NO_SPLIT") << tr("GMSH_AUTO") << tr("GMSH_AUTO_ONLY_WITH_METIS");
+ myRemeshAlgo->addItems(typesRemeshAlgo);
+ aGroupLayout->addWidget(myRemeshAlgo, row, 1);
+ row++;
- aGroupLayout->addWidget( new QLabel( tr( "GMSH_REMESH_PARA" ), GroupC1 ), row, 0 );
- myRemeshPara = new QComboBox( GroupC1 );
- QStringList typesRemeshPara;
- typesRemeshPara << tr( "GMSH_HARMONIC" ) << tr( "GMSH_CONFORMAL" ) << tr( "GMSH_RBF_HARMONIC" );
- myRemeshPara->addItems( typesRemeshPara );
- aGroupLayout->addWidget( myRemeshPara, row, 1 );
- row++;
+ aGroupLayout->addWidget(new QLabel(tr("GMSH_REMESH_PARA"), GroupC1), row, 0);
+ myRemeshPara = new QComboBox(GroupC1);
+ QStringList typesRemeshPara;
+ typesRemeshPara << tr("GMSH_HARMONIC") << tr("GMSH_CONFORMAL") << tr("GMSH_RBF_HARMONIC");
+ myRemeshPara->addItems(typesRemeshPara);
+ aGroupLayout->addWidget(myRemeshPara, row, 1);
+ row++;
+ }
aGroupLayout->addWidget( new QLabel( tr( "GMSH_SMOOTHING_STEPS" ), GroupC1 ), row, 0 );
mySmouthSteps = new SMESHGUI_SpinBox( GroupC1 );
aGroupLayout->addWidget( mySizeFactor, row, 1 );
row++;
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ aGroupLayout->addWidget( new QLabel( tr( "GMSH_SIZE_FROM_CURVATURE" ), GroupC1 ), row, 0 );
+ myMeshCurvatureSize = new SMESHGUI_SpinBox( GroupC1 );
+ myMeshCurvatureSize->RangeStepAndValidator( 0.0, 1e+22, 1.0, "length_precision" );
+ aGroupLayout->addWidget( myMeshCurvatureSize, row, 1 );
+ row++;
+#endif
+
aGroupLayout->addWidget( new QLabel( tr( "GMSH_MIN_SIZE" ), GroupC1 ), row, 0 );
myMinSize = new SMESHGUI_SpinBox( GroupC1 );
myMinSize->RangeStepAndValidator( 0.0, 1e+22, 1., "length_precision" );
connect( mySecondOrder, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
// Compounds
- QWidget* compoundGroup = new QWidget();
- tab->insertTab(1, compoundGroup, tr("GMSH_COMPOUND"));
-
- myCompoundTable = new QTableWidget(0, 2, compoundGroup);
- QGridLayout* compoundLayout = new QGridLayout(compoundGroup);
- compoundLayout->addWidget(myCompoundTable, 1, 0, 8, 1);
-
- QStringList compoundHeaders;
- compoundHeaders << tr( "GMSH_COMPOUND_ENTRY_COLUMN" ) << tr( "GMSH_COMPOUND_NAME_COLUMN" );
- myCompoundTable->setHorizontalHeaderLabels(compoundHeaders);
- myCompoundTable->horizontalHeader()->hideSection(0);
- myCompoundTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
- myCompoundTable->resizeColumnToContents(1);
- myCompoundTable->setAlternatingRowColors(true);
- myCompoundTable->verticalHeader()->hide();
-
- QPushButton* addCompoundButton = new QPushButton(tr("GMSH_COMPOUND_ADD"), compoundGroup);
- compoundLayout->addWidget(addCompoundButton, 1, 1, 1, 1);
- QFrame *line2 = new QFrame(compoundGroup);
+ if (!myIs3D)
+ {
+ QWidget* compoundGroup = new QWidget();
+ tab->insertTab(1, compoundGroup, tr("GMSH_COMPOUND"));
+
+ myCompoundTable = new QTableWidget(0, 2, compoundGroup);
+ QGridLayout* compoundLayout = new QGridLayout(compoundGroup);
+ compoundLayout->addWidget(myCompoundTable, 1, 0, 8, 1);
+
+ QStringList compoundHeaders;
+ compoundHeaders << tr("GMSH_COMPOUND_ENTRY_COLUMN") << tr("GMSH_COMPOUND_NAME_COLUMN");
+ myCompoundTable->setHorizontalHeaderLabels(compoundHeaders);
+ myCompoundTable->horizontalHeader()->hideSection(0);
+ myCompoundTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+ myCompoundTable->resizeColumnToContents(1);
+ myCompoundTable->setAlternatingRowColors(true);
+ myCompoundTable->verticalHeader()->hide();
- line2->setFrameShape(QFrame::HLine);
- line2->setFrameShadow(QFrame::Sunken);
- compoundLayout->addWidget(line2, 2, 1, 1, 1);
+ QPushButton* addCompoundButton = new QPushButton(tr("GMSH_COMPOUND_ADD"), compoundGroup);
+ compoundLayout->addWidget(addCompoundButton, 1, 1, 1, 1);
+ QFrame *line2 = new QFrame(compoundGroup);
- QPushButton* removeButton = new QPushButton(tr("GMSH_COMPOUND_REMOVE"), compoundGroup);
- compoundLayout->addWidget(removeButton, 3, 1, 1, 1);
+ line2->setFrameShape(QFrame::HLine);
+ line2->setFrameShadow(QFrame::Sunken);
+ compoundLayout->addWidget(line2, 2, 1, 1, 1);
- connect( addCompoundButton, SIGNAL(clicked()), this, SLOT(onAddCompound()));
- connect( removeButton, SIGNAL(clicked()), this, SLOT(onRemoveCompound()));
+ QPushButton* removeButton = new QPushButton(tr("GMSH_COMPOUND_REMOVE"), compoundGroup);
+ compoundLayout->addWidget(removeButton, 3, 1, 1, 1);
+ connect(addCompoundButton, SIGNAL(clicked()), this, SLOT(onAddCompound()));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(onRemoveCompound()));
+ }
return fr;
}
if( myName )
myName->setText( data.myName );
- my2DAlgo->setCurrentIndex( data.my2DAlgo );
+ if (!myIs3D)
+ my2DAlgo->setCurrentIndex( data.my2DAlgo );
if ( !myIs2D )
my3DAlgo->setCurrentIndex( data.my3DAlgo );
- myRecomb2DAlgo->setCurrentIndex( data.myRecomb2DAlgo );
+ if(!myIs3D)
+ myRecomb2DAlgo->setCurrentIndex( data.myRecomb2DAlgo );
if ( myRecombineAll )
myRecombineAll->setChecked( data.myRecombineAll );
if ( mySubdivAlgo )
mySubdivAlgo->setCurrentIndex( data.mySubdivAlgo );
- myRemeshAlgo->setCurrentIndex( data.myRemeshAlgo);
- myRemeshPara->setCurrentIndex( data.myRemeshPara);
+ if (!myIs3D)
+ {
+ myRemeshAlgo->setCurrentIndex(data.myRemeshAlgo);
+ myRemeshPara->setCurrentIndex(data.myRemeshPara);
+ }
if(data.mySmouthStepsVar.isEmpty())
mySmouthSteps->setValue( data.mySmouthSteps );
else
mySizeFactor->setValue( data.mySizeFactor );
else
mySizeFactor->setText( data.mySizeFactorVar );
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ if(data.myMeshCurvatureSizeVar.isEmpty())
+ myMeshCurvatureSize->setValue( data.myMeshCurvatureSize );
+ else
+ myMeshCurvatureSize->setText( data.myMeshCurvatureSizeVar );
+#endif
if(data.myMaxSizeVar.isEmpty())
myMaxSize->setValue( data.myMaxSize );
else
GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
that->updateWidgets();
- GeomSelectionTools* geomSelectionTools = that->getGeomSelectionTools();
- for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
+ if (!myIs3D)
{
- const QString entry = *i;
- std::string shapeName = geomSelectionTools->getNameFromEntry(entry.toStdString());
- int row = myCompoundTable->rowCount();
- myCompoundTable->setRowCount(row+1);
- myCompoundTable->setItem(row, 0, new QTableWidgetItem(entry));
- myCompoundTable->item(row, 0)->setFlags(0);
- myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName)));
- myCompoundTable->item(row, 1)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
+ GeomSelectionTools* geomSelectionTools = that->getGeomSelectionTools();
+ for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
+ {
+ const QString entry = *i;
+ std::string shapeName = geomSelectionTools->getNameFromEntry(entry.toStdString());
+ int row = myCompoundTable->rowCount();
+ myCompoundTable->setRowCount(row + 1);
+ myCompoundTable->setItem(row, 0, new QTableWidgetItem(entry));
+ myCompoundTable->item(row, 0)->setFlags(0);
+ myCompoundTable->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(shapeName)));
+ myCompoundTable->item(row, 1)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ }
+ myCompoundTable->resizeColumnToContents(1);
}
- myCompoundTable->resizeColumnToContents(1);
}
QString GMSHPluginGUI_HypothesisCreator::storeParams() const
QString valStr = tr("GMSH_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; ";
valStr += tr("GMSH_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; ";
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ valStr += tr("GMSH_SIZE_FROM_CURVATURE") + " = " + QString::number( data.myMeshCurvatureSize ) + "; ";
+#endif
if ( data.mySecondOrder )
valStr += tr("GMSH_SECOND_ORDER") + "; ";
h_data.myRemeshPara = (int) h->GetRemeshPara();
h_data.mySmouthSteps = h->GetSmouthSteps();
h_data.mySizeFactor = h->GetSizeFactor();
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ h_data.myMeshCurvatureSize = h->GetMeshCurvatureSize();
+ h_data.myMeshCurvatureSizeVar = getVariableName("SetMeshCurvatureSize");
+#endif
h_data.myMinSize = h->GetMinSize();
h_data.myMaxSize = h->GetMaxSize();
h_data.mySmouthStepsVar = getVariableName("SmouthSteps");
{
if( isCreation() )
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
-
- h->Set2DAlgo( h_data.my2DAlgo );
+ if( !myIs3D )
+ h->Set2DAlgo( h_data.my2DAlgo );
if ( !myIs2D )
h->Set3DAlgo( h_data.my3DAlgo );
- h->SetRecomb2DAlgo( h_data.myRecomb2DAlgo );
+ if (!myIs3D)
+ h->SetRecomb2DAlgo( h_data.myRecomb2DAlgo );
h->SetRecombineAll( h_data.myRecombineAll );
h->SetSubdivAlgo( h_data.mySubdivAlgo );
- h->SetRemeshAlgo( h_data.myRemeshAlgo );
- h->SetRemeshPara( h_data.myRemeshPara );
+ if (!myIs3D)
+ {
+ h->SetRemeshAlgo(h_data.myRemeshAlgo);
+ h->SetRemeshPara(h_data.myRemeshPara);
+ }
h->SetSmouthSteps( h_data.mySmouthSteps );
h->SetSizeFactor( h_data.mySizeFactor );
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ h->SetMeshCurvatureSize( h_data.myMeshCurvatureSize );
+#endif
h->SetMinSize( h_data.myMinSize );
h->SetMaxSize( h_data.myMaxSize );
h->SetVarParameter( h_data.mySmouthStepsVar.toLatin1().constData(), "SmouthSteps");
h->SetVarParameter( h_data.mySizeFactorVar.toLatin1().constData(), "SizeFactor");
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ h->SetVarParameter( h_data.myMeshCurvatureSizeVar.toLatin1().constData(), "SetMeshCurvatureSize");
+#endif
h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize");
h->SetSecondOrder( h_data.mySecondOrder );
bool GMSHPluginGUI_HypothesisCreator::readParamsFromWidgets( GmshHypothesisData& h_data ) const
{
h_data.myName = myName ? myName->text() : "";
- h_data.my2DAlgo = my2DAlgo->currentIndex();
+ if(my2DAlgo)
+ h_data.my2DAlgo = my2DAlgo->currentIndex();
if (my3DAlgo)
h_data.my3DAlgo = my3DAlgo->currentIndex();
- h_data.myRecomb2DAlgo = myRecomb2DAlgo->currentIndex();
+ if(myRecomb2DAlgo)
+ h_data.myRecomb2DAlgo = myRecomb2DAlgo->currentIndex();
h_data.myRecombineAll = myRecombineAll->isChecked();
h_data.mySubdivAlgo = mySubdivAlgo->currentIndex();
- h_data.myRemeshAlgo = myRemeshAlgo->currentIndex();
- h_data.myRemeshPara = myRemeshPara->currentIndex();
+ if(myRemeshAlgo)
+ h_data.myRemeshAlgo = myRemeshAlgo->currentIndex();
+ if(myRemeshPara)
+ h_data.myRemeshPara = myRemeshPara->currentIndex();
h_data.mySmouthSteps = mySmouthSteps->value();
h_data.mySizeFactor = mySizeFactor->value();
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=10
+ h_data.myMeshCurvatureSize = myMeshCurvatureSize->value();
+ h_data.myMeshCurvatureSizeVar = myMeshCurvatureSize->text();
+#endif
h_data.myMinSize = myMinSize->value();
h_data.myMaxSize = myMaxSize->value();
h_data.mySmouthStepsVar = mySmouthSteps->text();