From a73b22cd34f0dec2908d1fdfc218491753e144d2 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 21 Apr 2008 13:38:20 +0000 Subject: [PATCH] Join modifications from BR_Dev_For_4_0. --- build_configure | 1 + configure.in.base | 2 +- idl/HexoticPlugin_Algorithm.idl | 10 +- resources/HexoticPLUGIN.xml | 4 +- resources/HexoticPlugin.xml | 4 +- src/GUI/HexoticPLUGIN_msg_en.po | 10 + .../HexoticPluginGUI_HypothesisCreator.cxx | 43 +- src/GUI/HexoticPluginGUI_HypothesisCreator.h | 6 + src/GUI/HexoticPlugin_msg_en.po | 9 + src/HexoticPlugin/HexoticPlugin_Hexotic.cxx | 751 +++++++++++++----- src/HexoticPlugin/HexoticPlugin_Hexotic.hxx | 17 +- .../HexoticPlugin_Hypothesis.cxx | 44 +- .../HexoticPlugin_Hypothesis.hxx | 23 +- .../HexoticPlugin_Hypothesis_i.cxx | 51 ++ .../HexoticPlugin_Hypothesis_i.hxx | 9 + 15 files changed, 740 insertions(+), 244 deletions(-) diff --git a/build_configure b/build_configure index b1db1b3..d3790d2 100755 --- a/build_configure +++ b/build_configure @@ -244,6 +244,7 @@ else fi aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \ -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ diff --git a/configure.in.base b/configure.in.base index 516f016..7f95abb 100644 --- a/configure.in.base +++ b/configure.in.base @@ -16,7 +16,7 @@ # AC_INIT(src) -AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) +AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED) AC_CANONICAL_HOST PACKAGE=salome diff --git a/idl/HexoticPlugin_Algorithm.idl b/idl/HexoticPlugin_Algorithm.idl index c621d5d..0d3d331 100644 --- a/idl/HexoticPlugin_Algorithm.idl +++ b/idl/HexoticPlugin_Algorithm.idl @@ -52,8 +52,16 @@ module HexoticPlugin void SetHexoticQuadrangles(in boolean value); boolean GetHexoticQuadrangles(); - }; + void SetHexoticIgnoreRidges(in boolean value); + boolean GetHexoticIgnoreRidges(); + + void SetHexoticInvalidElements(in boolean value); + boolean GetHexoticInvalidElements(); + + void SetHexoticSharpAngleThreshold(in long value); + long GetHexoticSharpAngleThreshold(); + }; }; #endif diff --git a/resources/HexoticPLUGIN.xml b/resources/HexoticPLUGIN.xml index e997aad..bd4981a 100644 --- a/resources/HexoticPLUGIN.xml +++ b/resources/HexoticPLUGIN.xml @@ -7,8 +7,8 @@ + server-lib="HexoticEngine" + gui-lib="HexoticPluginGUI"> + server-lib="HexoticEngine" + gui-lib="HexoticPluginGUI"> #include +#include + #include #include @@ -79,7 +81,7 @@ bool HexoticPluginGUI_HypothesisCreator::checkParams() const QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() { QFrame* fr = new QFrame( 0, "myframe" ); - QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 ); + QVBoxLayout* lay = new QVBoxLayout( fr, 7, 0 ); QGroupBox* GroupC1 = new QGroupBox( 2, Qt::Horizontal, fr, "GroupC1" ); lay->addWidget( GroupC1 ); @@ -101,19 +103,31 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() myHexesMinLevel = new QtxIntSpinBox( GroupC1 ); // myHexesMinLevel->setMinValue( 3 ); myHexesMinLevel->setMinValue( h->GetHexesMinLevel() ); - myHexesMinLevel->setMaxValue( 8 ); + myHexesMinLevel->setMaxValue( 10 ); myHexesMinLevel->setLineStep( 1 ); new QLabel( tr( "Hexotic_HEXES_MAX_LEVEL" ), GroupC1 ); myHexesMaxLevel = new QtxIntSpinBox( GroupC1 ); myHexesMaxLevel->setMinValue( 3 ); - myHexesMaxLevel->setMaxValue( 8 ); + myHexesMaxLevel->setMaxValue( 10 ); myHexesMaxLevel->setLineStep( 1 ); myHexoticQuadrangles = new QCheckBox( tr( "Hexotic_QUADRANGLES" ), GroupC1 ); GroupC1->addSpace(0); myIs3D = true; - + + myHexoticIgnoreRidges = new QCheckBox( tr( "Hexotic_IGNORE_RIDGES" ), GroupC1 ); + GroupC1->addSpace(0); + + myHexoticInvalidElements = new QCheckBox( tr( "Hexotic_INVALID_ELEMENTS" ), GroupC1 ); + GroupC1->addSpace(0); + + new QLabel( tr( "Hexotic_SHARP_ANGLE_THRESHOLD" ), GroupC1 ); + myHexoticSharpAngleThreshold = new QtxIntSpinBox( GroupC1 ); + myHexoticSharpAngleThreshold->setMinValue( 0 ); + myHexoticSharpAngleThreshold->setMaxValue( 90 ); + myHexoticSharpAngleThreshold->setLineStep( 1 ); + return fr; } @@ -126,10 +140,15 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const myName->setText( data.myName ); myHexesMinLevel->setValue( data.myHexesMinLevel ); myHexesMaxLevel->setValue( data.myHexesMaxLevel ); + myHexoticSharpAngleThreshold->setValue( data.myHexoticSharpAngleThreshold ); + myHexoticQuadrangles->setChecked( data.myHexoticQuadrangles ); + myHexoticIgnoreRidges->setChecked( data.myHexoticIgnoreRidges ); + myHexoticInvalidElements->setChecked( data.myHexoticInvalidElements ); myHexesMinLevel->setEnabled(true); myHexesMaxLevel->setEnabled(true); + myHexoticSharpAngleThreshold->setEnabled(true); } QString HexoticPluginGUI_HypothesisCreator::storeParams() const @@ -142,7 +161,10 @@ QString HexoticPluginGUI_HypothesisCreator::storeParams() const valStr += tr("Hexotic_SEG_MIN_SIZE") + " = " + QString::number( data.myHexesMinLevel ) + "; "; valStr += tr("Hexotic_SEG_MAX_SIZE") + " = " + QString::number( data.myHexesMaxLevel ) + "; "; valStr += tr("Hexotic_QUADRANGLES") + " = " + QString::number( data.myHexoticQuadrangles ) + "; "; - + valStr += tr("Hexotic_IGNORE_RIDGES") + " = " + QString::number( data.myHexoticIgnoreRidges ) + "; "; + valStr += tr("Hexotic_INVALID_ELEMENTS") + " = " + QString::number( data.myHexoticInvalidElements ) + "; "; + valStr += tr("Hexotic_SHARP_ANGLE_THRESHOLD") + " = " + QString::number( data.myHexoticSharpAngleThreshold ) + "; "; + return valStr; } @@ -156,6 +178,9 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa h_data.myHexesMinLevel = h->GetHexesMinLevel(); h_data.myHexesMaxLevel = h->GetHexesMaxLevel(); h_data.myHexoticQuadrangles = h->GetHexoticQuadrangles(); + h_data.myHexoticIgnoreRidges = h->GetHexoticIgnoreRidges(); + h_data.myHexoticInvalidElements = h->GetHexoticInvalidElements(); + h_data.myHexoticSharpAngleThreshold = h->GetHexoticSharpAngleThreshold(); return true; } @@ -174,6 +199,9 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe h->SetHexesMinLevel( h_data.myHexesMinLevel ); h->SetHexesMaxLevel( h_data.myHexesMaxLevel ); h->SetHexoticQuadrangles( h_data.myHexoticQuadrangles ); + h->SetHexoticIgnoreRidges( h_data.myHexoticIgnoreRidges ); + h->SetHexoticInvalidElements( h_data.myHexoticInvalidElements ); + h->SetHexoticSharpAngleThreshold( h_data.myHexoticSharpAngleThreshold ); } catch(const SALOME::SALOME_Exception& ex) { @@ -189,7 +217,10 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesi h_data.myHexesMinLevel = myHexesMinLevel->value(); h_data.myHexesMaxLevel = myHexesMaxLevel->value(); h_data.myHexoticQuadrangles = myHexoticQuadrangles->isChecked(); - + h_data.myHexoticIgnoreRidges = myHexoticIgnoreRidges->isChecked(); + h_data.myHexoticInvalidElements = myHexoticInvalidElements->isChecked(); + h_data.myHexoticSharpAngleThreshold = myHexoticSharpAngleThreshold->value(); + return true; } diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.h b/src/GUI/HexoticPluginGUI_HypothesisCreator.h index 198be62..1110dcb 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.h +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.h @@ -40,6 +40,9 @@ typedef struct QString myName; int myHexesMinLevel, myHexesMaxLevel; bool myHexoticQuadrangles; + bool myHexoticInvalidElements; + bool myHexoticIgnoreRidges; + int myHexoticSharpAngleThreshold; } HexoticHypothesisData; /*! @@ -74,6 +77,9 @@ private: QtxIntSpinBox* myHexesMinLevel; QtxIntSpinBox* myHexesMaxLevel; QCheckBox* myHexoticQuadrangles; + QCheckBox* myHexoticIgnoreRidges; + QCheckBox* myHexoticInvalidElements; + QtxIntSpinBox* myHexoticSharpAngleThreshold; bool myIs3D; }; diff --git a/src/GUI/HexoticPlugin_msg_en.po b/src/GUI/HexoticPlugin_msg_en.po index d11e8ad..ab00003 100755 --- a/src/GUI/HexoticPlugin_msg_en.po +++ b/src/GUI/HexoticPlugin_msg_en.po @@ -75,3 +75,12 @@ msgstr "Hexotic 3D" msgid "Hexotic_3D_TITLE" msgstr "Hypothesis Construction" + +msgid "Hexotic_IGNORE_RIDGES" +msgstr "Generate smooth meshes ie no ridges" + +msgid "Hexotic_INVALID_ELEMENTS" +msgstr "Authorize invalid elements" + +msgid "Hexotic_SHARP_ANGLE_THRESHOLD" +msgstr "Sharp angle threshold in degrees" diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx index 4aaa430..1b77141 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx @@ -33,6 +33,7 @@ using namespace std; #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" +#include #include #include @@ -54,6 +55,21 @@ using namespace std; #include #include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include //============================================================================= /*! @@ -67,9 +83,9 @@ HexoticPlugin_Hexotic::HexoticPlugin_Hexotic(int hypId, int studyId, SMESH_Gen* MESSAGE("HexoticPlugin_Hexotic::HexoticPlugin_Hexotic"); _name = "Hexotic_3D"; _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type +// _onlyUnaryInput = false; _iShape=0; _nbShape=0; - _nodeRefNumber=0; _compatibleHypothesis.push_back("Hexotic_Parameters"); } @@ -95,7 +111,6 @@ bool HexoticPlugin_Hexotic::CheckHypothesis( SMESH_Mesh& SMESH_Hypothesis::Hypothesis_Status& aStatus ) { // MESSAGE("HexoticPlugin_Hexotic::CheckHypothesis"); - _hypothesis = NULL; list::const_iterator itl; @@ -103,8 +118,7 @@ bool HexoticPlugin_Hexotic::CheckHypothesis( SMESH_Mesh& const list& hyps = GetUsedHypothesis(aMesh, aShape); int nbHyp = hyps.size(); - if (!nbHyp) - { + if (!nbHyp) { aStatus = SMESH_Hypothesis::HYP_OK; return true; // can work with no hypothesis } @@ -113,8 +127,7 @@ bool HexoticPlugin_Hexotic::CheckHypothesis( SMESH_Mesh& theHyp = (*itl); // use only the first hypothesis string hypName = theHyp->GetName(); - if (hypName == "Hexotic_Parameters") - { + if (hypName == "Hexotic_Parameters") { _hypothesis = static_cast (theHyp); ASSERT(_hypothesis); aStatus = SMESH_Hypothesis::HYP_OK; @@ -126,34 +139,154 @@ bool HexoticPlugin_Hexotic::CheckHypothesis( SMESH_Mesh& } //======================================================================= -//function : countFaces -//purpose : +//function : findShape +//purpose : //======================================================================= -static int countFaces( SMESHDS_Mesh* the2DMesh, - list< const SMDS_MeshElement* >& theListOfFaces, - bool externalFaces ) -{ - int nbFaces = 0; - TopExp_Explorer fExp( (the2DMesh->ShapeToMesh()), TopAbs_FACE ); - SMESHDS_SubMesh* the2DSubMesh; - SMDS_ElemIteratorPtr itOnSmdsElement; +static TopoDS_Shape findShape(SMDS_MeshNode** t_Node, + TopoDS_Shape aShape, + const TopoDS_Shape* t_Shape, + double** t_Box, + const int nShape) { + double *pntCoor; + int iShape, nbNode = 8; + + pntCoor = new double[3]; + for ( int i=0; i<3; i++ ) { + pntCoor[i] = 0; + for ( int j=0; jX(); + if ( i == 1) pntCoor[i] += t_Node[j]->Y(); + if ( i == 2) pntCoor[i] += t_Node[j]->Z(); + } + pntCoor[i] /= nbNode; + } - if ( externalFaces ) - nbFaces = the2DMesh->NbFaces(); - else { - for ( ; fExp.More(); fExp.Next() ) { - the2DSubMesh = the2DMesh->MeshElements( fExp.Current() ); - if ( the2DSubMesh ) { - itOnSmdsElement = the2DSubMesh->GetElements(); - while ( itOnSmdsElement->more() ) { - theListOfFaces.push_back( itOnSmdsElement->next() ); - nbFaces++; - } + gp_Pnt aPnt(pntCoor[0], pntCoor[1], pntCoor[2]); + BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion()); + if ( not(SC.State() == TopAbs_IN) ) { + for (iShape = 0; iShape < nShape; iShape++) { + aShape = t_Shape[iShape]; + if ( not( pntCoor[0] < t_Box[iShape][0] || t_Box[iShape][1] < pntCoor[0] || + pntCoor[1] < t_Box[iShape][2] || t_Box[iShape][3] < pntCoor[1] || + pntCoor[2] < t_Box[iShape][4] || t_Box[iShape][5] < pntCoor[2]) ) { + BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion()); + if (SC.State() == TopAbs_IN) + break; } } } - return nbFaces; + delete [] pntCoor; + return aShape; +} + +//======================================================================= +//function : findEdge +//purpose : +//======================================================================= + +static int findEdge(const SMDS_MeshNode* aNode, + const SMESHDS_Mesh* theMesh, + const int nEdge, + const TopoDS_Shape* t_Edge) { + + TopoDS_Shape aPntShape, foundEdge; + TopoDS_Vertex aVertex; + gp_Pnt aPnt( aNode->X(), aNode->Y(), aNode->Z() ); + + int foundInd, ind; + double nearest = RealLast(), *t_Dist; + double epsilon = Precision::Confusion(); + + t_Dist = new double[ nEdge ]; + aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape(); + aVertex = TopoDS::Vertex( aPntShape ); + + for ( ind=0; ind < nEdge; ind++ ) { + BRepExtrema_DistShapeShape aDistance ( aVertex, t_Edge[ind] ); + t_Dist[ind] = aDistance.Value(); + if ( t_Dist[ind] < nearest ) { + nearest = t_Dist[ind]; + foundEdge = t_Edge[ind]; + foundInd = ind; + if ( nearest < epsilon ) + ind = nEdge; + } + } + + delete [] t_Dist; + return theMesh->ShapeToIndex( foundEdge ); +} + +//======================================================================= +//function : getNbShape +//purpose : +//======================================================================= + +static int getNbShape(string aFile, string aString) { + int number; + string aLine; + ifstream file(aFile.c_str()); + while ( !file.eof() ) { + getline( file, aLine); + if ( aLine == aString ) { + getline( file, aLine); + istringstream stringFlux( aLine ); + stringFlux >> number; + break; + } + } + file.close(); + return number; +} + +//======================================================================= +//function : countShape +//purpose : +//======================================================================= + +template < class Mesh, class Shape > +static int countShape( Mesh* mesh, Shape shape ) { + TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape ); + TopTools_MapOfShape mapShape; + int nbShape = 0; + for ( ; expShape.More(); expShape.Next() ) { + if (mapShape.Add(expShape.Current())) { + nbShape++; + } + } + return nbShape; +} + +//======================================================================= +//function : getShape +//purpose : +//======================================================================= + +template < class Mesh, class Shape, class Tab > +void getShape(Mesh* mesh, Shape shape, Tab *t_Shape) { + TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape ); + TopTools_MapOfShape mapShape; + for ( int i=0; expShape.More(); expShape.Next() ) { + if (mapShape.Add(expShape.Current())) { + t_Shape[i] = expShape.Current(); + i++; + } + } + return; +} + +//======================================================================= +//function : printWarning +//purpose : +//======================================================================= + +static void printWarning(const int nbExpected, string aString, const int nbFound) { + cout << endl; + cout << "WARNING : " << nbExpected << " " << aString << " expected, Hexotic has found " << nbFound << endl; + cout << "=======" << endl; + cout << endl; + return; } //======================================================================= @@ -162,18 +295,31 @@ static int countFaces( SMESHDS_Mesh* the2DMesh, //======================================================================= static bool writeHexoticFile (ofstream & theFile, - SMESHDS_Mesh * theMesh, + const SMESHDS_Mesh * theMesh, map & theSmdsToHexoticIdMap, map & theHexoticIdToNodeMap, const TCollection_AsciiString & Hexotic_In) { cout << endl; cout << "Creating Hexotic processed mesh file : " << Hexotic_In << endl; - bool onlyExternalFaces = true; - int nbVertices = 0; - int nbTriangles = 0; - const char* space = " "; - const int dummyint = 0; + int nbShape = 0; + + TopExp_Explorer expface(theMesh->ShapeToMesh(), TopAbs_FACE); + for ( ; expface.More(); expface.Next() ) + nbShape++; + + int *tabID; + int *tabNodeId; + TopoDS_Shape *tabShape, aShape; + + int shapeID; + bool idFound; + + int nbVertices = 0; + int nbTriangles = 0; + const char* space = " "; + int dummy_1D = 0; + int dummy_2D; int aSmdsNodeID = 1; const SMDS_MeshNode* aNode; @@ -182,10 +328,9 @@ static bool writeHexoticFile (ofstream & theFile, list< const SMDS_MeshElement* > faces; list< const SMDS_MeshElement* >::iterator itListFace; const SMDS_MeshElement* aFace; + SMESHDS_SubMesh* theSubMesh; map::const_iterator itOnSmdsNode; - SMDS_ElemIteratorPtr itOnSmdsElement; - SMDS_ElemIteratorPtr itOnFaceNode; - SMDS_FaceIteratorPtr itOnSmdsFace; + SMDS_ElemIteratorPtr itOnSubNode, itOnSubFace; // Writing SMESH points into Hexotic File @@ -199,50 +344,74 @@ static bool writeHexoticFile (ofstream & theFile, theFile << "Vertices" << endl; theFile << nbVertices << endl; + tabID = new int[nbShape]; + tabNodeId = new int[ nbVertices ]; + tabShape = new TopoDS_Shape[nbShape]; + itOnNode = theMesh->nodesIterator(); while ( itOnNode->more() ) { aNode = itOnNode->next(); + dummy_1D = aNode->GetPosition()->GetShapeId(); + tabNodeId[ aSmdsNodeID - 1 ] = 0; + idFound = false; + for ( int j=0; j< aSmdsNodeID; j++ ) { + if ( dummy_1D == tabNodeId[j] ) { + idFound = true; + break; + } + } + if ( not idFound ) + tabNodeId[ aSmdsNodeID - 1 ] = dummy_1D; theSmdsToHexoticIdMap.insert( map ::value_type( aNode->GetID(), aSmdsNodeID )); theHexoticIdToNodeMap.insert (map ::value_type( aSmdsNodeID, aNode )); aSmdsNodeID++; - theFile << aNode->X() << space << aNode->Y() << space << aNode->Z() << space << dummyint << endl; + theFile << aNode->X() << space << aNode->Y() << space << aNode->Z() << space << dummy_1D << endl; } // Writing SMESH faces into Hexotic File - nbTriangles = countFaces(theMesh, faces, onlyExternalFaces); + nbTriangles = theMesh->NbFaces(); theFile << endl; theFile << "# Set of mesh triangles (v1,v2,v3,tag)" << endl; theFile << "Triangles" << endl; theFile << nbTriangles << endl; - if ( onlyExternalFaces ) { - itOnSmdsFace = theMesh->facesIterator(); - while ( itOnSmdsFace->more() ) { - aFace = itOnSmdsFace->next(); - itOnFaceNode = aFace->nodesIterator(); - while ( itOnFaceNode->more() ) { - aSmdsNodeID = itOnFaceNode->next()->GetID(); - itOnSmdsNode = theSmdsToHexoticIdMap.find( aSmdsNodeID ); - ASSERT( itOnSmdsNode != theSmdsToHexoticIdMap.end() ); - theFile << (*itOnSmdsNode).second << space; + expface.ReInit(); + for ( int i = 0; expface.More(); expface.Next(), i++ ) { + tabID[i] = 0; + aShape = expface.Current(); + shapeID = theMesh->ShapeToIndex( aShape ); + idFound = false; + for ( int j=0; j<=i; j++) { + if ( shapeID == tabID[j] ) { + idFound = true; + break; } - theFile << dummyint << endl; + } + if ( not idFound ) { + tabID[i] = shapeID; + tabShape[i] = aShape; } } - else { - itListFace = faces.begin(); - for ( ; itListFace != faces.end(); ++itListFace ) { - aFace = *itListFace; - itOnFaceNode = aFace->nodesIterator(); - while ( itOnFaceNode->more() ) { - aSmdsNodeID = itOnFaceNode->next()->GetID(); - itOnSmdsNode = theSmdsToHexoticIdMap.find( aSmdsNodeID ); - ASSERT( itOnSmdsNode != theSmdsToHexoticIdMap.end() ); - theFile << (*itOnSmdsNode).second << space; + for ( int i=0; iMeshElements( aShape ); + itOnSubFace = theSubMesh->GetElements(); + while ( itOnSubFace->more() ) { + aFace = itOnSubFace->next(); + dummy_2D = shapeID; + itOnSubNode = aFace->nodesIterator(); + while ( itOnSubNode->more() ) { + aSmdsNodeID = itOnSubNode->next()->GetID(); + itOnSmdsNode = theSmdsToHexoticIdMap.find( aSmdsNodeID ); + ASSERT( itOnSmdsNode != theSmdsToHexoticIdMap.end() ); + theFile << (*itOnSmdsNode).second << space; + } + theFile << dummy_2D << endl; } - theFile << dummyint << endl; } } @@ -254,177 +423,244 @@ static bool writeHexoticFile (ofstream & theFile, cout << " " << nbTriangles << " triangles" << endl; cout << endl; - return true; -} - -//======================================================================= -//function : getInt -//purpose : -//======================================================================= - -static bool getInt( int & theValue, char * & theLine ) -{ - char *ptr; - theValue = strtol( theLine, &ptr, 10 ); - if ( ptr == theLine || - // there must not be neither '.' nor ',' nor 'E' ... - (*ptr != ' ' && *ptr != '\n' && *ptr != '\0')) - return false; - - DUMP( " " << theValue ); - theLine = ptr; - return true; -} - -//======================================================================= -//function : getDouble -//purpose : -//======================================================================= - -static bool getDouble( double & theValue, char * & theLine ) -{ - char *ptr; - theValue = strtod( theLine, &ptr ); - if ( ptr == theLine ) - return false; + delete [] tabID; + delete [] tabNodeId; + delete [] tabShape; - DUMP( " " << theValue ); - theLine = ptr; return true; } - -//======================================================================= -//function : readLine -//purpose : -//======================================================================= - -#define HexoticPlugin_BUFLENGTH 256 -#define HexoticPlugin_ReadLine(aPtr,aBuf,aFile,aLineNb) \ -{ aPtr = fgets( aBuf, HexoticPlugin_BUFLENGTH - 2, aFile ); aLineNb++; DUMP(endl); } //======================================================================= //function : readResult //purpose : //======================================================================= -static bool readResult(FILE * theFile, - SMESHDS_Mesh * theMesh, - const TopoDS_Shape & theShape, - map & theHexoticIdToNodeMap, - const TCollection_AsciiString & Hexotic_Out, - int & nodeRefNumber) +static bool readResult(string theFile, + SMESHDS_Mesh* theMesh, + const int nbShape, + const TopoDS_Shape* tabShape, + double** tabBox) { // --------------------------------- // Read generated elements and nodes // --------------------------------- - cout << "Reading Hexotic output file : " << Hexotic_Out << endl; - cout << endl; + TopoDS_Shape aShape; + TopoDS_Vertex aVertex; + string token; + int EndOfFile = 0, nbElem = 0, nField = 9, nbRef = 0; + int aHexoticNodeID = 0, shapeID, hexoticShapeID; + int IdShapeRef = 2; + int *tabID, *tabRef, *nodeAssigne; + bool *tabDummy, hasDummy = false; + double epsilon = Precision::Confusion(); + map mapField; + SMDS_MeshNode** HexoticNode; + TopoDS_Shape *tabCorner, *tabEdge; + + tabID = new int[nbShape]; + tabRef = new int[nField]; + tabDummy = new bool[nField]; + + for (int i=0; iShapeToIndex( theShape ); + SMDS_NodeIteratorPtr itOnHexoticInputNode = theMesh->nodesIterator(); + while ( itOnHexoticInputNode->more() ) + theMesh->RemoveNode( itOnHexoticInputNode->next() ); - int line = 1, EndOfFile = 0, nbElem = 0, nField = 10, nbRef = 0, aHexoticNodeID = 0; - char * theField; + int nbVertices = getNbShape(theFile, "Vertices"); + int nbHexCorners = getNbShape(theFile, "Corners"); + int nbCorners = countShape( theMesh, TopAbs_VERTEX ); + int nbShapeEdge = countShape( theMesh, TopAbs_EDGE ); - char * tabField [nField]; - int tabRef [nField]; + if ( nbHexCorners != nbCorners ) { + printWarning(nbCorners, "corners", nbHexCorners); + if ( nbHexCorners > nbCorners ) + nbCorners = nbHexCorners; + } - tabField[0] = "MeshVersionFormatted"; tabRef[0] = 0; - tabField[1] = "Dimension"; tabRef[1] = 0; - tabField[2] = "Vertices"; tabRef[2] = 3; - tabField[3] = "Edges"; tabRef[3] = 2; - tabField[4] = "Triangles"; tabRef[4] = 3; - tabField[5] = "Quadrilaterals"; tabRef[5] = 4; - tabField[6] = "Hexahedra"; tabRef[6] = 8; - tabField[7] = "Corners"; tabRef[7] = 1; - tabField[8] = "Ridges"; tabRef[0] = 1; - tabField[9] = "End"; tabRef[0] = 0; + tabCorner = new TopoDS_Shape[ nbCorners ]; + tabEdge = new TopoDS_Shape[ nbShapeEdge ]; + nodeAssigne = new int[ nbVertices + 1 ]; + HexoticNode = new SMDS_MeshNode*[ nbVertices + 1 ]; - nodeRefNumber += theMesh->NbNodes(); + getShape(theMesh, TopAbs_VERTEX, tabCorner); + getShape(theMesh, TopAbs_EDGE, tabEdge); - SMDS_NodeIteratorPtr itOnHexoticInputNode = theMesh->nodesIterator(); - while ( itOnHexoticInputNode->more() ) - theMesh->RemoveNode( itOnHexoticInputNode->next() ); + MESSAGE("Read " << theFile << " file"); + ifstream fileRes(theFile.c_str()); + ASSERT(fileRes); while ( EndOfFile == 0 ) { - HexoticPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb ); - for ( int iField = 0; iField < nField; iField++ ) { - stringstream theMessage; - theField = tabField[iField]; - if ( strncmp(aPtr, theField, strlen(theField)) == 0 ) { - if ( strcmp(theField, "End") == 0 ) { - EndOfFile = 1; - theMessage << "End of Hexotic output file has been reached"; + int dummy; + fileRes >> token; + + if (mapField.count(token)) { + nField = mapField[token]; + nbRef = tabRef[nField]; + hasDummy = tabDummy[nField]; + } + else { + nField = -1; + nbRef = 0; + } + + nbElem = 0; + if ( nField < (mapField.size() - 1) && nField >= 0 ) + fileRes >> nbElem; + + switch (nField) { + case 0: { // "MeshVersionFormatted" + MESSAGE(token << " " << nbElem); + break; + } + case 1: { // "Dimension" + MESSAGE("Mesh dimension " << nbElem << "D"); + break; + } + case 2: { // "Vertices" + MESSAGE("Read " << nbElem << " " << token); + int aHexoticID; + double *coord; + SMDS_MeshNode * aHexoticNode; + + coord = new double[nbRef]; + for ( int iElem = 0; iElem < nbElem; iElem++ ) { + aHexoticID = iElem + 1; + for ( int iCoord = 0; iCoord < 3; iCoord++ ) + fileRes >> coord[ iCoord ]; + fileRes >> dummy; + aHexoticNode = theMesh->AddNode(coord[0], coord[1], coord[2]); + HexoticNode[ aHexoticID ] = aHexoticNode; + nodeAssigne[ aHexoticID ] = 0; } - else { - HexoticPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb ); - line++; - getInt( nbElem, aPtr ); - - if ( strcmp(theField, "MeshVersionFormatted") == 0 ) - theMessage << "Hexotic mesh descriptor : " << theField << " " << nbElem; - else if ( strcmp(theField, "Dimension") == 0 ) - theMessage << "Hexotic mesh of " << nbElem << "D dimension"; - else if ( strcmp(theField, "Vertices") == 0 || - strcmp(theField, "Edges") == 0 || - strcmp(theField, "Quadrilaterals") == 0 || - strcmp(theField, "Hexahedra") == 0 ) { - nbRef = tabRef[iField]; - HexoticPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb ); // read blank line - - if ( strcmp(theField, "Vertices") == 0 ) { - int aHexoticID; - double coord[nbRef]; - SMDS_MeshNode * aHexoticNode; - - for ( int iElem = 0; iElem < nbElem; iElem++ ) { - aHexoticID = iElem + 1 + nodeRefNumber; - HexoticPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb ); // read file lines - for ( int iCoord = 0; iCoord < 3; iCoord++ ) - getDouble ( coord[ iCoord ], aPtr ); - aHexoticNode = theMesh->AddNode(coord[0], coord[1], coord[2]); - theMesh->SetNodeInVolume( aHexoticNode, shapeID ); - theHexoticIdToNodeMap[ aHexoticID ] = aHexoticNode; + delete [] coord; + break; + } + case 3: // "Corners" + case 4: // "Edges" + case 5: // "Ridges" + case 6: // "Quadrilaterals" + case 7: { // "Hexahedra" + MESSAGE("Read " << nbElem << " " << token); + SMDS_MeshNode** node; + int nodeDim, *nodeID; + SMDS_MeshElement * aHexoticElement; + + node = new SMDS_MeshNode*[ nbRef ]; + nodeID = new int[ nbRef ]; + for ( int iElem = 0; iElem < nbElem; iElem++ ) { + for ( int iRef = 0; iRef < nbRef; iRef++ ) { + fileRes >> aHexoticNodeID; // read nbRef aHexoticNodeID + node[ iRef ] = HexoticNode[ aHexoticNodeID ]; + nodeID[ iRef ] = aHexoticNodeID; + } + if ( hasDummy ) + fileRes >> dummy; + switch (nField) { + case 3: { // "Corners" + nodeDim = 1; + gp_Pnt HexoticPnt ( node[0]->X(), node[0]->Y(), node[0]->Z() ); + for ( int i=0; i::iterator itOnHexoticNode; - - for ( int iElem = 0; iElem < nbElem; iElem++ ) { - HexoticPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb ); // read file lines - for ( int iRef = 0; iRef < nbRef; iRef++ ) { - getInt ( aHexoticNodeID, aPtr ); // read nbRef aHexoticNodeID - aHexoticNodeID += nodeRefNumber; - itOnHexoticNode = theHexoticIdToNodeMap.find( aHexoticNodeID ); - node[ iRef ] = itOnHexoticNode->second; + case 4: { // "Edges" + nodeDim = 2; + aHexoticElement = theMesh->AddEdge( node[0], node[1] ); + int iNode = 1; + if ( nodeAssigne[ nodeID[0] ] == 0 || nodeAssigne[ nodeID[0] ] == 2 ) + iNode = 0; + shapeID = findEdge( node[iNode], theMesh, nbShapeEdge, tabEdge ); + break; + } + case 5: { // "Ridges" + break; + } + case 6: { // "Quadrilaterals" + nodeDim = 3; + aHexoticElement = theMesh->AddFace( node[0], node[1], node[2], node[3] ); + shapeID = dummy; + break; + } + case 7: { // "Hexahedra" + nodeDim = 4; + aHexoticElement = theMesh->AddVolume( node[0], node[3], node[2], node[1], node[4], node[7], node[6], node[5] ); + if ( nbShape > 1 ) { + hexoticShapeID = dummy - IdShapeRef; + if ( tabID[ hexoticShapeID ] == 0 ) { + if (iElem == 0) + aShape = tabShape[0]; + aShape = findShape(node, aShape, tabShape, tabBox, nbShape); + shapeID = theMesh->ShapeToIndex( aShape ); + tabID[ hexoticShapeID ] = shapeID; + } + else + shapeID = tabID[ hexoticShapeID ]; + if ( iElem == (nbElem - 1) ) { + int shapeAssociated = 0; + for ( int i=0; iAddEdge( node[0], node[1] ); - else if ( strcmp(theField, "Quadrilaterals") == 0 ) - aHexoticElement = theMesh->AddFace( node[0], node[1], node[2], node[3] ); - else if ( strcmp(theField, "Hexahedra") == 0 ) - aHexoticElement = theMesh->AddVolume( node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7] ); - - theMesh->SetMeshElementOnShape( aHexoticElement, shapeID ); } + break; } - theMessage << nbElem << " " << theField << " created"; + } + if ( token != "Ridges" ) { + for ( int i=0; iSetNodeOnVertex( node[0], aVertex ); + else if ( token == "Edges" ) theMesh->SetNodeOnEdge( node[i], shapeID ); + else if ( token == "Quadrilaterals" ) theMesh->SetNodeOnFace( node[i], shapeID ); + else if ( token == "Hexahedra" ) theMesh->SetNodeInVolume( node[i], shapeID ); + nodeAssigne[ nodeID[i] ] = nodeDim; + } + } + if ( token != "Corners" ) + theMesh->SetMeshElementOnShape( aHexoticElement, shapeID ); } } - if ( theMessage.str().size() != 0 ) { - cout << theMessage.str() << endl; - break; - } + delete [] node; + delete [] nodeID; + break; + } + case 8: { // "End" + EndOfFile = 1; + MESSAGE("End of " << theFile << " file"); + break; + } + default: { + MESSAGE("Unknown Token: " << token); } } } cout << endl; + delete [] tabID; + delete [] tabRef; + delete [] tabDummy; + delete [] tabCorner; + delete [] tabEdge; + delete [] nodeAssigne; + delete [] HexoticNode; return true; } @@ -435,17 +671,32 @@ static bool readResult(FILE * theFile, //============================================================================= void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) { + + MESSAGE("HexoticPlugin_Hexotic::SetParameters"); if (hyp) { - MESSAGE("HexoticPlugin_Hexotic::SetParameters"); _hexesMinLevel = hyp->GetHexesMinLevel(); _hexesMaxLevel = hyp->GetHexesMaxLevel(); _hexoticQuadrangles = hyp->GetHexoticQuadrangles(); + _hexoticIgnoreRidges = hyp->GetHexoticIgnoreRidges(); + _hexoticInvalidElements = hyp->GetHexoticInvalidElements(); + _hexoticSharpAngleThreshold = hyp->GetHexoticSharpAngleThreshold(); + } + else { + cout << endl; + cout << "WARNING : The Hexotic default parameters are taken into account" << endl; + cout << "=======" << endl; + _hexesMinLevel = hyp->GetDefaultHexesMinLevel(); + _hexesMaxLevel = hyp->GetDefaultHexesMaxLevel(); + _hexoticQuadrangles = hyp->GetDefaultHexoticQuadrangles(); + _hexoticIgnoreRidges = hyp->GetDefaultHexoticIgnoreRidges(); + _hexoticInvalidElements = hyp->GetDefaultHexoticInvalidElements(); + _hexoticSharpAngleThreshold = hyp->GetDefaultHexoticSharpAngleThreshold(); } } //======================================================================= //function : getTmpDir -//purpose : +//purpose : //======================================================================= static TCollection_AsciiString getTmpDir() @@ -480,49 +731,97 @@ static TCollection_AsciiString getTmpDir() bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape) { - bool Ok; + bool Ok = true; SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); + TCollection_AsciiString hexahedraMessage; if (_iShape == 0 && _nbShape == 0) { - cout << endl; - cout << "Hexotic execution..." << endl; - cout << endl; - - TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID); - for ( ; expf.More(); expf.Next() ) - _nbShape++; + _nbShape = countShape( meshDS, TopAbs_SOLID ); // we count the number of shapes + _tabNode = new SMDS_MeshNode*[_nbShape]; // we declare the size of the node array } + // to prevent from displaying error message after computing, + // we need to create one node for each shape theShape. + + _tabNode[_iShape] = meshDS->AddNode(0, 0, 0); + meshDS->SetNodeInVolume( _tabNode[_iShape], meshDS->ShapeToIndex(theShape) ); + _iShape++; if (_iShape == _nbShape ) { + + for (int i=0; i<_nbShape; i++) // we destroy the (_nbShape - 1) nodes created and used + meshDS->RemoveNode( _tabNode[i] ); // to simulate successful mesh computing. + delete [] _tabNode; + + // create bounding box for each shape of the compound + + int iShape = 0; + TopoDS_Shape *tabShape; + double **tabBox; + + tabShape = new TopoDS_Shape[_nbShape]; + tabBox = new double*[_nbShape]; + for (int i=0; i<_nbShape; i++) + tabBox[i] = new double[6]; + double Xmin, Ymin, Zmin, Xmax, Ymax, Zmax; + + TopExp_Explorer expBox (meshDS->ShapeToMesh(), TopAbs_SOLID); + for (; expBox.More(); expBox.Next()) { + tabShape[iShape] = expBox.Current(); + Bnd_Box BoundingBox; + BRepBndLib::Add(expBox.Current(), BoundingBox); + BoundingBox.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); + tabBox[iShape][0] = Xmin; tabBox[iShape][1] = Xmax; + tabBox[iShape][2] = Ymin; tabBox[iShape][3] = Ymax; + tabBox[iShape][4] = Zmin; tabBox[iShape][5] = Zmax; + iShape++; + } + SetParameters(_hypothesis); cout << endl; + cout << "Hexotic execution..." << endl; cout << _name << " parameters :" << endl; cout << " " << _name << " Segments Min Level = " << _hexesMinLevel << endl; cout << " " << _name << " Segments Max Level = " << _hexesMaxLevel << endl; cout << " " << "Salome Quadrangles : " << (_hexoticQuadrangles ? "yes":"no") << endl; + cout << " " << "Hexotic can ignore ridges : " << (_hexoticIgnoreRidges ? "yes":"no") << endl; + cout << " " << "Hexotic authorize invalide elements : " << ( _hexoticInvalidElements ? "yes":"no") << endl; + cout << " " << _name << " Sharp angle threshold = " << _hexoticSharpAngleThreshold << " degrees" << endl; TCollection_AsciiString aTmpDir = getTmpDir(); TCollection_AsciiString Hexotic_In, Hexotic_Out; TCollection_AsciiString run_Hexotic( "hexotic" ); - TCollection_AsciiString minl = " -minl ", maxl = " -maxl "; + TCollection_AsciiString minl = " -minl ", maxl = " -maxl ", angle = " -ra "; TCollection_AsciiString in = " -in ", out = " -out "; + TCollection_AsciiString ignoreRidges = " -nr ", invalideElements = " -inv "; + TCollection_AsciiString subdom = " -sd "; - TCollection_AsciiString minLevel, maxLevel; + TCollection_AsciiString minLevel, maxLevel, sharpAngle, mode; minLevel = _hexesMinLevel; maxLevel = _hexesMaxLevel; + sharpAngle = _hexoticSharpAngleThreshold; + mode = 4; map aSmdsToHexoticIdMap; map aHexoticIdToNodeMap; Hexotic_In = aTmpDir + "Hexotic_In.mesh"; Hexotic_Out = aTmpDir + "Hexotic_Out.mesh"; - run_Hexotic += minl + minLevel + maxl + maxLevel + in + Hexotic_In + out + Hexotic_Out; - // cout << "Hexotic command : " << run_Hexotic << endl; + if (_hexoticIgnoreRidges) + run_Hexotic += ignoreRidges; + + if (_hexoticInvalidElements) + run_Hexotic += invalideElements; + + run_Hexotic += angle + sharpAngle + minl + minLevel + maxl + maxLevel + in + Hexotic_In + out + Hexotic_Out; + run_Hexotic += subdom + mode; + + cout << endl; + cout << "Hexotic command : " << run_Hexotic << endl; OSD_File( Hexotic_In ).Remove(); OSD_File( Hexotic_Out ).Remove(); @@ -530,7 +829,10 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh& theMesh, ofstream HexoticFile (Hexotic_In.ToCString() , ios::out); Ok = ( writeHexoticFile(HexoticFile, meshDS, aSmdsToHexoticIdMap, aHexoticIdToNodeMap, Hexotic_In) ); + HexoticFile.close(); + aSmdsToHexoticIdMap.clear(); + aHexoticIdToNodeMap.clear(); MESSAGE("HexoticPlugin_Hexotic::Compute"); @@ -540,16 +842,25 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh& theMesh, // read a result // -------------- - FILE * aResultFile = fopen( Hexotic_Out.ToCString(), "r" ); - if (aResultFile) { - Ok = readResult( aResultFile, meshDS, theShape, aHexoticIdToNodeMap, Hexotic_Out, _nodeRefNumber ); - fclose(aResultFile); - cout << "Hexotic output file read !" << endl; - cout << endl; + ifstream fileRes( Hexotic_Out.ToCString() ); + if ( ! fileRes.fail() ) { + Ok = readResult( Hexotic_Out.ToCString(), meshDS, _nbShape, tabShape, tabBox ); + hexahedraMessage = "success"; } - else + else { + hexahedraMessage = "failed"; + cout << "Problem with Hexotic output file " << Hexotic_Out.ToCString() << endl; Ok = false; - _iShape=0; + } + cout << "Hexahedra meshing " << hexahedraMessage << endl; + cout << endl; + + delete [] tabShape; + for (int i=0; i<_nbShape; i++) + delete [] tabBox[i]; + delete [] tabBox; + _nbShape = 0; + _iShape = 0; } return Ok; } diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx index 9673dd0..3105290 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx @@ -48,7 +48,7 @@ public: void SetParameters(const HexoticPlugin_Hypothesis* hyp); virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); + const TopoDS_Shape& aShape); ostream & SaveTo(ostream & save); istream & LoadFrom(istream & load); @@ -58,12 +58,15 @@ public: protected: const HexoticPlugin_Hypothesis* _hypothesis; private: - int _iShape; - int _nbShape; - int _nodeRefNumber; - int _hexesMinLevel; - int _hexesMaxLevel; - bool _hexoticQuadrangles; + int _iShape; + int _nbShape; + int _hexesMinLevel; + int _hexesMaxLevel; + bool _hexoticQuadrangles; + bool _hexoticIgnoreRidges; + bool _hexoticInvalidElements; + int _hexoticSharpAngleThreshold; + SMDS_MeshNode** _tabNode; }; #endif diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx index 08401d3..b901082 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx @@ -39,7 +39,10 @@ HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, int studyId, : SMESH_Hypothesis(hypId, studyId, gen), _hexesMinLevel( GetDefaultHexesMinLevel() ), _hexesMaxLevel( GetDefaultHexesMaxLevel() ), - _hexoticQuadrangles( GetDefaultHexoticQuadrangles() ) + _hexoticQuadrangles( GetDefaultHexoticQuadrangles() ), + _hexoticIgnoreRidges( GetDefaultHexoticIgnoreRidges() ), + _hexoticInvalidElements( GetDefaultHexoticInvalidElements() ), + _hexoticSharpAngleThreshold( GetDefaultHexoticSharpAngleThreshold() ) { MESSAGE("HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis"); _name = "Hexotic_Parameters"; @@ -73,6 +76,27 @@ void HexoticPlugin_Hypothesis::SetHexoticQuadrangles(bool theVal) { } } +void HexoticPlugin_Hypothesis::SetHexoticIgnoreRidges(bool theVal) { + if (theVal != _hexoticIgnoreRidges) { + _hexoticIgnoreRidges = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetHexoticInvalidElements(bool theVal) { + if (theVal != _hexoticInvalidElements) { + _hexoticInvalidElements = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(int theVal) { + if (theVal != _hexoticSharpAngleThreshold) { + _hexoticSharpAngleThreshold = theVal; + NotifySubMeshesHypothesisModification(); + } +} + //============================================================================= /*! * @@ -82,6 +106,9 @@ ostream & HexoticPlugin_Hypothesis::SaveTo(ostream & save) { save << _hexesMinLevel << " " << _hexesMaxLevel; save << " " << (int)_hexoticQuadrangles; + save << " " << (int)_hexoticIgnoreRidges; + save << " " << (int)_hexoticInvalidElements; + save << " " << _hexoticSharpAngleThreshold; cout <GetImpl()->SetHexoticIgnoreRidges(theValue); + SMESH::TPythonDump() << _this() << ".SetHexoticIgnoreRidges( " << theValue << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements (CORBA::Boolean theValue) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements"); + ASSERT(myBaseImpl); + this->GetImpl()->SetHexoticInvalidElements(theValue); + SMESH::TPythonDump() << _this() << ".SetHexoticInvalidElements( " << theValue << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Long theValue) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold"); + ASSERT(myBaseImpl); + this->GetImpl()->SetHexoticSharpAngleThreshold(theValue); + SMESH::TPythonDump() << _this() << ".SetHexoticSharpAngleThreshold( " << theValue << " )"; +} + //============================================================================= /*! * HexoticPlugin_Hypothesis_i::GetHexesMinLevel * HexoticPlugin_Hypothesis_i::GetHexesMaxLevel * HexoticPlugin_Hypothesis_i::GetHexoticQuadrangles + * HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges + * HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements + * HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold */ //============================================================================= @@ -126,6 +156,27 @@ CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticQuadrangles() return this->GetImpl()->GetHexoticQuadrangles(); } +CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetHexoticIgnoreRidges(); +} + +CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetHexoticInvalidElements(); +} + +CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetHexoticSharpAngleThreshold(); +} + //============================================================================= /*! * HexoticPlugin_Hypothesis_i::GetImpl diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx index be0b732..43d6689 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx @@ -60,6 +60,15 @@ class HexoticPlugin_Hypothesis_i: void SetHexoticQuadrangles(CORBA::Boolean theVal); CORBA::Boolean GetHexoticQuadrangles(); + void SetHexoticIgnoreRidges(CORBA::Boolean theVal); + CORBA::Boolean GetHexoticIgnoreRidges(); + + void SetHexoticInvalidElements(CORBA::Boolean theVal); + CORBA::Boolean GetHexoticInvalidElements(); + + void SetHexoticSharpAngleThreshold(CORBA::Long theVal); + CORBA::Long GetHexoticSharpAngleThreshold(); + // Get implementation ::HexoticPlugin_Hypothesis* GetImpl(); -- 2.30.2