From: eap Date: Tue, 20 Dec 2016 12:43:13 +0000 (+0300) Subject: IMP23371: [CEA 1441] Define the faces where we impose the boundary layer from the... X-Git-Tag: V8_3_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0b67c2b63e6abfd764031232f80dc3fe26231a9e;p=plugins%2Fhybridplugin.git IMP23371: [CEA 1441] Define the faces where we impose the boundary layer from the dialog box of MG-Hybrid --- diff --git a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png index 956ade5..0891faa 100644 Binary files a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png differ diff --git a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png index a3a67c0..d6c2c43 100644 Binary files a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png differ diff --git a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png new file mode 100644 index 0000000..7f0a84f Binary files /dev/null and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png differ diff --git a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png index aca9fdc..736847f 100644 Binary files a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png differ diff --git a/doc/salome/gui/HYBRIDPLUGIN/input/hybrid_hypo.doc b/doc/salome/gui/HYBRIDPLUGIN/input/hybrid_hypo.doc index 77e5b8e..71ada99 100644 --- a/doc/salome/gui/HYBRIDPLUGIN/input/hybrid_hypo.doc +++ b/doc/salome/gui/HYBRIDPLUGIN/input/hybrid_hypo.doc @@ -198,8 +198,6 @@ MG-HYBRID USAGE EMail: ) \endverbatim -\n -- Limitations - Some of the MG-Hybrid parameters can not be changed in SALOME and are set to their default values. The parameters concerned are the following : global_physical_size, boundary_layer_size_mode, boundary_layer_initial_height_on_surface_tags, boundary_layer_max_element_angle and optimisation. \ref hybrid_top "Back to top" @@ -258,6 +256,20 @@ Pay attention: theses groups should be defined into the shell mesh from a previous group defined in the geometry. +\ref hybrid_top "Back to top" + +\section hybrid_layers_faces Faces with layers + +\image html hybrid_hypothesis_faces.png + +In case of a mesh based on geometry, if Mesh layers on all wrap +on Layers meshes tab is unchecked, you can specify geometrical +faces on which boundary layers should be constructed. After clicking +\a Selection button (arrow) you can select faces either in the +Viewer or in the Object Browser. \b Add button adds IDs of the +selected faces to the Face IDs list. \b Remove button removes +selected IDs from the list. +
See Also a sample TUI Script of the \ref tui_hybrid "creation of a MG-Hybrid hypothesis". \ref hybrid_top "Back to top" diff --git a/idl/HYBRIDPlugin_Algorithm.idl b/idl/HYBRIDPlugin_Algorithm.idl index 7f6233a..9732ad5 100644 --- a/idl/HYBRIDPlugin_Algorithm.idl +++ b/idl/HYBRIDPlugin_Algorithm.idl @@ -78,6 +78,11 @@ module HYBRIDPlugin */ void SetLayersOnAllWrap(in boolean toMesh); boolean GetLayersOnAllWrap(); + /*! + * To mesh layers on given faces. + */ + void SetFacesWithLayers(in SMESH::long_array faceIDs); + SMESH::long_array GetFacesWithLayers(); /*! * To make groups of volumes of different domains when mesh is generated from skin. * Default is to make groups. diff --git a/src/GUI/HYBRIDPluginGUI_Enums.h b/src/GUI/HYBRIDPluginGUI_Enums.h index 8b2bf77..c351ed3 100644 --- a/src/GUI/HYBRIDPluginGUI_Enums.h +++ b/src/GUI/HYBRIDPluginGUI_Enums.h @@ -29,8 +29,8 @@ enum { STD_TAB = 0, ADV_TAB, - ENF_VER_TAB, - ENF_MESH_TAB + ENF_MESH_TAB, + FACE_SEL_TAB }; // Enforced vertices array columns diff --git a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx index 5b50e17..f34c87e 100644 --- a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx @@ -28,12 +28,13 @@ #include -#include -#include #include +#include +#include #include #include #include +#include #include #include @@ -414,7 +415,7 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame() aStdLayout->addWidget( myBoundaryLayersGrowthCombo, row++, 1, 1, 1 ); QStringList typesBoundaryLayersGrowth; - typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_UPWARD" ) << tr( "HYBRID_LAYER_GROWTH_DOWNWARD" ); + typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_DOWNWARD" ) << tr( "HYBRID_LAYER_GROWTH_UPWARD" ); myBoundaryLayersGrowthCombo->addItems( typesBoundaryLayersGrowth ); aStdLayout->addWidget( new QLabel( tr( "HYBRID_HeightFirstLayer" ), myStdGroup ), row, 0, 1, 1 ); @@ -682,16 +683,35 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame() anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH+1, 1, ENF_MESH_NB_LINES, 1); anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10); - + + // selection of faces + + QWidget* faceSelGroup = new QWidget( dlg() ); + QGridLayout* faceSelLayout = new QGridLayout( faceSelGroup ); + + QLabel* facesLbl = new QLabel( tr("HYBRID_FACE_IDS"), faceSelGroup ); + faceSelLayout->addWidget( facesLbl, 0, 0 ); + + myFaceSelector = new StdMeshersGUI_SubShapeSelectorWdg( faceSelGroup, TopAbs_FACE, true, true ); + QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + myFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry ); + faceSelLayout->addWidget( myFaceSelector, 1, 0, 2, 2 ); + faceSelLayout->setRowStretch( 1, 10); + + // add tabs tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) ); tab->insertTab( ADV_TAB, myAdvGroup, tr( "HYBRID_ADV_ARGS" ) ); - //TODO remove or er usmay be lateful to select layers... - //tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "HYBRID_ENFORCED_VERTICES" ) ); tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "HYBRID_ENFORCED_MESHES" ) ); + if ( aMainEntry.isEmpty() && aSubEntry.isEmpty() ) // mesh not based of geometry + faceSelGroup->hide(); + else + tab->insertTab( FACE_SEL_TAB, faceSelGroup, tr( "HYBRID_FACES_TAB" )); tab->setCurrentIndex( STD_TAB ); // connections + connect( tab, SIGNAL( currentChanged ( int )), this, SLOT( onTabChanged( int ) ) ); //connect( myLayersOnAllWrapCheck, SIGNAL( toggled( bool ) ), this, SLOT( onLayersOnAllWrap(bool))); connect( myLayersOnAllWrapCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); //connect( myToMeshHolesCheck, SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool))); @@ -794,7 +814,6 @@ This method updates the tooltip of a modified item. The QLineEdit widgets conten is synchronized with the coordinates of the enforced vertex clicked in the tree widget. */ void HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) { -// MESSAGE("HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues"); int row = myEnforcedTableWidget->row(item); QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole); @@ -825,7 +844,6 @@ void HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetI if (!groupName.isEmpty()) toolTip += QString(" [") + groupName + QString("]"); -// MESSAGE("Tooltip: " << toolTip.toStdString()); for (int col=0;colitem(row,col)->setToolTip(toolTip); @@ -966,7 +984,6 @@ This method adds in the tree widget an enforced mesh from mesh, submesh or group */ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName) { - MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")"); bool okToCreate = true; QString itemEntry = ""; int itemElementType = 0; @@ -974,23 +991,19 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s bool allColumns = true; for (int row = 0;row(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) { allColumns = false; - MESSAGE("allColumns = false"); break; } } else if (myEnforcedMeshTableWidget->item(row, col) == 0) { allColumns = false; - MESSAGE("allColumns = false"); break; } if (col == ENF_MESH_CONSTRAINT_COLUMN) { QComboBox* itemComboBox = qobject_cast(myEnforcedMeshTableWidget->cellWidget(row, col)); itemElementType = itemComboBox->currentIndex(); - MESSAGE("itemElementType: " << itemElementType); } else if (col == ENF_MESH_ENTRY_COLUMN) itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString(); @@ -1002,7 +1015,6 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) { // // update group name // if (itemGroupName.toStdString() != groupName) { -// MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\""); // myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str())); // } okToCreate = false; @@ -1014,13 +1026,11 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s if (!okToCreate) return; - MESSAGE("Creation of enforced mesh"); myEnforcedMeshTableWidget->setRowCount(rowCount+1); myEnforcedMeshTableWidget->setSortingEnabled(false); for (int col=0;colpalette(); @@ -1029,7 +1039,6 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s comboBox->insertItems(0,myEnfMeshConstraintLabels); comboBox->setEditable(false); comboBox->setCurrentIndex(elementType); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString()); myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox); } else { @@ -1039,25 +1048,21 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s case ENF_MESH_NAME_COLUMN: item->setData( 0, name.c_str() ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedMeshTableWidget->setItem(rowCount,col,item); break; case ENF_MESH_ENTRY_COLUMN: item->setData( 0, entry.c_str() ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedMeshTableWidget->setItem(rowCount,col,item); break; case ENF_MESH_GROUP_COLUMN: item->setData( 0, groupName.c_str() ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedMeshTableWidget->setItem(rowCount,col,item); break; default: break; } } - MESSAGE("Done"); } // connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) ); @@ -1073,7 +1078,6 @@ This method adds in the tree widget an enforced vertex with given size and coord */ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound) { - MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")"); myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *))); bool okToCreate = true; double itemX,itemY,itemZ,itemSize = 0; @@ -1127,12 +1131,10 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) { // update size if (itemSize != size) { - MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\""); myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size)); } // update group name if (itemGroupName.toStdString() != groupName) { - MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\""); myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str())); } okToCreate = false; @@ -1141,19 +1143,15 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do } // for if (!okToCreate) { if (geomEntry.empty()) { - MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again"); } else { - MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again"); } return; } if (geomEntry.empty()) { - MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created"); } else { - MESSAGE("Vertex with geom entry " << geomEntry << " is created"); } int vertexIndex=0; @@ -1175,11 +1173,9 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do } } - MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\""); myEnforcedTableWidget->setRowCount(rowCount+1); myEnforcedTableWidget->setSortingEnabled(false); for (int col=0;colsetFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); switch (col) { @@ -1223,9 +1219,7 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do break; } - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedTableWidget->setItem(rowCount,col,item); - MESSAGE("Done"); } connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) ); @@ -1240,7 +1234,6 @@ This method is called when a item is added into the enforced meshes tree widget */ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh() { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()"); HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this; @@ -1268,11 +1261,9 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh() _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil; QString meshEntry = myEnfMeshWdg->GetValue(); - MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString()); if (selEnfMeshes == 1) { - MESSAGE("1 SMESH object selected"); // myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >(); // std::string entry = myEnfMeshWdg->GetValue(); aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str()); @@ -1284,7 +1275,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh() } else { - MESSAGE(selEnfMeshes << " SMESH objects selected"); QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts); QStringListIterator meshEntriesIt (meshEntries); while (meshEntriesIt.hasNext()) { @@ -1309,7 +1299,6 @@ This method is called when a item is added into the enforced vertices tree widge */ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex() { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()"); HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this; @@ -1336,7 +1325,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex() if (selEnfVertex <= 1) { - MESSAGE("0 or 1 GEOM object selected"); double x = 0, y = 0, z=0; if (myXCoord->GetString() != "") { x = myXCoord->GetValue(); @@ -1344,7 +1332,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex() z = myZCoord->GetValue(); } if (selEnfVertex == 1) { - MESSAGE("1 GEOM object selected"); myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(); std::string entry = ""; if (myEnfVertex != GEOM::GEOM_Object::_nil()) @@ -1352,8 +1339,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex() addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND); } else { - MESSAGE("0 GEOM object selected"); - MESSAGE("Coords: ("<removeRow(row ); } @@ -1435,7 +1419,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() it.toBack(); while ( it.hasPrevious() ) { row = it.previous(); - MESSAGE("delete row #"<< row); myEnforcedTableWidget->removeRow(row ); } @@ -1463,6 +1446,14 @@ void HYBRIDPluginGUI_HypothesisCreator::onDirBtnClicked() myAdvWidget->workingDirectoryLineEdit->setText( dir ); } +void HYBRIDPluginGUI_HypothesisCreator::onTabChanged( int ) +{ + myEnfVertexWdg->deactivateSelection(); + myEnfMeshWdg->deactivateSelection(); + myFaceSelector->ActivateSelection( false ); + myFaceSelector->ShowPreview( false ); +} + void HYBRIDPluginGUI_HypothesisCreator::updateWidgets() { //customs automatic set @@ -1485,12 +1476,12 @@ void HYBRIDPluginGUI_HypothesisCreator::updateWidgets() addEnfMeshButton->setEnabled(enabled); removeEnfMeshButton->setEnabled(enabled); myEnfMeshWdg->setEnabled(enabled); - //xxx->setEnabled(enabled); + if ( QTabWidget* tab = qobject_cast( myStdGroup->parentWidget()->parentWidget() )) + tab->setTabEnabled( FACE_SEL_TAB, enabled ); } bool HYBRIDPluginGUI_HypothesisCreator::checkParams(QString& msg) const { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::checkParams"); if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) { SUIT_MessageBox::warning( dlg(), @@ -1504,7 +1495,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::checkParams(QString& msg) const void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::retrieveParams"); HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this; HYBRIDHypothesisData data; readParamsFromHypo( data ); @@ -1522,15 +1512,16 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const myAdvWidget->initialMemorySpin ->setValue ( qMax( data.myInitialMemory, myAdvWidget->initialMemorySpin->minimum() )); - myCollisionModeCombo ->setCurrentIndex( data.myCollisionMode ); - myBoundaryLayersGrowthCombo ->setCurrentIndex( data.myBoundaryLayersGrowth ); - myElementGenerationCombo ->setCurrentIndex( data.myElementGeneration ); - myAddMultinormalsCheck -> setChecked ( data.myAddMultinormals ); - mySmoothNormalsCheck -> setChecked ( data.mySmoothNormals ); - myHeightFirstLayerSpin -> setValue( data.myHeightFirstLayer ); - myNbOfBoundaryLayersSpin -> setValue( data.myNbOfBoundaryLayers ); + myCollisionModeCombo ->setCurrentIndex( data.myCollisionMode ); + myBoundaryLayersGrowthCombo ->setCurrentIndex( data.myBoundaryLayersGrowth ); + myElementGenerationCombo ->setCurrentIndex( data.myElementGeneration ); + myAddMultinormalsCheck -> setChecked ( data.myAddMultinormals ); + mySmoothNormalsCheck -> setChecked ( data.mySmoothNormals ); + myHeightFirstLayerSpin -> setValue( data.myHeightFirstLayer ); + myNbOfBoundaryLayersSpin -> setValue( data.myNbOfBoundaryLayers ); myBoundaryLayersProgressionSpin -> setValue( data.myBoundaryLayersProgression ); - myMultinormalsAngleSpin -> setValue( data.myMultinormalsAngle ); + myMultinormalsAngleSpin -> setValue( data.myMultinormalsAngle ); + myFaceSelector ->SetListOfIDs( data.myFaceWLIds ); myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir ); myAdvWidget->keepWorkingFilesCheck ->setChecked( data.myKeepFiles ); @@ -1540,7 +1531,7 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const myAdvWidget->boundaryRecoveryCheck ->setChecked( data.myBoundaryRecovery ); myAdvWidget->FEMCorrectionCheck ->setChecked( data.myFEMCorrection ); myAdvWidget->gradationSpinBox ->setValue ( data.myGradation ); - myAdvWidget->myAdvOptionsTable ->SetCustomOptions( data.myTextOption ); + myAdvWidget->myAdvOptionsTable ->SetCustomOptions( data.myTextOption ); myAdvWidget->logInFileCheck ->setChecked( !data.myLogInStandardOutput ); myAdvWidget->removeLogOnSuccessCheck ->setChecked( data.myRemoveLogOnSuccess ); @@ -1555,8 +1546,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const myEnforcedTableWidget->setRowCount(rowCount+1); for (int col=0;colisCompound: " << enfVertex->isCompound); QTableWidgetItem* item = new QTableWidgetItem(); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); switch (col) { @@ -1568,50 +1557,41 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const else item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation))); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); } break; case ENF_VER_X_COLUMN: if (!enfVertex->isCompound) { item->setData( 0, enfVertex->coords.at(0) ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); } break; case ENF_VER_Y_COLUMN: if (!enfVertex->isCompound) { item->setData( 0, enfVertex->coords.at(1) ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); } break; case ENF_VER_Z_COLUMN: if (!enfVertex->isCompound) { item->setData( 0, enfVertex->coords.at(2) ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); } break; case ENF_VER_SIZE_COLUMN: item->setData( 0, enfVertex->size ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); break; case ENF_VER_ENTRY_COLUMN: item->setData( 0, enfVertex->geomEntry.c_str() ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); break; case ENF_VER_COMPOUND_COLUMN: item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable); item->setData( Qt::CheckStateRole, enfVertex->isCompound ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound); break; case ENF_VER_GROUP_COLUMN: item->setData( 0, enfVertex->groupName.c_str() ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); break; default: break; } myEnforcedTableWidget->setItem(rowCount,col,item); - MESSAGE("Done"); } that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN)); rowCount++; @@ -1635,7 +1615,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const myEnforcedMeshTableWidget->setRowCount(rowCount+1); for (int col=0;colpalette(); @@ -1644,7 +1623,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const comboBox->insertItems(0,myEnfMeshConstraintLabels); comboBox->setEditable(false); comboBox->setCurrentIndex(enfMesh->elementType); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString()); myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox); } else { @@ -1654,18 +1632,15 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const case ENF_MESH_NAME_COLUMN: item->setData( 0, enfMesh->name.c_str() ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedMeshTableWidget->setItem(rowCount,col,item); break; case ENF_MESH_ENTRY_COLUMN: item->setData( 0, enfMesh->entry.c_str() ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedMeshTableWidget->setItem(rowCount,col,item); break; case ENF_MESH_GROUP_COLUMN: item->setData( 0, enfMesh->groupName.c_str() ); - MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString()); myEnforcedMeshTableWidget->setItem(rowCount,col,item); break; default: @@ -1674,7 +1649,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const } // myEnforcedMeshTableWidget->setItem(rowCount,col,item); - MESSAGE("Done"); } // that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN)); rowCount++; @@ -1692,84 +1666,92 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const QString HYBRIDPluginGUI_HypothesisCreator::storeParams() const { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::storeParams"); - HYBRIDHypothesisData data; - readParamsFromWidgets( data ); - storeParamsToHypo( data ); - - QString valStr = ""; - - if ( !data.myBoundaryRecovery ) - valStr = "-c " + QString::number( !data.myToMeshHoles ); - - if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) { - const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" }; - valStr += " -o "; - valStr += level[ data.myOptimizationLevel ]; - } - if ( data.myMaximumMemory > 0 ) { - valStr += " -m "; - valStr += QString::number( data.myMaximumMemory ); - } - if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) { - valStr += " -M "; - valStr += QString::number( data.myInitialMemory ); - } - valStr += " -v "; - valStr += QString::number( data.myVerboseLevel ); - - if ( !data.myToCreateNewNodes ) - valStr += " -p0"; - - if ( data.myRemoveInitialCentralPoint ) - valStr += " -no_initial_central_point"; - - if ( data.myBoundaryRecovery ) - valStr += " -C"; - - if ( data.myFEMCorrection ) - valStr += " -FEM"; - - if ( data.myGradation != 1.05 ) { - valStr += " -Dcpropa="; - valStr += QString::number( data.myGradation ); - } - - valStr += " "; - valStr += data.myTextOption; - -// valStr += " #BEGIN ENFORCED VERTICES#"; -// // Add size map parameters storage -// for (int i=0 ; irowCount() ; i++) { -// valStr += " ("; -// double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble(); -// double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble(); -// double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble(); -// double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble(); -// valStr += QString::number( x ); -// valStr += ","; -// valStr += QString::number( y ); -// valStr += ","; -// valStr += QString::number( z ); -// valStr += ")="; -// valStr += QString::number( size ); -// if (i!=mySmpModel->rowCount()-1) -// valStr += ";"; -// } -// valStr += " #END ENFORCED VERTICES#"; -// MESSAGE(valStr.toStdString()); + HYBRIDHypothesisData data; + readParamsFromWidgets( data ); + storeParamsToHypo( data ); + + QString valStr = ""; + + if ( !data.myBoundaryRecovery ) + valStr = "-c " + QString::number( !data.myToMeshHoles ); + + if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) { + const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" }; + valStr += " -o "; + valStr += level[ data.myOptimizationLevel ]; + } + if ( data.myMaximumMemory > 0 ) { + valStr += " -m "; + valStr += QString::number( data.myMaximumMemory ); + } + if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) { + valStr += " -M "; + valStr += QString::number( data.myInitialMemory ); + } + valStr += " -v "; + valStr += QString::number( data.myVerboseLevel ); + + if ( !data.myToCreateNewNodes ) + valStr += " -p0"; + + if ( data.myRemoveInitialCentralPoint ) + valStr += " -no_initial_central_point"; + + if ( data.myBoundaryRecovery ) + valStr += " -C"; + + if ( data.myFEMCorrection ) + valStr += " -FEM"; + + if ( data.myGradation != 1.05 ) { + valStr += " -Dcpropa="; + valStr += QString::number( data.myGradation ); + } + + valStr += " "; + valStr += data.myTextOption; + + // valStr += " #BEGIN ENFORCED VERTICES#"; + // // Add size map parameters storage + // for (int i=0 ; irowCount() ; i++) { + // valStr += " ("; + // double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble(); + // double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble(); + // double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble(); + // double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble(); + // valStr += QString::number( x ); + // valStr += ","; + // valStr += QString::number( y ); + // valStr += ","; + // valStr += QString::number( z ); + // valStr += ")="; + // valStr += QString::number( size ); + // if (i!=mySmpModel->rowCount()-1) + // valStr += ";"; + // } + // valStr += " #END ENFORCED VERTICES#"; return valStr; } bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData& h_data ) const { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo"); HYBRIDPlugin::HYBRIDPlugin_Hypothesis_var h = HYBRIDPlugin::HYBRIDPlugin_Hypothesis::_narrow( initParamsHypothesis() ); HypothesisData* data = SMESH::GetHypothesisData( hypType() ); h_data.myName = isCreation() && data ? hypName() : ""; + h_data.myCollisionMode = h->GetCollisionMode(); + h_data.myBoundaryLayersGrowth = h->GetBoundaryLayersGrowth(); + h_data.myElementGeneration = h->GetElementGeneration(); + h_data.myAddMultinormals = h->GetAddMultinormals(); + h_data.mySmoothNormals = h->GetSmoothNormals(); + h_data.myHeightFirstLayer = h->GetHeightFirstLayer(); + h_data.myBoundaryLayersProgression = h->GetBoundaryLayersProgression(); + h_data.myMultinormalsAngle = h->GetMultinormalsAngle(); + h_data.myNbOfBoundaryLayers = h->GetNbOfBoundaryLayers(); + h_data.myFaceWLIds = h->GetFacesWithLayers(); + h_data.myLayersOnAllWrap = h->GetLayersOnAllWrap(); h_data.myToMeshHoles = h->GetToMeshHoles(); h_data.myToMakeGroupsOfDomains = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains(); @@ -1778,16 +1760,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData h_data.myInitialMemory = h->GetInitialMemory(); h_data.myOptimizationLevel = h->GetOptimizationLevel(); - h_data.myCollisionMode = h->GetCollisionMode(); - h_data.myBoundaryLayersGrowth = h->GetBoundaryLayersGrowth(); - h_data.myElementGeneration = h->GetElementGeneration(); - h_data.myAddMultinormals = h->GetAddMultinormals(); - h_data.mySmoothNormals = h->GetSmoothNormals(); - h_data.myHeightFirstLayer = h->GetHeightFirstLayer(); - h_data.myBoundaryLayersProgression = h->GetBoundaryLayersProgression(); - h_data.myMultinormalsAngle = h->GetMultinormalsAngle(); - h_data.myNbOfBoundaryLayers = h->GetNbOfBoundaryLayers(); - h_data.myKeepFiles = h->GetKeepFiles(); h_data.myWorkingDir = h->GetWorkingDirectory(); h_data.myVerboseLevel = h->GetVerboseLevel(); @@ -1801,7 +1773,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess(); HYBRIDPlugin::HYBRIDEnforcedVertexList_var vertices = h->GetEnforcedVertices(); - MESSAGE("vertices->length(): " << vertices->length()); h_data.myEnforcedVertices.clear(); for (CORBA::ULong i=0 ; ilength() ; i++) { TEnfVertex* myVertex = new TEnfVertex(); @@ -1813,13 +1784,11 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData if (vertices[i].coords.length()) { for (CORBA::ULong c = 0; c < vertices[i].coords.length() ; c++) myVertex->coords.push_back(vertices[i].coords[c]); - MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size); } h_data.myEnforcedVertices.insert(myVertex); } HYBRIDPlugin::HYBRIDEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes(); - MESSAGE("enfMeshes->length(): " << enfMeshes->length()); h_data.myEnforcedMeshes.clear(); for (CORBA::ULong i=0 ; ilength() ; i++) { TEnfMesh* myEnfMesh = new TEnfMesh(); @@ -1847,7 +1816,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesisData& h_data ) const { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo"); HYBRIDPlugin::HYBRIDPlugin_Hypothesis_var h = HYBRIDPlugin::HYBRIDPlugin_Hypothesis::_narrow( hypothesis() ); @@ -1871,7 +1839,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi h->SetInitialMemory ( h_data.myInitialMemory ); if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel ) h->SetOptimizationLevel( h_data.myOptimizationLevel ); - + if ( h->GetCollisionMode() != h_data.myCollisionMode ) h->SetCollisionMode( h_data.myCollisionMode ); if ( h->GetBoundaryLayersGrowth() != h_data.myBoundaryLayersGrowth ) @@ -1891,7 +1859,8 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi h->SetMultinormalsAngle ( h_data.myMultinormalsAngle ); if ( h->GetNbOfBoundaryLayers() != h_data.myNbOfBoundaryLayers ) h->SetNbOfBoundaryLayers ( h_data.myNbOfBoundaryLayers ); - + h->SetFacesWithLayers( h_data.myFaceWLIds ); + if ( h->GetKeepFiles() != h_data.myKeepFiles) h->SetKeepFiles ( h_data.myKeepFiles); if ( h->GetWorkingDirectory() != h_data.myWorkingDir ) @@ -1912,16 +1881,14 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi h->SetAdvancedOption ( h_data.myTextOption.toLatin1().constData() ); if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput ) h->SetStandardOutputLog ( h_data.myLogInStandardOutput ); - if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess ) + if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess ) h->SetRemoveLogOnSuccess ( h_data.myRemoveLogOnSuccess ); // Enforced vertices - int nbVertex = (int) h_data.myEnforcedVertices.size(); + //int nbVertex = (int) h_data.myEnforcedVertices.size(); HYBRIDPlugin::HYBRIDEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices(); int nbVertexHyp = vertexHyp->length(); - MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices"); - MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp); // 1. Clear all enforced vertices in hypothesis // 2. Add new enforced vertex according to h_data @@ -1942,12 +1909,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi } // for // Enforced Meshes - int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size(); + //int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size(); HYBRIDPlugin::HYBRIDEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes(); int nbEnfMeshListHyp = enfMeshListHyp->length(); - MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes"); - MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp); // 1. Clear all enforced vertices in hypothesis // 2. Add new enforced vertex according to h_data @@ -1964,7 +1929,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str()); SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); - MESSAGE("enfMesh->elementType: " << enfMesh->elementType); SMESH::ElementType elementType; switch(enfMesh->elementType) { case 0: @@ -1998,7 +1962,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisData& h_data ) const { - MESSAGE("HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets"); h_data.myName = myName ? myName->text() : ""; h_data.myLayersOnAllWrap = myLayersOnAllWrapCheck->isChecked(); h_data.myToMeshHoles = myToMeshHolesCheck->isChecked(); @@ -2006,18 +1969,19 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD h_data.myMaximumMemory = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1; h_data.myInitialMemory = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1; h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex(); - - h_data.myCollisionMode = myCollisionModeCombo->currentIndex(); - h_data.myBoundaryLayersGrowth = myBoundaryLayersGrowthCombo->currentIndex(); - h_data.myElementGeneration = myElementGenerationCombo->currentIndex(); - h_data.myAddMultinormals = myAddMultinormalsCheck->isChecked(); - h_data.mySmoothNormals = mySmoothNormalsCheck->isChecked(); - - h_data.myHeightFirstLayer = myHeightFirstLayerSpin -> value(); - h_data.myNbOfBoundaryLayers = myNbOfBoundaryLayersSpin -> value(); - h_data.myBoundaryLayersProgression = myBoundaryLayersProgressionSpin -> value(); - h_data.myMultinormalsAngle = myMultinormalsAngleSpin -> value(); - + + h_data.myCollisionMode = myCollisionModeCombo->currentIndex(); + h_data.myBoundaryLayersGrowth = myBoundaryLayersGrowthCombo->currentIndex(); + h_data.myElementGeneration = myElementGenerationCombo->currentIndex(); + h_data.myAddMultinormals = myAddMultinormalsCheck->isChecked(); + h_data.mySmoothNormals = mySmoothNormalsCheck->isChecked(); + + h_data.myHeightFirstLayer = myHeightFirstLayerSpin -> value(); + h_data.myNbOfBoundaryLayers = myNbOfBoundaryLayersSpin -> value(); + h_data.myBoundaryLayersProgression = myBoundaryLayersProgressionSpin -> value(); + h_data.myMultinormalsAngle = myMultinormalsAngleSpin -> value(); + h_data.myFaceWLIds = myFaceSelector->GetListOfIDs(); + h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked(); h_data.myWorkingDir = myAdvWidget->workingDirectoryLineEdit->text().trimmed(); h_data.myVerboseLevel = myAdvWidget->verboseLevelSpin->value(); @@ -2029,7 +1993,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD h_data.myTextOption = myAdvWidget->myAdvOptionsTable->GetCustomOptions(); h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked(); h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked(); - + // Enforced vertices h_data.myEnforcedVertices.clear(); QVariant valueX, valueY, valueZ; @@ -2037,13 +2001,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD TEnfVertex *myVertex = new TEnfVertex(); myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString(); - MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" ); myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString(); if (myVertex->geomEntry.size()) - MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" ); myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString(); if (myVertex->groupName.size()) - MESSAGE("Group name is \"" << myVertex->groupName << "\"" ); valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole); valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole); valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole); @@ -2051,14 +2012,9 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD myVertex->coords.push_back(valueX.toDouble()); myVertex->coords.push_back(valueY.toDouble()); myVertex->coords.push_back(valueZ.toDouble()); - MESSAGE("Coords are (" << myVertex->coords.at(0) << ", " - << myVertex->coords.at(1) << ", " - << myVertex->coords.at(2) << ")"); } myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble(); - MESSAGE("Size is " << myVertex->size); myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool(); - MESSAGE("Is compound ? " << myVertex->isCompound); h_data.myEnforcedVertices.insert(myVertex); } @@ -2069,14 +2025,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD TEnfMesh *myEnfMesh = new TEnfMesh(); myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString(); - MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" ); myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString(); - MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" ); myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString(); - MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" ); QComboBox* combo = qobject_cast(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN)); myEnfMesh->elementType = combo->currentIndex(); - MESSAGE("Element type: " << myEnfMesh->elementType); h_data.myEnforcedMeshes.insert(myEnfMesh); std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl; } diff --git a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.h b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.h index c4458ee..0726311 100644 --- a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.h +++ b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.h @@ -48,20 +48,21 @@ #include CORBA_SERVER_HEADER(SMESH_Gen) #include CORBA_SERVER_HEADER(SMESH_Mesh) -class QWidget; -class QComboBox; class QCheckBox; +class QComboBox; +class QHeaderView; class QLineEdit; class QSpinBox; class QTableWidget; class QTableWidgetItem; -class QHeaderView; +class QWidget; -class SMESHGUI_SpinBox; -class StdMeshersGUI_ObjectReferenceParamWdg; +class HYBRIDPluginGUI_AdvWidget; class LightApp_SelectionMgr; +class SMESHGUI_SpinBox; class SUIT_SelectionFilter; -class HYBRIDPluginGUI_AdvWidget; +class StdMeshersGUI_ObjectReferenceParamWdg; +class StdMeshersGUI_SubShapeSelectorWdg; class QTEnfVertex { @@ -162,6 +163,8 @@ typedef struct myBoundaryLayersProgression, myMultinormalsAngle; short myNbOfBoundaryLayers; + SMESH::long_array_var myFaceWLIds; + } HYBRIDHypothesisData; /*! @@ -210,6 +213,7 @@ protected slots: void onRemoveEnforcedMesh(); //void synchronizeEnforcedMesh(); void checkEnfMeshIsDefined(); + void onTabChanged( int ); signals: void vertexDefined(bool); @@ -271,6 +275,7 @@ private: SMESHGUI_SpinBox* myMultinormalsAngleSpin; QCheckBox* mySmoothNormalsCheck; + StdMeshersGUI_SubShapeSelectorWdg* myFaceSelector; }; class EnforcedVertexTableWidgetDelegate : public QItemDelegate diff --git a/src/GUI/HYBRIDPlugin_msg_en.ts b/src/GUI/HYBRIDPlugin_msg_en.ts index 61daaac..bf8f942 100644 --- a/src/GUI/HYBRIDPlugin_msg_en.ts +++ b/src/GUI/HYBRIDPlugin_msg_en.ts @@ -310,5 +310,13 @@ downward means inward and upward means outward ... HYBRID_ENF_MESH_INFO <b>Warning</b>: Enforced meshes are currently only taken into account for meshes w/o associated geometry. + + HYBRID_FACES_TAB + Faces with layers + + + HYBRID_FACE_IDS + Face IDs + diff --git a/src/HYBRIDPlugin/HYBRIDPluginBuilder.py b/src/HYBRIDPlugin/HYBRIDPluginBuilder.py index 7a66586..a84a91b 100644 --- a/src/HYBRIDPlugin/HYBRIDPluginBuilder.py +++ b/src/HYBRIDPlugin/HYBRIDPluginBuilder.py @@ -97,6 +97,29 @@ class HYBRID_Algorithm(Mesh_Algorithm): self.Parameters().SetLayersOnAllWrap(toMesh) pass + ## To mesh "holes" in a solid or not. Default is to mesh. + # @param faceIDs faces or face IDs to construct boundary layers on + def SetFacesWithLayers(self, faceIDs): + import GEOM + ids = [] + if not isinstance( faceIDs, list ) and not isinstance( faceIDs, tuple ): + faceIDs = [ faceIDs ] + for fid in faceIDs: + if isinstance( fid, int ): + ids.append( fid ) + elif isinstance( fid, GEOM._objref_GEOM_Object): + faces = self.mesh.geompyD.SubShapeAll( fid, self.mesh.geompyD.ShapeType["FACE"]) + for f in faces: + ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f )) + else: + raise TypeError, \ + "Face should be either ID or GEOM_Object, not %s" % type(fid) + pass + self.Parameters().SetFacesWithLayers(ids) + if ids: + self.SetLayersOnAllWrap( False ) + pass + """ obsolete ## To mesh "holes" in a solid or not. Default is to mesh. diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index 90fe559..30fdd6b 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -41,8 +41,6 @@ #include #include #include -// #include -// #include #include #include @@ -87,13 +85,13 @@ typedef const std::list TTriaList; static const char theDomainGroupNamePrefix[] = "Domain_"; -static void removeFile( const TCollection_AsciiString& fileName ) +static void removeFile( const std::string& fileName ) { try { - SMESH_File( fileName.ToCString() ).remove(); + SMESH_File( fileName ).remove(); } catch ( ... ) { - MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied"); + MESSAGE("Can't remove file: " << fileName << " ; file does not exist or permission denied"); } } @@ -106,26 +104,20 @@ static void removeFile( const TCollection_AsciiString& fileName ) HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, int studyId, SMESH_Gen* gen) : SMESH_3D_Algo(hypId, studyId, gen) { - MESSAGE("HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID"); _name = Name(); _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type _onlyUnaryInput = true; // Compute() will be called on each solid _iShape=0; _nbShape=0; _compatibleHypothesis.push_back( HYBRIDPlugin_Hypothesis::GetHypType()); - //_compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() ); _requireShape = false; // can work without shape_studyId smeshGen_i = SMESH_Gen_i::GetSMESHGen(); CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager"); SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject); - MESSAGE("studyid = " << _studyId); - myStudy = NULL; myStudy = aStudyMgr->GetStudyByID(_studyId); - if (!myStudy->_is_nil()) - MESSAGE("myStudy->StudyId() = " << myStudy->StudyId()); _computeCanceled = false; } @@ -138,7 +130,6 @@ HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, int studyId, SMESH_Gen* gen) HYBRIDPlugin_HYBRID::~HYBRIDPlugin_HYBRID() { - MESSAGE("HYBRIDPlugin_HYBRID::~HYBRIDPlugin_HYBRID"); } //============================================================================= @@ -154,7 +145,6 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh& aMesh, aStatus = SMESH_Hypothesis::HYP_OK; _hyp = 0; - //_viscousLayersHyp = 0; _keepFiles = false; _removeLogOnSuccess = true; _logInStandardOutput = false; @@ -166,8 +156,6 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh& aMesh, { if ( !_hyp ) _hyp = dynamic_cast< const HYBRIDPlugin_Hypothesis*> ( *h ); - // if ( !_viscousLayersHyp ) - // _viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h ); } if ( _hyp ) { @@ -187,7 +175,6 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh& aMesh, TopoDS_Shape HYBRIDPlugin_HYBRID::entryToShape(std::string entry) { - MESSAGE("HYBRIDPlugin_HYBRID::entryToShape "<_is_nil() ) throw SALOME_Exception("MG-HYBRID plugin can't work w/o publishing in the study"); GEOM::GEOM_Object_var aGeomObj; @@ -203,260 +190,6 @@ TopoDS_Shape HYBRIDPlugin_HYBRID::entryToShape(std::string entry) return S; } -//======================================================================= -//function : findShape -//purpose : -//======================================================================= - -// static TopoDS_Shape findShape(const SMDS_MeshNode *aNode[], -// TopoDS_Shape aShape, -// const TopoDS_Shape shape[], -// double** box, -// const int nShape, -// TopAbs_State * state = 0) -// { -// gp_XYZ aPnt(0,0,0); -// int j, iShape, nbNode = 4; - -// for ( j=0; jX(), aNode[j]->Y(), aNode[j]->Z() ); -// if ( aNode[j]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE ) { -// aPnt = p; -// break; -// } -// aPnt += p / nbNode; -// } - -// BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion()); -// if (state) *state = SC.State(); -// if ( SC.State() != TopAbs_IN || aShape.IsNull() || aShape.ShapeType() != TopAbs_SOLID) { -// for (iShape = 0; iShape < nShape; iShape++) { -// aShape = shape[iShape]; -// if ( !( aPnt.X() < box[iShape][0] || box[iShape][1] < aPnt.X() || -// aPnt.Y() < box[iShape][2] || box[iShape][3] < aPnt.Y() || -// aPnt.Z() < box[iShape][4] || box[iShape][5] < aPnt.Z()) ) { -// BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion()); -// if (state) *state = SC.State(); -// if (SC.State() == TopAbs_IN) -// break; -// } -// } -// } -// return aShape; -// } - -//======================================================================= -//function : readMapIntLine -//purpose : -//======================================================================= - -// static char* readMapIntLine(char* ptr, int tab[]) { -// long int intVal; -// std::cout << std::endl; - -// for ( int i=0; i<17; i++ ) { -// intVal = strtol(ptr, &ptr, 10); -// if ( i < 3 ) -// tab[i] = intVal; -// } -// return ptr; -// } - -//================================================================================ -/*! - * \brief returns true if a triangle defined by the nodes is a temporary face on a - * side facet of pyramid and defines sub-domain inside the pyramid - */ -//================================================================================ - -// static bool isTmpFace(const SMDS_MeshNode* node1, -// const SMDS_MeshNode* node2, -// const SMDS_MeshNode* node3) -// { -// // find a pyramid sharing the 3 nodes -// //const SMDS_MeshElement* pyram = 0; -// SMDS_ElemIteratorPtr vIt1 = node1->GetInverseElementIterator(SMDSAbs_Volume); -// while ( vIt1->more() ) -// { -// const SMDS_MeshElement* pyram = vIt1->next(); -// if ( pyram->NbCornerNodes() != 5 ) continue; -// int i2, i3; -// if ( (i2 = pyram->GetNodeIndex( node2 )) >= 0 && -// (i3 = pyram->GetNodeIndex( node3 )) >= 0 ) -// { -// // Triangle defines sub-domian inside the pyramid if it's -// // normal points out of the pyram - -// // make i2 and i3 hold indices of base nodes of the pyram while -// // keeping the nodes order in the triangle -// const int iApex = 4; -// if ( i2 == iApex ) -// i2 = i3, i3 = pyram->GetNodeIndex( node1 ); -// else if ( i3 == iApex ) -// i3 = i2, i2 = pyram->GetNodeIndex( node1 ); - -// int i3base = (i2+1) % 4; // next index after i2 within the pyramid base -// return ( i3base != i3 ); -// } -// } -// return false; -// } - -//======================================================================= -//function : findShapeID -//purpose : find the solid corresponding to HYBRID sub-domain following -// the technique proposed in GHS3D manual (available within -// ghs3d installation) in chapter "B.4 Subdomain (sub-region) assignment". -// In brief: normal of the triangle defined by the given nodes -// points out of the domain it is associated to -//======================================================================= - -// static int findShapeID(SMESH_Mesh& mesh, -// const SMDS_MeshNode* node1, -// const SMDS_MeshNode* node2, -// const SMDS_MeshNode* node3, -// const bool toMeshHoles) -// { -// const int invalidID = 0; -// SMESHDS_Mesh* meshDS = mesh.GetMeshDS(); - -// // face the nodes belong to -// std::vector nodes(3); -// nodes[0] = node1; -// nodes[1] = node2; -// nodes[2] = node3; -// const SMDS_MeshElement * face = meshDS->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/true); -// if ( !face ) -// return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID; -// #ifdef _DEBUG_ -// std::cout << "bnd face " << face->GetID() << " - "; -// #endif -// // geom face the face assigned to -// SMESH_MeshEditor editor(&mesh); -// int geomFaceID = editor.FindShape( face ); -// if ( !geomFaceID ) -// return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID; -// TopoDS_Shape shape = meshDS->IndexToShape( geomFaceID ); -// if ( shape.IsNull() || shape.ShapeType() != TopAbs_FACE ) -// return invalidID; -// TopoDS_Face geomFace = TopoDS::Face( shape ); - -// // solids bounded by geom face -// TopTools_IndexedMapOfShape solids, shells; -// TopTools_ListIteratorOfListOfShape ansIt = mesh.GetAncestors(geomFace); -// for ( ; ansIt.More(); ansIt.Next() ) { -// switch ( ansIt.Value().ShapeType() ) { -// case TopAbs_SOLID: -// solids.Add( ansIt.Value() ); break; -// case TopAbs_SHELL: -// shells.Add( ansIt.Value() ); break; -// default:; -// } -// } -// // analyse found solids -// if ( solids.Extent() == 0 || shells.Extent() == 0) -// return invalidID; - -// const TopoDS_Solid& solid1 = TopoDS::Solid( solids(1) ); -// if ( solids.Extent() == 1 ) -// { -// if ( toMeshHoles ) -// return meshDS->ShapeToIndex( solid1 ); - -// // - Are we at a hole boundary face? -// if ( shells(1).IsSame( BRepClass3d::OuterShell( solid1 )) ) -// { // - No, but maybe a hole is bound by two shapes? Does shells(1) touches another shell? -// bool touch = false; -// TopExp_Explorer eExp( shells(1), TopAbs_EDGE ); -// // check if any edge of shells(1) belongs to another shell -// for ( ; eExp.More() && !touch; eExp.Next() ) { -// ansIt = mesh.GetAncestors( eExp.Current() ); -// for ( ; ansIt.More() && !touch; ansIt.Next() ) { -// if ( ansIt.Value().ShapeType() == TopAbs_SHELL ) -// touch = ( !ansIt.Value().IsSame( shells(1) )); -// } -// } -// if (!touch) -// return meshDS->ShapeToIndex( solid1 ); -// } -// } -// // find orientation of geom face within the first solid -// TopExp_Explorer fExp( solid1, TopAbs_FACE ); -// for ( ; fExp.More(); fExp.Next() ) -// if ( geomFace.IsSame( fExp.Current() )) { -// geomFace = TopoDS::Face( fExp.Current() ); -// break; -// } -// if ( !fExp.More() ) -// return invalidID; // face not found - -// // normale to triangle -// gp_Pnt node1Pnt ( node1->X(), node1->Y(), node1->Z() ); -// gp_Pnt node2Pnt ( node2->X(), node2->Y(), node2->Z() ); -// gp_Pnt node3Pnt ( node3->X(), node3->Y(), node3->Z() ); -// gp_Vec vec12( node1Pnt, node2Pnt ); -// gp_Vec vec13( node1Pnt, node3Pnt ); -// gp_Vec meshNormal = vec12 ^ vec13; -// if ( meshNormal.SquareMagnitude() < DBL_MIN ) -// return invalidID; - -// // get normale to geomFace at any node -// bool geomNormalOK = false; -// gp_Vec geomNormal; -// SMESH_MesherHelper helper( mesh ); helper.SetSubShape( geomFace ); -// for ( int i = 0; !geomNormalOK && i < 3; ++i ) -// { -// // find UV of i-th node on geomFace -// const SMDS_MeshNode* nNotOnSeamEdge = 0; -// if ( helper.IsSeamShape( nodes[i]->getshapeId() )) { -// if ( helper.IsSeamShape( nodes[(i+1)%3]->getshapeId() )) -// nNotOnSeamEdge = nodes[(i+2)%3]; -// else -// nNotOnSeamEdge = nodes[(i+1)%3]; -// } -// bool uvOK; -// gp_XY uv = helper.GetNodeUV( geomFace, nodes[i], nNotOnSeamEdge, &uvOK ); -// // check that uv is correct -// if (uvOK) { -// double tol = 1e-6; -// TopoDS_Shape nodeShape = helper.GetSubShapeByNode( nodes[i], meshDS ); -// if ( !nodeShape.IsNull() ) -// switch ( nodeShape.ShapeType() ) -// { -// case TopAbs_FACE: tol = BRep_Tool::Tolerance( TopoDS::Face( nodeShape )); break; -// case TopAbs_EDGE: tol = BRep_Tool::Tolerance( TopoDS::Edge( nodeShape )); break; -// case TopAbs_VERTEX: tol = BRep_Tool::Tolerance( TopoDS::Vertex( nodeShape )); break; -// default:; -// } -// gp_Pnt nodePnt ( nodes[i]->X(), nodes[i]->Y(), nodes[i]->Z() ); -// BRepAdaptor_Surface surface( geomFace ); -// uvOK = ( nodePnt.Distance( surface.Value( uv.X(), uv.Y() )) < 2 * tol ); -// if ( uvOK ) { -// // normale to geomFace at UV -// gp_Vec du, dv; -// surface.D1( uv.X(), uv.Y(), nodePnt, du, dv ); -// geomNormal = du ^ dv; -// if ( geomFace.Orientation() == TopAbs_REVERSED ) -// geomNormal.Reverse(); -// geomNormalOK = ( geomNormal.SquareMagnitude() > DBL_MIN * 1e3 ); -// } -// } -// } -// if ( !geomNormalOK) -// return invalidID; - -// // compare normals -// bool isReverse = ( meshNormal * geomNormal ) < 0; -// if ( !isReverse ) -// return meshDS->ShapeToIndex( solid1 ); - -// if ( solids.Extent() == 1 ) -// return HOLE_ID; // we are inside a hole - -// return meshDS->ShapeToIndex( solids(2) ); -// } - - //======================================================================= //function : addElemInMeshGroup //purpose : Update or create groups in mesh @@ -480,7 +213,6 @@ static void addElemInMeshGroup(SMESH_Mesh* theMesh, SMESHDS_Group* aGroupDS = static_cast( groupDS ); aGroupDS->SMDSGroup().Add(anElem); groupDone = true; -// MESSAGE("Successfully added enforced element to existing group " << groupName); break; } } @@ -492,7 +224,6 @@ static void addElemInMeshGroup(SMESH_Mesh* theMesh, aGroup->SetName( groupName.c_str() ); SMESHDS_Group* aGroupDS = static_cast( aGroup->GetGroupDS() ); aGroupDS->SMDSGroup().Add(anElem); -// MESSAGE("Successfully created enforced vertex group " << groupName); groupDone = true; } if (!groupDone) @@ -516,7 +247,6 @@ static void updateMeshGroups(SMESH_Mesh* theMesh, std::set groupsTo std::string currentGroupName = (std::string)group->GetName(); if (groupDS->IsEmpty() && groupsToRemove.find(currentGroupName) != groupsToRemove.end()) { // Previous group created by enforced elements - MESSAGE("Delete previous group created by removed enforced elements: " << group->GetName()) theMesh->RemoveGroup(groupDS->GetID()); } } @@ -563,11 +293,6 @@ static void removeEmptyGroupsOfDomains(SMESH_Mesh* mesh, static void makeDomainGroups( std::vector< std::vector< const SMDS_MeshElement* > >& elemsOfDomain, SMESH_MesherHelper* theHelper) { - // int nbDomains = 0; - // for ( size_t i = 0; i < elemsOfDomain.size(); ++i ) - // nbDomains += ( elemsOfDomain[i].size() > 0 ); - - // if ( nbDomains > 1 ) for ( size_t iDomain = 0; iDomain < elemsOfDomain.size(); ++iDomain ) { std::vector< const SMDS_MeshElement* > & elems = elemsOfDomain[ iDomain ]; @@ -608,19 +333,19 @@ static void makeDomainGroups( std::vector< std::vector< const SMDS_MeshElement* //purpose : read GMF file w/o geometry associated to mesh //======================================================================= -static bool readGMFFile(MG_HYBRID_API* MGOutput, - const char* theFile, - HYBRIDPlugin_HYBRID* theAlgo, - SMESH_MesherHelper* theHelper, +static bool readGMFFile(MG_HYBRID_API* MGOutput, + const char* theFile, + HYBRIDPlugin_HYBRID* theAlgo, + SMESH_MesherHelper* theHelper, std::vector & theNodeByHybridId, std::vector & theFaceByHybridId, - std::map & theNodeToHybridIdMap, - std::vector & aNodeGroupByHybridId, - std::vector & anEdgeGroupByHybridId, - std::vector & aFaceGroupByHybridId, - std::set & groupsToRemove, - bool toMakeGroupsOfDomains=false, - bool toMeshHoles=true) + std::map & theNodeToHybridIdMap, + std::vector & aNodeGroupByHybridId, + std::vector & anEdgeGroupByHybridId, + std::vector & aFaceGroupByHybridId, + std::set & groupsToRemove, + bool toMakeGroupsOfDomains=false, + bool toMeshHoles=true) { std::string tmpStr; SMESHDS_Mesh* theMeshDS = theHelper->GetMeshDS(); @@ -666,11 +391,9 @@ static bool readGMFFile(MG_HYBRID_API* MGOutput, tabRef[GmfHexahedra] = 8; int ver, dim; - MESSAGE("Read " << theFile << " file"); int InpMsh = MGOutput->GmfOpenMesh(theFile, GmfRead, &ver, &dim); if (!InpMsh) return false; - MESSAGE("Done "); // Hybrid is not multi-domain => We can't (and don't need to) read ids of domains in ouput file like in GHS3DPlugin // We just need to get the id of the one and only solid @@ -789,7 +512,6 @@ static bool readGMFFile(MG_HYBRID_API* MGOutput, MGOutput->GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]); #ifdef _DEBUG_ subdomainId2tetraId[dummy].insert(iElem+1); -// MESSAGE("subdomainId2tetraId["< >::const_iterator subdomainIt = subdomainId2tetraId.begin(); - TCollection_AsciiString aSubdomainFileName = theFile; + std::string aSubdomainFileName = theFile; aSubdomainFileName = aSubdomainFileName + ".subdomain"; - ofstream aSubdomainFile ( aSubdomainFileName.ToCString() , ios::out); + ofstream aSubdomainFile ( aSubdomainFileName , ios::out); aSubdomainFile << "Nb subdomains " << subdomainId2tetraId.size() << std::endl; for(;subdomainIt != subdomainId2tetraId.end() ; ++subdomainIt) { int subdomainId = subdomainIt->first; std::set tetraIds = subdomainIt->second; - MESSAGE("Subdomain #"<::const_iterator tetraIdsIt = tetraIds.begin(); aSubdomainFile << subdomainId << std::endl; for(;tetraIdsIt != tetraIds.end() ; ++tetraIdsIt) { @@ -1088,8 +808,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput std::map, std::string> & enfVerticesWithGroup, HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices) { - //MESSAGE("writeGMFFile w/o geometry"); - std::cout << "!!!!!!!!!!!writeGMFFile w/o geometry for HYBRIDPLUGIN..." << std::endl; std::string tmpStr; int idx, idxRequired = 0, idxSol = 0; //tabg each dummyint @@ -1098,8 +816,8 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput const int dummyint2 = 2; const int dummyint3 = 3; const int dummyint4 = 4; - const int dummyint5 = 5; - const int dummyint6 = 6; //are interesting for layers + const int enforcedTag = HYBRIDPlugin_Hypothesis::EnforcedTag(); + //const int dummyint6 = 6; //are interesting for layers HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt; std::vector enfVertexSizes; const SMDS_MeshElement* elem; @@ -1349,22 +1067,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput continue; } -// gp_Pnt myPoint(node->X(),node->Y(),node->Z()); -// nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems); -// if (nbFoundElems ==0) { -// std::cout << " not found" << std::endl; -// if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) { -// nodesCoords.insert(coords); -// theOrderedNodes.push_back(node); -// } -// } -// else { -// std::cout << " found in initial mesh" << std::endl; -// const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0); -// nodesCoords.insert(coords); -// theOrderedNodes.push_back(existingNode); -// } - #ifdef _DEBUG_ std::cout << " not found" << std::endl; #endif @@ -1415,29 +1117,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput continue; } -// nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems); -// if (nbFoundElems ==0) { -// std::cout << " not found" << std::endl; -// if (result == TopAbs_IN) { -// nodesCoords.insert(coords); -// theRequiredNodes.push_back(node); -// } -// } -// else { -// std::cout << " found in initial mesh" << std::endl; -// const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0); -// // nodesCoords.insert(coords); -// theRequiredNodes.push_back(existingNode); -// } -// -// -// -// if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0) -// continue; - -// if ( result != TopAbs_IN ) -// continue; - #ifdef _DEBUG_ std::cout << " not found" << std::endl; #endif @@ -1450,7 +1129,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput int solSize = 0; std::vector > ReqVerTab; if (nbEnforcedVertices) { -// ReqVerTab.clear(); (nbEnforcedVertices <= 1) ? tmpStr = " node" : " nodes"; std::cout << nbEnforcedVertices << tmpStr << " from enforced vertices ..." << std::endl; // Iterate over the enforced vertices @@ -1463,11 +1141,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput TopAbs_State result = pntCls->GetPointState( myPoint ); if ( result == TopAbs_OUT ) continue; - //if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0) - //continue; - -// if ( result != TopAbs_IN ) -// continue; std::vector coords; coords.push_back(x); coords.push_back(y); @@ -1482,7 +1155,7 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput // GmfVertices std::cout << "Begin writing required nodes in GmfVertices" << std::endl; std::cout << "Nb vertices: " << theOrderedNodes.size() << std::endl; - MGInput->GmfSetKwd(idx, GmfVertices, theOrderedNodes.size()); //theOrderedNodes.size()+solSize) + MGInput->GmfSetKwd(idx, GmfVertices, theOrderedNodes.size()); for (hybridNodeIt = theOrderedNodes.begin();hybridNodeIt != theOrderedNodes.end();++hybridNodeIt) { MGInput->GmfSetLin(idx, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint1); } @@ -1508,8 +1181,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput double ValTab[] = {0.0}; MGInput->GmfSetKwd(idxRequired, GmfVertices, requiredNodes + solSize); MGInput->GmfSetKwd(idxSol, GmfSolAtVertices, requiredNodes + solSize, 1, TypTab); -// int usedEnforcedNodes = 0; -// std::string gn = ""; for (hybridNodeIt = theRequiredNodes.begin();hybridNodeIt != theRequiredNodes.end();++hybridNodeIt) { MGInput->GmfSetLin(idxRequired, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint2); MGInput->GmfSetLin(idxSol, GmfSolAtVertices, ValTab); @@ -1542,11 +1213,7 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput int usedEnforcedEdges = 0; if (theKeptEnforcedEdges.size()) { anEdgeGroupByHybridId.resize( theKeptEnforcedEdges.size() ); -// idxRequired = MGInput->GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION); -// if (!idxRequired) -// return false; MGInput->GmfSetKwd(idx, GmfEdges, theKeptEnforcedEdges.size()); -// MGInput->GmfSetKwd(idxRequired, GmfEdges, theKeptEnforcedEdges.size()); for(elemSetIt = theKeptEnforcedEdges.begin() ; elemSetIt != theKeptEnforcedEdges.end() ; ++elemSetIt) { elem = (*elemSetIt); nodeIt = elem->nodesIterator(); @@ -1565,10 +1232,8 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput } MGInput->GmfSetLin(idx, GmfEdges, nedge[0], nedge[1], dummyint4); anEdgeGroupByHybridId[usedEnforcedEdges] = theEnforcedEdges.find(elem)->second; -// MGInput->GmfSetLin(idxRequired, GmfEdges, nedge[0], nedge[1], dummyint); usedEnforcedEdges++; } -// MGInput->GmfCloseMesh(idxRequired); } @@ -1581,16 +1246,19 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput // GmfTriangles int usedEnforcedTriangles = 0; - if (anElemSetTri.size()+theKeptEnforcedTriangles.size()) { + if (anElemSetTri.size()+theKeptEnforcedTriangles.size()) + { aFaceGroupByHybridId.resize( anElemSetTri.size()+theKeptEnforcedTriangles.size() ); MGInput->GmfSetKwd(idx, GmfTriangles, anElemSetTri.size()+theKeptEnforcedTriangles.size()); int k=0; - for(elemSetIt = anElemSetTri.begin() ; elemSetIt != anElemSetTri.end() ; ++elemSetIt,++k) { + for(elemSetIt = anElemSetTri.begin() ; elemSetIt != anElemSetTri.end() ; ++elemSetIt,++k) + { elem = (*elemSetIt); theFaceByHybridId.push_back( elem ); nodeIt = elem->nodesIterator(); int index=0; - for ( int j = 0; j < 3; ++j ) { + for ( int j = 0; j < 3; ++j ) + { // find HYBRID ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); std::map< const SMDS_MeshNode*,int >::iterator it = aNodeToHybridIdMap.find(node); @@ -1599,22 +1267,26 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput ntri[index] = it->second; index++; } - MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint5); + MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], /*tag=*/elem->getshapeId() ); aFaceGroupByHybridId[k] = ""; } if ( !theHelper.GetMesh()->HasShapeToMesh() ) SMESHUtils::FreeVector( theFaceByHybridId ); std::cout << "Enforced triangles size " << theKeptEnforcedTriangles.size() << std::endl; - if (theKeptEnforcedTriangles.size()) { - for(elemSetIt = theKeptEnforcedTriangles.begin() ; elemSetIt != theKeptEnforcedTriangles.end() ; ++elemSetIt,++k) { + if (theKeptEnforcedTriangles.size()) + { + for(elemSetIt = theKeptEnforcedTriangles.begin() ; elemSetIt != theKeptEnforcedTriangles.end() ; ++elemSetIt,++k) + { elem = (*elemSetIt); nodeIt = elem->nodesIterator(); int index=0; - for ( int j = 0; j < 3; ++j ) { + for ( int j = 0; j < 3; ++j ) + { // find HYBRID ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); std::map< const SMDS_MeshNode*,int >::iterator it = anEnforcedNodeToHybridIdMap.find(node); - if (it == anEnforcedNodeToHybridIdMap.end()) { + if (it == anEnforcedNodeToHybridIdMap.end()) + { it = anExistingEnforcedNodeToHybridIdMap.find(node); if (it == anEnforcedNodeToHybridIdMap.end()) throw "Node not found"; @@ -1622,7 +1294,7 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput ntri[index] = it->second; index++; } - MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint6); + MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], enforcedTag); aFaceGroupByHybridId[k] = theEnforcedTriangles.find(elem)->second; usedEnforcedTriangles++; } @@ -1630,21 +1302,25 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput } - if (usedEnforcedTriangles) { + if (usedEnforcedTriangles) + { MGInput->GmfSetKwd(idx, GmfRequiredTriangles, usedEnforcedTriangles); for (int enfID=1;enfID<=usedEnforcedTriangles;enfID++) MGInput->GmfSetLin(idx, GmfRequiredTriangles, anElemSetTri.size()+enfID); } - if (anElemSetQuad.size()) { + if (anElemSetQuad.size()) + { MGInput->GmfSetKwd(idx, GmfQuadrilaterals, anElemSetQuad.size()); int k=0; - for(elemSetIt = anElemSetQuad.begin() ; elemSetIt != anElemSetQuad.end() ; ++elemSetIt,++k) { + for(elemSetIt = anElemSetQuad.begin() ; elemSetIt != anElemSetQuad.end() ; ++elemSetIt,++k) + { elem = (*elemSetIt); theFaceByHybridId.push_back( elem ); nodeIt = elem->nodesIterator(); int index=0; - for ( int j = 0; j < 4; ++j ) { + for ( int j = 0; j < 4; ++j ) + { // find HYBRID ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); std::map< const SMDS_MeshNode*,int >::iterator it = aNodeToHybridIdMap.find(node); @@ -1653,7 +1329,8 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput nquad[index] = it->second; index++; } - MGInput->GmfSetLin(idx, GmfQuadrilaterals, nquad[0], nquad[1], nquad[2], nquad[3], dummyint5); + MGInput->GmfSetLin(idx, GmfQuadrilaterals, nquad[0], nquad[1], nquad[2], nquad[3], + /*tag=*/elem->getshapeId() ); // _CEA_cbo what is it for??? //aFaceGroupByHybridId[k] = ""; } @@ -1669,1217 +1346,6 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput } -// static bool writeGMFFile(const char* theMeshFileName, -// const char* theRequiredFileName, -// const char* theSolFileName, -// SMESH_MesherHelper& theHelper, -// const SMESH_ProxyMesh& theProxyMesh, -// std::map & theNodeId2NodeIndexMap, -// std::map & theSmdsToHybridIdMap, -// std::map & theHybridIdToNodeMap, -// TIDSortedNodeSet & theEnforcedNodes, -// TIDSortedElemSet & theEnforcedEdges, -// TIDSortedElemSet & theEnforcedTriangles, -// // TIDSortedElemSet & theEnforcedQuadrangles, -// HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices) -// { -// MESSAGE("writeGMFFile with geometry"); -// int idx, idxRequired, idxSol; -// int nbv, nbev, nben, aHybridID = 0; -// const int dummyint = 0; -// HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt; -// std::vector enfVertexSizes; -// TIDSortedNodeSet::const_iterator enfNodeIt; -// const SMDS_MeshNode* node; -// SMDS_NodeIteratorPtr nodeIt; -// -// idx = GmfOpenMesh(theMeshFileName, GmfWrite, GMFVERSION, GMFDIMENSION); -// if (!idx) -// return false; -// -// SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS(); -// -// /* ========================== NODES ========================== */ -// // NB_NODES -// nbv = theMeshDS->NbNodes(); -// if ( nbv == 0 ) -// return false; -// nbev = theEnforcedVertices.size(); -// nben = theEnforcedNodes.size(); -// -// // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by HYBRID -// // The problem is in nodes on degenerated edges, we need to skip nodes which are free -// // and replace not-free nodes on edges by the node on vertex -// TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex -// TNodeNodeMap::iterator n2nDegenIt; -// if ( theHelper.HasDegeneratedEdges() ) -// { -// set checkedSM; -// for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next()) -// { -// SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() ); -// if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() )) -// { -// if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) -// { -// TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value(); -// const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS); -// { -// SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); -// while ( nIt->more() ) -// n2nDegen.insert( std::make_pair( nIt->next(), vNode )); -// } -// } -// } -// } -// } -// -// const bool isQuadMesh = -// theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) || -// theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) || -// theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC ); -// -// std::vector > VerTab; -// std::set > VerMap; -// VerTab.clear(); -// std::vector aVerTab; -// // Loop from 1 to NB_NODES -// -// nodeIt = theMeshDS->nodesIterator(); -// -// while ( nodeIt->more() ) -// { -// node = nodeIt->next(); -// if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238 -// continue; -// if ( n2nDegen.count( node ) ) // Issue 0020674 -// continue; -// -// std::vector coords; -// coords.push_back(node->X()); -// coords.push_back(node->Y()); -// coords.push_back(node->Z()); -// if (VerMap.find(coords) != VerMap.end()) { -// aHybridID = theSmdsToHybridIdMap[node->GetID()]; -// theHybridIdToNodeMap[theSmdsToHybridIdMap[node->GetID()]] = node; -// continue; -// } -// VerTab.push_back(coords); -// VerMap.insert(coords); -// aHybridID++; -// theSmdsToHybridIdMap.insert( std::make_pair( node->GetID(), aHybridID )); -// theHybridIdToNodeMap.insert( std::make_pair( aHybridID, node )); -// } -// -// -// /* ENFORCED NODES ========================== */ -// if (nben) { -// std::cout << "Add " << nben << " enforced nodes to input .mesh file" << std::endl; -// for(enfNodeIt = theEnforcedNodes.begin() ; enfNodeIt != theEnforcedNodes.end() ; ++enfNodeIt) { -// double x = (*enfNodeIt)->X(); -// double y = (*enfNodeIt)->Y(); -// double z = (*enfNodeIt)->Z(); -// // Test if point is inside shape to mesh -// gp_Pnt myPoint(x,y,z); -// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh()); -// scl.Perform(myPoint, 1e-7); -// TopAbs_State result = scl.State(); -// if ( result != TopAbs_IN ) -// continue; -// std::vector coords; -// coords.push_back(x); -// coords.push_back(y); -// coords.push_back(z); -// if (theEnforcedVertices.find(coords) != theEnforcedVertices.end()) -// continue; -// if (VerMap.find(coords) != VerMap.end()) -// continue; -// VerTab.push_back(coords); -// VerMap.insert(coords); -// aHybridID++; -// theNodeId2NodeIndexMap.insert( std::make_pair( (*enfNodeIt)->GetID(), aHybridID )); -// } -// } -// -// -// /* ENFORCED VERTICES ========================== */ -// int solSize = 0; -// std::vector > ReqVerTab; -// ReqVerTab.clear(); -// if (nbev) { -// std::cout << "Add " << nbev << " enforced vertices to input .mesh file" << std::endl; -// for(vertexIt = theEnforcedVertices.begin() ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) { -// double x = vertexIt->first[0]; -// double y = vertexIt->first[1]; -// double z = vertexIt->first[2]; -// // Test if point is inside shape to mesh -// gp_Pnt myPoint(x,y,z); -// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh()); -// scl.Perform(myPoint, 1e-7); -// TopAbs_State result = scl.State(); -// if ( result != TopAbs_IN ) -// continue; -// enfVertexSizes.push_back(vertexIt->second); -// std::vector coords; -// coords.push_back(x); -// coords.push_back(y); -// coords.push_back(z); -// if (VerMap.find(coords) != VerMap.end()) -// continue; -// ReqVerTab.push_back(coords); -// VerMap.insert(coords); -// solSize++; -// } -// } -// -// -// /* ========================== FACES ========================== */ -// -// int nbTriangles = 0/*, nbQuadrangles = 0*/, aSmdsID; -// TopTools_IndexedMapOfShape facesMap, trianglesMap/*, quadranglesMap*/; -// TIDSortedElemSet::const_iterator elemIt; -// const SMESHDS_SubMesh* theSubMesh; -// TopoDS_Shape aShape; -// SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace; -// const SMDS_MeshElement* aFace; -// map::const_iterator itOnMap; -// std::vector > tt, qt,et; -// tt.clear(); -// qt.clear(); -// et.clear(); -// std::vector att, aqt, aet; -// -// TopExp::MapShapes( theMeshDS->ShapeToMesh(), TopAbs_FACE, facesMap ); -// -// for ( int i = 1; i <= facesMap.Extent(); ++i ) -// if (( theSubMesh = theProxyMesh.GetSubMesh( facesMap(i)))) -// { -// SMDS_ElemIteratorPtr it = theSubMesh->GetElements(); -// while (it->more()) -// { -// const SMDS_MeshElement *elem = it->next(); -// int nbCornerNodes = elem->NbCornerNodes(); -// if (nbCornerNodes == 3) -// { -// trianglesMap.Add(facesMap(i)); -// nbTriangles ++; -// } -// // else if (nbCornerNodes == 4) -// // { -// // quadranglesMap.Add(facesMap(i)); -// // nbQuadrangles ++; -// // } -// } -// } -// -// /* TRIANGLES ========================== */ -// if (nbTriangles) { -// for ( int i = 1; i <= trianglesMap.Extent(); i++ ) -// { -// aShape = trianglesMap(i); -// theSubMesh = theProxyMesh.GetSubMesh(aShape); -// if ( !theSubMesh ) continue; -// itOnSubMesh = theSubMesh->GetElements(); -// while ( itOnSubMesh->more() ) -// { -// aFace = itOnSubMesh->next(); -// itOnSubFace = aFace->nodesIterator(); -// att.clear(); -// for ( int j = 0; j < 3; ++j ) { -// // find HYBRID ID -// node = castToNode( itOnSubFace->next() ); -// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() ) -// node = n2nDegenIt->second; -// aSmdsID = node->GetID(); -// itOnMap = theSmdsToHybridIdMap.find( aSmdsID ); -// ASSERT( itOnMap != theSmdsToHybridIdMap.end() ); -// att.push_back((*itOnMap).second); -// } -// tt.push_back(att); -// } -// } -// } -// -// if (theEnforcedTriangles.size()) { -// std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles to input .mesh file" << std::endl; -// // Iterate over the enforced triangles -// for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) { -// aFace = (*elemIt); -// itOnSubFace = aFace->nodesIterator(); -// bool isOK = true; -// att.clear(); -// -// for ( int j = 0; j < 3; ++j ) { -// node = castToNode( itOnSubFace->next() ); -// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() ) -// node = n2nDegenIt->second; -// // std::cout << node; -// double x = node->X(); -// double y = node->Y(); -// double z = node->Z(); -// // Test if point is inside shape to mesh -// gp_Pnt myPoint(x,y,z); -// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh()); -// scl.Perform(myPoint, 1e-7); -// TopAbs_State result = scl.State(); -// if ( result != TopAbs_IN ) { -// isOK = false; -// theEnforcedTriangles.erase(elemIt); -// continue; -// } -// std::vector coords; -// coords.push_back(x); -// coords.push_back(y); -// coords.push_back(z); -// if (VerMap.find(coords) != VerMap.end()) { -// att.push_back(theNodeId2NodeIndexMap[node->GetID()]); -// continue; -// } -// VerTab.push_back(coords); -// VerMap.insert(coords); -// aHybridID++; -// theNodeId2NodeIndexMap.insert( std::make_pair( node->GetID(), aHybridID )); -// att.push_back(aHybridID); -// } -// if (isOK) -// tt.push_back(att); -// } -// } -// -// -// /* ========================== EDGES ========================== */ -// -// if (theEnforcedEdges.size()) { -// // Iterate over the enforced edges -// std::cout << "Add " << theEnforcedEdges.size() << " enforced edges to input .mesh file" << std::endl; -// for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) { -// aFace = (*elemIt); -// bool isOK = true; -// itOnSubFace = aFace->nodesIterator(); -// aet.clear(); -// for ( int j = 0; j < 2; ++j ) { -// node = castToNode( itOnSubFace->next() ); -// if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() ) -// node = n2nDegenIt->second; -// double x = node->X(); -// double y = node->Y(); -// double z = node->Z(); -// // Test if point is inside shape to mesh -// gp_Pnt myPoint(x,y,z); -// BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh()); -// scl.Perform(myPoint, 1e-7); -// TopAbs_State result = scl.State(); -// if ( result != TopAbs_IN ) { -// isOK = false; -// theEnforcedEdges.erase(elemIt); -// continue; -// } -// std::vector coords; -// coords.push_back(x); -// coords.push_back(y); -// coords.push_back(z); -// if (VerMap.find(coords) != VerMap.end()) { -// aet.push_back(theNodeId2NodeIndexMap[node->GetID()]); -// continue; -// } -// VerTab.push_back(coords); -// VerMap.insert(coords); -// -// aHybridID++; -// theNodeId2NodeIndexMap.insert( std::make_pair( node->GetID(), aHybridID )); -// aet.push_back(aHybridID); -// } -// if (isOK) -// et.push_back(aet); -// } -// } -// -// -// /* Write vertices number */ -// MESSAGE("Number of vertices: "<GetElements(); -// // for ( int j = 0; j < 4; ++j ) -// // { -// // aFace = itOnSubMesh->next(); -// // itOnSubFace = aFace->nodesIterator(); -// // aqt.clear(); -// // while ( itOnSubFace->more() ) { -// // // find HYBRID ID -// // aSmdsID = itOnSubFace->next()->GetID(); -// // itOnMap = theSmdsToHybridIdMap.find( aSmdsID ); -// // ASSERT( itOnMap != theSmdsToHybridIdMap.end() ); -// // aqt.push_back((*itOnMap).second); -// // } -// // qt.push_back(aqt); -// // } -// // } -// // } -// // -// // if (theEnforcedQuadrangles.size()) { -// // // Iterate over the enforced triangles -// // for(elemIt = theEnforcedQuadrangles.begin() ; elemIt != theEnforcedQuadrangles.end() ; ++elemIt) { -// // aFace = (*elemIt); -// // bool isOK = true; -// // itOnSubFace = aFace->nodesIterator(); -// // aqt.clear(); -// // for ( int j = 0; j < 4; ++j ) { -// // int aNodeID = itOnSubFace->next()->GetID(); -// // itOnMap = theNodeId2NodeIndexMap.find(aNodeID); -// // if (itOnMap != theNodeId2NodeIndexMap.end()) -// // aqt.push_back((*itOnMap).second); -// // else { -// // isOK = false; -// // theEnforcedQuadrangles.erase(elemIt); -// // break; -// // } -// // } -// // if (isOK) -// // qt.push_back(aqt); -// // } -// // } -// // -// -// // /* Write quadrilaterals number */ -// // if (qt.size()) { -// // GmfSetKwd(idx, GmfQuadrilaterals, qt.size()); -// // for (int i=0;i & theSmdsToHybridIdMap, -// const std::map & theEnforcedNodeIdToHybridIdMap, -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges, -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles) -// { -// // record structure: -// // -// // NB_ELEMS DUMMY_INT -// // Loop from 1 to NB_ELEMS -// // NB_NODES NODE_NB_1 NODE_NB_2 ... (NB_NODES + 1) times: DUMMY_INT - -// TopoDS_Shape aShape; -// const SMESHDS_SubMesh* theSubMesh; -// const SMDS_MeshElement* aFace; -// const char* space = " "; -// const int dummyint = 0; -// std::map::const_iterator itOnMap; -// SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace; -// int nbNodes, aSmdsID; - -// TIDSortedElemSet::const_iterator elemIt; -// int nbEnforcedEdges = theEnforcedEdges.size(); -// int nbEnforcedTriangles = theEnforcedTriangles.size(); - -// // count triangles bound to geometry -// int nbTriangles = 0; - -// TopTools_IndexedMapOfShape facesMap, trianglesMap; -// TopExp::MapShapes( theShape, TopAbs_FACE, facesMap ); - -// int nbFaces = facesMap.Extent(); - -// for ( int i = 1; i <= nbFaces; ++i ) -// if (( theSubMesh = theMesh.GetSubMesh( facesMap(i)))) -// nbTriangles += theSubMesh->NbElements(); -// std::string tmpStr; -// (nbFaces == 0 || nbFaces == 1) ? tmpStr = " shape " : tmpStr = " shapes " ; -// std::cout << " " << nbFaces << tmpStr << "of 2D dimension"; -// int nbEnforcedElements = nbEnforcedEdges+nbEnforcedTriangles; -// if (nbEnforcedElements > 0) { -// (nbEnforcedElements == 1) ? tmpStr = "shape:" : tmpStr = "shapes:"; -// std::cout << " and" << std::endl; -// std::cout << " " << nbEnforcedElements -// << " enforced " << tmpStr << std::endl; -// } -// else -// std::cout << std::endl; -// if (nbEnforcedEdges) { -// (nbEnforcedEdges == 1) ? tmpStr = "edge" : tmpStr = "edges"; -// std::cout << " " << nbEnforcedEdges << " enforced " << tmpStr << std::endl; -// } -// if (nbEnforcedTriangles) { -// (nbEnforcedTriangles == 1) ? tmpStr = "triangle" : tmpStr = "triangles"; -// std::cout << " " << nbEnforcedTriangles << " enforced " << tmpStr << std::endl; -// } -// std::cout << std::endl; - -// // theFile << space << nbTriangles << space << dummyint << std::endl; -// std::ostringstream globalStream, localStream, aStream; - -// for ( int i = 1; i <= facesMap.Extent(); i++ ) -// { -// aShape = facesMap(i); -// theSubMesh = theMesh.GetSubMesh(aShape); -// if ( !theSubMesh ) continue; -// itOnSubMesh = theSubMesh->GetElements(); -// while ( itOnSubMesh->more() ) -// { -// aFace = itOnSubMesh->next(); -// nbNodes = aFace->NbCornerNodes(); - -// localStream << nbNodes << space; - -// itOnSubFace = aFace->nodesIterator(); -// for ( int j = 0; j < 3; ++j ) { -// // find HYBRID ID -// aSmdsID = itOnSubFace->next()->GetID(); -// itOnMap = theSmdsToHybridIdMap.find( aSmdsID ); -// // if ( itOnMap == theSmdsToHybridIdMap.end() ) { -// // cout << "not found node: " << aSmdsID << endl; -// // return false; -// // } -// ASSERT( itOnMap != theSmdsToHybridIdMap.end() ); - -// localStream << (*itOnMap).second << space ; -// } - -// // (NB_NODES + 1) times: DUMMY_INT -// for ( int j=0; j<=nbNodes; j++) -// localStream << dummyint << space ; - -// localStream << std::endl; -// } -// } - -// globalStream << localStream.str(); -// localStream.str(""); - -// // -// // FACES : END -// // - -// // // -// // // ENFORCED EDGES : BEGIN -// // // -// // -// // // Iterate over the enforced edges -// // int usedEnforcedEdges = 0; -// // bool isOK; -// // for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) { -// // aFace = (*elemIt); -// // isOK = true; -// // itOnSubFace = aFace->nodesIterator(); -// // aStream.str(""); -// // aStream << "2" << space ; -// // for ( int j = 0; j < 2; ++j ) { -// // aSmdsID = itOnSubFace->next()->GetID(); -// // itOnMap = theEnforcedNodeIdToHybridIdMap.find(aSmdsID); -// // if (itOnMap != theEnforcedNodeIdToHybridIdMap.end()) -// // aStream << (*itOnMap).second << space; -// // else { -// // isOK = false; -// // break; -// // } -// // } -// // if (isOK) { -// // for ( int j=0; j<=2; j++) -// // aStream << dummyint << space ; -// // // aStream << dummyint << space << dummyint; -// // localStream << aStream.str() << std::endl; -// // usedEnforcedEdges++; -// // } -// // } -// // -// // if (usedEnforcedEdges) { -// // globalStream << localStream.str(); -// // localStream.str(""); -// // } -// // -// // // -// // // ENFORCED EDGES : END -// // // -// // // -// // -// // // -// // // ENFORCED TRIANGLES : BEGIN -// // // -// // // Iterate over the enforced triangles -// // int usedEnforcedTriangles = 0; -// // for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) { -// // aFace = (*elemIt); -// // nbNodes = aFace->NbCornerNodes(); -// // isOK = true; -// // itOnSubFace = aFace->nodesIterator(); -// // aStream.str(""); -// // aStream << nbNodes << space ; -// // for ( int j = 0; j < 3; ++j ) { -// // aSmdsID = itOnSubFace->next()->GetID(); -// // itOnMap = theEnforcedNodeIdToHybridIdMap.find(aSmdsID); -// // if (itOnMap != theEnforcedNodeIdToHybridIdMap.end()) -// // aStream << (*itOnMap).second << space; -// // else { -// // isOK = false; -// // break; -// // } -// // } -// // if (isOK) { -// // for ( int j=0; j<=3; j++) -// // aStream << dummyint << space ; -// // localStream << aStream.str() << std::endl; -// // usedEnforcedTriangles++; -// // } -// // } -// // -// // if (usedEnforcedTriangles) { -// // globalStream << localStream.str(); -// // localStream.str(""); -// // } -// // -// // // -// // // ENFORCED TRIANGLES : END -// // // - -// theFile -// << nbTriangles/*+usedEnforcedTriangles+usedEnforcedEdges*/ -// << " 0" << std::endl -// << globalStream.str(); - -// return true; -// } - -//======================================================================= -//function : writePoints -//purpose : -//======================================================================= - -// static bool writePoints (ofstream & theFile, -// SMESH_MesherHelper& theHelper, -// std::map & theSmdsToHybridIdMap, -// std::map & theEnforcedNodeIdToHybridIdMap, -// std::map & theHybridIdToNodeMap, -// HYBRIDPlugin_Hypothesis::TID2SizeMap & theNodeIDToSizeMap, -// HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices, -// HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap & theEnforcedNodes, -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges, -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles) -// { -// // record structure: -// // -// // NB_NODES -// // Loop from 1 to NB_NODES -// // X Y Z DUMMY_INT - -// SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS(); -// int nbNodes = theMeshDS->NbNodes(); -// if ( nbNodes == 0 ) -// return false; - -// int nbEnforcedVertices = theEnforcedVertices.size(); -// int nbEnforcedNodes = theEnforcedNodes.size(); - -// const TopoDS_Shape shapeToMesh = theMeshDS->ShapeToMesh(); - -// int aHybridID = 1; -// SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator(); -// const SMDS_MeshNode* node; - -// // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by HYBRID -// // The problem is in nodes on degenerated edges, we need to skip nodes which are free -// // and replace not-free nodes on degenerated edges by the node on vertex -// TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex -// TNodeNodeMap::iterator n2nDegenIt; -// if ( theHelper.HasDegeneratedEdges() ) -// { -// std::set checkedSM; -// for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next()) -// { -// SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() ); -// if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() )) -// { -// if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) -// { -// TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value(); -// const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS); -// { -// SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); -// while ( nIt->more() ) -// n2nDegen.insert( std::make_pair( nIt->next(), vNode )); -// } -// } -// } -// } -// nbNodes -= n2nDegen.size(); -// } - -// const bool isQuadMesh = -// theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) || -// theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) || -// theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC ); -// if ( isQuadMesh ) -// { -// // descrease nbNodes by nb of medium nodes -// while ( nodeIt->more() ) -// { -// node = nodeIt->next(); -// if ( !theHelper.IsDegenShape( node->getshapeId() )) -// nbNodes -= int( theHelper.IsMedium( node )); -// } -// nodeIt = theMeshDS->nodesIterator(); -// } - -// const char* space = " "; -// const int dummyint = 0; - -// std::string tmpStr; -// (nbNodes == 0 || nbNodes == 1) ? tmpStr = " node" : tmpStr = " nodes"; -// // NB_NODES -// std::cout << std::endl; -// std::cout << "The initial 2D mesh contains :" << std::endl; -// std::cout << " " << nbNodes << tmpStr << std::endl; -// if (nbEnforcedVertices > 0) { -// (nbEnforcedVertices == 1) ? tmpStr = "vertex" : tmpStr = "vertices"; -// std::cout << " " << nbEnforcedVertices << " enforced " << tmpStr << std::endl; -// } -// if (nbEnforcedNodes > 0) { -// (nbEnforcedNodes == 1) ? tmpStr = "node" : tmpStr = "nodes"; -// std::cout << " " << nbEnforcedNodes << " enforced " << tmpStr << std::endl; -// } -// std::cout << std::endl; -// std::cout << "Start writing in 'points' file ..." << std::endl; - -// theFile << nbNodes << std::endl; - -// // Loop from 1 to NB_NODES - -// while ( nodeIt->more() ) -// { -// node = nodeIt->next(); -// if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238 -// continue; -// if ( n2nDegen.count( node ) ) // Issue 0020674 -// continue; - -// theSmdsToHybridIdMap.insert( std::make_pair( node->GetID(), aHybridID )); -// theHybridIdToNodeMap.insert( std::make_pair( aHybridID, node )); -// aHybridID++; - -// // X Y Z DUMMY_INT -// theFile -// << node->X() << space -// << node->Y() << space -// << node->Z() << space -// << dummyint; - -// theFile << std::endl; - -// } - -// // Iterate over the enforced nodes -// std::map enfVertexIndexSizeMap; -// if (nbEnforcedNodes) { -// HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator nodeIt = theEnforcedNodes.begin(); -// for( ; nodeIt != theEnforcedNodes.end() ; ++nodeIt) { -// double x = nodeIt->first->X(); -// double y = nodeIt->first->Y(); -// double z = nodeIt->first->Z(); -// // Test if point is inside shape to mesh -// gp_Pnt myPoint(x,y,z); -// BRepClass3d_SolidClassifier scl(shapeToMesh); -// scl.Perform(myPoint, 1e-7); -// TopAbs_State result = scl.State(); -// if ( result != TopAbs_IN ) -// continue; -// std::vector coords; -// coords.push_back(x); -// coords.push_back(y); -// coords.push_back(z); -// if (theEnforcedVertices.find(coords) != theEnforcedVertices.end()) -// continue; - -// // double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second; -// // theHybridIdToNodeMap.insert( std::make_pair( nbNodes + i, (*nodeIt) )); -// // MESSAGE("Adding enforced node (" << x << "," << y <<"," << z << ")"); -// // X Y Z PHY_SIZE DUMMY_INT -// theFile -// << x << space -// << y << space -// << z << space -// << -1 << space -// << dummyint << space; -// theFile << std::endl; -// theEnforcedNodeIdToHybridIdMap.insert( std::make_pair( nodeIt->first->GetID(), aHybridID )); -// enfVertexIndexSizeMap[aHybridID] = -1; -// aHybridID++; -// // else -// // MESSAGE("Enforced vertex (" << x << "," << y <<"," << z << ") is not inside the geometry: it was not added "); -// } -// } - -// if (nbEnforcedVertices) { -// // Iterate over the enforced vertices -// HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt = theEnforcedVertices.begin(); -// for( ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) { -// double x = vertexIt->first[0]; -// double y = vertexIt->first[1]; -// double z = vertexIt->first[2]; -// // Test if point is inside shape to mesh -// gp_Pnt myPoint(x,y,z); -// BRepClass3d_SolidClassifier scl(shapeToMesh); -// scl.Perform(myPoint, 1e-7); -// TopAbs_State result = scl.State(); -// if ( result != TopAbs_IN ) -// continue; -// MESSAGE("Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second); -// // X Y Z PHY_SIZE DUMMY_INT -// theFile -// << x << space -// << y << space -// << z << space -// << vertexIt->second << space -// << dummyint << space; -// theFile << std::endl; -// enfVertexIndexSizeMap[aHybridID] = vertexIt->second; -// aHybridID++; -// } -// } - - -// std::cout << std::endl; -// std::cout << "End writing in 'points' file." << std::endl; - -// return true; -// } - -//======================================================================= -//function : readResultFile -//purpose : readResultFile with geometry -//======================================================================= - -// static bool readResultFile(const int fileOpen, -// #ifdef WIN32 -// const char* fileName, -// #endif -// HYBRIDPlugin_HYBRID* theAlgo, -// SMESH_MesherHelper& theHelper, -// TopoDS_Shape tabShape[], -// double** tabBox, -// const int nbShape, -// std::map & theHybridIdToNodeMap, -// std::map & theNodeId2NodeIndexMap, -// bool toMeshHoles, -// int nbEnforcedVertices, -// int nbEnforcedNodes, -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges, -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles, -// bool toMakeGroupsOfDomains) -// { -// MESSAGE("HYBRIDPlugin_HYBRID::readResultFile()"); -// Kernel_Utils::Localizer loc; -// struct stat status; -// size_t length; - -// std::string tmpStr; - -// char *ptr, *mapPtr; -// char *tetraPtr; -// char *shapePtr; - -// SMESHDS_Mesh* theMeshDS = theHelper.GetMeshDS(); - -// int nbElems, nbNodes, nbInputNodes; -// int nbTriangle; -// int ID, shapeID, hybridShapeID; -// int IdShapeRef = 1; -// int compoundID = -// nbShape ? theMeshDS->ShapeToIndex( tabShape[0] ) : theMeshDS->ShapeToIndex( theMeshDS->ShapeToMesh() ); - -// int *tab, *tabID, *nodeID, *nodeAssigne; -// double *coord; -// const SMDS_MeshNode **node; - -// tab = new int[3]; -// nodeID = new int[4]; -// coord = new double[3]; -// node = new const SMDS_MeshNode*[4]; - -// TopoDS_Shape aSolid; -// SMDS_MeshNode * aNewNode; -// std::map ::iterator itOnNode; -// SMDS_MeshElement* aTet; -// #ifdef _DEBUG_ -// std::set shapeIDs; -// #endif - -// // Read the file state -// fstat(fileOpen, &status); -// length = status.st_size; - -// // Mapping the result file into memory -// #ifdef WIN32 -// HANDLE fd = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, -// NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -// HANDLE hMapObject = CreateFileMapping(fd, NULL, PAGE_READONLY, -// 0, (DWORD)length, NULL); -// ptr = ( char* ) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, 0 ); -// #else -// ptr = (char *) mmap(0,length,PROT_READ,MAP_PRIVATE,fileOpen,0); -// #endif -// mapPtr = ptr; - -// ptr = readMapIntLine(ptr, tab); -// tetraPtr = ptr; - -// nbElems = tab[0]; -// nbNodes = tab[1]; -// nbInputNodes = tab[2]; - -// nodeAssigne = new int[ nbNodes+1 ]; - -// if (nbShape > 0) -// aSolid = tabShape[0]; - -// // Reading the nodeId -// for (int i=0; i < 4*nbElems; i++) -// strtol(ptr, &ptr, 10); - -// MESSAGE("nbInputNodes: "<computeCanceled()) -// return false; -// for (int iCoor=0; iCoor < 3; iCoor++) -// coord[ iCoor ] = strtod(ptr, &ptr); -// nodeAssigne[ iNode ] = 1; -// if ( iNode > (nbInputNodes-(nbEnforcedVertices+nbEnforcedNodes)) ) { -// // Creating SMESH nodes -// // - for enforced vertices -// // - for vertices of forced edges -// // - for hybrid nodes -// nodeAssigne[ iNode ] = 0; -// aNewNode = theMeshDS->AddNode( coord[0],coord[1],coord[2] ); -// theHybridIdToNodeMap.insert(theHybridIdToNodeMap.end(), std::make_pair( iNode, aNewNode )); -// } -// } - -// // Reading the number of triangles which corresponds to the number of sub-domains -// nbTriangle = strtol(ptr, &ptr, 10); - -// tabID = new int[nbTriangle]; -// for (int i=0; i < nbTriangle; i++) { -// if(theAlgo->computeCanceled()) -// return false; -// tabID[i] = 0; -// // find the solid corresponding to HYBRID sub-domain following -// // the technique proposed in HYBRID manual in chapter -// // "B.4 Subdomain (sub-region) assignment" -// int nodeId1 = strtol(ptr, &ptr, 10); -// int nodeId2 = strtol(ptr, &ptr, 10); -// int nodeId3 = strtol(ptr, &ptr, 10); -// if ( nbTriangle > 1 ) { -// const SMDS_MeshNode* n1 = theHybridIdToNodeMap[ nodeId1 ]; -// const SMDS_MeshNode* n2 = theHybridIdToNodeMap[ nodeId2 ]; -// const SMDS_MeshNode* n3 = theHybridIdToNodeMap[ nodeId3 ]; -// if (!n1 || !n2 || !n3) { -// tabID[i] = HOLE_ID; -// continue; -// } -// try { -// OCC_CATCH_SIGNALS; -// // tabID[i] = findShapeID( theHelper, n1, n2, n3, toMeshHoles ); -// tabID[i] = findShapeID( *theHelper.GetMesh(), n1, n2, n3, toMeshHoles ); -// // -- 0020330: Pb with hybrid as a submesh -// // check that found shape is to be meshed -// if ( tabID[i] > 0 ) { -// const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( tabID[i] ); -// bool isToBeMeshed = false; -// for ( int iS = 0; !isToBeMeshed && iS < nbShape; ++iS ) -// isToBeMeshed = foundShape.IsSame( tabShape[ iS ]); -// if ( !isToBeMeshed ) -// tabID[i] = HOLE_ID; -// } -// // END -- 0020330: Pb with hybrid as a submesh -// #ifdef _DEBUG_ -// std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl; -// #endif -// } -// catch ( Standard_Failure & ex) -// { -// #ifdef _DEBUG_ -// std::cout << i+1 << " subdomain: Exception caugt: " << ex.GetMessageString() << std::endl; -// #endif -// } -// catch (...) { -// #ifdef _DEBUG_ -// std::cout << i+1 << " subdomain: unknown exception caught " << std::endl; -// #endif -// } -// } -// } - -// shapePtr = ptr; - -// if ( nbTriangle <= nbShape ) // no holes -// toMeshHoles = true; // not avoid creating tetras in holes - -// // IMP 0022172: [CEA 790] create the groups corresponding to domains -// std::vector< std::vector< const SMDS_MeshElement* > > elemsOfDomain( Max( nbTriangle, nbShape )); - -// // Associating the tetrahedrons to the shapes -// shapeID = compoundID; -// for (int iElem = 0; iElem < nbElems; iElem++) { -// if(theAlgo->computeCanceled()) -// return false; -// for (int iNode = 0; iNode < 4; iNode++) { -// ID = strtol(tetraPtr, &tetraPtr, 10); -// itOnNode = theHybridIdToNodeMap.find(ID); -// node[ iNode ] = itOnNode->second; -// nodeID[ iNode ] = ID; -// } -// // We always run HYBRID with "to mesh holes"==TRUE but we must not create -// // tetras within holes depending on hypo option, -// // so we first check if aTet is inside a hole and then create it -// //aTet = theMeshDS->AddVolume( node[1], node[0], node[2], node[3] ); -// hybridShapeID = 0; // domain ID -// if ( nbTriangle > 1 ) { -// shapeID = HOLE_ID; // negative shapeID means not to create tetras if !toMeshHoles -// hybridShapeID = strtol(shapePtr, &shapePtr, 10) - IdShapeRef; -// if ( tabID[ hybridShapeID ] == 0 ) { -// TopAbs_State state; -// aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape, &state); -// if ( toMeshHoles || state == TopAbs_IN ) -// shapeID = theMeshDS->ShapeToIndex( aSolid ); -// tabID[ hybridShapeID ] = shapeID; -// } -// else -// shapeID = tabID[ hybridShapeID ]; -// } -// else if ( nbShape > 1 ) { -// // Case where nbTriangle == 1 while nbShape == 2 encountered -// // with compound of 2 boxes and "To mesh holes"==False, -// // so there are no subdomains specified for each tetrahedron. -// // Try to guess a solid by a node already bound to shape -// shapeID = 0; -// for ( int i=0; i<4 && shapeID==0; i++ ) { -// if ( nodeAssigne[ nodeID[i] ] == 1 && -// node[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE && -// node[i]->getshapeId() > 1 ) -// { -// shapeID = node[i]->getshapeId(); -// } -// } -// if ( shapeID==0 ) { -// aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape); -// shapeID = theMeshDS->ShapeToIndex( aSolid ); -// } -// } -// // set new nodes and tetrahedron onto the shape -// for ( int i=0; i<4; i++ ) { -// if ( nodeAssigne[ nodeID[i] ] == 0 ) { -// if ( shapeID != HOLE_ID ) -// theMeshDS->SetNodeInVolume( node[i], shapeID ); -// nodeAssigne[ nodeID[i] ] = shapeID; -// } -// } -// if ( toMeshHoles || shapeID != HOLE_ID ) { -// aTet = theHelper.AddVolume( node[1], node[0], node[2], node[3], -// /*id=*/0, /*force3d=*/false); -// theMeshDS->SetMeshElementOnShape( aTet, shapeID ); -// if ( toMakeGroupsOfDomains ) -// { -// if ( int( elemsOfDomain.size() ) < hybridShapeID+1 ) -// elemsOfDomain.resize( hybridShapeID+1 ); -// elemsOfDomain[ hybridShapeID ].push_back( aTet ); -// } -// } -// #ifdef _DEBUG_ -// shapeIDs.insert( shapeID ); -// #endif -// } -// if ( toMakeGroupsOfDomains ) -// makeDomainGroups( elemsOfDomain, &theHelper ); - -// // Add enforced elements -// HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap::const_iterator elemIt; -// const SMDS_MeshElement* anElem; -// SMDS_ElemIteratorPtr itOnEnfElem; -// std::map::const_iterator itOnMap; -// shapeID = compoundID; -// // Enforced edges -// if (theEnforcedEdges.size()) { -// (theEnforcedEdges.size() <= 1) ? tmpStr = " enforced edge" : " enforced edges"; -// std::cout << "Add " << theEnforcedEdges.size() << tmpStr << std::endl; -// std::vector< const SMDS_MeshNode* > node( 2 ); -// // Iterate over the enforced edges -// for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) { -// anElem = elemIt->first; -// bool addElem = true; -// itOnEnfElem = anElem->nodesIterator(); -// for ( int j = 0; j < 2; ++j ) { -// int aNodeID = itOnEnfElem->next()->GetID(); -// itOnMap = theNodeId2NodeIndexMap.find(aNodeID); -// if (itOnMap != theNodeId2NodeIndexMap.end()) { -// itOnNode = theHybridIdToNodeMap.find((*itOnMap).second); -// if (itOnNode != theHybridIdToNodeMap.end()) { -// node.push_back((*itOnNode).second); -// // shapeID =(*itOnNode).second->getshapeId(); -// } -// else -// addElem = false; -// } -// else -// addElem = false; -// } -// if (addElem) { -// aTet = theHelper.AddEdge( node[0], node[1], 0, false); -// theMeshDS->SetMeshElementOnShape( aTet, shapeID ); -// } -// } -// } -// // Enforced faces -// if (theEnforcedTriangles.size()) { -// (theEnforcedTriangles.size() <= 1) ? tmpStr = " enforced triangle" : " enforced triangles"; -// std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles" << std::endl; -// std::vector< const SMDS_MeshNode* > node( 3 ); -// // Iterate over the enforced triangles -// for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) { -// anElem = elemIt->first; -// bool addElem = true; -// itOnEnfElem = anElem->nodesIterator(); -// for ( int j = 0; j < 3; ++j ) { -// int aNodeID = itOnEnfElem->next()->GetID(); -// itOnMap = theNodeId2NodeIndexMap.find(aNodeID); -// if (itOnMap != theNodeId2NodeIndexMap.end()) { -// itOnNode = theHybridIdToNodeMap.find((*itOnMap).second); -// if (itOnNode != theHybridIdToNodeMap.end()) { -// node.push_back((*itOnNode).second); -// // shapeID =(*itOnNode).second->getshapeId(); -// } -// else -// addElem = false; -// } -// else -// addElem = false; -// } -// if (addElem) { -// aTet = theHelper.AddFace( node[0], node[1], node[2], 0, false); -// theMeshDS->SetMeshElementOnShape( aTet, shapeID ); -// } -// } -// } - -// // Remove nodes of tetras inside holes if !toMeshHoles -// if ( !toMeshHoles ) { -// itOnNode = theHybridIdToNodeMap.find( nbInputNodes ); -// for ( ; itOnNode != theHybridIdToNodeMap.end(); ++itOnNode) { -// ID = itOnNode->first; -// if ( nodeAssigne[ ID ] == HOLE_ID ) -// theMeshDS->RemoveFreeNode( itOnNode->second, 0 ); -// } -// } - - -// if ( nbElems ) { -// (nbElems <= 1) ? tmpStr = " tetrahedra" : " tetrahedrons"; -// cout << nbElems << tmpStr << " have been associated to " << nbShape; -// (nbShape <= 1) ? tmpStr = " shape" : " shapes"; -// cout << tmpStr << endl; -// } -// #ifdef WIN32 -// UnmapViewOfFile(mapPtr); -// CloseHandle(hMapObject); -// CloseHandle(fd); -// #else -// munmap(mapPtr, length); -// #endif -// close(fileOpen); - -// delete [] tab; -// delete [] tabID; -// delete [] nodeID; -// delete [] coord; -// delete [] node; -// delete [] nodeAssigne; - -// #ifdef _DEBUG_ -// shapeIDs.erase(-1); -// if ((int) shapeIDs.size() != nbShape ) { -// (shapeIDs.size() <= 1) ? tmpStr = " solid" : " solids"; -// std::cout << "Only " << shapeIDs.size() << tmpStr << " of " << nbShape << " found" << std::endl; -// for (int i=0; iShapeToIndex( tabShape[i] ); -// if ( shapeIDs.find( shapeID ) == shapeIDs.end() ) -// std::cout << " Solid #" << shapeID << " not found" << std::endl; -// } -// } -// #endif - -// return true; -// } - - //============================================================================= /*! *Here we are going to use the HYBRID mesher with geometry @@ -2894,35 +1360,26 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, // a unique working file name // to avoid access to the same files by eg different users _genericName = HYBRIDPlugin_Hypothesis::GetFileName(_hyp); - TCollection_AsciiString aGenericName((char*) _genericName.c_str() ); - TCollection_AsciiString aGenericNameRequired = aGenericName + "_required"; + std::string aGenericName = _genericName; + std::string aGenericNameRequired = aGenericName + "_required"; - TCollection_AsciiString aLogFileName = aGenericName + ".log"; // log - TCollection_AsciiString aResultFileName; + std::string aLogFileName = aGenericName + ".log"; // log + std::string aResultFileName; - TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName; -//#ifdef _DEBUG_ + std::string aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName; aGMFFileName = aGenericName + ".mesh"; // GMF mesh file aResultFileName = aGenericName + "Vol.mesh"; // GMF mesh file aResSolFileName = aGenericName + "Vol.sol"; // GMF mesh file aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file aSolFileName = aGenericNameRequired + ".sol"; // GMF solution file -//#else -// aGMFFileName = aGenericName + ".meshb"; // GMF mesh file -// aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file -// aRequiredVerticesFileName = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file -// aSolFileName = aGenericNameRequired + ".solb"; // GMF solution file -//#endif std::map aNodeId2NodeIndexMap, aSmdsToHybridIdMap, anEnforcedNodeIdToHybridIdMap; - //std::map aHybridIdToNodeMap; std::map nodeID2nodeIndexMap; std::map, std::string> enfVerticesWithGroup; HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues coordsSizeMap = HYBRIDPlugin_Hypothesis::GetEnforcedVerticesCoordsSize(_hyp); HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = HYBRIDPlugin_Hypothesis::GetEnforcedNodes(_hyp); HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = HYBRIDPlugin_Hypothesis::GetEnforcedEdges(_hyp); HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(_hyp); -// TIDSortedElemSet enforcedQuadrangles = HYBRIDPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp); HYBRIDPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = HYBRIDPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp); HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertices = HYBRIDPlugin_Hypothesis::GetEnforcedVertices(_hyp); @@ -2932,53 +1389,30 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt) { HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* enfVertex = (*enfVerIt); -// if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) { if (enfVertex->coords.size()) { coordsSizeMap.insert(std::make_pair(enfVertex->coords,enfVertex->size)); enfVerticesWithGroup.insert(std::make_pair(enfVertex->coords,enfVertex->groupName)); -// MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<coords[0]<<","<coords[1]<<","<coords[2]<<"),\""<groupName<<"\"))"); } else { -// if (!enfVertex->geomEntry.empty()) { TopoDS_Shape GeomShape = entryToShape(enfVertex->geomEntry); -// GeomType = GeomShape.ShapeType(); - -// if (!enfVertex->isCompound) { -// // if (GeomType == TopAbs_VERTEX) { -// coords.clear(); -// aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape)); -// coords.push_back(aPnt.X()); -// coords.push_back(aPnt.Y()); -// coords.push_back(aPnt.Z()); -// if (coordsSizeMap.find(coords) == coordsSizeMap.end()) { -// coordsSizeMap.insert(std::make_pair(coords,enfVertex->size)); -// enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName)); -// } -// } -// -// // Group Management -// else { -// if (GeomType == TopAbs_COMPOUND){ - for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ - coords.clear(); - if (it.Value().ShapeType() == TopAbs_VERTEX){ - gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value())); - coords.push_back(aPnt.X()); - coords.push_back(aPnt.Y()); - coords.push_back(aPnt.Z()); - if (coordsSizeMap.find(coords) == coordsSizeMap.end()) { - coordsSizeMap.insert(std::make_pair(coords,enfVertex->size)); - enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName)); -// MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<groupName<<"\"))"); - } + for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ + coords.clear(); + if (it.Value().ShapeType() == TopAbs_VERTEX){ + gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value())); + coords.push_back(aPnt.X()); + coords.push_back(aPnt.Y()); + coords.push_back(aPnt.Z()); + if (coordsSizeMap.find(coords) == coordsSizeMap.end()) { + coordsSizeMap.insert(std::make_pair(coords,enfVertex->size)); + enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName)); } } -// } + } } } int nbEnforcedVertices = coordsSizeMap.size(); int nbEnforcedNodes = enforcedNodes.size(); - + std::string tmpStr; (nbEnforcedNodes <= 1) ? tmpStr = "node" : "nodes"; std::cout << nbEnforcedNodes << " enforced " << tmpStr << " from hypo" << std::endl; @@ -2998,9 +1432,9 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, MG_HYBRID_API mgHybrid( _computeCanceled, _progress ); Ok = writeGMFFile(&mgHybrid, - aGMFFileName.ToCString(), - aRequiredVerticesFileName.ToCString(), - aSolFileName.ToCString(), + aGMFFileName.c_str(), + aRequiredVerticesFileName.c_str(), + aSolFileName.c_str(), *proxyMesh, helper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap, aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId, @@ -3008,9 +1442,9 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, enfVerticesWithGroup, coordsSizeMap); // Write aSmdsToHybridIdMap to temp file - TCollection_AsciiString aSmdsToHybridIdMapFileName; + std::string aSmdsToHybridIdMapFileName; aSmdsToHybridIdMapFileName = aGenericName + ".ids"; // ids relation - ofstream aIdsFile ( aSmdsToHybridIdMapFileName.ToCString() , ios::out); + ofstream aIdsFile ( aSmdsToHybridIdMapFileName , ios::out); Ok = aIdsFile.rdbuf()->is_open(); if (!Ok) { INFOS( "Can't write into " << aSmdsToHybridIdMapFileName); @@ -3040,23 +1474,21 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, // run hybrid mesher // ----------------- - TCollection_AsciiString cmd( (char*)HYBRIDPlugin_Hypothesis::CommandToRun( _hyp ).c_str() ); + std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, theMesh ); if ( mgHybrid.IsExecutable() ) { - cmd += TCollection_AsciiString(" --in ") + aGMFFileName; - //if ( nbEnforcedVertices + nbEnforcedNodes) - // cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired; - cmd += TCollection_AsciiString(" --out ") + aResultFileName; + cmd += " --in " + aGMFFileName; + cmd += " --out " + aResultFileName; } std::cout << std::endl; std::cout << "Hybrid execution with geometry..." << std::endl; std::cout << cmd; if ( !_logInStandardOutput ) { - mgHybrid.SetLogFile( aLogFileName.ToCString() ); + mgHybrid.SetLogFile( aLogFileName ); if ( mgHybrid.IsExecutable() ) - cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file + cmd += " 1>" + aLogFileName; // dump into file std::cout << " 1> " << aLogFileName; } std::cout << std::endl; @@ -3064,7 +1496,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, _computeCanceled = false; std::string errStr; - Ok = mgHybrid.Compute( cmd.ToCString(), errStr ); // run + Ok = mgHybrid.Compute( cmd, errStr ); // run if ( _logInStandardOutput && mgHybrid.IsLibrary() ) std::cout << std::endl << mgHybrid.GetLog() << std::endl; @@ -3077,22 +1509,21 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, // Mapping the result file - HYBRIDPlugin_Hypothesis::TSetStrings groupsToRemove = HYBRIDPlugin_Hypothesis::GetGroupsToRemove(_hyp); - bool toMeshHoles = - _hyp ? _hyp->GetToMeshHoles(true) : HYBRIDPlugin_Hypothesis::DefaultMeshHoles(); - const bool toMakeGroupsOfDomains = HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp ); + HYBRIDPlugin_Hypothesis::TSetStrings groupsToRemove = HYBRIDPlugin_Hypothesis::GetGroupsToRemove(_hyp); + bool toMeshHoles = + _hyp ? _hyp->GetToMeshHoles(true) : HYBRIDPlugin_Hypothesis::DefaultMeshHoles(); + const bool toMakeGroupsOfDomains = HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp ); - helper.IsQuadraticSubMesh( theShape ); - helper.SetElementsOnShape( false ); - - Ok = readGMFFile(&mgHybrid, aResultFileName.ToCString(), - this, - &helper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap, - aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId, - groupsToRemove, toMakeGroupsOfDomains, toMeshHoles); + helper.IsQuadraticSubMesh( theShape ); + helper.SetElementsOnShape( false ); - removeEmptyGroupsOfDomains( helper.GetMesh(), !toMakeGroupsOfDomains ); + Ok = readGMFFile(&mgHybrid, aResultFileName.c_str(), + this, + &helper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap, + aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId, + groupsToRemove, toMakeGroupsOfDomains, toMeshHoles); + removeEmptyGroupsOfDomains( helper.GetMesh(), !toMakeGroupsOfDomains ); @@ -3104,15 +1535,12 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, { if ( _removeLogOnSuccess ) removeFile( aLogFileName ); - - // if ( _hyp && _hyp->GetToMakeGroupsOfDomains() ) - // error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since the mesh is on shape" ); } else if ( mgHybrid.HasLog() ) { // get problem description from the log file _Ghs2smdsConvertor conv( aNodeByHybridId ); - storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(), + storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.c_str(), mgHybrid.GetLog(), conv ); } else if ( !errStr.empty() ) @@ -3135,7 +1563,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, } if ( mgHybrid.IsExecutable() ) { - std::cout << "<" << aResultFileName.ToCString() << "> HYBRID output file "; + std::cout << "<" << aResultFileName << "> HYBRID output file "; if ( !Ok ) std::cout << "not "; std::cout << "treated !" << std::endl; @@ -3157,39 +1585,29 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, SMESH_MesherHelper* theHelper) { - MESSAGE("HYBRIDPlugin_HYBRID::Compute()"); - theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() ); // a unique working file name // to avoid access to the same files by eg different users _genericName = HYBRIDPlugin_Hypothesis::GetFileName(_hyp); - TCollection_AsciiString aGenericName((char*) _genericName.c_str() ); - TCollection_AsciiString aGenericNameRequired = aGenericName + "_required"; + std::string aGenericName((char*) _genericName.c_str() ); + std::string aGenericNameRequired = aGenericName + "_required"; - TCollection_AsciiString aLogFileName = aGenericName + ".log"; // log - TCollection_AsciiString aResultFileName; + std::string aLogFileName = aGenericName + ".log"; // log + std::string aResultFileName; bool Ok; - TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName; -//#ifdef _DEBUG_ + std::string aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName; aGMFFileName = aGenericName + ".mesh"; // GMF mesh file aResultFileName = aGenericName + "Vol.mesh"; // GMF mesh file aResSolFileName = aGenericName + "Vol.sol"; // GMF mesh file aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file aSolFileName = aGenericNameRequired + ".sol"; // GMF solution file -//#else -// aGMFFileName = aGenericName + ".meshb"; // GMF mesh file -// aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file -// aRequiredVerticesFileName = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file -// aSolFileName = aGenericNameRequired + ".solb"; // GMF solution file -//#endif std::map nodeID2nodeIndexMap; std::map, std::string> enfVerticesWithGroup; HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues coordsSizeMap; TopoDS_Shape GeomShape; -// TopAbs_ShapeEnum GeomType; std::vector coords; gp_Pnt aPnt; HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* enfVertex; @@ -3200,69 +1618,31 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt) { enfVertex = (*enfVerIt); -// if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) { if (enfVertex->coords.size()) { coordsSizeMap.insert(std::make_pair(enfVertex->coords,enfVertex->size)); enfVerticesWithGroup.insert(std::make_pair(enfVertex->coords,enfVertex->groupName)); -// MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<coords[0]<<","<coords[1]<<","<coords[2]<<"),\""<groupName<<"\"))"); } else { -// if (!enfVertex->geomEntry.empty()) { GeomShape = entryToShape(enfVertex->geomEntry); -// GeomType = GeomShape.ShapeType(); - -// if (!enfVertex->isCompound) { -// // if (GeomType == TopAbs_VERTEX) { -// coords.clear(); -// aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape)); -// coords.push_back(aPnt.X()); -// coords.push_back(aPnt.Y()); -// coords.push_back(aPnt.Z()); -// if (coordsSizeMap.find(coords) == coordsSizeMap.end()) { -// coordsSizeMap.insert(std::make_pair(coords,enfVertex->size)); -// enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName)); -// } -// } -// -// // Group Management -// else { -// if (GeomType == TopAbs_COMPOUND){ - for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ - coords.clear(); - if (it.Value().ShapeType() == TopAbs_VERTEX){ - aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value())); - coords.push_back(aPnt.X()); - coords.push_back(aPnt.Y()); - coords.push_back(aPnt.Z()); - if (coordsSizeMap.find(coords) == coordsSizeMap.end()) { - coordsSizeMap.insert(std::make_pair(coords,enfVertex->size)); - enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName)); -// MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<groupName<<"\"))"); - } + for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ + coords.clear(); + if (it.Value().ShapeType() == TopAbs_VERTEX){ + aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value())); + coords.push_back(aPnt.X()); + coords.push_back(aPnt.Y()); + coords.push_back(aPnt.Z()); + if (coordsSizeMap.find(coords) == coordsSizeMap.end()) { + coordsSizeMap.insert(std::make_pair(coords,enfVertex->size)); + enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName)); } } -// } + } } } -// const SMDS_MeshNode* enfNode; HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = HYBRIDPlugin_Hypothesis::GetEnforcedNodes(_hyp); -// HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator enfNodeIt = enforcedNodes.begin(); -// for ( ; enfNodeIt != enforcedNodes.end() ; ++enfNodeIt) -// { -// enfNode = enfNodeIt->first; -// coords.clear(); -// coords.push_back(enfNode->X()); -// coords.push_back(enfNode->Y()); -// coords.push_back(enfNode->Z()); -// if (enfVerticesWithGro -// enfVerticesWithGroup.insert(std::make_pair(coords,enfNodeIt->second)); -// } - - HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = HYBRIDPlugin_Hypothesis::GetEnforcedEdges(_hyp); HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(_hyp); -// TIDSortedElemSet enforcedQuadrangles = HYBRIDPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp); HYBRIDPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = HYBRIDPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp); std::string tmpStr; @@ -3284,8 +1664,8 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, MG_HYBRID_API mgHybrid( _computeCanceled, _progress ); Ok = writeGMFFile(&mgHybrid, - aGMFFileName.ToCString(), - aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(), + aGMFFileName.c_str(), + aRequiredVerticesFileName.c_str(), aSolFileName.c_str(), *proxyMesh, *theHelper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap, aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId, @@ -3296,19 +1676,17 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, // run hybrid mesher // ----------------- - TCollection_AsciiString cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, false ).c_str(); + std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, theMesh ); if ( mgHybrid.IsExecutable() ) { - cmd += TCollection_AsciiString(" --in ") + aGMFFileName; - //if ( nbEnforcedVertices + nbEnforcedNodes) - // cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired; - cmd += TCollection_AsciiString(" --out ") + aResultFileName; + cmd += " --in " + aGMFFileName; + cmd += " --out " + aResultFileName; } if ( !_logInStandardOutput ) { - cmd += TCollection_AsciiString(" 1> " ) + aLogFileName; // dump into file - mgHybrid.SetLogFile( aLogFileName.ToCString() ); + cmd += " 1> " + aLogFileName; // dump into file + mgHybrid.SetLogFile( aLogFileName ); } std::cout << std::endl; std::cout << "Hybrid execution w/o geometry..." << std::endl; @@ -3317,7 +1695,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, _computeCanceled = false; std::string errStr; - Ok = mgHybrid.Compute( cmd.ToCString(), errStr ); // run + Ok = mgHybrid.Compute( cmd, errStr ); // run if ( _logInStandardOutput && mgHybrid.IsLibrary() ) std::cout << std::endl << mgHybrid.GetLog() << std::endl; @@ -3331,14 +1709,13 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, const bool toMakeGroupsOfDomains = HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp ); Ok = Ok && readGMFFile(&mgHybrid, - aResultFileName.ToCString(), + aResultFileName.c_str(), this, theHelper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap, aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId, groupsToRemove, toMakeGroupsOfDomains); updateMeshGroups(theHelper->GetMesh(), groupsToRemove); - //removeEmptyGroupsOfDomains( theHelper->GetMesh(), notEmptyAsWell ); removeEmptyGroupsOfDomains( theHelper->GetMesh(), !toMakeGroupsOfDomains ); if ( Ok ) { @@ -3354,21 +1731,18 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, { if ( _removeLogOnSuccess ) removeFile( aLogFileName ); - - //if ( !toMakeGroupsOfDomains && _hyp && _hyp->GetToMakeGroupsOfDomains() ) - //error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since 'toMeshHoles' is OFF." ); } else if ( mgHybrid.HasLog() ) { // get problem description from the log file _Ghs2smdsConvertor conv( aNodeByHybridId ); - storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(), + storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.c_str(), mgHybrid.GetLog(), conv ); } else { // the log file is empty removeFile( aLogFileName ); - INFOS( "HYBRID Error, command '" << cmd.ToCString() << "' failed" ); + INFOS( "HYBRID Error, command '" << cmd << "' failed" ); error(COMPERR_ALGO_FAILED, "hybrid: command not found" ); } diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx index 80cd00a..0c67197 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx @@ -48,7 +48,6 @@ HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i (PortableServer::POA_ptr thePOA, SMESH_Algo_i( thePOA ), SMESH_3D_Algo_i( thePOA ) { - MESSAGE( "HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i" ); myBaseImpl = new ::HYBRIDPlugin_HYBRID (theGenImpl->GetANewId(), theStudyId, theGenImpl ); @@ -64,7 +63,6 @@ HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i (PortableServer::POA_ptr thePOA, HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i() { - MESSAGE( "HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i" ); } //============================================================================= @@ -77,7 +75,6 @@ HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i() ::HYBRIDPlugin_HYBRID* HYBRIDPlugin_HYBRID_i::GetImpl() { - MESSAGE( "HYBRIDPlugin_HYBRID_i::GetImpl" ); return ( ::HYBRIDPlugin_HYBRID* )myBaseImpl; } @@ -91,7 +88,6 @@ HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i() SMESH::SMESH_Mesh_ptr HYBRIDPlugin_HYBRID_i::importGMFMesh(const char* theGMFFileName) { - MESSAGE( "HYBRIDPlugin_HYBRID_i::importGMFMesh" ); SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen(); SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh(); smeshGen->RemoveLastFromPythonScript(smeshGen->GetCurrentStudy()->StudyId()); diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index 9d929ab..56de2c8 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -27,7 +27,7 @@ #include -#include +#include #ifdef WIN32 #include @@ -102,6 +102,32 @@ bool HYBRIDPlugin_Hypothesis::GetLayersOnAllWrap(bool checkFreeOption) const return myLayersOnAllWrap; } +//======================================================================= +//function : SetFacesWithLayers +//purpose : Set IDs of faces to grow the layers on +//======================================================================= + +bool HYBRIDPlugin_Hypothesis::SetFacesWithLayers(const std::vector& theVal) +{ + if ( myFacesWithLayers != theVal ) + { + myFacesWithLayers = theVal; + NotifySubMeshesHypothesisModification(); + return true; + } + return false; +} + +//======================================================================= +//function : GetFacesWithLayers +//purpose : Return IDs of faces to grow the layers on +//======================================================================= + +const std::vector& HYBRIDPlugin_Hypothesis::GetFacesWithLayers() const +{ + return myFacesWithLayers; +} + //======================================================================= //function : SetToMeshHoles //======================================================================= @@ -649,9 +675,6 @@ bool HYBRIDPlugin_Hypothesis::GetRemoveLogOnSuccess() const bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName, double size, double x, double y, double z, bool isCompound) { - MESSAGE("HYBRIDPlugin_Hypothesis::SetEnforcedVertex(\""<< theName << "\", \""<< theEntry << "\", \"" << theGroupName << "\", " - << size << ", " << x << ", " << y << ", " << z << ", "<< isCompound << ")"); - bool toNotify = false; bool toCreate = true; @@ -675,19 +698,15 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string if (it != _enfVertexList.end()) { toCreate = false; oldEnVertex = (*it); - MESSAGE("Enforced Vertex was found => Update"); if (oldEnVertex->name != theName) { - MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theName << "\""); oldEnVertex->name = theName; toNotify = true; } if (oldEnVertex->groupName != theGroupName) { - MESSAGE("Update group name from \"" << oldEnVertex->groupName << "\" to \"" << theGroupName << "\""); oldEnVertex->groupName = theGroupName; toNotify = true; } if (oldEnVertex->size != size) { - MESSAGE("Update size from \"" << oldEnVertex->size << "\" to \"" << size << "\""); oldEnVertex->size = size; toNotify = true; } @@ -709,7 +728,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string // //////// CREATE //////////// if (toCreate) { toNotify = true; - MESSAGE("Creating new enforced vertex"); _enfVertexList.insert(newEnfVertex); if (theEntry == "") { _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex; @@ -724,7 +742,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string if (toNotify) NotifySubMeshesHypothesisModification(); - MESSAGE("HYBRIDPlugin_Hypothesis::SetEnforcedVertex END"); return toNotify; } @@ -738,7 +755,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::Elemen SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType)); while ( eIt->more() ) theElemSet.insert( eIt->next() ); - MESSAGE("Add "<length() == 0 ){MESSAGE("The source group is empty");} for ( CORBA::ULong i = 0; i < theIDs->length(); i++) { @@ -788,7 +803,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SM // while ( it->more() ) // theElemSet.insert( it->next() ); - MESSAGE("Add "<X()<<","<Y()<<","<Z()<< ") with ID " << node->GetID() <<" added ? " << msg); } else { SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator(); @@ -932,28 +944,23 @@ bool HYBRIDPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, TGeomEntryHYBRIDEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry); if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) { // Success - MESSAGE("Found enforced vertex with geom entry " << theEntry); oldEnfVertex = it_enfVertexEntry->second; _geomEntryEnfVertexMap.erase(it_enfVertexEntry); } else { // Fail - MESSAGE("Enforced vertex with geom entry " << theEntry << " not found"); // check that enf vertex with given coords exists TCoordsHYBRIDEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords); if (it_coords_enf != _coordsEnfVertexMap.end()) { // Success - MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z); oldEnfVertex = it_coords_enf->second; _coordsEnfVertexMap.erase(it_coords_enf); _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords)); } else { // Fail - MESSAGE("Enforced vertex with coords " << x << ", " << y << ", " << z << " not found"); throw std::invalid_argument(msg.str()); } } - MESSAGE("Remove enf vertex from _enfVertexList"); // update _enfVertexList THYBRIDEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex); @@ -962,7 +969,6 @@ bool HYBRIDPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, _groupsToRemove.insert((*it)->groupName); _enfVertexList.erase(it); toNotify = true; - MESSAGE("Done"); } if (toNotify) @@ -1148,7 +1154,7 @@ short HYBRIDPlugin_Hypothesis::DefaultOptimizationLevel() std::string HYBRIDPlugin_Hypothesis::DefaultWorkingDirectory() { - TCollection_AsciiString aTmpDir; + std::string aTmpDir; char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { @@ -1156,12 +1162,12 @@ std::string HYBRIDPlugin_Hypothesis::DefaultWorkingDirectory() } else { #ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); + aTmpDir = "C:\\"; #else - aTmpDir = TCollection_AsciiString("/tmp/"); + aTmpDir = "/tmp/"; #endif } - return aTmpDir.ToCString(); + return aTmpDir; } //======================================================================= @@ -1328,7 +1334,7 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save) save << myTextOption << " "; save << "__OPTIONS_END__ "; } - + THYBRIDEnforcedVertexList::iterator it = _enfVertexList.begin(); if (it != _enfVertexList.end()) { @@ -1397,6 +1403,11 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save) } save << " " << "__ENFORCED_MESHES_END__ "; } + + save << " " << myFacesWithLayers.size(); + for ( size_t i = 0; i < myFacesWithLayers.size(); ++i ) + save << " " << myFacesWithLayers[i]; + return save; } @@ -1584,7 +1595,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) name += txt; } } - MESSAGE("name: " <(load >> txt); // __END_ENTRY__ if (txt != "__END_ENTRY__") throw std::exception(); - MESSAGE("entry: " << entry); } if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__ @@ -1605,7 +1614,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) groupName += txt; } } - MESSAGE("groupName: " << groupName); } if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__ @@ -1614,7 +1622,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) isOK = static_cast(load >> txt); // __END_COORDS__ if (txt != "__END_COORDS__") throw std::exception(); - MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]); } if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__ @@ -1623,7 +1630,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) if (txt != "__END_SIZE__") { throw std::exception(); } - MESSAGE("size: " << size); } } isOK = static_cast(load >> txt); // __BEGIN_VERTEX__ @@ -1675,7 +1681,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) name += txt; } } - MESSAGE("name: " <(load >> txt); // __END_ENTRY__ if (txt != "__END_ENTRY__") throw std::exception(); - MESSAGE("entry: " << entry); } if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__ @@ -1691,7 +1695,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) isOK = static_cast(load >> txt); // __END_ELEM_TYPE__ if (txt != "__END_ELEM_TYPE__") throw std::exception(); - MESSAGE("elementType: " << elementType); } if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__ @@ -1703,12 +1706,10 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) groupName += txt; } } // while - MESSAGE("groupName: " << groupName); } // if if (txt == "__PERSIST_ID__") { isOK = static_cast(load >> persistID); - MESSAGE("persistID: " << persistID); } std::cout << "isOK: " << isOK << std::endl; } // while @@ -1717,6 +1718,21 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) } // while } // if + if ( hasEnforcedMeshes ) + isOK = static_cast(load >> separator); + + if ( isOK ) + { + i = atoi( separator.c_str() ); + isOK = ( i >= 0 ); + if ( isOK ) + { + myFacesWithLayers.reserve( i ); + while (( myFacesWithLayers.size() < myFacesWithLayers.capacity() ) && + ( isOK = static_cast(load >> i)) ) + myFacesWithLayers.push_back( i ); + } + } return load; } @@ -1750,26 +1766,26 @@ bool HYBRIDPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts, //================================================================================ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp, - const bool hasShapeToMesh) + SMESH_Mesh& mesh) { - TCollection_AsciiString cmd = GetExeName().c_str(); + SMESH_Comment cmd = GetExeName(); // check if any option is overridden by hyp->myTextOption - bool p_h = ( hyp && hyp->myTextOption.find("-h") != std::string::npos ); - bool p_v = ( hyp && hyp->myTextOption.find("-v ") != std::string::npos ); - bool p_i = ( hyp && hyp->myTextOption.find("-i") != std::string::npos ); - bool p_o = ( hyp && hyp->myTextOption.find("-o") != std::string::npos ); - bool p_mnot = ( hyp && hyp->myTextOption.find("--max_number_of_threads ") != std::string::npos ); - bool p_blsi = ( hyp && hyp->myTextOption.find("--boundary_layer_surface_tags ") != std::string::npos ); - bool p_blii = ( hyp && hyp->myTextOption.find("--boundary_layer_imprint_tags ") != std::string::npos ); - bool p_blsd = ( hyp && hyp->myTextOption.find("--normal_direction ") != std::string::npos ); - bool p_hotfl = ( hyp && hyp->myTextOption.find("--boundary_layer_global_initial_height ") != std::string::npos ); - bool p_nobl = ( hyp && hyp->myTextOption.find("--number_of_boundary_layers ") != std::string::npos ); - bool p_blgp = ( hyp && hyp->myTextOption.find("--boundary_layer_geometric_progression ") != std::string::npos ); - bool p_eg = ( hyp && hyp->myTextOption.find("--element_generation ") != std::string::npos ); - bool p_cm = ( hyp && hyp->myTextOption.find("--collision_mode ") != std::string::npos ); - bool p_am = ( hyp && hyp->myTextOption.find("--add_multinormals ") != std::string::npos ); - bool p_mat = ( hyp && hyp->myTextOption.find("--multinormal_angle_threshold ") != std::string::npos ); - bool p_sn = ( hyp && hyp->myTextOption.find("--smooth_normals ") != std::string::npos ); + bool p_h = ( hyp && hyp->myTextOption.find("-h") != std::string::npos ); + bool p_v = ( hyp && hyp->myTextOption.find("-v") != std::string::npos ); + bool p_i = ( hyp && hyp->myTextOption.find("-i") != std::string::npos ); + bool p_o = ( hyp && hyp->myTextOption.find("-o") != std::string::npos ); + bool p_mnot = ( hyp && hyp->myTextOption.find("--max_number_of_threads ") != std::string::npos ); + bool p_blsi = ( hyp && hyp->myTextOption.find("--boundary_layer_surface_tags ") != std::string::npos ); + bool p_blii = ( hyp && hyp->myTextOption.find("--boundary_layer_imprint_tags ") != std::string::npos ); + bool p_blsd = ( hyp && hyp->myTextOption.find("--normal_direction ") != std::string::npos ); + bool p_hotfl = ( hyp && hyp->myTextOption.find("--boundary_layer_global_initial_height ") != std::string::npos ); + bool p_nobl = ( hyp && hyp->myTextOption.find("--number_of_boundary_layers ") != std::string::npos ); + bool p_blgp = ( hyp && hyp->myTextOption.find("--boundary_layer_geometric_progression ") != std::string::npos ); + bool p_eg = ( hyp && hyp->myTextOption.find("--element_generation ") != std::string::npos ); + bool p_cm = ( hyp && hyp->myTextOption.find("--collision_mode ") != std::string::npos ); + bool p_am = ( hyp && hyp->myTextOption.find("--add_multinormals ") != std::string::npos ); + bool p_mat = ( hyp && hyp->myTextOption.find("--multinormal_angle_threshold ") != std::string::npos ); + bool p_sn = ( hyp && hyp->myTextOption.find("--smooth_normals ") != std::string::npos ); //missing options : //- global_physical_size @@ -1782,34 +1798,20 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* //help mode if ( p_h ) { - cmd += " --help "; + cmd << " --help "; #ifdef WIN32 - cmd += " < NUL"; + cmd << " < NUL"; #endif - std::cout << "!!!!! CommandToRun help only !!!! " << cmd.ToCString() << std::endl; - return cmd.ToCString(); + std::cout << "!!!!! CommandToRun help only !!!! " << cmd << std::endl; + return cmd; } - if ( !p_v && hyp ) { - cmd += " --verbose "; - cmd += hyp->myVerboseLevel; - } + if ( !p_v && hyp ) + cmd << " --verbose " << hyp->myVerboseLevel; + + if ( !p_mnot && hyp ) + cmd << " --max_number_of_threads " << 8; //TODO getenv NB CPU - if ( !p_mnot && hyp ) { - cmd += " --max_number_of_threads "; - cmd += 8; //TODO getenv NB CPU - } - - //if ( !p_blsi && hyp ) { - // cmd += " --boundary_layers_surface_ids "; - // cmd += 0; //TODO hyp->my; - //} - - //if ( !p_blii && hyp ) { - // cmd += " --boundary_layers_imprint_ids "; - // cmd += 0; //TODO hyp->my; - //} - //no layers? if ( !p_nobl && hyp ) { if ( hyp->myNbOfBoundaryLayers < 1 ) nolayers = true; @@ -1820,81 +1822,81 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* if ( !p_blsd && hyp ) { if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) { - const char* value[] = { "1" , "-1" }; - cmd += " --normal_direction "; - cmd += value[ hyp->myBoundaryLayersGrowth ]; + const char* value[] = { "-1" , "1" }; // -1 == inside + cmd << " --normal_direction " << value[ hyp->myBoundaryLayersGrowth ]; } } if ( !p_hotfl && hyp ) { - cmd += " --boundary_layer_global_initial_height "; - cmd += hyp->myHeightFirstLayer; + cmd << " --boundary_layer_global_initial_height " << hyp->myHeightFirstLayer; } if ( !p_nobl && hyp ) { - cmd += " --number_of_boundary_layers "; - if ( nolayers ) - cmd += 0; - else - cmd += hyp->myNbOfBoundaryLayers; + cmd << " --number_of_boundary_layers " << ( nolayers ? 0 : hyp->myNbOfBoundaryLayers ); } - + if ( !p_blgp && hyp ) { - cmd += " --boundary_layer_geometric_progression "; - cmd += hyp->myBoundaryLayersProgression; + cmd << " --boundary_layer_geometric_progression " << hyp->myBoundaryLayersProgression; } - //--boundary_layers_surface_ids 5 #for all wrap shell - //--boundary_layers_surface_ids 6 #for all enfMeshList - //TODO? if ( !nolayers ) cmd += " --boundary_layers_surface_ids 5,6 "; //as all wrap shell and triangles of enforced mesh - if ( !nolayers ) { - if (layersOnAllWrap) - cmd += " --boundary_layer_surface_tags 5 "; //as triangles of all wrap + if ( !nolayers && hyp ) + { + cmd << " --boundary_layer_size_mode " << ( layersOnAllWrap ? "global" : "local" ); + cmd << " --boundary_layer_surface_tags "; + if ( layersOnAllWrap ) + { + cmd << " 3 "; + } else - cmd += " --boundary_layer_surface_tags 6 "; //as triangles of enforced mesh + { + const std::vector& faceIDs = hyp->GetFacesWithLayers(); + const bool hasEnforcedTria = !HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(hyp).empty(); + for ( size_t i = 0; i < faceIDs.size(); ++i ) + cmd << faceIDs[i] << ","; + if ( hasEnforcedTria ) + cmd << EnforcedTag(); + cmd << " --boundary_layer_initial_height_on_surface_tags "; + for ( size_t i = 0; i < faceIDs.size() + hasEnforcedTria; ++i ) + cmd << hyp->myHeightFirstLayer << ","; + } } if ( !p_eg && hyp ) { if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 1 ) { const char* value[] = { "tetra-dominant" , "hexa-dominant" }; - cmd += " --element_generation "; - cmd += value[ hyp->myElementGeneration ]; + cmd << " --element_generation " << value[ hyp->myElementGeneration ]; } } if ( !p_cm && hyp ) { if ( hyp->myCollisionMode >= 0 && hyp->myCollisionMode <= 1 ) { const char* value[] = { "decrease" , "stop" }; - cmd += " --collision_mode "; - cmd += value[ hyp->myCollisionMode ]; + cmd << " --collision_mode " << value[ hyp->myCollisionMode ]; } } if ( !p_am && hyp ) { int res = hyp->myAddMultinormals ? 0 : 1 ; const char* value[] = { "yes" , "no" }; - cmd += " --add_multinormals "; - cmd += value[ res ]; + cmd << " --add_multinormals " << value[ res ]; } if ( !p_mat && hyp ) { - cmd += " --multinormal_angle_threshold "; - cmd += hyp->myMultinormalsAngle; + cmd << " --multinormal_angle_threshold " << hyp->myMultinormalsAngle; } if ( !p_sn && hyp ) { int res = hyp->mySmoothNormals ? 0 : 1 ; const char* value[] = { "yes" , "no" }; - cmd += " --smooth_normals "; - cmd += value[ res ]; + cmd << " --smooth_normals " << value[ res ]; } #ifdef WIN32 - cmd += " < NUL"; + cmd << " < NUL"; #endif - //std::cout << "!!!!!CommandToRun end " << cmd.ToCString() << std::endl; + //std::cout << "!!!!!CommandToRun end " << cmd << std::endl; - return cmd.ToCString(); + return cmd; } //================================================================================ @@ -1908,18 +1910,18 @@ std::string HYBRIDPlugin_Hypothesis::GetFileName(const HYBRIDPlugin_Hypothesis* std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory(); const char lastChar = *aTmpDir.rbegin(); #ifdef WIN32 - if(lastChar != '\\') aTmpDir+='\\'; + if(lastChar != '\\') aTmpDir+='\\'; #else - if(lastChar != '/') aTmpDir+='/'; + if(lastChar != '/') aTmpDir+='/'; #endif - TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str(); - aGenericName += "HYBRID_"; - aGenericName += getpid(); - aGenericName += "_"; - aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString()); + SMESH_Comment aGenericName = aTmpDir; + aGenericName << "HYBRID_"; + aGenericName << getpid(); + aGenericName << "_"; + aGenericName << Abs((Standard_Integer)(long) aGenericName.c_str()); - return aGenericName.ToCString(); + return aGenericName; } //================================================================================ diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx index 779eee5..0bbd718 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx @@ -129,6 +129,11 @@ public: */ void SetLayersOnAllWrap(bool toMesh); bool GetLayersOnAllWrap(bool checkFreeOption = false) const; + /*! + * IDs of faces to grow the layers on + */ + bool SetFacesWithLayers(const std::vector& theVal); + const std::vector& GetFacesWithLayers() const; /*! * To make groups of volumes of different domains when mesh is generated from skin. * Default is to make groups. @@ -288,8 +293,7 @@ public: /*! * \brief Return command to run hybrid mesher excluding file prefix (-f) */ - static std::string CommandToRun(const HYBRIDPlugin_Hypothesis* hyp, - const bool hasShapeToMesh=true); + static std::string CommandToRun(const HYBRIDPlugin_Hypothesis* hyp, SMESH_Mesh& mesh); /*! * \brief Return a unique file name */ @@ -298,6 +302,10 @@ public: * \brief Return the name of executable */ static std::string GetExeName(); + /*! + * \brief Return a tag of enforced triangles + */ + static int EnforcedTag() { return -5; } /*! * To set an enforced vertex @@ -408,33 +416,34 @@ public: private: - bool myToMeshHoles; - bool myLayersOnAllWrap; - bool myToMakeGroupsOfDomains; - double myMaximumMemory; - double myInitialMemory; - short myOptimizationLevel; - short myCollisionMode; - short myBoundaryLayersGrowth; - short myElementGeneration; - bool myKeepFiles; - std::string myWorkingDirectory; - short myVerboseLevel; - bool myToCreateNewNodes; - bool myToUseBoundaryRecoveryVersion; - bool myToUseFemCorrection; - bool myToRemoveCentralPoint; - bool myLogInStandardOutput; - bool myRemoveLogOnSuccess; - std::string myTextOption; - double myGradation; + bool myToMeshHoles; + bool myLayersOnAllWrap; + std::vector myFacesWithLayers; + bool myToMakeGroupsOfDomains; + double myMaximumMemory; + double myInitialMemory; + short myOptimizationLevel; + short myCollisionMode; + short myBoundaryLayersGrowth; + short myElementGeneration; + bool myKeepFiles; + std::string myWorkingDirectory; + short myVerboseLevel; + bool myToCreateNewNodes; + bool myToUseBoundaryRecoveryVersion; + bool myToUseFemCorrection; + bool myToRemoveCentralPoint; + bool myLogInStandardOutput; + bool myRemoveLogOnSuccess; + std::string myTextOption; + double myGradation; - bool myAddMultinormals; - bool mySmoothNormals; - double myHeightFirstLayer; - double myBoundaryLayersProgression; - double myMultinormalsAngle; - short myNbOfBoundaryLayers; + bool myAddMultinormals; + bool mySmoothNormals; + double myHeightFirstLayer; + double myBoundaryLayersProgression; + double myMultinormalsAngle; + short myNbOfBoundaryLayers; THYBRIDEnforcedVertexList _enfVertexList; THYBRIDEnforcedVertexCoordsValues _enfVertexCoordsSizeList; diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx index dbb26c5..0d769f5 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx @@ -54,7 +54,6 @@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr th : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ) { - MESSAGE( "HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i" ); myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(), theStudyId, theGenImpl); @@ -65,7 +64,6 @@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr th //======================================================================= HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i() { - MESSAGE( "HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i" ); } //======================================================================= @@ -89,6 +87,35 @@ CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetLayersOnAllWrap() return this->GetImpl()->GetLayersOnAllWrap(); } +//======================================================================= +//function : SetFacesWithLayers +//======================================================================= + +void HYBRIDPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal) +{ + std::vector ids( theVal.length() ); + for ( size_t i = 0; i < ids.size(); ++i ) + ids[i] = theVal[i]; + + bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids); + if (valueChanged) + SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )"; +} + +//======================================================================= +//function : GetFacesWithLayers +//======================================================================= + +SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithLayers() +{ + const std::vector& idsVec = this->GetImpl()->GetFacesWithLayers(); + SMESH::long_array_var ids = new SMESH::long_array; + ids->length( idsVec.size() ); + for ( size_t i = 0; i < idsVec.size(); ++i ) + ids[i] = idsVec[i]; + return ids._retn(); +} + //======================================================================= //function : SetToMeshHoles //======================================================================= @@ -667,28 +694,24 @@ CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers() bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); - MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")"); return p_SetEnforcedVertex(size, x, y, z); } bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); - MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")"); return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", ""); } bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); - MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")"); return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName); } bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); - MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")"); return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName); } @@ -697,7 +720,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV ASSERT(myBaseImpl); if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) { - MESSAGE("theVertex shape type is not VERTEX or COMPOUND"); THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM); } @@ -729,11 +751,9 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV return false; measureOp->PointCoordinates (theVertex, x, y, z); - MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z); } std::string theVertexName = theVertex->GetName(); - MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")"); return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound); } @@ -775,11 +795,9 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object return false; measureOp->PointCoordinates (theVertex, x, y, z); - MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z); } std::string theVertexName = theVertex->GetName(); - MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")"); return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound); } @@ -789,7 +807,6 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA:: CORBA::Boolean isCompound) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); - MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")"); bool newValue = false; ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList; @@ -801,19 +818,15 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA:: coords.push_back(y); coords.push_back(z); if (coordsList.find(coords) == coordsList.end()) { - MESSAGE("Coords not found: add it in coordsList"); newValue = true; } else { - MESSAGE("Coords already found, compare names"); ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z); if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) { - MESSAGE("The names or size are different: update"); // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z); newValue = true; } else { - MESSAGE("The names and size are identical"); } } @@ -837,19 +850,15 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA:: enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry(); // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry); if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) { - MESSAGE("Geom entry not found: add it in enfVertexEntryList"); newValue = true; } else { - MESSAGE("Geom entry already found, compare names"); ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry); if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) { - MESSAGE("The names or size are different: update"); // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z); newValue = true; } else { - MESSAGE("The names and size are identical"); } } @@ -864,7 +873,6 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA:: if (newValue) this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound); - MESSAGE("IDL : SetEnforcedVertexEntry END"); return newValue; } @@ -1138,7 +1146,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_p bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType) throw (SALOME::SALOME_Exception) { -// MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh"); // #if HYBRID_VERSION >= 42 return p_SetEnforcedMesh(theSource, theType); // #else @@ -1190,7 +1197,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr th bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName) throw (SALOME::SALOME_Exception) { - MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh"); ASSERT(myBaseImpl); if (CORBA::is_nil( theSource )) @@ -1205,25 +1211,17 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS switch (theType) { case SMESH::NODE: - MESSAGE("Required type is NODE"); break; case SMESH::EDGE: - MESSAGE("Required type is EDGE"); break; case SMESH::FACE: - MESSAGE("Required type is FACE"); break; default: - MESSAGE("Incompatible required type: " << theType); - return false; + return false; } -// MESSAGE("Required type is "<GetTypes(); - MESSAGE("Available types:"); - for (CORBA::ULong i=0;ilength();i++){MESSAGE(types[i]);} if ( types->length() >= 1 && types[types->length()-1] < theType) { - MESSAGE("Required type not available"); return false; // SALOME::ExceptionStruct ExDescription; // ExDescription.text = "The source mesh has bad type"; @@ -1274,7 +1272,6 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS } else if (theGroup_i)// && types->length() == 1 && types[0] == theType) { - MESSAGE("The source is a group") try { bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName); if (theGroupName && theGroupName[0]) { @@ -1301,7 +1298,6 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS } else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType) { - MESSAGE("The source is a group on geom") try { bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName); if (theGroupName && theGroupName[0]) { diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx index 7c34352..4733318 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx @@ -55,6 +55,11 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i: */ void SetToMeshHoles(CORBA::Boolean toMesh); CORBA::Boolean GetToMeshHoles(); + /*! + * IDs of faces to grow the layers on + */ + void SetFacesWithLayers(const SMESH::long_array& faceIDs); + SMESH::long_array* GetFacesWithLayers(); /*! * To mesh "layers on all wrap". Default is to mesh. */ diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx index 1495564..5fdea9c 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx @@ -48,8 +48,6 @@ extern "C" HYBRIDPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) { - MESSAGE("GetHypothesisCreator " << aHypName); - GenericHypothesisCreator_i* aCreator = 0; // Hypotheses