//*/
std::map <int,double> mapAlgo2d;
- mapAlgo2d[0]=2; mapAlgo2d[1]=1; mapAlgo2d[2]=5; mapAlgo2d[3]=6; mapAlgo2d[4]=8; mapAlgo2d[5]=9;
+ mapAlgo2d[0]=2; // Automatic
+ mapAlgo2d[1]=1; // MeshAdapt
+ mapAlgo2d[2]=5; // Delaunay
+ mapAlgo2d[3]=6; // Frontal-Delaunay
+ mapAlgo2d[4]=8; // DelQuad (Frontal-Delaunay for Quads)
+ mapAlgo2d[5]=9; // Packing of parallelograms
+
std::map <int,double> mapAlgo3d;
- mapAlgo3d[0]=1; mapAlgo3d[1]=4; mapAlgo3d[2]=5; mapAlgo3d[3]=6; mapAlgo3d[4]=7; mapAlgo3d[5]=9;
+ mapAlgo3d[0]=1; // Delaunay
+ mapAlgo3d[1]=4; // Frontal
+ mapAlgo3d[2]=7; // MMG3D
+ mapAlgo3d[3]=9; // R-tree
int ok;
ok = GmshSetOption("Mesh", "Algorithm" , mapAlgo2d[_algo2d]) ;
ASSERT(ok);
if ( !_is2d)
{
- ok = GmshSetOption("Mesh", "Algorithm3D" , mapAlgo2d[_algo3d]) ;
+ ok = GmshSetOption("Mesh", "Algorithm3D" , mapAlgo3d[_algo3d]) ;
ASSERT(ok);
}
ok = GmshSetOption("Mesh", "RecombinationAlgorithm" , (double)_recomb2DAlgo) ;
OCC_Internals* occgeo = _gModel->getOCCInternals();
bool toSynchronize = false;
-
+
for(std::set<std::string>::const_iterator its = _compounds.begin();its != _compounds.end(); ++its )
{
GEOM::GEOM_Object_var aGeomObj;
}
}
+//================================================================================
+/*!
+ * \brief For a compound mesh set the mesh components to be transmitted to SMESH
+ */
+//================================================================================
+
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
+void GMSHPlugin_Mesher::SetCompoundMeshVisibility()
+{
+
+ // Loop over all faces, if the face belongs to a compound entry then
+ // for all (boundary) edges whithin the face visibility is set to 0,
+ // if the face doesn't belong to a compound entry then visibility is
+ // set to 1 for all its (boundary) edges. Later, in FillSMesh() func
+ // getVisibility() (returns either 1 or 0) is used to decide weather
+ // the mesh of edge should be transmitted to SMESH or not.
+
+ for ( GModel::fiter itF = _gModel->firstFace(); itF != _gModel->lastFace(); ++itF )
+ {
+ std::vector< GEdge *> faceEdges = (*itF)->edges();
+
+ for ( auto itE = faceEdges.begin(); itE != faceEdges.end(); ++itE )
+ {
+ if ( ((*itF)->compound.size()) )
+ (*itE)->setVisibility(0);
+ else
+ (*itE)->setVisibility(1);
+ }
+ }
+
+
+ // Loop over all edges, if the edge belongs to a compound entry then
+ // for all (boundary) vertices whithin the edge visibility is set to
+ // 0, if the edge doesn't belong to a compound entry then visibility
+ // is set to 1 for all its (boundary) vertices. Later, in FillSMesh()
+ // func getVisibility() (returns either 1 or 0) is used to decide we-
+ // ather the mesh of vertices should be transmitted to SMESH or not.
+
+ for ( GModel::eiter itE = _gModel->firstEdge(); itE != _gModel->lastEdge(); ++itE )
+ {
+ std::vector<GVertex *> bndVerticies = (*itE)->vertices();
+
+ for( auto itV = bndVerticies.begin(); itV != bndVerticies.end(); ++itV )
+ {
+ if(((*itE)->compound.size()))
+ (*itV)->setVisibility(0);
+ else
+ (*itV)->setVisibility(1);
+ }
+ }
+
+}
+#endif
+
//================================================================================
/*!
* \brief Write mesh from GModel instance to SMESH instance
// meshDS->SetMeshElementOnShape(zeroDElement, topoVertex);
// }
}
-
+
// ADD 1D ELEMENTS
for(GModel::eiter it = _gModel->firstEdge(); it != _gModel->lastEdge(); ++it)
{
GEdge *gEdge = *it;
-
+
// GET topoEdge CORRESPONDING TO gEdge
TopoDS_Edge topoEdge;
std::vector< ShapeBounds > topoEdges;
TopoDS_Solid topoSolid = *((TopoDS_Solid*)gRegion->getNativePtr());
// FILL SMESH FOR topoSolid
-
+
//nodes
for(unsigned int i = 0; i < gRegion->mesh_vertices.size(); i++)
{
meshDS->SetNodeInVolume( node, topoSolid );
}
}
-
+
//elements
std::vector<MVertex*> verts;
for(unsigned int i = 0; i < gRegion->getNumMeshElements(); i++)
meshDS->SetMeshElementOnShape(volume, topoSolid);
}
}
-
+
//return 0;
}
{
SPoint3 min = bounds.min();
SPoint3 max = bounds.max();
-
+
float x,y,z;
-
+
if (point.x() < min.x())
x = min.x()-point.x();
else if (point.x() > max.x())
x = point.x()-max.x();
else
x = 0.;
-
+
if (point.y() < min.y())
y = min.y()-point.y();
else if (point.y() > max.y())
y = point.y()-max.y();
else
y = 0.;
-
+
if (point.z() < min.z())
z = min.z()-point.z();
else if (point.z() > max.z())
z = point.z()-max.z();
else
z = 0.;
-
+
return x*x+y*y+z*z;
}
//================================================================================
{
//MESSAGE("level="<< level.c_str() << ", msg=" << msg.c_str()<< "\n");
printf("level=%s msg=%s\n", level.c_str(), msg.c_str());
-
+
if(level == "Fatal" || level == "Error")
{
std::ostringstream oss;
//comment << SMESH_Comment(oss.str);
//std::string str = oss.str();
//smError.reset( new SMESH_ComputeError( str ));
-
+
// plutot que de faire de la merde ici, on pourait simplement
// remplir une liste pour dire sur quelles entités gmsh se plante
// (puis faire le fillsmesh)
bool GMSHPlugin_Mesher::Compute()
{
MESSAGE("GMSHPlugin_Mesher::Compute");
-
+
int err = 0;
-
+
GmshInitialize();
SetGmshOptions();
_gModel = new GModel();
err = 1;
MESSAGE("Unrecoverable error during Generation of Gmsh Mesh");
}
-
+
if (!err)
{
#if GMSH_MAJOR_VERSION < 4
if (_compounds.size() > 0) _gModel->setCompoundVisibility();
+#endif
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
+ if (_compounds.size() > 0)
+ SetCompoundMeshVisibility();
#endif
FillSMesh();
}
enum Algo3D
{
+ delaunay3,
frontal3,
- frontaldelaunay,
- fontalhex,
mmg3d,
rtree
};
lay->addWidget( tab );
QWidget* GroupC1 = new QWidget();
tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" ) );
-
+
QGridLayout* aGroupLayout = new QGridLayout( GroupC1 );
aGroupLayout->setSpacing( 6 );
aGroupLayout->setMargin( 11 );
-
+
int row = 0;
myName = 0;
if( isCreation() )
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_FRONTAL_DELAUNAY" ) << tr( "GMSH_FRONTAL_HEX" ) << tr( "GMSH_MMG3D" ) <<
- tr( "GMSH_R_TREE" );
+ types3DAlgo << tr("GMSH_DELAUNAY3") << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_MMG3D" ) <<
+ tr( "GMSH_R_TREE" );
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->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 );
QStringList typesSubdivAlgo;
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;
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;
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 );
mySmouthSteps->RangeStepAndValidator( 1, 1000, 1, "length_precision" );
mySizeFactor->RangeStepAndValidator( 1e-06, 1e+06, 0.1, "length_precision" );
aGroupLayout->addWidget( mySizeFactor, row, 1 );
row++;
-
+
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" );
aGroupLayout->addWidget( myMinSize, row, 1 );
row++;
-
+
aGroupLayout->addWidget( new QLabel( tr( "GMSH_MAX_SIZE" ), GroupC1 ), row, 0 );
myMaxSize = new SMESHGUI_SpinBox( GroupC1 );
myMaxSize->RangeStepAndValidator( 0.0, 1e+22, 1e+21, "length_precision" );
aGroupLayout->addWidget( myMaxSize, row, 1 );
row++;
-
+
mySecondOrder = new QCheckBox( tr( "GMSH_SECOND_ORDER" ), GroupC1 );
aGroupLayout->addWidget( mySecondOrder, row, 0 );
-
+
myUseIncomplElem = new QCheckBox( tr( "GMSH_USE_INCOMPLETE_ELEMENT" ), GroupC1 );
aGroupLayout->addWidget( myUseIncomplElem, row, 1 );
row++;
-
+
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->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);
-
+
line2->setFrameShape(QFrame::HLine);
line2->setFrameShadow(QFrame::Sunken);
compoundLayout->addWidget(line2, 2, 1, 1, 1);
-
+
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;
}
{
GmshHypothesisData data;
readParamsFromHypo( data );
-
+
if( myName )
myName->setText( data.myName );
my2DAlgo->setCurrentIndex( data.my2DAlgo );
mySecondOrder->setChecked( data.mySecondOrder );
if ( myUseIncomplElem )
myUseIncomplElem->setChecked( data.myUseIncomplElem );
-
+
GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
that->updateWidgets();
-
+
GeomSelectionTools* geomSelectionTools = that->getGeomSelectionTools();
for (QSet<QString>::const_iterator i = myCompoundSet.begin(); i != myCompoundSet.end(); ++i)
{
GmshHypothesisData data;
readParamsFromWidgets( data );
storeParamsToHypo( data );
-
+
QString valStr = tr("GMSH_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; ";
valStr += tr("GMSH_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; ";
if ( data.mySecondOrder )
valStr += tr("GMSH_SECOND_ORDER") + "; ";
-
+
return valStr;
}
HypothesisData* data = SMESH::GetHypothesisData( hypType() );
h_data.myName = isCreation() && data ? data->Label : "";
-
+
h_data.my2DAlgo = (int) h->Get2DAlgo();
if ( !myIs2D )
h_data.my3DAlgo = (int) h->Get3DAlgo();
h_data.myMaxSizeVar = getVariableName("SetMaxSize");
h_data.mySecondOrder = h->GetSecondOrder();
h_data.myUseIncomplElem = h->GetUseIncomplElem();
-
+
GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;
GMSHPlugin::string_array_var myEntries = h->GetCompoundOnEntries();
for ( CORBA::ULong i=0 ; i<myEntries->length() ; i++ )
QString entry = myEntries[i].in();
that->myCompoundSet.insert(entry);
}
-
+
return true;
}
h_data.myMaxSizeVar = myMaxSize->text();
h_data.mySecondOrder = mySecondOrder->isChecked();
h_data.myUseIncomplElem = myUseIncomplElem->isChecked();
-
+
// ne semble pas utile dans la mesure ou myCompoundSet n'a pas besoin d'etre modifier
/*
GMSHPluginGUI_HypothesisCreator* that = (GMSHPluginGUI_HypothesisCreator*)this;