diff --git a/doc/salome/examples/grouping_elements_ex03.py b/doc/salome/examples/grouping_elements_ex03.py index bd85e09e0..abe275c64 100644 --- a/doc/salome/examples/grouping_elements_ex03.py +++ b/doc/salome/examples/grouping_elements_ex03.py @@ -28,22 +28,22 @@ critaria = [ \ ] filt = smesh.GetFilterFromCriteria( critaria ) filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt ) -print "Group on filter contains %s elemens" % filtGroup.Size() +print "Group on filter contains %s elements" % filtGroup.Size() # group on filter is updated if the mesh is modified hyp1D.SetStartLength( 2.5 ) hyp1D.SetEndLength( 2.5 ) mesh.Compute() -print "After mesh change, group on filter contains %s elemens" % filtGroup.Size() +print "After mesh change, group on filter contains %s elements" % filtGroup.Size() # set a new filter defining the group filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds, "1-50" ) filtGroup.SetFilter( filt2 ) -print "With a new filter, group on filter contains %s elemens" % filtGroup.Size() +print "With a new filter, group on filter contains %s elements" % filtGroup.Size() # group is updated at modification of the filter filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )]) filtIDs3 = filtGroup.GetIDs() -print "After filter modification, group on filter contains %s elemens" % filtGroup.Size() +print "After filter modification, group on filter contains %s elements" % filtGroup.Size() salome.sg.updateObjBrowser(True) diff --git a/doc/salome/gui/SMESH/input/smesh_migration.doc b/doc/salome/gui/SMESH/input/smesh_migration.doc index 3713fae37..f869fd16d 100644 --- a/doc/salome/gui/SMESH/input/smesh_migration.doc +++ b/doc/salome/gui/SMESH/input/smesh_migration.doc @@ -31,7 +31,7 @@ smesh = smeshBuilder.New(salome.myStudy) Of course, from smesh import * is no more possible. -\n You have to explicitely write smesh.some_method(). +\n You have to explicitly write smesh.some_method(). All algorithms have been transferred from the namespace smesh to the namespace smeshBuilder. \n For instance: @@ -79,7 +79,7 @@ is replaced by: Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05) \endcode -If you need to import a %SMESH Plugin explicitely, keep in mind that they are now located in separate namespaces. +If you need to import a %SMESH Plugin explicitly, keep in mind that they are now located in separate namespaces. \n For instance: \code import StdMeshers diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index f3feeaea3..fbb9430d3 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -551,7 +551,7 @@ module SMESH raises (SALOME::SALOME_Exception); /*! - * Remove an hypothesis previouly added with AddHypothesis. + * Remove an hypothesis previously added with AddHypothesis. */ Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject, in SMESH_Hypothesis anHyp) @@ -734,7 +734,7 @@ module SMESH double GetComputeProgress(); /*! - * Get informations about mesh contents + * Get information about mesh contents */ long NbNodes() raises (SALOME::SALOME_Exception); diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index aa1eb5eaa..13a2a0008 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -98,6 +99,15 @@ namespace { v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 ); } + inline double getCos2( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 ) + { + gp_Vec v1( P1 - P2 ), v2( P3 - P2 ); + double dot = v1 * v2, len1 = v1.SquareMagnitude(), len2 = v2.SquareMagnitude(); + + return ( len1 < gp::Resolution() || len2 < gp::Resolution() ? -1 : + dot * dot / len1 / len2 ); + } + inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 ) { gp_Vec aVec1( P2 - P1 ); @@ -713,21 +723,25 @@ SMDSAbs_ElementType MaxElementLength3D::GetType() const double MinimumAngle::GetValue( const TSequenceOfXYZ& P ) { - double aMin; - - if (P.size() <3) + if ( P.size() < 3 ) return 0.; - aMin = getAngle(P( P.size() ), P( 1 ), P( 2 )); - aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 ))); + double aMaxCos2; + + aMaxCos2 = getCos2( P( P.size() ), P( 1 ), P( 2 )); + aMaxCos2 = Max( aMaxCos2, getCos2( P( P.size()-1 ), P( P.size() ), P( 1 ))); for ( size_t i = 2; i < P.size(); i++ ) { - double A0 = getAngle( P( i-1 ), P( i ), P( i+1 ) ); - aMin = Min(aMin,A0); + double A0 = getCos2( P( i-1 ), P( i ), P( i+1 ) ); + aMaxCos2 = Max( aMaxCos2, A0 ); } + if ( aMaxCos2 <= 0 ) + return 0; // all nodes coincide - return aMin * 180.0 / M_PI; + double cos = sqrt( aMaxCos2 ); + if ( cos >= 1 ) return 0; + return acos( cos ) * 180.0 / M_PI; } double MinimumAngle::GetBadRate( double Value, int nbNodes ) const @@ -786,58 +800,51 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P ) if ( nbNodes == 3 ) { // Compute lengths of the sides - std::vector< double > aLen (nbNodes); - for ( int i = 0; i < nbNodes - 1; i++ ) - aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) ); - aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) ); + double aLen1 = getDistance( P( 1 ), P( 2 )); + double aLen2 = getDistance( P( 2 ), P( 3 )); + double aLen3 = getDistance( P( 3 ), P( 1 )); // Q = alfa * h * p / S, where // // alfa = sqrt( 3 ) / 6 // h - length of the longest edge // p - half perimeter // S - triangle surface - const double alfa = sqrt( 3. ) / 6.; - double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) ); - double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.; - double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) ); + const double alfa = sqrt( 3. ) / 6.; + double maxLen = Max( aLen1, Max( aLen2, aLen3 )); + double half_perimeter = ( aLen1 + aLen2 + aLen3 ) / 2.; + double anArea = getArea( P( 1 ), P( 2 ), P( 3 )); if ( anArea <= theEps ) return theInf; return alfa * maxLen * half_perimeter / anArea; } else if ( nbNodes == 6 ) { // quadratic triangles // Compute lengths of the sides - std::vector< double > aLen (3); - aLen[0] = getDistance( P(1), P(3) ); - aLen[1] = getDistance( P(3), P(5) ); - aLen[2] = getDistance( P(5), P(1) ); - // Q = alfa * h * p / S, where - // - // alfa = sqrt( 3 ) / 6 - // h - length of the longest edge - // p - half perimeter - // S - triangle surface - const double alfa = sqrt( 3. ) / 6.; - double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) ); - double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.; - double anArea = getArea( P(1), P(3), P(5) ); + double aLen1 = getDistance( P( 1 ), P( 3 )); + double aLen2 = getDistance( P( 3 ), P( 5 )); + double aLen3 = getDistance( P( 5 ), P( 1 )); + // algo same as for the linear triangle + const double alfa = sqrt( 3. ) / 6.; + double maxLen = Max( aLen1, Max( aLen2, aLen3 )); + double half_perimeter = ( aLen1 + aLen2 + aLen3 ) / 2.; + double anArea = getArea( P( 1 ), P( 3 ), P( 5 )); if ( anArea <= theEps ) return theInf; return alfa * maxLen * half_perimeter / anArea; } else if( nbNodes == 4 ) { // quadrangle // Compute lengths of the sides - std::vector< double > aLen (4); + double aLen[4]; aLen[0] = getDistance( P(1), P(2) ); aLen[1] = getDistance( P(2), P(3) ); aLen[2] = getDistance( P(3), P(4) ); aLen[3] = getDistance( P(4), P(1) ); // Compute lengths of the diagonals - std::vector< double > aDia (2); + double aDia[2]; aDia[0] = getDistance( P(1), P(3) ); aDia[1] = getDistance( P(2), P(4) ); // Compute areas of all triangles which can be built // taking three nodes of the quadrangle - std::vector< double > anArea (4); + double anArea[4]; anArea[0] = getArea( P(1), P(2), P(3) ); anArea[1] = getArea( P(1), P(2), P(4) ); anArea[2] = getArea( P(1), P(3), P(4) ); @@ -853,35 +860,35 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P ) // Si - areas of the triangles const double alpha = sqrt( 1 / 32. ); double L = Max( aLen[ 0 ], - Max( aLen[ 1 ], - Max( aLen[ 2 ], - Max( aLen[ 3 ], - Max( aDia[ 0 ], aDia[ 1 ] ) ) ) ) ); + Max( aLen[ 1 ], + Max( aLen[ 2 ], + Max( aLen[ 3 ], + Max( aDia[ 0 ], aDia[ 1 ] ) ) ) ) ); double C1 = sqrt( ( aLen[0] * aLen[0] + aLen[1] * aLen[1] + aLen[2] * aLen[2] + aLen[3] * aLen[3] ) / 4. ); double C2 = Min( anArea[ 0 ], - Min( anArea[ 1 ], - Min( anArea[ 2 ], anArea[ 3 ] ) ) ); + Min( anArea[ 1 ], + Min( anArea[ 2 ], anArea[ 3 ] ) ) ); if ( C2 <= theEps ) return theInf; return alpha * L * C1 / C2; } else if( nbNodes == 8 || nbNodes == 9 ) { // nbNodes==8 - quadratic quadrangle // Compute lengths of the sides - std::vector< double > aLen (4); + double aLen[4]; aLen[0] = getDistance( P(1), P(3) ); aLen[1] = getDistance( P(3), P(5) ); aLen[2] = getDistance( P(5), P(7) ); aLen[3] = getDistance( P(7), P(1) ); // Compute lengths of the diagonals - std::vector< double > aDia (2); + double aDia[2]; aDia[0] = getDistance( P(1), P(5) ); aDia[1] = getDistance( P(3), P(7) ); // Compute areas of all triangles which can be built // taking three nodes of the quadrangle - std::vector< double > anArea (4); + double anArea[4]; anArea[0] = getArea( P(1), P(3), P(5) ); anArea[1] = getArea( P(1), P(3), P(7) ); anArea[2] = getArea( P(1), P(5), P(7) ); @@ -1922,6 +1929,12 @@ double Deflection2D::GetValue( const TSequenceOfXYZ& P ) if ( !S.IsNull() && S.ShapeType() == TopAbs_FACE ) { mySurface = new ShapeAnalysis_Surface( BRep_Tool::Surface( TopoDS::Face( S ))); + + GeomLib_IsPlanarSurface isPlaneCheck( mySurface->Surface() ); + if ( isPlaneCheck.IsPlanar() ) + myPlane.reset( new gp_Pln( isPlaneCheck.Plan() )); + else + myPlane.reset(); } } // project gravity center to the surface @@ -1947,12 +1960,22 @@ double Deflection2D::GetValue( const TSequenceOfXYZ& P ) double maxLen = MaxElementLength2D().GetValue( P ); double tol = 1e-3 * maxLen; - if ( uv.X() != 0 && uv.Y() != 0 ) // faster way - mySurface->NextValueOfUV( uv, gc, tol, 0.5 * maxLen ); + double dist; + if ( myPlane ) + { + dist = myPlane->Distance( gc ); + if ( dist < tol ) + dist = 0; + } else - mySurface->ValueOfUV( gc, tol ); - - return Round( mySurface->Gap() ); + { + if ( uv.X() != 0 && uv.Y() != 0 ) // faster way + mySurface->NextValueOfUV( uv, gc, tol, 0.5 * maxLen ); + else + mySurface->ValueOfUV( gc, tol ); + dist = mySurface->Gap(); + } + return Round( dist ); } } return 0; @@ -1962,6 +1985,7 @@ void Deflection2D::SetMesh( const SMDS_Mesh* theMesh ) { NumericalFunctor::SetMesh( dynamic_cast( theMesh )); myShapeIndex = -100; + myPlane.reset(); } SMDSAbs_ElementType Deflection2D::GetType() const diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx index 048b10d0b..452b27a39 100644 --- a/src/Controls/SMESH_ControlsDef.hxx +++ b/src/Controls/SMESH_ControlsDef.hxx @@ -53,9 +53,10 @@ class SMESHDS_Mesh; class SMESHDS_SubMesh; class SMESHDS_GroupBase; -class gp_Pnt; class BRepClass3d_SolidClassifier; class ShapeAnalysis_Surface; +class gp_Pln; +class gp_Pnt; namespace SMESH{ namespace Controls{ @@ -321,6 +322,7 @@ namespace SMESH{ private: Handle(ShapeAnalysis_Surface) mySurface; int myShapeIndex; + boost::shared_ptr myPlane; }; /* diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx index 4e4002ee3..95e775433 100644 --- a/src/SMESH/SMESH_Algo.cxx +++ b/src/SMESH/SMESH_Algo.cxx @@ -87,7 +87,7 @@ using namespace std; bool SMESH_Algo::Features::IsCompatible( const SMESH_Algo::Features& algo2 ) const { if ( _dim > algo2._dim ) return algo2.IsCompatible( *this ); - // algo2 is of highter dimension + // algo2 is of higher dimension if ( _outElemTypes.empty() || algo2._inElemTypes.empty() ) return false; bool compatible = true; diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 76987e5b1..93fbbac35 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -2188,7 +2188,7 @@ ostream& SMESH_Mesh::Dump(ostream& save) save << clause << ".3) Faces in detail: " << endl; map ::iterator itF; for (itF = myFaceMap.begin(); itF != myFaceMap.end(); itF++) - save << "--> nb nodes: " << itF->first << " - nb elemens:\t" << itF->second << endl; + save << "--> nb nodes: " << itF->first << " - nb elements:\t" << itF->second << endl; } } save << ++clause << ") Total number of " << orderStr << " volumes:\t" << NbVolumes(order) << endl; @@ -2213,7 +2213,7 @@ ostream& SMESH_Mesh::Dump(ostream& save) save << clause << ".5) Volumes in detail: " << endl; map ::iterator itV; for (itV = myVolumesMap.begin(); itV != myVolumesMap.end(); itV++) - save << "--> nb nodes: " << itV->first << " - nb elemens:\t" << itV->second << endl; + save << "--> nb nodes: " << itV->first << " - nb elements:\t" << itV->second << endl; } } save << endl; diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 022e091ba..6b167f132 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -3460,6 +3460,24 @@ double SMESH_MesherHelper::GetOtherParam(const double param) const return fabs(param-myPar1[i]) < fabs(param-myPar2[i]) ? myPar2[i] : myPar1[i]; } +//======================================================================= +//function : NbRealSeam +//purpose : Return a number of real seam edges in the shape set through +// IsQuadraticSubMesh() or SetSubShape(). A real seam edge encounters twice in a wire +//======================================================================= + +size_t SMESH_MesherHelper::NbRealSeam() const +{ + size_t nb = 0; + + std::set< int >::const_iterator id = mySeamShapeIds.begin(); + for ( ; id != mySeamShapeIds.end(); ++id ) + if ( *id < 0 ) ++nb; + else break; + + return nb; +} + //======================================================================= //function : IsOnSeam //purpose : Check if UV is on seam. Return 0 if not, 1 for U seam, 2 for V seam @@ -5126,7 +5144,7 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError, MSG("Internal chain - ignore"); continue; } - // mesure chain length and compute link position along the chain + // measure chain length and compute link position along the chain double chainLen = 0; vector< double > linkPos; TChain savedChain; // backup diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index cf3506fea..d4f54833a 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -52,7 +52,7 @@ typedef std::map::iterator ItTLinkNode; typedef SMDS_Iterator PShapeIterator; typedef boost::shared_ptr< PShapeIterator > PShapeIteratorPtr; - + typedef std::vector TNodeColumn; typedef std::map< double, TNodeColumn > TParam2ColumnMap; @@ -561,9 +561,15 @@ public: /*! * \brief Check if the shape set through IsQuadraticSubMesh() or SetSubShape() * has a degenerated edges - * \retval bool - true if it has + * \retval bool - true if there are degenerated edges */ bool HasDegeneratedEdges() const { return !myDegenShapeIds.empty(); } + /*! + * \brief Return a number of degenerated edges in the shape set through + * IsQuadraticSubMesh() or SetSubShape() + * \retval size_t - nb edges + */ + size_t NbDegeneratedEdges() const { return myDegenShapeIds.size(); } /*! * \brief Check if shape is a seam edge or it's vertex @@ -610,6 +616,12 @@ public: * \retval bool - true if it has */ bool HasRealSeam() const { return HasSeam() && ( *mySeamShapeIds.begin() < 0 ); } + /*! + * \brief Return a number of real seam edges in the shape set through + * IsQuadraticSubMesh() or SetSubShape(). A real seam edge encounters twice in a wire + * \retval size_t - nb of real seams + */ + size_t NbRealSeam() const; /*! * \brief Return index of periodic parametric direction of a closed face * \retval int - 1 for U, 2 for V direction diff --git a/src/SMESH/SMESH_ProxyMesh.cxx b/src/SMESH/SMESH_ProxyMesh.cxx index f994b83ec..a28033fda 100644 --- a/src/SMESH/SMESH_ProxyMesh.cxx +++ b/src/SMESH/SMESH_ProxyMesh.cxx @@ -95,7 +95,7 @@ SMESH_ProxyMesh::SMESH_ProxyMesh(std::vector& components): //================================================================================ /*! - * \brief Destructor deletes proxy submeshes and tmp elemens + * \brief Destructor deletes proxy submeshes and tmp elements */ //================================================================================ diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 1dc5e7e12..ce634a4b3 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1539,7 +1539,7 @@ SMESHGUI_ComputeOp::SMESHGUI_ComputeOp() //================================================================================ /*! - * \brief Desctructor + * \brief Destructor */ //================================================================================ @@ -2158,7 +2158,7 @@ SMESHGUI_EvaluateOp::SMESHGUI_EvaluateOp() //================================================================================ /*! - * \brief Desctructor + * \brief Destructor */ //================================================================================ diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index 06163d911..c45b9eae1 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -91,7 +91,7 @@ namespace SMESHOp { OpRemoveElemGroupPopup = 2082, // POPUP MENU - REMOVE ELEMENTS FROM GROUP OpMeshInformation = 2100, // MENU MESH - MESH INFORMATION OpWhatIs = 2101, // MENU MESH - MESH ELEMENT INFORMATION - OpStdInfo = 2102, // MENU MESH - MESH STANDART INFORMATION + OpStdInfo = 2102, // MENU MESH - MESH STANDARD INFORMATION OpFindElementByPoint = 2103, // MENU MESH - FIND ELEMENT BY POINT OpUpdate = 2200, // POPUP MENU - UPDATE // Controls -----------------------//-------------------------------- diff --git a/src/SMESHUtils/SMESH_FillHole.cxx b/src/SMESHUtils/SMESH_FillHole.cxx index 4ded1127f..ee22ef944 100644 --- a/src/SMESHUtils/SMESH_FillHole.cxx +++ b/src/SMESHUtils/SMESH_FillHole.cxx @@ -66,6 +66,7 @@ namespace double myDirCoef; // 1. or -1, to make myDir oriented as myNodes in myFace double myLength; // between nodes double myAngleWithPrev; // between myDir and -myPrev->myDir + double myMinMaxRatio; // of a possible triangle sides TAngleMap::iterator myAngleMapPos; double myOverlapAngle; // angle delta due to overlapping const SMDS_MeshNode* myNode1Shift; // nodes created to avoid overlapping of faces @@ -87,11 +88,13 @@ namespace std::vector& newFaces, const bool isReverse ); gp_XYZ GetInFaceDir() const { return myFaceNorm ^ myDir * myDirCoef; } + double ShapeFactor() const { return 0.5 * ( 1. - myMinMaxRatio ); } void InsertSelf(TAngleMap& edgesByAngle, bool isReverseFaces, bool reBind, bool useOverlap ) { if ( reBind ) edgesByAngle.erase( myAngleMapPos ); double key = (( isReverseFaces ? 2 * M_PI - myAngleWithPrev : myAngleWithPrev ) - + myOverlapAngle * useOverlap ); + + myOverlapAngle * useOverlap + + ShapeFactor() ); myAngleMapPos = edgesByAngle.insert( std::make_pair( key, this )); } @@ -163,7 +166,6 @@ namespace myFaceNorm *= -1; myDirCoef *= -1; } - } //================================================================================ @@ -174,21 +176,28 @@ namespace void BEdge::ComputeAngle( bool theReverseAngle ) { - myAngleWithPrev = ACos( myDir.Dot( myPrev->myDir.Reversed() )); + double dot = myDir.Dot( myPrev->myDir.Reversed() ); + if ( dot >= 1 ) myAngleWithPrev = 0; + else if ( dot <= -1 ) myAngleWithPrev = M_PI; + else myAngleWithPrev = acos( dot ); bool isObtuse; - gp_XYZ inNewFaceDir = myDir - myPrev->myDir; - double dot1 = myDir.Dot( myPrev->myFaceNorm ); - double dot2 = myPrev->myDir.Dot( myFaceNorm ); - bool isOverlap1 = ( inNewFaceDir * myPrev->GetInFaceDir() > 0 ); - bool isOverlap2 = ( inNewFaceDir * GetInFaceDir() > 0 ); + gp_XYZ inFaceDirNew = myDir - myPrev->myDir; + gp_XYZ inFaceDir1 = myPrev->GetInFaceDir(); + gp_XYZ inFaceDir2 = this->GetInFaceDir(); + double dot1 = inFaceDirNew * inFaceDir1; + double dot2 = inFaceDirNew * inFaceDir2; + bool isOverlap1 = ( dot1 > 0 ); + bool isOverlap2 = ( dot2 > 0 ); if ( !myPrev->myFace ) isObtuse = isOverlap1; else if ( !myFace ) isObtuse = isOverlap2; else { - isObtuse = ( dot1 > 0 || dot2 < 0 ); // suppose face normals point outside the border + double dt1 = myDir.Dot( myPrev->myFaceNorm ); + double dt2 = myPrev->myDir.Dot( myFaceNorm ); + isObtuse = ( dt1 > 0 || dt2 < 0 ); // suppose face normals point outside the border if ( theReverseAngle ) isObtuse = !isObtuse; } @@ -207,15 +216,22 @@ namespace // check if myFace and a triangle built on this and prev edges overlap if ( isOverlap1 ) { - double cos2 = dot1 * dot1 / myPrev->myFaceNorm.SquareModulus(); - myOverlapAngle += 0.5 * M_PI * ( 1 - cos2 ); + double cos2 = dot1 * dot1 / inFaceDirNew.SquareModulus() / inFaceDir1.SquareModulus(); + myOverlapAngle += 1. * M_PI * cos2; } if ( isOverlap2 ) { - double cos2 = dot2 * dot2 / myFaceNorm.SquareModulus(); - myOverlapAngle += 0.5 * M_PI * ( 1 - cos2 ); + double cos2 = dot2 * dot2 / inFaceDirNew.SquareModulus() / inFaceDir2.SquareModulus(); + myOverlapAngle += 1. * M_PI * cos2; } } + + { + double len3 = SMESH_NodeXYZ( myPrev->myNode1 ).Distance( myNode2 ); + double minLen = Min( myLength, Min( myPrev->myLength, len3 )); + double maxLen = Max( myLength, Max( myPrev->myLength, len3 )); + myMinMaxRatio = minLen / maxLen; + } } //================================================================================ @@ -445,11 +461,12 @@ void SMESH_MeshAlgos::FillHole(const SMESH_MeshAlgos::TFreeBorder & theFreeBord while ( edgesByAngle.size() > 2 ) { TAngleMap::iterator a2e = edgesByAngle.begin(); - if ( useOverlap && a2e->first > M_PI - angTol ) // all new triangles need shift + edge = a2e->second; + if ( useOverlap && + a2e->first - edge->ShapeFactor() > M_PI - angTol ) // all new triangles need shift { - // re-sort the edges + // re-sort the edges w/o overlap consideration useOverlap = false; - edge = a2e->second; nbEdges = edgesByAngle.size(); edgesByAngle.clear(); for ( size_t i = 0; i < nbEdges; ++i, edge = edge->myNext ) diff --git a/src/SMESHUtils/SMESH_TypeDefs.hxx b/src/SMESHUtils/SMESH_TypeDefs.hxx index c9be990f6..4c2dddab0 100644 --- a/src/SMESHUtils/SMESH_TypeDefs.hxx +++ b/src/SMESHUtils/SMESH_TypeDefs.hxx @@ -149,7 +149,6 @@ struct SMESH_OrientedLink: public SMESH_TLink struct SMESH_TNodeXYZ : public gp_XYZ { const SMDS_MeshNode* _node; - double _xyz[3]; SMESH_TNodeXYZ( const SMDS_MeshElement* e=0):gp_XYZ(0,0,0),_node(0) { Set(e); @@ -159,15 +158,14 @@ struct SMESH_TNodeXYZ : public gp_XYZ if (e) { assert( e->GetType() == SMDSAbs_Node ); _node = static_cast(e); - _node->GetXYZ(_xyz); // - thread safe getting coords - SetCoord( _xyz[0], _xyz[1], _xyz[2] ); + _node->GetXYZ( ChangeData() ); // - thread safe getting coords return true; } return false; } double Distance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).Modulus(); } double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); } - bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; } + bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; } }; typedef SMESH_TNodeXYZ SMESH_NodeXYZ; diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 38fc1414f..2718b0c1d 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -72,7 +72,7 @@ using SMESH::TPythonDump; /*! * \brief Container of commands into which the initial script is split. - * It also contains data coresponding to SMESH_Gen contents + * It also contains data corresponding to SMESH_Gen contents */ static Handle(_pyGen) theGen; diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 916a1f222..33aa46a96 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -3812,7 +3812,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, // "Face V positions" - V parameter of node on face // Find out nb of nodes on edges and faces - // Collect corresponing sub-meshes + // Collect corresponding sub-meshes int nbEdgeNodes = 0, nbFaceNodes = 0; list aEdgeSM, aFaceSM; // loop on SMESHDS_SubMesh'es diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index 4fef40fab..beea2de8d 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -953,6 +953,10 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): ## doc string of the method # @internal docHelper = "Creates prism 3D algorithm for volumes" + ## flag pointing whether this algorithm should be used by default in dynamic method + # of smeshBuilder.Mesh class + # @internal + isDefault = True ## Private constructor. # @param mesh parent mesh object algorithm is assigned to diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index e83fbe993..24aaad3b8 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -2303,10 +2303,10 @@ class Mesh: return self.editor.MakeIDSource(ids, elemType) - # Get informations about mesh contents: + # Get information about mesh contents: # ------------------------------------ - ## Get the mesh stattistic + ## Get the mesh statistic # @return dictionary type element - count of elements # @ingroup l1_meshinfo def GetMeshInfo(self, obj = None): @@ -4924,12 +4924,12 @@ class Mesh: ## Identify the elements that will be affected by node duplication (actual duplication is not performed. # This method is the first step of DoubleNodeElemGroupsInRegion. - # @param theElems - list of groups of elements (edges or faces) to be replicated + # @param theElems - list of groups of nodes or elements (edges or faces) to be replicated # @param theNodesNot - list of groups of nodes not to replicated # @param theShape - shape to detect affected elements (element which geometric center # located on or inside shape). # The replicated nodes should be associated to affected elements. - # @return groups of affected elements + # @return groups of affected elements in order: volumes, faces, edges # @ingroup l2_modif_duplicat def AffectedElemGroupsInRegion(self, theElems, theNodesNot, theShape): return self.editor.AffectedElemGroupsInRegion(theElems, theNodesNot, theShape) diff --git a/src/StdMeshers/StdMeshers_AutomaticLength.cxx b/src/StdMeshers/StdMeshers_AutomaticLength.cxx index ad5f5263f..c86e02a78 100644 --- a/src/StdMeshers/StdMeshers_AutomaticLength.cxx +++ b/src/StdMeshers/StdMeshers_AutomaticLength.cxx @@ -191,7 +191,7 @@ namespace { theTShapeToLengthMap.insert( make_pair( getTShape( edge ), L )); } - // Compute S0 - minimal segement length, is computed by the shortest EDGE + // Compute S0 - minimal segment length, is computed by the shortest EDGE /* image attached to PAL10237 diff --git a/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx b/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx index a4d3ffbdd..85592db51 100644 --- a/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx @@ -604,7 +604,7 @@ namespace theSinuEdges [0].size() > 0 && theSinuEdges [1].size() > 0 ); // the sinuous EDGEs can be composite and C0 continuous, - // therefor we use a complex criterion to find TWO short non-sinuous EDGEs + // therefore we use a complex criterion to find TWO short non-sinuous EDGEs // and the rest EDGEs will be treated as sinuous. // A short edge should have the following features: // a) straight diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 994089cfe..66654eeac 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -4593,7 +4593,7 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace, { d = Abs( idealLen - accuLength[ iEV ]); - // take into account presence of a coresponding halfDivider + // take into account presence of a corresponding halfDivider const double cornerWgt = 0.5 / nbSides; const double vertexWgt = 0.25 / nbSides; TGeoIndex hd = halfDivider[ evVec[ iEV ]]; diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx index 9f9510225..a4ba0446d 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx @@ -429,7 +429,7 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobFileList & meshJo //jobParameters->maximum_duration = CORBA::string_dup("01:00"); jobParameters->queue = CORBA::string_dup(""); - // Setting resource and additionnal properties (if needed) + // Setting resource and additional properties (if needed) // The resource parameters can be initiated from scratch, for // example by specifying the values in hard coding: // >>> @@ -451,7 +451,7 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobFileList & meshJo resourceDefinition = _resourcesManager->GetResourceDefinition(resourceName); } catch (const CORBA::SystemException& ex) { - _lastErrorMessage = std::string("We can not access to the ressource ") + std::string(resourceName); + _lastErrorMessage = std::string("We can not access the resource ") + std::string(resourceName); _lastErrorMessage+= std::string("(check the file CatalogResource.xml)"); LOG(_lastErrorMessage); return JOBID_UNDEFINED; @@ -462,7 +462,7 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobFileList & meshJo // Then, the values can be used to initiate the resource parameters // of the job: jobParameters->resource_required.name = CORBA::string_dup(resourceDefinition->name.in()); - // CAUTION: the additionnal two following parameters MUST be + // CAUTION: the additional two following parameters MUST be // specified explicitly, because they are not provided by the // resource definition: jobParameters->resource_required.mem_mb = resourceDefinition->mem_mb; @@ -682,7 +682,7 @@ std::vector * MeshJobManager_i::_getResourceNames() { // SALOME application. // In the code instructions, you just have to choose a resource // configuration by its name and then define the ResourceParameters - // that specify additionnal properties for a specific job submission + // that specify additional properties for a specific job submission // (use the attribute resource_required of the JobParameters). return resourceNames; diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx index 618a4a2f2..177c4ccfa 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx @@ -73,7 +73,7 @@ private: Engines::ResourcesManager_var _resourcesManager; // This maps the config identifier to the config parameters. A - // config is a resource with additionnal data specifying the + // config is a resource with additional data specifying the // location of the binary program to be executed by the task std::map _configMap;