From: san Date: Thu, 20 Jan 2005 14:44:17 +0000 (+0000) Subject: Implementation of new pattern mapping algorthm (mesh refinement) X-Git-Tag: V2_2_0b2~46 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e465982eeb48dded773c5e18053a8da7fcf15222;p=modules%2Fsmesh.git Implementation of new pattern mapping algorthm (mesh refinement) --- diff --git a/idl/SMESH_Pattern.idl b/idl/SMESH_Pattern.idl index f02fe4326..fa1d7dd11 100644 --- a/idl/SMESH_Pattern.idl +++ b/idl/SMESH_Pattern.idl @@ -174,8 +174,9 @@ module SMESH /*! * Return nodal connectivity of the elements of the pattern + * or of all elements to be crated */ - array_of_long_array GetElementPoints(); + array_of_long_array GetElementPoints(in boolean all); }; }; diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index aeec4521f..763d61c47 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -1604,9 +1604,7 @@ static set * intersectionOfSets( static set * getFinitElements(const SMDS_MeshElement * element) { int numberOfSets=element->NbNodes(); - auto_ptr > pInitSet - (new set[numberOfSets]); - set *initSet = &(*pInitSet); + set *initSet = new set[numberOfSets]; SMDS_ElemIteratorPtr itNodes=element->nodesIterator(); @@ -1622,8 +1620,9 @@ static set * getFinitElements(const SMDS_MeshElement * i++; } - - return intersectionOfSets(initSet, numberOfSets); + set *retSet=intersectionOfSets(initSet, numberOfSets); + delete [] initSet; + return retSet; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 86f1d52ab..432e54161 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -3306,17 +3306,37 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh) } } // set element on a shape - if ( elem && onMeshElements ) + if ( elem && onMeshElements ) // applied to mesh elements { int elemIndex = iElem / nbElems; - if ( shapeIDs[ elemIndex ] > 0 ) - aMeshDS->SetMeshElementOnShape( elem, shapeIDs[ elemIndex ] ); + int shapeID = shapeIDs[ elemIndex ]; + if ( shapeID > 0 ) { + aMeshDS->SetMeshElementOnShape( elem, shapeID ); + // set nodes on a shape + TopoDS_Shape S = aMeshDS->IndexToShape( shapeID ); + if ( S.ShapeType() == TopAbs_SOLID ) { + TopoDS_Iterator shellIt( S ); + if ( shellIt.More() ) + shapeID = aMeshDS->ShapeToIndex( shellIt.Value() ); + } + SMDS_ElemIteratorPtr noIt = elem->nodesIterator(); + while ( noIt->more() ) { + SMDS_MeshNode* node = const_cast + ( static_cast( noIt->next() )); + if ( !node->GetPosition() || !node->GetPosition()->GetShapeId() ) { + if ( S.ShapeType() == TopAbs_FACE ) + aMeshDS->SetNodeOnFace( node, shapeID ); + else + aMeshDS->SetNodeInVolume( node, shapeID ); + } + } + } // add elem in groups list< SMESHDS_Group* >::iterator g = groups[ elemIndex ].begin(); for ( ; g != groups[ elemIndex ].end(); ++g ) (*g)->SMDSGroup().Add( elem ); } - if ( elem && !myShape.IsNull() ) + if ( elem && !myShape.IsNull() ) // applied to shape aMeshDS->SetMeshElementOnShape( elem, myShape ); } @@ -3342,7 +3362,7 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh) } elemIDs.push_back( myElements[ i ]->GetID() ); } - // remove refined elements and their nodes + // remove refined elements editor.Remove( elemIDs, false ); } @@ -3768,9 +3788,13 @@ bool SMESH_Pattern::GetMappedPoints ( list< const gp_XYZ * > & thePoints ) const thePoints.push_back( & (*pVecIt).myXYZ.XYZ() ); } else { // applied to mesh elements + const gp_XYZ * definedXYZ = & myPoints[ myKeyPointIDs.front() ].myXYZ.XYZ(); vector::const_iterator xyz = myXYZ.begin(); for ( ; xyz != myXYZ.end(); ++xyz ) - thePoints.push_back( & (*xyz) ); + if ( !isDefined( *xyz )) + thePoints.push_back( definedXYZ ); + else + thePoints.push_back( & (*xyz) ); } return !thePoints.empty(); } diff --git a/src/SMESH/SMESH_Pattern.hxx b/src/SMESH/SMESH_Pattern.hxx index 0a54cfa71..670578ce4 100644 --- a/src/SMESH/SMESH_Pattern.hxx +++ b/src/SMESH/SMESH_Pattern.hxx @@ -190,8 +190,8 @@ class SMESH_Pattern { // Return indices of key-points within the sequences returned by // GetPoints() and GetMappedPoints() - const std::list< std::list< int > >& GetElementPointIDs () const - { return myElemXYZIDs.empty() ? myElemPointIDs : myElemXYZIDs; } + const std::list< std::list< int > >& GetElementPointIDs (bool applied) const + { return myElemXYZIDs.empty() || !applied ? myElemPointIDs : myElemXYZIDs; } // Return nodal connectivity of the elements of the pattern void DumpPoints() const; diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index 3e63d654f..fd903bbc6 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -677,7 +677,7 @@ void SMESHGUI_CreatePatternDlg::displayPreview() { SMESH::point_array_var pnts = myPattern->GetPoints(); SMESH::long_array_var keyPoints = myPattern->GetKeyPoints(); - SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(); + SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false); if ( pnts->length() == 0 || keyPoints->length() == 0 || diff --git a/src/SMESH_I/SMESH_Pattern_i.cxx b/src/SMESH_I/SMESH_Pattern_i.cxx index fa664b4a8..d0b8bd216 100644 --- a/src/SMESH_I/SMESH_Pattern_i.cxx +++ b/src/SMESH_I/SMESH_Pattern_i.cxx @@ -374,11 +374,11 @@ SMESH::long_array* SMESH_Pattern_i::GetKeyPoints() //purpose : //======================================================================= -SMESH::array_of_long_array* SMESH_Pattern_i::GetElementPoints() +SMESH::array_of_long_array* SMESH_Pattern_i::GetElementPoints(CORBA::Boolean applied) { SMESH::array_of_long_array_var arrayOfArray = new SMESH::array_of_long_array; - const list< list< int > >& listOfIdList = myPattern.GetElementPointIDs(); + const list< list< int > >& listOfIdList = myPattern.GetElementPointIDs(applied); arrayOfArray->length( listOfIdList.size() ); list< list< int > >::const_iterator llIt = listOfIdList.begin(); for ( int i = 0 ; llIt != listOfIdList.end(); llIt++, i++ ) diff --git a/src/SMESH_I/SMESH_Pattern_i.hxx b/src/SMESH_I/SMESH_Pattern_i.hxx index 7bcbdff66..d0a9656bd 100644 --- a/src/SMESH_I/SMESH_Pattern_i.hxx +++ b/src/SMESH_I/SMESH_Pattern_i.hxx @@ -87,7 +87,7 @@ class SMESH_Pattern_i: SMESH::long_array* GetKeyPoints(); - SMESH::array_of_long_array* GetElementPoints(); + SMESH::array_of_long_array* GetElementPoints(CORBA::Boolean applied); private: