SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
# Common CMake macros
# ===================
]
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)
--- /dev/null
+# Deflection 2D
+
+
+import salome
+salome.salome_init()
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+# fuse a box and a sphere
+Sphere_1 = geompy.MakeSphereR(100)
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Fuse = geompy.MakeFuse( Sphere_1, Box_1, theName="box + sphere" )
+
+# create a mesh
+mesh = smesh.Mesh( Fuse, "Deflection_2D")
+algo = mesh.Segment()
+algo.LocalLength(35)
+algo = mesh.Triangle()
+mesh.Compute()
+
+# get min and max deflection
+minMax = mesh.GetMinMax( SMESH.FT_Deflection2D )
+print "min and max deflection: ", minMax
+
+# get deflection of a certain face
+faceID = mesh.NbEdges() + mesh.NbFaces()
+defl = mesh.FunctorValue( SMESH.FT_Deflection2D, faceID )
+print "deflection of face %s = %s" % ( faceID, defl )
+
+margin = minMax[1] / 2
+
+# get all faces with deflection LESS than the margin
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Deflection2D, '<', margin, mesh=mesh)
+anIds = aFilter.GetIDs()
+print "%s faces have deflection less than %s" %( len(anIds), margin )
+
+# create a group of faces with deflection MORE than the margin
+aGroup = mesh.MakeGroup("Deflection > " + `margin`, SMESH.FACE, SMESH.FT_Deflection2D,'>',margin)
+print "%s faces have deflection more than %s: %s ..." %( aGroup.Size(), margin, aGroup.GetIDs()[:10] )
+
+salome.sg.updateObjBrowser(True)
quality_controls_ex17.py
quality_controls_ex18.py
quality_controls_ex19.py
+ quality_controls_defl.py
transforming_meshes_ex01.py
transforming_meshes_ex02.py
transforming_meshes_ex03.py
or edit mesh groups, remove elements from the mesh, control
mesh quality by different parameters, etc.
-Several criteria can be combined together by using logical operators \a
-AND and \a OR. In addition, a filter criterion can be reverted
-using logical operator \a NOT.
+Several \ref filtering_criteria "filtering criteria" can be combined
+together by using logical operators \a AND and \a OR. In addition, a
+filter criterion can be reverted using logical operator \a NOT.
-Some filtering criteria use the functionality of \ref quality_page "mesh quality controls"
-to filter mesh nodes / elements by specific characteristic (Area, Length, etc).
+Some filtering criteria use the functionality of \ref quality_page
+"mesh quality controls" to filter mesh nodes / elements by specific
+characteristic (Area, Length, etc).
The functinality of mesh filters is available in both GUI and TUI
modes:
-- In GUI, filters are available in some dialog boxes via
-"Set Filters" button, clicking on which opens the dialog box
+- In GUI, filters are available in some dialog boxes via "Set Filters"
+button, clicking on which opens the \ref filtering_elements "dialog box"
allowing to specify the list of filter criteria to be applied to the
-current selection. See \subpage selection_filter_library_page page to learn more
-about selection filters and their usage in GUI.
+current selection. See \subpage selection_filter_library_page page to
+learn more about selection filters and their usage in GUI.
- In Python scripts, filters can be used to choose only some mesh
entities (nodes or elements) for the operations, which require the
<li>\subpage bare_border_faces_page "Bare border faces"</li>
<li>\subpage over_constrained_faces_page "Over-constrained faces"</li>
<li>\subpage length_2d_page "Length 2D"</li>
+<li>\subpage deflection_2d_page "Deflection 2D"</li>
<li>\subpage borders_at_multi_connection_2d_page "Borders at multi-connection 2D"</li>
<li>\subpage area_page "Area"</li>
<li>\subpage taper_page "Taper"</li>
--- /dev/null
+/*!
+
+\page deflection_2d_page Deflection 2D
+
+\n This quality control criterion consists of calculation of distance
+between a mesh face gravity corner and the surface the face discretizes.
+
+<em>To apply the Deflection 2D quality criterion to your mesh:</em>
+<ol>
+<li>Display your mesh in the viewer. </li>
+
+<li>Choose <b>Controls > Face Controls > Deflection 2D</b> or click
+<em>"Deflection 2D"</em> button in the toolbar.
+
+Your mesh will be displayed in the viewer with faces colored according
+to the applied mesh quality control criterion:
+
+\image html deflection_2d.png
+</li>
+</ol>
+
+<br><b>See Also</b> a sample TUI Script of a
+\ref tui_deflection_2d "Deflection 2D quality control" operation.
+
+*/
\page selection_filter_library_page Selection filter library
+\tableofcontents
+
+\section selection_filter_library Filter library
+
\n Selection filter library allows creating and storing in files
the filters that can be later reused for operations on meshes. You can
access it from the Main Menu via <b>Tools / Selection filter library</b>.
\n In <b>Filter name</b> box you can specify the name for your
filter. By default it is prefixed with the corresponding entity type.
-\anchor filtering_elements
-<h2>Filter Dialog</h2>
+\section filtering_elements Filter Dialog
When we use filters during group creation or another operation (by
clicking <b>Set Filter</b> button in the corresponding dialog), the
is no selected mesh in the Object Browser and the filter can not be
created. You have to select the mesh and the button will be enabled.
+\section filtering_criteria Filtering Criteria
+
Some criteria are applicable to all <b>Entity types</b>:
<ul><li>
<b>Belong to Geom</b> selects entities whose all nodes lie on the
angular tolerance (defined in degrees). Selection continues among all neighbor faces of already
selected ones.<br>
</li><li>
+<b>Deflection 2D</b> selects 2D mesh elements having distance between their gravity
+centers and underlying surfaces, which is more, less or equal (within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
+\ref deflection_2d_page "Deflection 2D quality control".
+</li><li>
<b>Element Diameter 2D</b> selects triangles and quadrangles composed of the edges and
diagonals with a value of length, which is more, less or equal
(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
<b> Of course, <em>from smesh import *</em> is no more possible.</b>
-\n You have to explicitely write <em>smesh.some_method()</em>.
+\n You have to explicitly write <em>smesh.some_method()</em>.
<b>All algorithms have been transferred from the namespace <em>smesh</em> to the namespace <em>smeshBuilder</em>.</b>
\n For instance:
Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
\endcode
-<b>If you need to import a %SMESH Plugin explicitely, keep in mind that they are now located in separate namespaces.</b>
+<b>If you need to import a %SMESH Plugin explicitly, keep in mind that they are now located in separate namespaces.</b>
\n For instance:
\code
import StdMeshers
\section tui_length_2d Length 2D
\tui_script{quality_controls_ex11.py}
+\section tui_deflection_2d Deflection 2D
+\tui_script{quality_controls_defl.py}
+
\section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
\tui_script{quality_controls_ex12.py}
FT_MultiConnection2D,
FT_Length,
FT_Length2D,
+ FT_Deflection2D,
FT_NodeConnectivityNumber,
FT_BelongToMeshGroup,
FT_BelongToGeom,
typedef sequence<Value> Values;
Values GetValues();
};
+ interface Deflection2D : NumericalFunctor{};
interface MultiConnection : NumericalFunctor{};
interface MultiConnection2D : NumericalFunctor
{
MaxElementLength3D CreateMaxElementLength3D();
Length CreateLength();
Length2D CreateLength2D();
+ Deflection2D CreateDeflection2D();
MultiConnection CreateMultiConnection();
MultiConnection2D CreateMultiConnection2D();
BallDiameter CreateBallDiameter();
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)
double GetComputeProgress();
/*!
- * Get informations about mesh contents
+ * Get information about mesh contents
*/
long NbNodes()
raises (SALOME::SALOME_Exception);
* Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
* TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
*/
- short GetPointState(in double x, in double y, in double z)
+ short GetPointState(in double x, in double y, in double z)
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Check if a 2D mesh is manifold
+ */
+ boolean IsManifold()
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Check if orientation of 2D elements is coherent
+ */
+ boolean IsCoherentOrientation2D()
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Returns all or only closed FreeBorder's.
+ */
+ ListOfFreeBorders FindFreeBorders(in boolean closedOnly)
+ raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Fill with 2D elements a hole defined by a FreeBorder.
+ */
+ void FillHole(in FreeBorder hole)
raises (SALOME::SALOME_Exception);
/*!
mesh_quality.png
mesh_show.png
mesh_hide.png
+ mesh_deflection.png
)
INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})
#include "SMESH_ControlsDef.hxx"
#include "SMDS_BallElement.hxx"
+#include "SMDS_FacePosition.hxx"
#include "SMDS_Iterator.hxx"
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Copy.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRep_Tool.hxx>
+#include <GeomLib_IsPlanarSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <NCollection_Map.hxx>
#include <Precision.hxx>
+#include <ShapeAnalysis_Surface.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
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 );
}
if ( anIter ) {
- double xyz[3];
+ SMESH_NodeXYZ p;
while( anIter->more() ) {
- if ( const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( anIter->next() ))
- {
- aNode->GetXYZ( xyz );
- theRes.push_back( gp_XYZ( xyz[0], xyz[1], xyz[2] ));
- }
+ if ( p.Set( anIter->next() ))
+ theRes.push_back( p );
}
}
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
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) );
// 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) );
*/
//================================================================================
-double Length2D::GetValue( long theElementId )
+double Length2D::GetValue( const TSequenceOfXYZ& P )
{
- TSequenceOfXYZ P;
-
- if ( GetPoints( theElementId, P ))
- {
- double aVal = 0;
- int len = P.size();
- SMDSAbs_EntityType aType = P.getElementEntity();
+ double aVal = 0;
+ int len = P.size();
+ SMDSAbs_EntityType aType = P.getElementEntity();
- switch (aType) {
- case SMDSEntity_Edge:
- if (len == 2)
- aVal = getDistance( P( 1 ), P( 2 ) );
- break;
- case SMDSEntity_Quad_Edge:
- if (len == 3) // quadratic edge
- aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
- break;
- case SMDSEntity_Triangle:
- if (len == 3){ // triangles
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- aVal = Min(L1,Min(L2,L3));
- }
- break;
- case SMDSEntity_Quadrangle:
- if (len == 4){ // quadrangles
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- aVal = Min(Min(L1,L2),Min(L3,L4));
- }
- break;
- case SMDSEntity_Quad_Triangle:
- case SMDSEntity_BiQuad_Triangle:
- if (len >= 6){ // quadratic triangles
- double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
- double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
- double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
- aVal = Min(L1,Min(L2,L3));
- }
- break;
- case SMDSEntity_Quad_Quadrangle:
- case SMDSEntity_BiQuad_Quadrangle:
- if (len >= 8){ // quadratic quadrangles
- double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
- double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
- double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
- double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
- aVal = Min(Min(L1,L2),Min(L3,L4));
- }
- break;
- case SMDSEntity_Tetra:
- if (len == 4){ // tetrahedra
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 4 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- }
- break;
- case SMDSEntity_Pyramid:
- if (len == 5){ // pyramid
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 5 ));
-
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(L7,L8));
- }
- break;
- case SMDSEntity_Penta:
- if (len == 6) { // pentahedron
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 6 ));
-
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),L9));
- }
- break;
- case SMDSEntity_Hexa:
- if (len == 8){ // hexahedron
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 8 ));
-
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
- aVal = Min(aVal,Min(L11,L12));
- }
- break;
- case SMDSEntity_Quad_Tetra:
- if (len == 10){ // quadratic tetrahedron
- double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- }
- break;
- case SMDSEntity_Quad_Pyramid:
- if (len == 13){ // quadratic pyramid
- double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(L7,L8));
- }
- break;
- case SMDSEntity_Quad_Penta:
- case SMDSEntity_BiQuad_Penta:
- if (len >= 15){ // quadratic pentahedron
- double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),L9));
- }
- break;
- case SMDSEntity_Quad_Hexa:
- case SMDSEntity_TriQuad_Hexa:
- if (len >= 20) { // quadratic hexahedron
- double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
- aVal = Min(aVal,Min(L11,L12));
- }
- break;
- case SMDSEntity_Polygon:
- if ( len > 1 ) {
- aVal = getDistance( P(1), P( P.size() ));
- for ( size_t i = 1; i < P.size(); ++i )
- aVal = Min( aVal, getDistance( P( i ), P( i+1 )));
- }
- break;
- case SMDSEntity_Quad_Polygon:
- if ( len > 2 ) {
- aVal = getDistance( P(1), P( P.size() )) + getDistance( P(P.size()), P( P.size()-1 ));
- for ( size_t i = 1; i < P.size()-1; i += 2 )
- aVal = Min( aVal, getDistance( P( i ), P( i+1 )) + getDistance( P( i+1 ), P( i+2 )));
- }
- break;
- case SMDSEntity_Hexagonal_Prism:
- if (len == 12) { // hexagonal prism
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 1 ));
-
- double L7 = getDistance(P( 7 ), P( 8 ));
- double L8 = getDistance(P( 8 ), P( 9 ));
- double L9 = getDistance(P( 9 ), P( 10 ));
- double L10= getDistance(P( 10 ),P( 11 ));
- double L11= getDistance(P( 11 ),P( 12 ));
- double L12= getDistance(P( 12 ),P( 7 ));
-
- double L13 = getDistance(P( 1 ),P( 7 ));
- double L14 = getDistance(P( 2 ),P( 8 ));
- double L15 = getDistance(P( 3 ),P( 9 ));
- double L16 = getDistance(P( 4 ),P( 10 ));
- double L17 = getDistance(P( 5 ),P( 11 ));
- double L18 = getDistance(P( 6 ),P( 12 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal, Min(Min(Min(L7,L8),Min(L9,L10)),Min(L11,L12)));
- aVal = Min(aVal, Min(Min(Min(L13,L14),Min(L15,L16)),Min(L17,L18)));
- }
- break;
- case SMDSEntity_Polyhedra:
- {
+ switch (aType) {
+ case SMDSEntity_Edge:
+ if (len == 2)
+ aVal = getDistance( P( 1 ), P( 2 ) );
+ break;
+ case SMDSEntity_Quad_Edge:
+ if (len == 3) // quadratic edge
+ aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
+ break;
+ case SMDSEntity_Triangle:
+ if (len == 3){ // triangles
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ aVal = Min(L1,Min(L2,L3));
}
break;
- default:
- return 0;
+ case SMDSEntity_Quadrangle:
+ if (len == 4){ // quadrangles
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ aVal = Min(Min(L1,L2),Min(L3,L4));
+ }
+ break;
+ case SMDSEntity_Quad_Triangle:
+ case SMDSEntity_BiQuad_Triangle:
+ if (len >= 6){ // quadratic triangles
+ double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+ double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+ double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
+ aVal = Min(L1,Min(L2,L3));
+ }
+ break;
+ case SMDSEntity_Quad_Quadrangle:
+ case SMDSEntity_BiQuad_Quadrangle:
+ if (len >= 8){ // quadratic quadrangles
+ double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+ double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+ double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
+ double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
+ aVal = Min(Min(L1,L2),Min(L3,L4));
+ }
+ break;
+ case SMDSEntity_Tetra:
+ if (len == 4){ // tetrahedra
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 1 ),P( 4 ));
+ double L5 = getDistance(P( 2 ),P( 4 ));
+ double L6 = getDistance(P( 3 ),P( 4 ));
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
}
+ break;
+ case SMDSEntity_Pyramid:
+ if (len == 5){ // pyramid
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ double L5 = getDistance(P( 1 ),P( 5 ));
+ double L6 = getDistance(P( 2 ),P( 5 ));
+ double L7 = getDistance(P( 3 ),P( 5 ));
+ double L8 = getDistance(P( 4 ),P( 5 ));
- if (aVal < 0 ) {
- return 0.;
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal,Min(L7,L8));
}
+ break;
+ case SMDSEntity_Penta:
+ if (len == 6) { // pentahedron
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 4 ));
+ double L7 = getDistance(P( 1 ),P( 4 ));
+ double L8 = getDistance(P( 2 ),P( 5 ));
+ double L9 = getDistance(P( 3 ),P( 6 ));
- if ( myPrecision >= 0 )
- {
- double prec = pow( 10., (double)( myPrecision ) );
- aVal = floor( aVal * prec + 0.5 ) / prec;
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal,Min(Min(L7,L8),L9));
}
+ break;
+ case SMDSEntity_Hexa:
+ if (len == 8){ // hexahedron
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 7 ));
+ double L7 = getDistance(P( 7 ),P( 8 ));
+ double L8 = getDistance(P( 8 ),P( 5 ));
+ double L9 = getDistance(P( 1 ),P( 5 ));
+ double L10= getDistance(P( 2 ),P( 6 ));
+ double L11= getDistance(P( 3 ),P( 7 ));
+ double L12= getDistance(P( 4 ),P( 8 ));
- return aVal;
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
+ aVal = Min(aVal,Min(L11,L12));
+ }
+ break;
+ case SMDSEntity_Quad_Tetra:
+ if (len == 10){ // quadratic tetrahedron
+ double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
+ double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
+ double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
+ double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ }
+ break;
+ case SMDSEntity_Quad_Pyramid:
+ if (len == 13){ // quadratic pyramid
+ double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+ double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+ double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
+ double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
+ double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal,Min(L7,L8));
+ }
+ break;
+ case SMDSEntity_Quad_Penta:
+ case SMDSEntity_BiQuad_Penta:
+ if (len >= 15){ // quadratic pentahedron
+ double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
+ double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
+ double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
+ double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal,Min(Min(L7,L8),L9));
+ }
+ break;
+ case SMDSEntity_Quad_Hexa:
+ case SMDSEntity_TriQuad_Hexa:
+ if (len >= 20) { // quadratic hexahedron
+ double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
+ double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
+ double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
+ double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
+ double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
+ double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
+ double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
+ double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
+ aVal = Min(aVal,Min(L11,L12));
+ }
+ break;
+ case SMDSEntity_Polygon:
+ if ( len > 1 ) {
+ aVal = getDistance( P(1), P( P.size() ));
+ for ( size_t i = 1; i < P.size(); ++i )
+ aVal = Min( aVal, getDistance( P( i ), P( i+1 )));
+ }
+ break;
+ case SMDSEntity_Quad_Polygon:
+ if ( len > 2 ) {
+ aVal = getDistance( P(1), P( P.size() )) + getDistance( P(P.size()), P( P.size()-1 ));
+ for ( size_t i = 1; i < P.size()-1; i += 2 )
+ aVal = Min( aVal, getDistance( P( i ), P( i+1 )) + getDistance( P( i+1 ), P( i+2 )));
+ }
+ break;
+ case SMDSEntity_Hexagonal_Prism:
+ if (len == 12) { // hexagonal prism
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 1 ));
+
+ double L7 = getDistance(P( 7 ), P( 8 ));
+ double L8 = getDistance(P( 8 ), P( 9 ));
+ double L9 = getDistance(P( 9 ), P( 10 ));
+ double L10= getDistance(P( 10 ),P( 11 ));
+ double L11= getDistance(P( 11 ),P( 12 ));
+ double L12= getDistance(P( 12 ),P( 7 ));
+
+ double L13 = getDistance(P( 1 ),P( 7 ));
+ double L14 = getDistance(P( 2 ),P( 8 ));
+ double L15 = getDistance(P( 3 ),P( 9 ));
+ double L16 = getDistance(P( 4 ),P( 10 ));
+ double L17 = getDistance(P( 5 ),P( 11 ));
+ double L18 = getDistance(P( 6 ),P( 12 ));
+ aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
+ aVal = Min(aVal, Min(Min(Min(L7,L8),Min(L9,L10)),Min(L11,L12)));
+ aVal = Min(aVal, Min(Min(Min(L13,L14),Min(L15,L16)),Min(L17,L18)));
+ }
+ break;
+ case SMDSEntity_Polyhedra:
+ {
+ }
+ break;
+ default:
+ return 0;
+ }
+ if (aVal < 0 ) {
+ return 0.;
}
- return 0.;
+
+ if ( myPrecision >= 0 )
+ {
+ double prec = pow( 10., (double)( myPrecision ) );
+ aVal = floor( aVal * prec + 0.5 ) / prec;
+ }
+
+ return aVal;
}
double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
}
}
+//================================================================================
+/*
+ Class : Deflection2D
+ Description : Functor for calculating number of faces conneted to the edge
+*/
+//================================================================================
+
+double Deflection2D::GetValue( const TSequenceOfXYZ& P )
+{
+ if ( myMesh && P.getElement() )
+ {
+ // get underlying surface
+ if ( myShapeIndex != P.getElement()->getshapeId() )
+ {
+ mySurface.Nullify();
+ myShapeIndex = P.getElement()->getshapeId();
+ const TopoDS_Shape& S =
+ static_cast< const SMESHDS_Mesh* >( myMesh )->IndexToShape( myShapeIndex );
+ 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
+ if ( !mySurface.IsNull() )
+ {
+ gp_XYZ gc(0,0,0);
+ gp_XY uv(0,0);
+ int nbUV = 0;
+ for ( size_t i = 0; i < P.size(); ++i )
+ {
+ gc += P(i+1);
+
+ if ( const SMDS_FacePosition* fPos = dynamic_cast<const SMDS_FacePosition*>
+ ( P.getElement()->GetNode( i )->GetPosition() ))
+ {
+ uv.ChangeCoord(1) += fPos->GetUParameter();
+ uv.ChangeCoord(2) += fPos->GetVParameter();
+ ++nbUV;
+ }
+ }
+ gc /= P.size();
+ if ( nbUV ) uv /= nbUV;
+
+ double maxLen = MaxElementLength2D().GetValue( P );
+ double tol = 1e-3 * maxLen;
+ double dist;
+ if ( myPlane )
+ {
+ dist = myPlane->Distance( gc );
+ if ( dist < tol )
+ dist = 0;
+ }
+ else
+ {
+ 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;
+}
+
+void Deflection2D::SetMesh( const SMDS_Mesh* theMesh )
+{
+ NumericalFunctor::SetMesh( dynamic_cast<const SMESHDS_Mesh* >( theMesh ));
+ myShapeIndex = -100;
+ myPlane.reset();
+}
+
+SMDSAbs_ElementType Deflection2D::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+double Deflection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ // meaningless as it is not quality control functor
+ return Value;
+}
+
//================================================================================
/*
Class : MultiConnection
#include "SMESH_TypeDefs.hxx"
-#include <BRepClass3d_SolidClassifier.hxx>
#include <Bnd_B3d.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
class SMESHDS_SubMesh;
class SMESHDS_GroupBase;
+class BRepClass3d_SolidClassifier;
+class ShapeAnalysis_Surface;
+class gp_Pln;
class gp_Pnt;
namespace SMESH{
*/
class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
public:
- virtual double GetValue( long theElementId );
+ virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
};
typedef boost::shared_ptr<Length2D> Length2DPtr;
+ /*
+ Class : Deflection2D
+ Description : Functor for calculating distance between a face and geometry
+ */
+ class SMESHCONTROLS_EXPORT Deflection2D: public virtual NumericalFunctor{
+ public:
+ virtual void SetMesh( const SMDS_Mesh* theMesh );
+ virtual double GetValue( const TSequenceOfXYZ& thePoints );
+ virtual double GetBadRate( double Value, int nbNodes ) const;
+ virtual SMDSAbs_ElementType GetType() const;
+ private:
+ Handle(ShapeAnalysis_Surface) mySurface;
+ int myShapeIndex;
+ boost::shared_ptr<gp_Pln> myPlane;
+ };
+
/*
Class : MultiConnection
Description : Functor for calculating number of faces connected to the edge
typedef TIntVector TElemNum;
typedef SharedPtr<TElemNum> PElemNum;
- //! Define a parent class for all MED entities that describes mesh entites such as nodes and cells.
+ //! Define a parent class for all MED entities that describes mesh entities such as nodes and cells.
struct MEDWRAPPER_EXPORT TElemInfo: virtual TBase
{
PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
TInt myNbElem; //<! Number of corresponding mesh entities
TInt GetNbElem() const { return myNbElem;} //! Get number of mesh elements
- //! Defines sequence MED Family indexes for corresponding mesh entites
+ //! Defines sequence MED Family indexes for corresponding mesh entities
PElemNum myFamNum;
//! Get number of a MED FAMILY by order number of the mesh element
TInt GetFamNum(TInt theId) const;
//! Defines if the mesh elements are named
EBooleen myIsElemNames;
- //! Let know if the mesh elements havew names
+ //! Let know if the mesh elements have names
EBooleen IsElemNames() const { return myIsElemNames;}
//! Contains sequence of the names for the mesh elements
void SetGrilleStructure(TInt theAxis,TInt theNb);
/*!
- *Defines sequence MED Family indexes for corresponding mesh entites
+ *Defines sequence MED Family indexes for corresponding mesh entities
*/
TElemNum myFamNum;
//! Get number of a MED FAMILY by order number of the mesh element
void SetFamNum(TInt theId, TInt theVal);
/*!
- *Defines sequence MED Family indexes for sub entites
+ *Defines sequence MED Family indexes for sub entities
*/
TElemNum myFamSubNum;
//! Get number of a MED FAMILY by order number of sub element
//----------------------------------------------------------------------------
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+ //! Read the values for MEDWrapper MED TIMESTAMP from defined MED file
virtual
void
GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL) = 0;
- //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
+ //! Write the values for MEDWrapper MED TIMESTAMP to defined MED file
virtual
void
SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
TErr* theErr = NULL) = 0;
- //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+ //! Creates the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
EModeSwitch theMode = eFULL_INTERLACE) = 0;
- //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+ //! Creates the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
EModeSwitch theMode = eFULL_INTERLACE);
- //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
+ //! A copy-constructor for the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampValueBase& theInfo,
ETypeChamp theTypeChamp) = 0;
- //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
+ //! A copy-constructor for the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampValueBase& theInfo);
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+ //! Read the values for MEDWrapper MED TIMESTAMP from defined MED file
PTimeStampValueBase
GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const TMKey2Profile& theMKey2Profile,
//----------------------------------------------------------------------------
// Backward compatibility declarations
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+ //! Read the values for MEDWrapper MED TIMESTAMP from defined MED file
virtual
void
GetTimeStampVal(const PTimeStampVal& theVal,
const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL);
- //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
+ //! Write the values for MEDWrapper MED TIMESTAMP to defined MED file
virtual
void
SetTimeStamp(const PTimeStampVal& theVal,
TErr* theErr = NULL);
- //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+ //! Creates the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
EModeSwitch theMode = eFULL_INTERLACE);
- //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
+ //! A copy-constructor for the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampVal& theInfo);
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+ //! Read the values for MEDWrapper MED TIMESTAMP from defined MED file
PTimeStampVal
GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const TMKey2Profile& theMKey2Profile,
break;
}
case eLength2D:
- {
myFunctor.reset(new SMESH::Controls::Length2D());
myControlActor = my2DActor;
break;
- }
case eFreeBorders:
myFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor;
myControlActor = my3DActor;
break;
}
+ case eDeflection2D:
+ {
+ SMESH::Controls::Deflection2D* aControl = new SMESH::Controls::Deflection2D();
+ aControl->SetPrecision( myControlsPrecision );
+ myFunctor.reset( aControl );
+ myControlActor = my2DActor;
+ break;
+ }
case eBareBorderVolume:
{
myFunctor.reset(new SMESH::Controls::BareBorderVolume());
virtual void SetFacesOrientation3DVectors(bool theState) = 0;
virtual bool GetFacesOrientation3DVectors() = 0;
- enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
+ enum eControl{eNone, eLength, eLength2D, eDeflection2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D,
eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume,
int idnode4, int idnode5, int idnode6) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8) const;
- const SMDS_MeshElement *FindElement(int IDelem) const;
+ virtual const SMDS_MeshElement * FindElement(int IDelem) const;
static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
static const SMDS_BallElement* FindBall(const SMDS_MeshNode * n);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) it->second; }
};
+ template<typename VALUE,typename VALUE_SET_ITERATOR>
+ struct PointerAccessor {
+ static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) &(*it); }
+ };
+
///////////////////////////////////////////////////////////////////////////////
/// Filters of value pointed by iterator
///////////////////////////////////////////////////////////////////////////////
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;
save << clause << ".3) Faces in detail: " << endl;
map <int,int>::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;
save << clause << ".5) Volumes in detail: " << endl;
map <int,int>::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;
* \param theElems - The triangles to be fused.
* \param theCriterion - Is used to choose a neighbour to fuse with.
* \param theMaxAngle - Is a max angle between element normals at which fusion
- * is still performed; theMaxAngle is mesured in radians.
+ * is still performed; theMaxAngle is measured in radians.
* \return bool - Success or not.
*/
bool TriToQuad (TIDSortedElemSet & theElems,
const double theMaxAngle);
/*!
* \brief Split quadrangles into triangles.
- * \param theElems - The faces to be splitted.
+ * \param theElems - The faces to be split.
* \param theCriterion - Is used to choose a diagonal for splitting.
* \return bool - Success or not.
*/
SMESH::Controls::NumericalFunctorPtr theCriterion);
/*!
* \brief Split quadrangles into triangles.
- * \param theElems - The faces to be splitted.
+ * \param theElems - The faces to be split.
* \param the13Diag - Is used to choose a diagonal for splitting.
* \return bool - Success or not.
*/
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
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
typedef SMDS_Iterator<const TopoDS_Shape*> PShapeIterator;
typedef boost::shared_ptr< PShapeIterator > PShapeIteratorPtr;
-
+
typedef std::vector<const SMDS_MeshNode* > TNodeColumn;
typedef std::map< double, TNodeColumn > TParam2ColumnMap;
/*!
* \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
* \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
//================================================================================
/*!
- * \brief Destructor deletes proxy submeshes and tmp elemens
+ * \brief Destructor deletes proxy submeshes and tmp elements
*/
//================================================================================
"SMESH_TETRAHEDRA","SMESH_QUADRATIC_TETRAHEDRONS","SMESH_PYRAMIDS",
"SMESH_QUADRATIC_PYRAMIDS","SMESH_HEXAHEDRA","SMESH_QUADRATIC_HEXAHEDRONS",
"SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
- "SMESH_BIQUADRATIC_PENTAHEDRONS",
+ "SMESH_BIQUADRATIC_PENTAHEDRONS",
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
};
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
type = QObject::tr( "LENGTH_EDGES" );
else if ( dynamic_cast< SMESH::Controls::Length2D* >( f.get() ) )
type = QObject::tr( "LENGTH2D_EDGES" );
+ else if ( dynamic_cast< SMESH::Controls::Deflection2D* >( f.get() ) )
+ type = QObject::tr( "DEFLECTION2D_FACES" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection* >( f.get() ) )
type = QObject::tr( "MULTI_BORDERS" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection2D* >( f.get() ) )
ActionControl.Bind( SMESHOp::OpBareBorderFace, SMESH_Actor::eBareBorderFace );
ActionControl.Bind( SMESHOp::OpOverConstrainedFace, SMESH_Actor::eOverConstrainedFace );
ActionControl.Bind( SMESHOp::OpLength2D, SMESH_Actor::eLength2D );
+ ActionControl.Bind( SMESHOp::OpDeflection2D, SMESH_Actor::eDeflection2D );
ActionControl.Bind( SMESHOp::OpConnection2D, SMESH_Actor::eMultiConnection2D );
ActionControl.Bind( SMESHOp::OpArea, SMESH_Actor::eArea );
ActionControl.Bind( SMESHOp::OpTaper, SMESH_Actor::eTaper );
case SMESHOp::OpBareBorderFace:
case SMESHOp::OpOverConstrainedFace:
case SMESHOp::OpLength2D:
+ case SMESHOp::OpDeflection2D:
case SMESHOp::OpConnection2D:
case SMESHOp::OpArea:
case SMESHOp::OpTaper:
createSMESHAction( SMESHOp::OpBareBorderFace, "BARE_BORDER_FACE", "ICON_BARE_BORDER_FACE", 0, true );
createSMESHAction( SMESHOp::OpOverConstrainedFace, "OVER_CONSTRAINED_FACE", "ICON_OVER_CONSTRAINED_FACE", 0, true );
createSMESHAction( SMESHOp::OpLength2D, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
+ createSMESHAction( SMESHOp::OpDeflection2D, "DEFLECTION_2D", "ICON_DEFLECTION_2D", 0, true );
createSMESHAction( SMESHOp::OpConnection2D, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
createSMESHAction( SMESHOp::OpArea, "AREA", "ICON_AREA", 0, true );
createSMESHAction( SMESHOp::OpTaper, "TAPER", "ICON_TAPER", 0, true );
<< SMESHOp::OpNodeConnectivityNb // node controls
<< SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder
<< SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls
+ << SMESHOp::OpDeflection2D
<< SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D
<< SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio
<< SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew
createMenu( SMESHOp::OpSkew, faceId, -1 );
createMenu( SMESHOp::OpMaxElementLength2D, faceId, -1 );
createMenu( SMESHOp::OpEqualFace, faceId, -1 );
+ createMenu( SMESHOp::OpDeflection2D, faceId, -1 );
createMenu( SMESHOp::OpAspectRatio3D, volumeId, -1 );
createMenu( SMESHOp::OpVolume, volumeId, -1 );
createMenu( SMESHOp::OpMaxElementLength3D, volumeId, -1 );
createTool( SMESHOp::OpSkew, ctrl2dTb );
createTool( SMESHOp::OpMaxElementLength2D, ctrl2dTb );
createTool( SMESHOp::OpEqualFace, ctrl2dTb );
+ createTool( SMESHOp::OpDeflection2D, ctrl2dTb );
createTool( SMESHOp::OpAspectRatio3D, ctrl3dTb );
createTool( SMESHOp::OpVolume, ctrl3dTb );
popupMgr()->insert ( action( SMESHOp::OpOverConstrainedFace ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), "controlMode = 'eOverConstrainedFace'", QtxPopupMgr::ToggleRule );
+
popupMgr()->insert ( action( SMESHOp::OpEqualFace ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpEqualFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpEqualFace ), "controlMode = 'eCoincidentElems2D'", QtxPopupMgr::ToggleRule );
+ popupMgr()->insert ( action( SMESHOp::OpDeflection2D ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDeflection2D ), aMeshInVtkHasFaces + " && hasGeomReference", QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpDeflection2D ), "controlMode = 'eDeflection2D'", QtxPopupMgr::ToggleRule );
+
aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS
popupMgr()->insert ( action( SMESHOp::OpAspectRatio3D ), aSubId, -1 );
//================================================================================
/*!
- * \brief Desctructor
+ * \brief Destructor
*/
//================================================================================
//================================================================================
/*!
- * \brief Desctructor
+ * \brief Destructor
*/
//================================================================================
//=======================================================================
// name : SMESHGUI_FilterTable::Table::isEditable
-// Purpose : Verify wheter cell is editable
+// Purpose : Verify whether cell is editable
//=======================================================================
bool SMESHGUI_FilterTable::Table::isEditable (int row, int col) const
{
aCriterion == SMESH::FT_MaxElementLength3D ||
aCriterion == SMESH::FT_Length ||
aCriterion == SMESH::FT_Length2D ||
+ aCriterion == SMESH::FT_Deflection2D ||
aCriterion == SMESH::FT_BallDiameter );
bool toEnable = (( isDbl && ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo) ||
retval = "len_tol_precision"; break;
case SMESH::FT_Length:
case SMESH::FT_Length2D:
+ case SMESH::FT_Deflection2D:
case SMESH::FT_MaxElementLength2D:
case SMESH::FT_MaxElementLength3D:
case SMESH::FT_BallDiameter:
}
// find out a type of item required by a new criterion and other table features
- int aCriterionType = GetCriterionType(row);
+ int aCriterionType = GetCriterionType(row);
bool anIsDoubleCriterion = false;
bool anIsIntCriterion = false;
bool anIsComboCriterion = false;
// other features:
QList<int> comboIDs; // values to show in a combo item
- int nbCompareSigns = 0; // possible values are 0,1,3
+ int nbCompareSigns = 0; // possible values are 0,1,3
bool isThresholdEditable = false; // actual for "simple" item types
switch ( aCriterionType )
{
case SMESH::FT_Area:
case SMESH::FT_Volume3D:
case SMESH::FT_MaxElementLength2D:
- case SMESH::FT_MaxElementLength3D:
- anIsDoubleCriterion = true; break;
+ case SMESH::FT_MaxElementLength3D: anIsDoubleCriterion = true; break;
case SMESH::FT_FreeBorders:
case SMESH::FT_FreeEdges:
case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; nbCompareSigns = 3; break;
case SMESH::FT_Length:
- case SMESH::FT_Length2D: anIsDoubleCriterion = true; break;
+ case SMESH::FT_Length2D:
+ case SMESH::FT_Deflection2D: anIsDoubleCriterion = true; break;
case SMESH::FT_BelongToMeshGroup: break;
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D");
+ aCriteria[ SMESH::FT_Deflection2D ] = tr("DEFLECTION2D");
aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS");
aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES");
aCriteria[ SMESH::FT_BareBorderFace ] = tr("BARE_BORDER_FACE");
QLabel* a2DTriQuad = createField();
a2DTriQuad->setObjectName("nbQuadraticTriangle");
QLabel* a2DTriBiQuad = createField();
- a2DTriBiQuad->setObjectName("nbBiQuadraticTriangle");
+ a2DTriBiQuad->setObjectName("nbBiQuadraticTriangle");
QLabel* a2DQuaLab = new QLabel( tr( "QUADRANGLES_LAB" ), this );
QLabel* a2DQuaTotal = createField();
a2DQuaTotal->setObjectName("nbQuadrangle");
\param parent parent widget
*/
SMESHGUI_ElemInfo::SMESHGUI_ElemInfo( QWidget* parent )
-: QWidget( parent ), myActor( 0 ), myIsElement( -1 )
+ : QWidget( parent ), myActor( 0 ), myIsElement( -1 )
{
myFrame = new QWidget( this );
myExtra = new ExtraWidget( this );
\brief Set mesh data source (actor)
\param actor mesh object actor
*/
-void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor )
+void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor, SMESH::SMESH_IDSource_var obj )
{
if ( myActor != actor ) {
myActor = actor;
myIsElement = -1;
+ SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
+ myMeshHasShape = ( !mesh->_is_nil() && mesh->HasShapeToMesh() );
clear();
}
}
\param parent parent widget
*/
SMESHGUI_SimpleElemInfo::SMESHGUI_SimpleElemInfo( QWidget* parent )
-: SMESHGUI_ElemInfo( parent )
+ : SMESHGUI_ElemInfo( parent )
{
myInfo = new QTextBrowser( frame() );
QVBoxLayout* l = new QVBoxLayout( frame() );
void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
{
clearInternal();
-
+
if ( actor() ) {
int grp_details = SMESHGUI::resourceMgr()->booleanValue( "SMESH", "elem_info_grp_details", false );
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
int cprecision = -1;
- if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ))
+ if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ))
cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
foreach ( long id, ids ) {
if ( !isElements() ) {
myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" )).arg( id ));
}
// node position
- SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();
+ SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();
if ( !CORBA::is_nil( aMeshPtr )) {
SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id );
int shapeID = pos->shapeID;
case GEOM::FACE:
shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
if ( pos->params.length() == 2 ) {
- u = pos->params[0];
- v = pos->params[1];
+ u = pos->params[0];
+ v = pos->params[1];
}
break;
case GEOM::VERTEX:
SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
-
+
// type : group on geometry, standalone group, group on filter
if ( !CORBA::is_nil( aStdGroup )) {
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" )) );
}
-
+
// size
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" )).
arg( QString::number( aGrp->Size() )) );
-
+
// color
SALOMEDS::Color color = aGrp->GetColor();
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" )).
else {
//
// show element info
- //
+ //
const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
SMESH::Controls::NumericalFunctorPtr afunctor;
if ( !e ) return;
-
+
// Element ID && Type
QString stype;
switch( e->GetType() ) {
stype = SMESHGUI_ElemInfo::tr( "FACE" ); break;
case SMDSAbs_Volume:
stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break;
- default:
+ default:
break;
}
if ( stype.isEmpty() ) return;
case SMDSEntity_Polyhedra:
case SMDSEntity_Quad_Polyhedra:
gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
- default:
+ default:
break;
}
if ( !gtype.isEmpty() )
afunctor.reset( new SMESH::Controls::Length() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
- myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "LENGTH_EDGES" )).arg( afunctor->GetValue( id )) );
+ myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "LENGTH_EDGES" )).arg( afunctor->GetValue( id )) );
}
if( e->GetType() == SMDSAbs_Face ) {
//Area
afunctor.reset( new SMESH::Controls::Area() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
+ afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "AREA_ELEMENTS" )).arg( afunctor->GetValue( id )) );
//Taper
afunctor.reset( new SMESH::Controls::Taper() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
+ afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "TAPER_ELEMENTS" )).arg( afunctor->GetValue( id )) );
//AspectRatio2D
afunctor.reset( new SMESH::Controls::AspectRatio() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "ASPECTRATIO_ELEMENTS" )).arg( afunctor->GetValue( id )) );
- //Minimum angle
+ //Minimum angle
afunctor.reset( new SMESH::Controls::MinimumAngle() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MINIMUMANGLE_ELEMENTS" )).arg( afunctor->GetValue( id )) );
- //Wraping angle
+ //Warping angle
afunctor.reset( new SMESH::Controls::Warping() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "WARP_ELEMENTS" )).arg( afunctor->GetValue( id )) );
- //Skew
+ //Skew
afunctor.reset( new SMESH::Controls::Skew() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "SKEW_ELEMENTS" )).arg( afunctor->GetValue( id )) );
- //ElemDiam2D
+ //ElemDiam2D
afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
+ afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_2D" )).arg( afunctor->GetValue( id )) );
+ //min edge length
+ afunctor.reset( new SMESH::Controls::Length2D() );
+ afunctor->SetMesh( actor()->GetObject()->GetMesh() );
+ myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MIN_ELEM_EDGE" )).arg( afunctor->GetValue( id )) );
}
if( e->GetType() == SMDSAbs_Volume ) {
//AspectRatio3D
afunctor.reset( new SMESH::Controls::AspectRatio3D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "ASPECTRATIO_3D_ELEMENTS" )).arg( afunctor->GetValue( id )) );
- //Volume
+ //Volume
afunctor.reset( new SMESH::Controls::Volume() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUME_3D_ELEMENTS" )).arg( afunctor->GetValue( id )) );
- //ElementDiameter3D
+ //ElementDiameter3D
afunctor.reset( new SMESH::Controls::Volume() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" )).arg( afunctor->GetValue( id )) );
// Gravity center
XYZ gc = gravityCenter( e );
myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" )).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ));
-
+
// Normal vector
if( e->GetType() == SMDSAbs_Face ) {
XYZ gc = normal( e );
// Element position
if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
- SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
+ SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
if ( !CORBA::is_nil( aMesh )) {
SMESH::ElementPosition pos = aMesh->GetElementPosition( id );
int shapeID = pos.shapeID;
SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
-
+
// type : group on geometry, standalone group, group on filter
if ( !CORBA::is_nil( aStdGroup )) {
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" )).
arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" )) );
}
-
+
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" )).
arg( QString::number( aGrp->Size() )) );
-
+
// color
SALOMEDS::Color color = aGrp->GetColor();
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" )).
\param parent parent widget
*/
SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
-: SMESHGUI_ElemInfo( parent )
+ : SMESHGUI_ElemInfo( parent )
{
myInfo = new QTreeWidget( frame() );
myInfo->setColumnCount( 2 );
QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold );
taperlItem->setText( 0, tr( "TAPER_ELEMENTS" ));
taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
- //Wraping angle
+ //Warping angle
afunctor.reset( new SMESH::Controls::Warping() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
skewItem->setText( 0, tr( "SKEW_ELEMENTS" ));
skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
}
+ //Deflection
+ if ( hasShapeToMesh() )
+ {
+ afunctor.reset( new SMESH::Controls::Deflection2D() );
+ afunctor->SetMesh( actor()->GetObject()->GetMesh() );
+ QTreeWidgetItem* deflItem = createItem( cntrItem, Bold );
+ deflItem->setText( 0, tr( "DEFLECTION_2D" ));
+ deflItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
+ }
//ElemDiam2D
if ( !e->IsPoly() )
{
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
}
+ //min edge length
+ afunctor.reset( new SMESH::Controls::Length2D() );
+ afunctor->SetMesh( actor()->GetObject()->GetMesh() );
+ QTreeWidgetItem* minEdgeItem = createItem( cntrItem, Bold );
+ minEdgeItem->setText( 0, tr( "MIN_ELEM_EDGE" ));
+ minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
+
// gravity center
XYZ gc = gravityCenter( e );
QTreeWidgetItem* gcItem = createItem( elemItem, Bold );
\param parent parent widget
*/
SMESHGUI_AddInfo::SMESHGUI_AddInfo( QWidget* parent )
-: QTreeWidget( parent )
+ : QTreeWidget( parent )
{
setColumnCount( 2 );
header()->setStretchLastSection( true );
SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
SMESH::GetNameOfSelectedNodes( selector, IO, ID );
}
- myElemInfo->setSource( myActor ) ;
+ myElemInfo->setSource( myActor, obj ) ;
if ( nb > 0 ) {
myID->setText( ID.trimmed() );
QSet<long> ids;
computeOverConstrainedVolumesInfo();
// aspect Ratio 3D histogram
computeAspectRatio3D();
- }
- else {
- myButtons[7]->setEnabled( true );
- myButtons[8]->setEnabled( true );
- myButtons[9]->setEnabled( true );
- }
+ }
+ else {
+ myButtons[7]->setEnabled( true );
+ myButtons[8]->setEnabled( true );
+ myButtons[9]->setEnabled( true );
+ }
#ifdef DISABLE_PLOT2DVIEWER
myMainLayout->setRowStretch(17,0);
for( int i=35; i<=37; i++)
\param parent parent widget
*/
SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent )
-: QDialog( parent )
+ : QDialog( parent )
{
setAttribute( Qt::WA_DeleteOnClose, true );
setWindowTitle( tr( "CTRL_INFO" ));
SMESHGUI_ElemInfo( QWidget* = 0 );
~SMESHGUI_ElemInfo();
- void setSource( SMESH_Actor* );
+ void setSource( SMESH_Actor*, SMESH::SMESH_IDSource_var );
void showInfo( long, bool );
void showInfo( QSet<long>, bool );
void clear();
QWidget* frame() const;
SMESH_Actor* actor() const;
bool isElements() const;
+ bool hasShapeToMesh() const { return myMeshHasShape; }
virtual void information( const QList<long>& ) = 0;
virtual void clearInternal();
QWidget* myFrame;
ExtraWidget* myExtra;
int myIndex;
+ bool myMeshHasShape;
};
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
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 -----------------------//--------------------------------
OpSkew = 3210, // MENU CONTROLS - SKEW
OpMaxElementLength2D = 3211, // MENU CONTROLS - ELEMENT DIAMETER 2D
OpEqualFace = 3212, // MENU CONTROLS - DOUBLE FACES
+ OpDeflection2D = 3213, // MENU CONTROLS - DEFLECTION 2D
OpAspectRatio3D = 3300, // MENU CONTROLS - ASPECT RATIO 3D
OpVolume = 3301, // MENU CONTROLS - VOLUME
OpMaxElementLength3D = 3302, // MENU CONTROLS - ELEMENT DIAMETER 3D
switch( actor->GetControlMode() ) {
case SMESH_Actor::eLength: mode = "eLength"; break;
case SMESH_Actor::eLength2D: mode = "eLength2D"; break;
+ case SMESH_Actor::eDeflection2D: mode = "eDeflection2D"; break;
case SMESH_Actor::eFreeEdges: mode = "eFreeEdges"; break;
case SMESH_Actor::eFreeNodes: mode = "eFreeNodes"; break;
case SMESH_Actor::eFreeBorders: mode = "eFreeBorders"; break;
return "eNone";
}
+//=======================================================================
+//function : isNumFunctor
+//purpose : return true if a given actor is shown using a numeric functor
+//=======================================================================
+
bool SMESHGUI_Selection::isNumFunctor( int ind ) const
{
bool result = false;
switch( actor->GetControlMode() ) {
case SMESH_Actor::eLength:
case SMESH_Actor::eLength2D:
+ case SMESH_Actor::eDeflection2D:
case SMESH_Actor::eMultiConnection:
case SMESH_Actor::eMultiConnection2D:
case SMESH_Actor::eArea:
//=======================================================================
//function : facesOrientationMode
-//purpose :
+//purpose :
//=======================================================================
QString SMESHGUI_Selection::facesOrientationMode( int ind ) const
}
if ( objModified ) {
- // PAL16631. Mesurements showed that to show aVisualObj in SHADING(default) mode,
+ // PAL16631. Measurements showed that to show aVisualObj in SHADING(default) mode,
// ~5 times more memory is used than it occupies.
// Warn the user if there is less free memory than 30 sizes of a grid
// TODO: estimate memory usage in other modes and take current mode into account
/*! Return active view window, if it instantiates SVTK_ViewWindow class,
- * overwise find or create corresponding view window, make it active and return it.
+ * otherwise find or create corresponding view window, make it active and return it.
* \note Active VVTK_ViewWindow can be returned, because it inherits SVTK_ViewWindow.
*/
SVTK_ViewWindow* GetViewWindow (const SalomeApp_Module* theModule,
<source>ICON_LENGTH_2D</source>
<translation>mesh_length_2d.png</translation>
</message>
+ <message>
+ <source>ICON_DEFLECTION_2D</source>
+ <translation>mesh_deflection.png</translation>
+ </message>
<message>
<source>ICON_MAP</source>
<translation>mesh_pattern.png</translation>
<source>MIN_DIAG_ELEMENTS</source>
<translation>Minimum diagonal</translation>
</message>
+ <message>
+ <source>MIN_ELEM_EDGE</source>
+ <translation>Minimum Edge Length</translation>
+ </message>
<message>
<source>ASPECTRATIO_3D_ELEMENTS</source>
<translation>Aspect Ratio 3D</translation>
<source>LENGTH2D_EDGES</source>
<translation>Length 2D</translation>
</message>
+ <message>
+ <source>DEFLECTION2D_FACES</source>
+ <translation>Deflection 2D</translation>
+ </message>
<message>
<source>LENGTH_EDGES</source>
<translation>Length</translation>
<source>MAX_ELEMENT_LENGTH_3D</source>
<translation>Element Diameter 3D</translation>
</message>
+ <message>
+ <source>DEFLECTION_2D</source>
+ <translation>Deflection 2D</translation>
+ </message>
<message>
<source>MEN_ADD</source>
<translation>Add</translation>
<source>MEN_LENGTH_2D</source>
<translation>Length 2D</translation>
</message>
+ <message>
+ <source>MEN_DEFLECTION_2D</source>
+ <translation>Deflection 2D</translation>
+ </message>
<message>
<source>MEN_MAP</source>
<translation>Pattern Mapping</translation>
</message>
<message>
<source>SMESH_MESHINFO_ALL_TYPES</source>
- <translation>Heterogenous</translation>
+ <translation>Heterogeneous</translation>
</message>
<message>
<source>SMESH_MESHINFO_EDGES</source>
<source>STB_LENGTH_2D</source>
<translation>Length 2D</translation>
</message>
+ <message>
+ <source>STB_DEFLECTION_2D</source>
+ <translation>Deflection 2D</translation>
+ </message>
<message>
<source>STB_MAP</source>
<translation>Pattern mapping</translation>
<source>TOP_LENGTH_2D</source>
<translation>Length 2D</translation>
</message>
+ <message>
+ <source>TOP_DEFLECTION_2D</source>
+ <translation>Deflection 2D</translation>
+ </message>
<message>
<source>TOP_MAP</source>
<translation>Pattern mapping</translation>
<source>LENGTH2D</source>
<translation>Length 2D</translation>
</message>
+ <message>
+ <source>DEFLECTION2D</source>
+ <translation>Deflection 2D</translation>
+ </message>
<message>
<source>LESS_THAN</source>
<translation>Less than</translation>
${CAS_TKMesh}
${Boost_LIBRARIES}
SMDS
-)
+ )
# --- headers ---
SMESH_MAT2d.hxx
SMESH_ControlPnt.hxx
SMESH_Delaunay.hxx
-)
+ )
# --- sources ---
SMESH_ControlPnt.cxx
SMESH_DeMerge.cxx
SMESH_Delaunay.cxx
+ SMESH_FillHole.cxx
)
# --- rules ---
--- /dev/null
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SMESH_FillHole.cxx
+// Created : Tue Sep 26 15:11:17 2017
+// Author : Edward AGAPOV (eap)
+//
+
+#include "SMESH_MeshAlgos.hxx"
+
+#include "SMESH_Comment.hxx"
+
+#include "SMESH_TypeDefs.hxx"
+#include "SMDS_Mesh.hxx"
+
+#include <Utils_SALOME_Exception.hxx>
+
+#include <boost/intrusive/circular_list_algorithms.hpp>
+#include <boost/container/flat_map.hpp>
+
+#include <Bnd_B3d.hxx>
+
+namespace
+{
+ bool isSmallAngle( double cos2 )
+ {
+ // cosine of min angle at which adjacent faces are considered overlapping
+ const double theMinCos2 = 0.996 * 0.996; // ~5 degrees
+ return ( cos2 > theMinCos2 );
+ }
+
+ struct BEdge;
+ typedef std::multimap< double, BEdge* > TAngleMap;
+ typedef std::map< const SMDS_MeshElement*, int > TFaceIndMap;
+
+ //--------------------------------------------------------------------------------
+ /*!
+ * \brief Edge of a free border
+ */
+ struct BEdge
+ {
+ const SMDS_MeshNode* myNode1;
+ const SMDS_MeshNode* myNode2;
+ const SMDS_MeshElement* myFace; // face adjacent to the border
+
+ gp_XYZ myFaceNorm;
+ gp_XYZ myDir; // myNode1 -> myNode2
+ 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
+ const SMDS_MeshNode* myNode2Shift;
+
+ BEdge* myPrev; // neighbors in the border
+ BEdge* myNext;
+
+ BEdge(): myNode1Shift(0), myNode2Shift(0) {}
+ void Init( const SMDS_MeshNode* n1, const SMDS_MeshNode* n2,
+ const SMDS_MeshElement* f=0,
+ const SMDS_MeshNode* nf1=0, const SMDS_MeshNode* nf2=0 );
+ void ComputeAngle( bool reverseAngle = false );
+ void ShiftOverlapped( const SMDS_MeshNode* oppNode,
+ const TFaceIndMap& capFaceWithBordInd,
+ SMDS_Mesh& mesh,
+ std::vector<const SMDS_MeshElement*>& newFaces);
+ void MakeShiftfFaces( SMDS_Mesh& mesh,
+ std::vector<const SMDS_MeshElement*>& 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
+ + ShapeFactor() );
+ myAngleMapPos = edgesByAngle.insert( std::make_pair( key, this ));
+ }
+
+ // traits used by boost::intrusive::circular_list_algorithms
+ typedef BEdge node;
+ typedef BEdge * node_ptr;
+ typedef const BEdge * const_node_ptr;
+ static node_ptr get_next(const_node_ptr n) { return n->myNext; }
+ static void set_next(node_ptr n, node_ptr next) { n->myNext = next; }
+ static node_ptr get_previous(const_node_ptr n) { return n->myPrev; }
+ static void set_previous(node_ptr n, node_ptr prev){ n->myPrev = prev; }
+ };
+
+ //================================================================================
+ /*!
+ * \brief Initialize a border edge data
+ */
+ //================================================================================
+
+ void BEdge::Init( const SMDS_MeshNode* n1,
+ const SMDS_MeshNode* n2,
+ const SMDS_MeshElement* newFace, // new cap face
+ const SMDS_MeshNode* nf1,
+ const SMDS_MeshNode* nf2 )
+ {
+ myNode1 = n1;
+ myNode2 = n2;
+ myDir = SMESH_NodeXYZ( n2 ) - SMESH_NodeXYZ( n1 );
+ myLength = myDir.Modulus();
+ if ( myLength > std::numeric_limits<double>::min() )
+ myDir /= myLength;
+
+ myFace = newFace;
+ if ( !myFace )
+ {
+ TIDSortedElemSet elemSet, avoidSet;
+ int ind1, ind2;
+ myFace = SMESH_MeshAlgos::FindFaceInSet( n1, n2, elemSet, avoidSet, &ind1, &ind2 );
+ if ( !myFace )
+ throw SALOME_Exception( SMESH_Comment("No face sharing nodes #")
+ << myNode1->GetID() << " and #" << myNode2->GetID());
+ avoidSet.insert( myFace );
+ if ( SMESH_MeshAlgos::FindFaceInSet( n1, n2, elemSet, avoidSet ))
+ throw SALOME_Exception( SMESH_Comment("No free border between nodes #")
+ << myNode1->GetID() << " and #" << myNode2->GetID());
+
+ myDirCoef = SMESH_MeshAlgos::IsRightOrder( myFace, myNode1, myNode2 ) ? 1. : -1.;
+ }
+
+ if (! SMESH_MeshAlgos::FaceNormal( myFace, myFaceNorm, /*normalized=*/false ))
+ {
+ SMDS_ElemIteratorPtr fIt = myNode1->GetInverseElementIterator( SMDSAbs_Face );
+ while ( fIt->more() )
+ if ( SMESH_MeshAlgos::FaceNormal( fIt->next(), myFaceNorm, /*normalized=*/false ))
+ break;
+ }
+
+ if ( newFace )
+ {
+ myFace = 0;
+ myDirCoef = SMESH_MeshAlgos::IsRightOrder( newFace, nf1, nf2 ) ? 1. : -1.;
+ if ( myPrev->myNode2 == n1 )
+ myNode1Shift = myPrev->myNode2Shift;
+ if ( myNext->myNode1 == n2 )
+ myNode2Shift = myNext->myNode1Shift;
+ }
+ else if ( myDirCoef * myPrev->myDirCoef < 0 ) // different orientation of faces
+ {
+ myFaceNorm *= -1;
+ myDirCoef *= -1;
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief Compute myAngleWithPrev
+ */
+ //================================================================================
+
+ void BEdge::ComputeAngle( bool theReverseAngle )
+ {
+ 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 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
+ {
+ 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;
+ }
+ if ( isObtuse )
+ {
+ myAngleWithPrev = 2 * M_PI - myAngleWithPrev;
+ }
+
+ // if ( ! isObtuse )
+ // isObtuse =
+ // isSmallAngle( 1 - myDir.CrossSquareMagnitude( myPrev->myDir )); // edges co-directed
+
+ myOverlapAngle = 0;
+ //if ( !isObtuse )
+ {
+ // check if myFace and a triangle built on this and prev edges overlap
+ if ( isOverlap1 )
+ {
+ double cos2 = dot1 * dot1 / inFaceDirNew.SquareModulus() / inFaceDir1.SquareModulus();
+ myOverlapAngle += 1. * M_PI * cos2;
+ }
+ if ( isOverlap2 )
+ {
+ 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;
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief Check if myFace is overlapped by a triangle formed by myNode's and a
+ * given node. If so, create shifted nodes to avoid overlapping
+ */
+ //================================================================================
+
+ void BEdge::ShiftOverlapped( const SMDS_MeshNode* theOppNode,
+ const TFaceIndMap& theCapFaceWithBordInd,
+ SMDS_Mesh& theMesh,
+ std::vector<const SMDS_MeshElement*>& theNewFaces )
+ {
+ if ( myNode1Shift && myNode2Shift )
+ return;
+
+ gp_XYZ inNewFaceDir = SMESH_NodeXYZ( theOppNode ) - SMESH_NodeXYZ( myNode1 );
+ double dot = inNewFaceDir.Dot( myFaceNorm );
+ double cos2 = dot * dot / myFaceNorm.SquareModulus() / inNewFaceDir.SquareModulus();
+ bool isOverlap = ( isSmallAngle( 1 - cos2 ) && GetInFaceDir() * inNewFaceDir > 0 );
+
+ if ( isOverlap )
+ {
+ gp_XYZ shift = myFaceNorm / myLength / 4;
+ if ( myFace )
+ shift.Reverse();
+ if ( !myNode1Shift )
+ {
+ gp_XYZ p = SMESH_NodeXYZ( myNode1 ) + shift;
+ myNode1Shift = theMesh.AddNode( p.X(), p.Y(), p.Z() );
+ myPrev->myNode2Shift = myNode1Shift;
+ }
+ if ( !myNode2Shift )
+ {
+ gp_XYZ p = SMESH_NodeXYZ( myNode2 ) + shift;
+ myNode2Shift = theMesh.AddNode( p.X(), p.Y(), p.Z() );
+ myNext->myNode1Shift = myNode2Shift;
+ }
+
+ // MakeShiftfFaces() for already created cap faces
+ for ( int is2nd = 0; is2nd < 2; ++is2nd )
+ {
+ const SMDS_MeshNode* ns = is2nd ? myNode2Shift : myNode1Shift;
+ const SMDS_MeshNode* n = is2nd ? myNode2 : myNode1;
+ if ( !ns ) continue;
+
+ SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator( SMDSAbs_Face );
+ while ( fIt->more() )
+ {
+ const SMDS_MeshElement* f = fIt->next();
+ if ( !f->isMarked() ) continue;
+
+ TFaceIndMap::const_iterator f2i = theCapFaceWithBordInd.find( f );
+ if ( f2i == theCapFaceWithBordInd.end() )
+ continue;
+ const SMDS_MeshNode* nf1 = f->GetNode( f2i->second );
+ const SMDS_MeshNode* nf2 = f->GetNode(( f2i->second+1 ) % f->NbNodes() );
+ if ( nf1 == n || nf2 == n )
+ {
+ BEdge tmpE;
+ tmpE.myPrev = tmpE.myNext = this;
+ tmpE.Init( nf1, nf2, f, nf1, nf2 );
+ if ( !tmpE.myNode1Shift && !tmpE.myNode2Shift )
+ tmpE.Init( nf2, nf1, f, nf2, nf1 );
+ tmpE.myFace = f;
+ tmpE.MakeShiftfFaces( theMesh, theNewFaces, tmpE.myDirCoef < 0 );
+ }
+ std::vector< const SMDS_MeshNode* > nodes( f->begin_nodes(), f->end_nodes() );
+ nodes[ f->GetNodeIndex( n ) ] = ns;
+ theMesh.ChangeElementNodes( f, &nodes[0], nodes.size() );
+ }
+ }
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief Create a triangle
+ */
+ //================================================================================
+
+ const SMDS_MeshElement* MakeTria( SMDS_Mesh& mesh,
+ const SMDS_MeshNode* n1,
+ const SMDS_MeshNode* n2,
+ const SMDS_MeshNode* n3,
+ const bool isReverse )
+ {
+ if ( isReverse )
+ return mesh.AddFace( n1, n3, n2 );
+ return mesh.AddFace( n1, n2, n3 );
+ }
+
+ //================================================================================
+ /*!
+ * \brief Create a quadrangle
+ */
+ //================================================================================
+
+ // const SMDS_MeshElement* MakeQuad( SMDS_Mesh& mesh,
+ // const SMDS_MeshNode* n1,
+ // const SMDS_MeshNode* n2,
+ // const SMDS_MeshNode* n3,
+ // const SMDS_MeshNode* n4,
+ // const bool isReverse )
+ // {
+ // if ( isReverse )
+ // return mesh.AddFace( n4, n3, n2, n1 );
+ // return mesh.AddFace( n1, n2, n3, n4 );
+ // }
+
+ //================================================================================
+ /*!
+ * \brief Create faces on myNode* and myNode*Shift
+ */
+ //================================================================================
+
+ void BEdge::MakeShiftfFaces(SMDS_Mesh& mesh,
+ std::vector<const SMDS_MeshElement*>& newFaces,
+ const bool isReverse )
+ {
+ if ( !myFace )
+ return;
+ if ( myNode1Shift && myNode2Shift )
+ {
+ newFaces.push_back( MakeTria( mesh, myNode1, myNode2, myNode2Shift, isReverse ));
+ newFaces.push_back( MakeTria( mesh, myNode1, myNode2Shift, myNode1Shift, isReverse ));
+ }
+ else if ( myNode1Shift )
+ {
+ newFaces.push_back( MakeTria( mesh, myNode1, myNode2, myNode1Shift, isReverse ));
+ }
+ else if ( myNode2Shift )
+ {
+ newFaces.push_back( MakeTria( mesh, myNode1, myNode2, myNode2Shift, isReverse ));
+ }
+ }
+
+} // namespace
+
+//================================================================================
+/*!
+ * \brief Fill with 2D elements a hole defined by a TFreeBorder
+ */
+//================================================================================
+
+void SMESH_MeshAlgos::FillHole(const SMESH_MeshAlgos::TFreeBorder & theFreeBorder,
+ SMDS_Mesh& theMesh,
+ std::vector<const SMDS_MeshElement*>& theNewFaces)
+{
+ if ( theFreeBorder.size() < 4 || // at least 3 nodes
+ theFreeBorder[0] != theFreeBorder.back() ) // the hole must be closed
+ return;
+
+ // prepare data of the border
+
+ ObjectPool< BEdge > edgeAllocator;
+ boost::intrusive::circular_list_algorithms< BEdge > circularList;
+ BEdge* edge;
+ BEdge* edge0 = edgeAllocator.getNew();
+ BEdge* edgePrev = edge0;
+ circularList.init_header( edge0 );
+ edge0->Init( theFreeBorder[0], theFreeBorder[1], 0 );
+ Bnd_B3d box;
+ box.Add( SMESH_NodeXYZ( edge0->myNode1 ));
+ for ( size_t i = 2; i < theFreeBorder.size(); ++i )
+ {
+ edge = edgeAllocator.getNew();
+ circularList.link_after( edgePrev, edge );
+ edge->Init( theFreeBorder[i-1], theFreeBorder[i] );
+ edge->ComputeAngle();
+ edgePrev = edge;
+ box.Add( SMESH_NodeXYZ( edge->myNode1 ));
+ }
+ edge0->ComputeAngle();
+
+ // check if face normals point outside the border
+
+ gp_XYZ hSize = 0.5 * ( box.CornerMax() - box.CornerMin() );
+ const double hDelta = 1e-6 * hSize.Modulus();
+ hSize -= gp_XYZ( hDelta, hDelta, hDelta );
+ if ( hSize.X() < 0 ) hSize.SetX(hDelta);
+ if ( hSize.Y() < 0 ) hSize.SetY(hDelta);
+ if ( hSize.Z() < 0 ) hSize.SetZ(hDelta);
+ box.SetHSize( hSize ); // decrease the box by hDelta
+
+ size_t nbEdges = theFreeBorder.size() - 1;
+ edge = edge0;
+ int nbRev = 0, nbFrw = 0;
+ double angTol = M_PI - ( nbEdges - 2 ) * M_PI / nbEdges, sumDirCoeff = 0;
+ for ( size_t i = 0; i < nbEdges; ++i, edge = edge->myNext )
+ {
+ if ( box.IsOut( SMESH_NodeXYZ( edge->myNode1 )) &&
+ edge->myOverlapAngle < 0.1 * M_PI )
+ {
+ nbRev += edge->myAngleWithPrev > M_PI + angTol;
+ nbFrw += edge->myAngleWithPrev < M_PI - angTol;
+ }
+ sumDirCoeff += edge->myDirCoef;
+
+ // unmark all adjacent faces, new faces will be marked
+ SMDS_ElemIteratorPtr fIt = edge->myNode1->GetInverseElementIterator( SMDSAbs_Face );
+ while ( fIt->more() )
+ fIt->next()->setIsMarked( false );
+ }
+ bool isReverseAngle = ( nbRev > nbFrw ); // true == face normals point inside the border
+ //std::cout << "nbRev="<< nbRev << ", nbFrw="<< nbFrw<<std::endl;
+
+ // sort border edges by myAngleWithPrev
+
+ TAngleMap edgesByAngle;
+ bool useOverlap = true; // to add BEdge.myOverlapAngle when filling edgesByAngle
+ edge = edge0;
+ for ( size_t i = 0; i < nbEdges; ++i, edge = edge->myNext )
+ edge->InsertSelf( edgesByAngle, isReverseAngle, /*reBind=*/false, useOverlap );
+
+ // create triangles to fill the hole
+
+ //compare order of nodes in the edges with their order in faces
+ bool isReverse = sumDirCoeff > 0.5 * nbEdges;
+
+ // faces filling the hole (cap faces) and indices of border edges in them
+ TFaceIndMap capFaceWithBordInd;
+
+ theNewFaces.reserve( nbEdges - 2 );
+ std::vector< const SMDS_MeshNode* > nodes(3);
+ while ( edgesByAngle.size() > 2 )
+ {
+ TAngleMap::iterator a2e = edgesByAngle.begin();
+ edge = a2e->second;
+ if ( useOverlap &&
+ a2e->first - edge->ShapeFactor() > M_PI - angTol ) // all new triangles need shift
+ {
+ // re-sort the edges w/o overlap consideration
+ useOverlap = false;
+ nbEdges = edgesByAngle.size();
+ edgesByAngle.clear();
+ for ( size_t i = 0; i < nbEdges; ++i, edge = edge->myNext )
+ edge->InsertSelf( edgesByAngle, isReverseAngle, /*reBind=*/false, useOverlap );
+ a2e = edgesByAngle.begin();
+ }
+ edge = a2e->second;
+ edgePrev = edge->myPrev;
+
+ // create shift nodes and faces
+ edgePrev->ShiftOverlapped( edge->myNode2, capFaceWithBordInd, theMesh, theNewFaces );
+ edge->ShiftOverlapped( edgePrev->myNode1, capFaceWithBordInd, theMesh, theNewFaces );
+ edge ->MakeShiftfFaces( theMesh, theNewFaces, isReverse );
+ edgePrev->MakeShiftfFaces( theMesh, theNewFaces, isReverse );
+
+ // make a cap face
+ //nodes.resize( 3 );
+ nodes[0] = edgePrev->myNode1Shift ? edgePrev->myNode1Shift : edgePrev->myNode1;
+ nodes[1] = edgePrev->myNode2Shift ? edgePrev->myNode2Shift : edgePrev->myNode2;
+ nodes[2] = edge->myNode2Shift ? edge->myNode2Shift : edge->myNode2;
+ theNewFaces.push_back( MakeTria( theMesh, nodes[0], nodes[1], nodes[2], isReverse ));
+ // std::cout << nodes[1]->GetID() << " " << nodes[0]->GetID() << " " << nodes[2]->GetID()
+ // << " " << edge->myAngleWithPrev << std::endl;
+
+ // remember a border edge within the new cap face
+ theNewFaces.back()->setIsMarked( true );
+ if ( edgePrev->myFace )
+ capFaceWithBordInd.insert( std::make_pair( theNewFaces.back(), isReverse ? 2 : 0 ));
+ if ( edge->myFace )
+ capFaceWithBordInd.insert( std::make_pair( theNewFaces.back(), 1 ));
+
+ // remove edgePrev from the list and update <edge>
+ edgesByAngle.erase( edgePrev->myAngleMapPos );
+ circularList.unlink( edgePrev ); // remove edgePrev from the border
+
+ edge->Init( edgePrev->myNode1, edge->myNode2, theNewFaces.back(), nodes[0], nodes[2] );
+ edge->ComputeAngle( isReverseAngle );
+ edge->InsertSelf( edgesByAngle, /*isReverse=*/false, /*reBind=*/true, useOverlap );
+ edge->myNext->ComputeAngle( isReverseAngle );
+ edge->myNext->InsertSelf( edgesByAngle, /*isReverse=*/false, /*reBind=*/true, useOverlap );
+ // std::cout << "A " << edge->myNode1->GetID() << " " << edge->myAngleWithPrev
+ // << " " << edge->myNext->myNode1->GetID() << " " << edge->myNext->myAngleWithPrev
+ // << std::endl;
+ }
+ edge = edgesByAngle.begin()->second;
+ edge-> MakeShiftfFaces( theMesh, theNewFaces, isReverse );
+ edge->myNext->MakeShiftfFaces( theMesh, theNewFaces, isReverse );
+}
if ( myID < 0 )
{
myID = id;
- if ( myNext )
- myNext->SetID( id + 1 );
+
+ for ( BEdge* be = myNext; be && be->myID < 0; be = be->myNext )
+ {
+ be->myID = ++id;
+ }
}
}
//================================================================================
} // SMESH_MeshAlgos::FindCoincidentFreeBorders()
+//================================================================================
+/*
+ * Returns all TFreeBorder's. Optionally check if the mesh is manifold
+ * and if faces are correctly oriented.
+ */
+//================================================================================
+
+void SMESH_MeshAlgos::FindFreeBorders(SMDS_Mesh& theMesh,
+ TFreeBorderVec & theFoundFreeBordes,
+ const bool theClosedOnly,
+ bool* theIsManifold,
+ bool* theIsGoodOri)
+{
+ bool isManifold = true;
+
+ // find free links
+ typedef NCollection_DataMap<SMESH_TLink, const SMDS_MeshElement*, SMESH_TLink > TLink2FaceMap;
+ TLink2FaceMap linkMap;
+ int nbSharedLinks = 0;
+ SMDS_FaceIteratorPtr faceIt = theMesh.facesIterator();
+ while ( faceIt->more() )
+ {
+ const SMDS_MeshElement* face = faceIt->next();
+ if ( !face ) continue;
+
+ const SMDS_MeshNode* n0 = face->GetNode( face->NbNodes() - 1 );
+ SMDS_NodeIteratorPtr nodeIt = face->interlacedNodesIterator();
+ while ( nodeIt->more() )
+ {
+ const SMDS_MeshNode* n1 = nodeIt->next();
+ SMESH_TLink link( n0, n1 );
+ if ( const SMDS_MeshElement** faceInMap = linkMap.ChangeSeek( link ))
+ {
+ if ( *faceInMap )
+ {
+ if ( theIsGoodOri && *theIsGoodOri && !IsRightOrder( *faceInMap, n1, n0 ))
+ *theIsGoodOri = false;
+ }
+ else
+ {
+ isManifold = false;
+ }
+ nbSharedLinks += bool( *faceInMap );
+ *faceInMap = 0;
+ }
+ else
+ {
+ linkMap.Bind( link, face );
+ }
+ n0 = n1;
+ }
+ }
+ if ( theIsManifold )
+ *theIsManifold = isManifold;
+
+ if ( linkMap.Extent() == nbSharedLinks )
+ return;
+
+ // form free borders
+ std::set < BNode > bNodes;
+ std::vector< BEdge > bEdges( linkMap.Extent() - nbSharedLinks );
+
+ TLink2FaceMap::Iterator linkIt( linkMap );
+ for ( int iEdge = 0; linkIt.More(); linkIt.Next() )
+ {
+ if ( !linkIt.Value() ) continue;
+ const SMESH_TLink & link = linkIt.Key();
+ std::set< BNode >::iterator n1 = bNodes.insert( BNode( link.node1() )).first;
+ std::set< BNode >::iterator n2 = bNodes.insert( BNode( link.node2() )).first;
+ bEdges[ iEdge ].Set( &*n1, &*n2, linkIt.Value(), iEdge+1 );
+ n1->AddLinked( & bEdges[ iEdge ] );
+ n2->AddLinked( & bEdges[ iEdge ] );
+ ++iEdge;
+ }
+ linkMap.Clear();
+
+ // assign IDs to borders
+ std::vector< BEdge* > borders; // 1st of connected (via myPrev and myNext) edges
+ std::set< BNode >::iterator bn = bNodes.begin();
+ for ( ; bn != bNodes.end(); ++bn )
+ {
+ for ( size_t i = 0; i < bn->myLinkedEdges.size(); ++i )
+ {
+ if ( bn->myLinkedEdges[i]->myBorderID < 0 )
+ {
+ BEdge* be = bn->myLinkedEdges[i];
+ int borderID = borders.size();
+ borders.push_back( be );
+ for ( ; be && be->myBorderID < 0; be = be->myNext )
+ {
+ be->myBorderID = borderID;
+ be->Orient();
+ }
+ bool isClosed = ( be == bn->myLinkedEdges[i] );
+ if ( !isClosed && theClosedOnly )
+ {
+ borders.pop_back();
+ continue;
+ }
+ be = bn->myLinkedEdges[i]->myPrev;
+ for ( ; be && be->myBorderID < 0; be = be->myPrev )
+ {
+ be->myBorderID = borderID;
+ be->Orient();
+ }
+ if ( !isClosed )
+ while ( borders.back()->myPrev )
+ borders.back() = borders.back()->myPrev;
+ }
+ }
+ }
+ theFoundFreeBordes.resize( borders.size() );
+ for ( size_t i = 0; i < borders.size(); ++i )
+ {
+ TFreeBorder & bordNodes = theFoundFreeBordes[ i ];
+ BEdge* be = borders[i];
+
+ size_t cnt = 1;
+ for ( be = be->myNext; be && be != borders[i]; be = be->myNext )
+ ++cnt;
+ bordNodes.resize( cnt + 1 );
+
+ BEdge* beLast;
+ for ( be = borders[i], cnt = 0;
+ be && cnt < bordNodes.size()-1;
+ be = be->myNext, ++cnt )
+ {
+ bordNodes[ cnt ] = be->myBNode1->Node();
+ beLast = be;
+ }
+ bordNodes.back() = beLast->myBNode2->Node();
+ }
+}
#include "SMDS_VolumeTool.hxx"
#include "SMESH_OctreeNode.hxx"
+#include <Utils_SALOME_Exception.hxx>
+
#include <GC_MakeSegment.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
#include <Geom_Line.hxx>
SMDSAbs_ElementType elemType,
SMDS_ElemIteratorPtr theElemIt = SMDS_ElemIteratorPtr(),
double tolerance = NodeRadius );
- void prepare(); // !!!call it before calling the following methods!!!
void getElementsNearPoint( const gp_Pnt& point, vector<const SMDS_MeshElement*>& foundElems );
void getElementsNearLine ( const gp_Ax1& line, vector<const SMDS_MeshElement*>& foundElems);
void getElementsInSphere ( const gp_XYZ& center,
const double radius,
vector<const SMDS_MeshElement*>& foundElems);
+ ElementBndBoxTree* getLeafAtPoint( const gp_XYZ& point );
protected:
ElementBndBoxTree() {}
}
}
- //================================================================================
- /*!
- * \brief Un-mark all elements
- */
- //================================================================================
-
- void ElementBndBoxTree::prepare()
- {
- // TElementBoxPool& elBoPool = getElementBoxPool();
- // for ( size_t i = 0; i < elBoPool.nbElements(); ++i )
- // const_cast< ElementBox* >( elBoPool[ i ])->_isMarked = false;
- }
-
//================================================================================
/*!
* \brief Return elements which can include the point
}
}
+ //================================================================================
+ /*!
+ * \brief Return a leaf including a point
+ */
+ //================================================================================
+
+ ElementBndBoxTree* ElementBndBoxTree::getLeafAtPoint( const gp_XYZ& point )
+ {
+ if ( getBox()->IsOut( point ))
+ return 0;
+
+ if ( isLeaf() )
+ {
+ return this;
+ }
+ else
+ {
+ for (int i = 0; i < 8; i++)
+ if ( ElementBndBoxTree* l = ((ElementBndBoxTree*) myChildren[i])->getLeafAtPoint( point ))
+ return l;
+ }
+ return 0;
+ }
+
//================================================================================
/*!
* \brief Construct the element box
virtual const SMDS_MeshElement* FindClosestTo( const gp_Pnt& point,
SMDSAbs_ElementType type );
- void GetElementsNearLine( const gp_Ax1& line,
- SMDSAbs_ElementType type,
- vector< const SMDS_MeshElement* >& foundElems);
- void GetElementsInSphere( const gp_XYZ& center,
- const double radius,
- SMDSAbs_ElementType type,
- vector< const SMDS_MeshElement* >& foundElems);
+ virtual void GetElementsNearLine( const gp_Ax1& line,
+ SMDSAbs_ElementType type,
+ vector< const SMDS_MeshElement* >& foundElems);
+ virtual void GetElementsInSphere( const gp_XYZ& center,
+ const double radius,
+ SMDSAbs_ElementType type,
+ vector< const SMDS_MeshElement* >& foundElems);
+ virtual gp_XYZ Project(const gp_Pnt& point,
+ SMDSAbs_ElementType type,
+ const SMDS_MeshElement** closestElem);
double getTolerance();
bool getIntersParamOnLine(const gp_Lin& line, const SMDS_MeshElement* face,
const double tolerance, double & param);
{
_ebbTree[_elementType] = new ElementBndBoxTree( *_mesh, type, _meshPartIt, tolerance );
}
- else
- {
- _ebbTree[ type ]->prepare();
- }
vector< const SMDS_MeshElement* > suspectElems;
_ebbTree[ type ]->getElementsNearPoint( point, suspectElems );
vector< const SMDS_MeshElement* >::iterator elem = suspectElems.begin();
const SMDS_MeshElement* closestElem = 0;
_elementType = type;
- if ( type == SMDSAbs_Face || type == SMDSAbs_Volume )
+ if ( type == SMDSAbs_Face ||
+ type == SMDSAbs_Volume ||
+ type == SMDSAbs_Edge )
{
ElementBndBoxTree*& ebbTree = _ebbTree[ type ];
if ( !ebbTree )
ebbTree = new ElementBndBoxTree( *_mesh, type, _meshPartIt );
- else
- ebbTree->prepare();
vector<const SMDS_MeshElement*> suspectElems;
ebbTree->getElementsNearPoint( point, suspectElems );
radius = ebbTree->maxSize() / pow( 2., getTreeHeight()) / 2;
while ( suspectElems.empty() )
{
- ebbTree->prepare();
ebbTree->getElementsInSphere( point.XYZ(), radius, suspectElems );
radius *= 1.1;
}
ElementBndBoxTree*& ebbTree = _ebbTree[ SMDSAbs_Face ];
if ( !ebbTree )
ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt );
- else
- ebbTree->prepare();
// Algo: analyse transition of a line starting at the point through mesh boundary;
// try three lines parallel to axis of the coordinate system and perform rough
gp_Lin line ( lineAxis );
vector<const SMDS_MeshElement*> suspectFaces; // faces possibly intersecting the line
- if ( axis > 0 ) ebbTree->prepare();
ebbTree->getElementsNearLine( lineAxis, suspectFaces );
// Intersect faces with the line
ElementBndBoxTree*& ebbTree = _ebbTree[ type ];
if ( !ebbTree )
ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt );
- else
- ebbTree->prepare();
ebbTree->getElementsNearLine( line, foundElems );
}
ElementBndBoxTree*& ebbTree = _ebbTree[ type ];
if ( !ebbTree )
ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt );
- else
- ebbTree->prepare();
ebbTree->getElementsInSphere( center, radius, foundElems );
}
+//=======================================================================
+/*
+ * \brief Return a projection of a given point to a mesh.
+ * Optionally return the closest element
+ */
+//=======================================================================
+
+gp_XYZ SMESH_ElementSearcherImpl::Project(const gp_Pnt& point,
+ SMDSAbs_ElementType type,
+ const SMDS_MeshElement** closestElem)
+{
+ _elementType = type;
+ if ( _mesh->GetMeshInfo().NbElements( _elementType ) == 0 )
+ throw SALOME_Exception( LOCALIZED( "No elements of given type in the mesh" ));
+
+ ElementBndBoxTree*& ebbTree = _ebbTree[ _elementType ];
+ if ( !ebbTree )
+ ebbTree = new ElementBndBoxTree( *_mesh, _elementType );
+
+ gp_XYZ p = point.XYZ();
+ ElementBndBoxTree* ebbLeaf = ebbTree->getLeafAtPoint( p );
+ const Bnd_B3d* box = ebbLeaf->getBox();
+ double radius = ( box->CornerMax() - box->CornerMin() ).Modulus();
+
+ vector< const SMDS_MeshElement* > elems;
+ ebbTree->getElementsInSphere( p, radius, elems );
+ while ( elems.empty() )
+ {
+ radius *= 1.5;
+ ebbTree->getElementsInSphere( p, radius, elems );
+ }
+ gp_XYZ proj, bestProj;
+ const SMDS_MeshElement* elem = 0;
+ double minDist = 2 * radius;
+ for ( size_t i = 0; i < elems.size(); ++i )
+ {
+ double d = SMESH_MeshAlgos::GetDistance( elems[i], p, &proj );
+ if ( d < minDist )
+ {
+ bestProj = proj;
+ elem = elems[i];
+ minDist = d;
+ }
+ }
+ if ( closestElem ) *closestElem = elem;
+
+ return bestProj;
+}
+
//=======================================================================
/*!
* \brief Return true if the point is IN or ON of the element
//=======================================================================
double SMESH_MeshAlgos::GetDistance( const SMDS_MeshElement* elem,
- const gp_Pnt& point )
+ const gp_Pnt& point,
+ gp_XYZ* closestPnt )
{
switch ( elem->GetType() )
{
case SMDSAbs_Volume:
- return GetDistance( dynamic_cast<const SMDS_MeshVolume*>( elem ), point);
+ return GetDistance( dynamic_cast<const SMDS_MeshVolume*>( elem ), point, closestPnt );
case SMDSAbs_Face:
- return GetDistance( dynamic_cast<const SMDS_MeshFace*>( elem ), point);
+ return GetDistance( dynamic_cast<const SMDS_MeshFace*>( elem ), point, closestPnt );
case SMDSAbs_Edge:
- return GetDistance( dynamic_cast<const SMDS_MeshEdge*>( elem ), point);
+ return GetDistance( dynamic_cast<const SMDS_MeshEdge*>( elem ), point, closestPnt );
case SMDSAbs_Node:
+ if ( closestPnt ) *closestPnt = SMESH_TNodeXYZ( elem );
return point.Distance( SMESH_TNodeXYZ( elem ));
default:;
}
//=======================================================================
double SMESH_MeshAlgos::GetDistance( const SMDS_MeshFace* face,
- const gp_Pnt& point )
+ const gp_Pnt& point,
+ gp_XYZ* closestPnt )
{
- double badDistance = -1;
+ const double badDistance = -1;
if ( !face ) return badDistance;
// coordinates of nodes (medium nodes, if any, ignored)
trsf.Transforms( tmpPnt );
gp_XY point2D( tmpPnt.X(), tmpPnt.Z() );
- // loop on segments of the face to analyze point position ralative to the face
+ // loop on edges of the face to analyze point position ralative to the face
set< PointPos > pntPosSet;
for ( size_t i = 1; i < xy.size(); ++i )
{
// compute distance
PointPos pos = *pntPosSet.begin();
- // cout << "Face " << face->GetID() << " DIST: ";
switch ( pos._name )
{
- case POS_LEFT: {
- // point is most close to a segment
- gp_Vec p0p1( point, xyz[ pos._index ] );
- gp_Vec p1p2( xyz[ pos._index ], xyz[ pos._index+1 ]); // segment vector
- p1p2.Normalize();
- double projDist = p0p1 * p1p2; // distance projected to the segment
- gp_Vec projVec = p1p2 * projDist;
- gp_Vec distVec = p0p1 - projVec;
- // cout << distVec.Magnitude() << ", SEG " << face->GetNode(pos._index)->GetID()
- // << " - " << face->GetNodeWrap(pos._index+1)->GetID() << endl;
- return distVec.Magnitude();
+ case POS_LEFT:
+ {
+ // point is most close to an edge
+ gp_Vec edge( xyz[ pos._index ], xyz[ pos._index+1 ]);
+ gp_Vec n1p ( xyz[ pos._index ], point );
+ double u = ( edge * n1p ) / edge.SquareMagnitude(); // param [0,1] on the edge
+ // projection of the point on the edge
+ gp_XYZ proj = ( 1. - u ) * xyz[ pos._index ] + u * xyz[ pos._index+1 ];
+ if ( closestPnt ) *closestPnt = proj;
+ return point.Distance( proj );
}
- case POS_RIGHT: {
+ case POS_RIGHT:
+ {
// point is inside the face
- double distToFacePlane = tmpPnt.Y();
- // cout << distToFacePlane << ", INSIDE " << endl;
- return Abs( distToFacePlane );
+ double distToFacePlane = Abs( tmpPnt.Y() );
+ if ( closestPnt )
+ {
+ if ( distToFacePlane < std::numeric_limits<double>::min() ) {
+ *closestPnt = point.XYZ();
+ }
+ else {
+ tmpPnt.SetY( 0 );
+ trsf.Inverted().Transforms( tmpPnt );
+ *closestPnt = tmpPnt;
+ }
+ }
+ return distToFacePlane;
}
- case POS_VERTEX: {
+ case POS_VERTEX:
+ {
// point is most close to a node
gp_Vec distVec( point, xyz[ pos._index ]);
- // cout << distVec.Magnitude() << " VERTEX " << face->GetNode(pos._index)->GetID() << endl;
return distVec.Magnitude();
}
default:;
*/
//=======================================================================
-double SMESH_MeshAlgos::GetDistance( const SMDS_MeshEdge* seg, const gp_Pnt& point )
+double SMESH_MeshAlgos::GetDistance( const SMDS_MeshEdge* seg,
+ const gp_Pnt& point,
+ gp_XYZ* closestPnt )
{
double dist = Precision::Infinite();
if ( !seg ) return dist;
{
gp_Vec edge( xyz[i-1], xyz[i] );
gp_Vec n1p ( xyz[i-1], point );
- double u = ( edge * n1p ) / edge.SquareMagnitude(); // param [0,1] on the edge
+ double d, u = ( edge * n1p ) / edge.SquareMagnitude(); // param [0,1] on the edge
if ( u <= 0. ) {
- dist = Min( dist, n1p.SquareMagnitude() );
+ if (( d = n1p.SquareMagnitude() ) < dist ) {
+ dist = d;
+ if ( closestPnt ) *closestPnt = xyz[i-1];
+ }
}
else if ( u >= 1. ) {
- dist = Min( dist, point.SquareDistance( xyz[i] ));
+ if (( d = point.SquareDistance( xyz[i] )) < dist ) {
+ dist = d;
+ if ( closestPnt ) *closestPnt = xyz[i];
+ }
}
else {
- gp_XYZ proj = ( 1. - u ) * xyz[i-1] + u * xyz[i]; // projection of the point on the edge
- dist = Min( dist, point.SquareDistance( proj ));
+ gp_XYZ proj = xyz[i-1] + u * edge.XYZ(); // projection of the point on the edge
+ if (( d = point.SquareDistance( proj )) < dist ) {
+ dist = d;
+ if ( closestPnt ) *closestPnt = proj;
+ }
}
}
return Sqrt( dist );
*/
//=======================================================================
-double SMESH_MeshAlgos::GetDistance( const SMDS_MeshVolume* volume, const gp_Pnt& point )
+double SMESH_MeshAlgos::GetDistance( const SMDS_MeshVolume* volume,
+ const gp_Pnt& point,
+ gp_XYZ* closestPnt )
{
SMDS_VolumeTool vTool( volume );
vTool.SetExternalNormal();
double n[3], bc[3];
double minDist = 1e100, dist;
+ gp_XYZ closeP = point.XYZ();
+ bool isOut = false;
for ( int iF = 0; iF < vTool.NbFaces(); ++iF )
{
// skip a facet with normal not "looking at" the point
case 3:
{
SMDS_FaceOfNodes tmpFace( nodes[0], nodes[ 1*iQ ], nodes[ 2*iQ ] );
- dist = GetDistance( &tmpFace, point );
+ dist = GetDistance( &tmpFace, point, closestPnt );
break;
}
case 4:
{
SMDS_FaceOfNodes tmpFace( nodes[0], nodes[ 1*iQ ], nodes[ 2*iQ ], nodes[ 3*iQ ]);
- dist = GetDistance( &tmpFace, point );
+ dist = GetDistance( &tmpFace, point, closestPnt );
break;
}
default:
vector<const SMDS_MeshNode *> nvec( nodes, nodes + vTool.NbFaceNodes( iF ));
SMDS_PolygonalFaceOfNodes tmpFace( nvec );
- dist = GetDistance( &tmpFace, point );
+ dist = GetDistance( &tmpFace, point, closestPnt );
+ }
+ if ( dist < minDist )
+ {
+ minDist = dist;
+ isOut = true;
+ if ( closestPnt ) closeP = *closestPnt;
}
- minDist = Min( minDist, dist );
}
- return minDist;
+ if ( isOut )
+ {
+ if ( closestPnt ) *closestPnt = closeP;
+ return minDist;
+ }
+
+ return 0; // point is inside the volume
}
//================================================================================
common.push_back( e1->GetNode( i ));
return common;
}
+//================================================================================
+/*!
+ * \brief Return true if node1 encounters first in the face and node2, after
+ */
+//================================================================================
+
+bool SMESH_MeshAlgos::IsRightOrder( const SMDS_MeshElement* face,
+ const SMDS_MeshNode* node0,
+ const SMDS_MeshNode* node1 )
+{
+ int i0 = face->GetNodeIndex( node0 );
+ int i1 = face->GetNodeIndex( node1 );
+ if ( face->IsQuadratic() )
+ {
+ if ( face->IsMediumNode( node0 ))
+ {
+ i0 -= ( face->NbNodes()/2 - 1 );
+ i1 *= 2;
+ }
+ else
+ {
+ i1 -= ( face->NbNodes()/2 - 1 );
+ i0 *= 2;
+ }
+ }
+ int diff = i1 - i0;
+ return ( diff == 1 ) || ( diff == -face->NbNodes()+1 );
+}
//=======================================================================
/*!
* \brief Find out if the given point is out of closed 2D mesh.
*/
virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0;
+
+ /*!
+ * \brief Return a projection of a given point to a 2D mesh.
+ * Optionally return the closest face
+ */
+ virtual gp_XYZ Project(const gp_Pnt& point,
+ SMDSAbs_ElementType type,
+ const SMDS_MeshElement** closestFace= 0) = 0;
+
virtual ~SMESH_ElementSearcher();
};
bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
SMESHUtils_EXPORT
- double GetDistance( const SMDS_MeshElement* elem, const gp_Pnt& point );
+ double GetDistance( const SMDS_MeshElement* elem, const gp_Pnt& point, gp_XYZ* closestPnt = 0 );
SMESHUtils_EXPORT
- double GetDistance( const SMDS_MeshEdge* edge, const gp_Pnt& point );
+ double GetDistance( const SMDS_MeshEdge* edge, const gp_Pnt& point, gp_XYZ* closestPnt = 0 );
SMESHUtils_EXPORT
- double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point );
+ double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point, gp_XYZ* closestPnt = 0 );
SMESHUtils_EXPORT
- double GetDistance( const SMDS_MeshVolume* volume, const gp_Pnt& point );
+ double GetDistance( const SMDS_MeshVolume* volume, const gp_Pnt& point, gp_XYZ* closestPnt = 0 );
SMESHUtils_EXPORT
void GetBarycentricCoords( const gp_XY& point,
SMESHUtils_EXPORT
std::vector< const SMDS_MeshNode*> GetCommonNodes(const SMDS_MeshElement* e1,
const SMDS_MeshElement* e2);
+ /*!
+ * \brief Return true if node1 encounters first in the face and node2, after.
+ * The nodes are supposed to be neighbor nodes in the face.
+ */
+ SMESHUtils_EXPORT
+ bool IsRightOrder( const SMDS_MeshElement* face,
+ const SMDS_MeshNode* node0,
+ const SMDS_MeshNode* node1 );
/*!
* \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it
void FindCoincidentFreeBorders(SMDS_Mesh& mesh,
double tolerance,
CoincidentFreeBorders & foundFreeBordes);
-
+ /*!
+ * Returns all or only closed TFreeBorder's.
+ * Optionally check if the mesh is manifold and if faces are correctly oriented.
+ *
+ * (Implemented in ./SMESH_FreeBorders.cxx)
+ */
+ SMESHUtils_EXPORT
+ void FindFreeBorders(SMDS_Mesh& mesh,
+ TFreeBorderVec & foundFreeBordes,
+ const bool closedOnly,
+ bool* isManifold = 0,
+ bool* isGoodOri = 0);
+ /*!
+ * Fill a hole defined by a TFreeBorder with 2D elements.
+ *
+ * (Implemented in ./SMESH_FillHole.cxx)
+ */
+ SMESHUtils_EXPORT
+ void FillHole(const TFreeBorder & freeBorder,
+ SMDS_Mesh& mesh,
+ std::vector<const SMDS_MeshElement*>& newFaces);
+
/*!
* \brief Find nodes whose merge makes the element invalid
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);
if (e) {
assert( e->GetType() == SMDSAbs_Node );
_node = static_cast<const SMDS_MeshNode*>(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;
/*!
* \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;
// - FT_BelongToMeshGroup = 22
// v 8.1.0: FT_Undefined == 48, new items:
// - FT_NodeConnectivityNumber= 22
+ // v 8.5.0: FT_Undefined == 49, new items:
+ // - FT_Deflection2D = 22
//
// It's necessary to continue recording this history and to fill
// undef2newItems (see below) accordingly.
undef2newItems[ 46 ].push_back( 39 );
undef2newItems[ 47 ].push_back( 22 );
undef2newItems[ 48 ].push_back( 22 );
+ undef2newItems[ 49 ].push_back( 22 );
ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined );
}
//================================================================================
/*!
* \brief Convert a command using a specific converter
- * \param theCommand - the command to convert
+ * \param theCommand - the command to convert
*/
//================================================================================
aCommand->GetString() += tmpCmd.GetString();
}
// IMP issue 0021014
- // set GetCriterion(elementType,CritType,Compare,Treshold,UnaryOp,BinaryOp,Tolerance)
- // 1 2 3 4 5 6 7
+ // set GetCriterion(elementType,CritType,Compare,Threshold,UnaryOp,BinaryOp,Tolerance)
+ // 1 2 3 4 5 6 7
// instead of "SMESH.Filter.Criterion(
// Type,Compare,Threshold,ThresholdStr,ThresholdID,UnaryOp,BinaryOp,Tolerance,TypeOfElement,Precision)
// 1 2 3 4 5 6 7 8 9 10
//================================================================================
/*!
* \brief Convert the command or remember it for later conversion
- * \param theCommand - The python command calling a method of SMESH_Gen
+ * \param theCommand - The python command calling a method of SMESH_Gen
*/
//================================================================================
//================================================================================
/*!
* \brief Add access method to mesh that is an argument
- * \param theCmd - command to add access method
- * \retval bool - true if added
+ * \param theCmd - command to add access method
+ * \retval bool - true if added
*/
//================================================================================
//================================================================================
/*!
* \brief Add access method to algo that is an object or an argument
- * \param theCmd - command to add access method
- * \retval bool - true if added
+ * \param theCmd - command to add access method
+ * \retval bool - true if added
*/
//================================================================================
//================================================================================
/*!
* \brief Find hypothesis by ID (entry)
- * \param theHypID - The hypothesis ID
- * \retval Handle(_pyHypothesis) - The found hypothesis
+ * \param theHypID - The hypothesis ID
+ * \retval Handle(_pyHypothesis) - The found hypothesis
*/
//================================================================================
//================================================================================
/*!
* \brief Find algorithm able to create a hypothesis
- * \param theGeom - The shape ID the algorithm was created on
- * \param theMesh - The mesh ID that created the algorithm
- * \param theHypothesis - The hypothesis the algorithm should be able to create
- * \retval Handle(_pyHypothesis) - The found algo
+ * \param theGeom - The shape ID the algorithm was created on
+ * \param theMesh - The mesh ID that created the algorithm
+ * \param theHypothesis - The hypothesis the algorithm should be able to create
+ * \retval Handle(_pyHypothesis) - The found algo
*/
//================================================================================
//================================================================================
/*!
* \brief Find subMesh by ID (entry)
- * \param theSubMeshID - The subMesh ID
- * \retval Handle(_pySubMesh) - The found subMesh
+ * \param theSubMeshID - The subMesh ID
+ * \retval Handle(_pySubMesh) - The found subMesh
*/
//================================================================================
//================================================================================
/*!
* \brief Change order of commands in the script
- * \param theCmd1 - One command
- * \param theCmd2 - Another command
+ * \param theCmd1 - One command
+ * \param theCmd2 - Another command
*/
//================================================================================
int nb1 = theCmd1->GetOrderNb();
theCmd1->SetOrderNb( theCmd2->GetOrderNb() );
theCmd2->SetOrderNb( nb1 );
-// cout << "BECOME " << theCmd1->GetOrderNb() << "\t" << theCmd1->GetString() << endl
-// << "BECOME " << theCmd2->GetOrderNb() << "\t" << theCmd2->GetString() << endl << endl;
+ // cout << "BECOME " << theCmd1->GetOrderNb() << "\t" << theCmd1->GetString() << endl
+ // << "BECOME " << theCmd2->GetOrderNb() << "\t" << theCmd2->GetString() << endl << endl;
}
//================================================================================
/*!
* \brief Set one command after the other
- * \param theCmd - Command to move
- * \param theAfterCmd - Command ater which to insert the first one
+ * \param theCmd - Command to move
+ * \param theAfterCmd - Command ater which to insert the first one
*/
//================================================================================
//================================================================================
/*!
* \brief Set one command before the other
- * \param theCmd - Command to move
- * \param theBeforeCmd - Command before which to insert the first one
+ * \param theCmd - Command to move
+ * \param theBeforeCmd - Command before which to insert the first one
*/
//================================================================================
//================================================================================
/*!
* \brief Set one command before or after the other
- * \param theCmd - Command to move
- * \param theOtherCmd - Command ater or before which to insert the first one
+ * \param theCmd - Command to move
+ * \param theOtherCmd - Command ater or before which to insert the first one
*/
//================================================================================
// void _pyGen::addFilterUser( Handle(_pyCommand)& theCommand, const Handle(_pyObject)& user )
// {
- // No more needed after adding _pyObject::myArgCommands
+// No more needed after adding _pyObject::myArgCommands
// const char filterPrefix[] = "aFilter0x";
// if ( theCommand->GetString().Search( filterPrefix ) < 1 )
//================================================================================
/*!
* \brief Set command be last in list of commands
- * \param theCmd - Command to be last
+ * \param theCmd - Command to be last
*/
//================================================================================
//================================================================================
/*!
* \brief Set method to access to object wrapped with python class
- * \param theID - The wrapped object entry
- * \param theMethod - The accessor method
+ * \param theID - The wrapped object entry
+ * \param theMethod - The accessor method
*/
//================================================================================
//================================================================================
/*!
* \brief Generated new ID for object and assign with existing name
- * \param theID - ID of existing object
+ * \param theID - ID of existing object
*/
//================================================================================
}
else if ( theObj->IsKind( STANDARD_TYPE( _pyMeshEditor ))) {
add = myMeshEditors.insert( make_pair( theObj->GetID(),
- Handle(_pyMeshEditor)::DownCast( theObj ))).second;
+ Handle(_pyMeshEditor)::DownCast( theObj ))).second;
}
else {
add = myObjects.insert( make_pair( theObj->GetID(), theObj )).second;
//================================================================================
/*!
* \brief Convert an IDL API command of SMESH::SMESH_Mesh to a method call of python Mesh
- * \param theCommand - Engine method called for this mesh
+ * \param theCommand - Engine method called for this mesh
*/
//================================================================================
"ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
"ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects",
"Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
- "FindCoincidentNodes","MergeNodes","FindEqualElements",
+ "FindCoincidentNodes","MergeNodes","FindEqualElements","FillHole",
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
"FindCoincidentFreeBorders", "SewCoincidentFreeBorders",
"SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
//================================================================================
/*!
* \brief _pyHypothesis constructor
- * \param theCreationCmd -
+ * \param theCreationCmd -
*/
//================================================================================
//================================================================================
/*!
* \brief Creates algorithm or hypothesis
- * \param theCreationCmd - The engine command creating a hypothesis
- * \retval Handle(_pyHypothesis) - Result _pyHypothesis
+ * \param theCreationCmd - The engine command creating a hypothesis
+ * \retval Handle(_pyHypothesis) - Result _pyHypothesis
*/
//================================================================================
//================================================================================
/*!
* \brief Convert the command adding a hypothesis to mesh into a smesh command
- * \param theCmd - The command like mesh.AddHypothesis( geom, hypo )
- * \param theAlgo - The algo that can create this hypo
- * \retval bool - false if the command can't be converted
+ * \param theCmd - The command like mesh.AddHypothesis( geom, hypo )
+ * \param theAlgo - The algo that can create this hypo
+ * \retval bool - false if the command can't be converted
*/
//================================================================================
//================================================================================
/*!
* \brief Remember hypothesis parameter values
- * \param theCommand - The called hypothesis method
+ * \param theCommand - The called hypothesis method
*/
//================================================================================
//================================================================================
/*!
* \brief Remember hypothesis parameter values
- * \param theCommand - The called hypothesis method
+ * \param theCommand - The called hypothesis method
*/
//================================================================================
{
CreationMethod& crMethod = type2meth->second;
while ( (int) crMethod.myArgs.size() < i+1 )
- crMethod.myArgs.push_back( "[]" );
- crMethod.myArgs[ i ] = theCommand->GetArg( 1 ); // arg value
+ crMethod.myArgs.push_back( "[]" );
+ crMethod.myArgs[ i ] = theCommand->GetArg( 1 ); // arg value
}
myArgCommands.push_back( theCommand );
}
//================================================================================
/*!
* \brief Convert methods of 1D hypotheses to my own methods
- * \param theCommand - The called hypothesis method
+ * \param theCommand - The called hypothesis method
*/
//================================================================================
//================================================================================
/*!
* \brief
- * \param theAdditionCmd - command to be converted
- * \param theMesh - mesh instance
- * \retval bool - status
+ * \param theAdditionCmd - command to be converted
+ * \param theMesh - mesh instance
+ * \retval bool - status
*/
//================================================================================
//================================================================================
/*!
* \brief additionally to Addition2Creation, clears SetDistrType() command
- * \param theCmd - AddHypothesis() command
- * \param theMesh - mesh to which a hypothesis is added
- * \retval bool - conversion result
+ * \param theCmd - AddHypothesis() command
+ * \param theMesh - mesh to which a hypothesis is added
+ * \retval bool - conversion result
*/
//================================================================================
/*!
* \brief Convert the command adding "SegmentLengthAroundVertex" to mesh
* into regular1D.LengthNearVertex( length, vertex )
- * \param theCmd - The command like mesh.AddHypothesis( vertex, SegmentLengthAroundVertex )
- * \param theMesh - The mesh needing this hypo
- * \retval bool - false if the command can't be converted
+ * \param theCmd - The command like mesh.AddHypothesis( vertex, SegmentLengthAroundVertex )
+ * \param theMesh - The mesh needing this hypo
+ * \retval bool - false if the command can't be converted
*/
//================================================================================
//================================================================================
/*!
* \brief _pyAlgorithm constructor
- * \param theCreationCmd - The command like "algo = smeshgen.CreateHypothesis(type,lib)"
+ * \param theCreationCmd - The command like "algo = smeshgen.CreateHypothesis(type,lib)"
*/
//================================================================================
//================================================================================
/*!
* \brief Convert the command adding an algorithm to mesh
- * \param theCmd - The command like mesh.AddHypothesis( geom, algo )
- * \param theMesh - The mesh needing this algo
- * \retval bool - false if the command can't be converted
+ * \param theCmd - The command like mesh.AddHypothesis( geom, algo )
+ * \param theMesh - The mesh needing this algo
+ * \retval bool - false if the command can't be converted
*/
//================================================================================
//================================================================================
/*!
* \brief Return starting position of a part of python command
- * \param thePartIndex - The index of command part
- * \retval int - Part position
+ * \param thePartIndex - The index of command part
+ * \retval int - Part position
*/
//================================================================================
//================================================================================
/*!
* \brief Store starting position of a part of python command
- * \param thePartIndex - The index of command part
- * \param thePosition - Part position
+ * \param thePartIndex - The index of command part
+ * \param thePosition - Part position
*/
//================================================================================
//================================================================================
/*!
* \brief Returns whitespace symbols at the line beginning
- * \retval TCollection_AsciiString - result
+ * \retval TCollection_AsciiString - result
*/
//================================================================================
//================================================================================
/*!
* \brief Return substring of python command looking like ResultValue = Obj.Meth()
- * \retval const TCollection_AsciiString & - ResultValue substring
+ * \retval const TCollection_AsciiString & - ResultValue substring
*/
//================================================================================
//================================================================================
/*!
* \brief Return substring of python command looking like ResVal = Obj.Method()
- * \retval const TCollection_AsciiString & - Method substring
+ * \retval const TCollection_AsciiString & - Method substring
*/
//================================================================================
//================================================================================
/*!
* \brief Return substring of python command looking like ResVal = Obj.Meth(Arg1,...)
- * \retval const TCollection_AsciiString & - Arg<index> substring
+ * \retval const TCollection_AsciiString & - Arg<index> substring
*/
//================================================================================
//================================================================================
/*!
* \brief Check if char is a word part
- * \param c - The character to check
- * \retval bool - The check result
+ * \param c - The character to check
+ * \retval bool - The check result
*/
//================================================================================
//================================================================================
/*!
* \brief Looks for a word in the string and returns word's beginning
- * \param theString - The input string
- * \param theStartPos - The position to start the search, returning word's beginning
- * \param theForward - The search direction
- * \retval TCollection_AsciiString - The found word
+ * \param theString - The input string
+ * \param theStartPos - The position to start the search, returning word's beginning
+ * \param theForward - The search direction
+ * \retval TCollection_AsciiString - The found word
*/
//================================================================================
//================================================================================
/*!
* \brief Look for position where not space char is
- * \param theString - The string
- * \param thePos - The position to search from and which returns result
- * \retval bool - false if there are only space after thePos in theString
+ * \param theString - The string
+ * \param thePos - The position to search from and which returns result
+ * \retval bool - false if there are only space after thePos in theString
*/
//================================================================================
//================================================================================
/*!
* \brief Modify a part of the command
- * \param thePartIndex - The index of the part
- * \param thePart - The new part string
- * \param theOldPart - The old part
+ * \param thePartIndex - The index of the part
+ * \param thePart - The new part string
+ * \param theOldPart - The old part
*/
//================================================================================
void _pyCommand::SetPart(int thePartIndex, const TCollection_AsciiString& thePart,
- TCollection_AsciiString& theOldPart)
+ TCollection_AsciiString& theOldPart)
{
int pos = GetBegPos( thePartIndex );
if ( pos <= Length() && theOldPart != thePart)
//================================================================================
/*!
* \brief Set agrument
- * \param index - The argument index, it counts from 1
- * \param theArg - The argument string
+ * \param index - The argument index, it counts from 1
+ * \param theArg - The argument string
*/
//================================================================================
//================================================================================
/*!
* \brief Insert accessor method after theObjectID
- * \param theObjectID - id of the accessed object
- * \param theAcsMethod - name of the method giving access to the object
- * \retval bool - false if theObjectID is not found in the command string
+ * \param theObjectID - id of the accessed object
+ * \param theAcsMethod - name of the method giving access to the object
+ * \retval bool - false if theObjectID is not found in the command string
*/
//================================================================================
//================================================================================
/*!
* \brief Return method name giving access to an interaface object wrapped by python class
- * \retval const char* - method name
+ * \retval const char* - method name
*/
//================================================================================
bool _pySubMesh::CanBeArgOfMethod(const _AString& theMethodName)
{
return false;
-// // names of all methods where a sub-mesh can be used as argument
-// static TStringSet methods;
-// if ( methods.empty() ) {
-// const char * names[] = {
-// // methods of SMESH_Gen
-// "CopyMesh",
-// // methods of SMESH_Group
-// "AddFrom",
-// // methods of SMESH_Measurements
-// "MinDistance",
-// // methods of SMESH_Mesh
-// "ExportPartToMED","ExportCGNS","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL",
-// "RemoveSubMesh",
-// // methods of SMESH_MeshEditor
-// "ReorientObject","Reorient2D","TriToQuadObject","QuadToTriObject","SplitQuadObject",
-// "SplitVolumesIntoTetra","SmoothObject","SmoothParametricObject","ConvertFromQuadraticObject",
-// "RotationSweepObject","RotationSweepObjectMakeGroups","RotationSweepObject1D",
-// "RotationSweepObject1DMakeGroups","RotationSweepObject2D","RotationSweepObject2DMakeGroups",
-// "ExtrusionSweepObject","ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
-// "ExtrusionSweepObject0DMakeGroups","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
-// "ExtrusionSweepObject1DMakeGroups","ExtrusionSweepObject2DMakeGroups",
-// "ExtrusionAlongPathObjX","ExtrusionAlongPathObject","ExtrusionAlongPathObjectMakeGroups",
-// "ExtrusionAlongPathObject1D","ExtrusionAlongPathObject1DMakeGroups",
-// "ExtrusionAlongPathObject2D","ExtrusionAlongPathObject2DMakeGroups","MirrorObject",
-// "MirrorObjectMakeGroups","MirrorObjectMakeMesh","TranslateObject","Scale",
-// "TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh",
-// "RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart",
-// "FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint",
-// "MakeBoundaryMesh","Create0DElementsOnAllNodes",
-// "" }; // <- mark of end
-// methods.Insert( names );
-// }
-// return methods.Contains( theMethodName );
+ // names of all methods where a sub-mesh can be used as argument
+ // static TStringSet methods;
+ // if ( methods.empty() ) {
+ // const char * names[] = {
+ // // methods of SMESH_Gen
+ // "CopyMesh",
+ // // methods of SMESH_Group
+ // "AddFrom",
+ // // methods of SMESH_Measurements
+ // "MinDistance",
+ // // methods of SMESH_Mesh
+ // "ExportPartToMED","ExportCGNS","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL",
+ // "RemoveSubMesh",
+ // // methods of SMESH_MeshEditor
+ // "ReorientObject","Reorient2D","TriToQuadObject","QuadToTriObject","SplitQuadObject",
+ // "SplitVolumesIntoTetra","SmoothObject","SmoothParametricObject","ConvertFromQuadraticObject",
+ // "RotationSweepObject","RotationSweepObjectMakeGroups","RotationSweepObject1D",
+ // "RotationSweepObject1DMakeGroups","RotationSweepObject2D","RotationSweepObject2DMakeGroups",
+ // "ExtrusionSweepObject","ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
+ // "ExtrusionSweepObject0DMakeGroups","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
+ // "ExtrusionSweepObject1DMakeGroups","ExtrusionSweepObject2DMakeGroups",
+ // "ExtrusionAlongPathObjX","ExtrusionAlongPathObject","ExtrusionAlongPathObjectMakeGroups",
+ // "ExtrusionAlongPathObject1D","ExtrusionAlongPathObject1DMakeGroups",
+ // "ExtrusionAlongPathObject2D","ExtrusionAlongPathObject2DMakeGroups","MirrorObject",
+ // "MirrorObjectMakeGroups","MirrorObjectMakeMesh","TranslateObject","Scale",
+ // "TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh",
+ // "RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart",
+ // "FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint",
+ // "MakeBoundaryMesh","Create0DElementsOnAllNodes",
+ // "" }; // <- mark of end
+ // methods.Insert( names );
+ // }
+ // return methods.Contains( theMethodName );
}
//================================================================================
//}
//else {
// ------------------------->>>>> GroupOnGeom( geom, name, typ )
- _pyID type = theCreationCmd->GetArg( 1 );
- _pyID name = theCreationCmd->GetArg( 2 );
- theCreationCmd->SetMethod( "GroupOnGeom" );
- theCreationCmd->RemoveArgs();
- theCreationCmd->SetArg( 1, geom );
- theCreationCmd->SetArg( 2, name );
- theCreationCmd->SetArg( 3, type );
+ _pyID type = theCreationCmd->GetArg( 1 );
+ _pyID name = theCreationCmd->GetArg( 2 );
+ theCreationCmd->SetMethod( "GroupOnGeom" );
+ theCreationCmd->RemoveArgs();
+ theCreationCmd->SetArg( 1, geom );
+ theCreationCmd->SetArg( 2, name );
+ theCreationCmd->SetArg( 3, type );
//}
}
else if ( method == "CreateGroupFromFilter" )
case FT_MultiConnection2D: myStream<< "aMultiConnection2D"; break;
case FT_Length: myStream<< "aLength"; break;
case FT_Length2D: myStream<< "aLength2D"; break;
+ case FT_Deflection2D: myStream<< "aDeflection2D"; break;
case FT_NodeConnectivityNumber:myStream<< "aNodeConnectivityNumber";break;
case FT_BelongToMeshGroup: myStream<< "aBelongToMeshGroup"; break;
case FT_BelongToGeom: myStream<< "aBelongToGeom"; break;
return aResult._retn();
}
+/*
+ Class : Deflection2D_i
+ Description : Functor for calculating distance between a face and geometry
+*/
+Deflection2D_i::Deflection2D_i()
+{
+ myNumericalFunctorPtr.reset( new Controls::Deflection2D() );
+ myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType Deflection2D_i::GetFunctorType()
+{
+ return SMESH::FT_Deflection2D;
+}
+
/*
Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge
return anObj._retn();
}
+Deflection2D_ptr FilterManager_i::CreateDeflection2D()
+{
+ SMESH::Deflection2D_i* aServant = new SMESH::Deflection2D_i();
+ SMESH::Deflection2D_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateLength2D()";
+ return anObj._retn();
+}
+
MultiConnection_ptr FilterManager_i::CreateMultiConnection()
{
SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i();
case SMESH::FT_Length2D:
aFunctor = aFilterMgr->CreateLength2D();
break;
+ case SMESH::FT_Deflection2D:
+ aFunctor = aFilterMgr->CreateDeflection2D();
+ break;
case SMESH::FT_AspectRatio:
aFunctor = aFilterMgr->CreateAspectRatio();
break;
case FT_EqualFaces : return "Equal faces";
case FT_EqualVolumes : return "Equal volumes";
case FT_MultiConnection : return "Borders at multi-connections";
- case FT_MultiConnection2D :return "Borders at multi-connections 2D";
+ case FT_MultiConnection2D : return "Borders at multi-connections 2D";
case FT_Length : return "Length";
case FT_Length2D : return "Length 2D";
+ case FT_Deflection2D : return "Deflection 2D";
case FT_LessThan : return "Less than";
case FT_MoreThan : return "More than";
case FT_EqualTo : return "Equal to";
case FT_LogicalOR : return "Or";
case FT_GroupColor : return "Color of Group";
case FT_LinearOrQuadratic : return "Linear or Quadratic";
- case FT_ElemGeomType : return "Element geomtry type";
+ case FT_ElemGeomType : return "Element geometry type";
case FT_EntityType : return "Entity type";
case FT_Undefined : return "";
default : return "";
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Length" ) ) return FT_Length;
// else if ( theStr.equals( "Length2D" ) ) return FT_Length2D;
+ else if ( theStr.equals( "Deflection" ) ) return FT_Deflection2D;
else if ( theStr.equals( "Range of IDs" ) ) return FT_RangeOfIds;
else if ( theStr.equals( "Bad Oriented Volume" ) ) return FT_BadOrientedVolume;
else if ( theStr.equals( "Volumes with bare border" ) ) return FT_BareBorderVolume;
else if ( theStr.equals( "Or" ) ) return FT_LogicalOR;
else if ( theStr.equals( "Color of Group" ) ) return FT_GroupColor;
else if ( theStr.equals( "Linear or Quadratic" ) ) return FT_LinearOrQuadratic;
- else if ( theStr.equals( "Element geomtry type" ) ) return FT_ElemGeomType;
+ else if ( theStr.equals( "Element geometry type" ) ) return FT_ElemGeomType;
else if ( theStr.equals( "Entity type" ) ) return FT_EntityType;
else if ( theStr.equals( "" ) ) return FT_Undefined;
else return FT_Undefined;
"FT_MultiConnection2D",
"FT_Length",
"FT_Length2D",
+ "FT_Deflection2D",
"FT_NodeConnectivityNumber",
"FT_BelongToMeshGroup",
"FT_BelongToGeom",
"FT_LinearOrQuadratic",
"FT_GroupColor",
"FT_ElemGeomType",
- "FT_EntityType",
+ "FT_EntityType",
"FT_CoplanarFaces",
"FT_BallDiameter",
"FT_ConnectedElements",
Length2D_i();
SMESH::Length2D::Values* GetValues();
FunctorType GetFunctorType();
-
+
protected:
Controls::Length2DPtr myLength2DPtr;
};
-
+
+ /*
+ Class : Deflection2D_i
+ Description : Functor for calculating distance between a face and geometry
+ */
+ class SMESH_I_EXPORT Deflection2D_i: public virtual POA_SMESH::Deflection2D,
+ public virtual NumericalFunctor_i
+ {
+ public:
+ Deflection2D_i();
+ FunctorType GetFunctorType();
+ };
+
/*
Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge
MaxElementLength3D_ptr CreateMaxElementLength3D();
Length_ptr CreateLength();
Length2D_ptr CreateLength2D();
+ Deflection2D_ptr CreateDeflection2D();
NodeConnectivityNumber_ptr CreateNodeConnectivityNumber();
MultiConnection_ptr CreateMultiConnection();
MultiConnection2D_ptr CreateMultiConnection2D();
// "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<SMESHDS_SubMesh*> aEdgeSM, aFaceSM;
// loop on SMESHDS_SubMesh'es
// and then "GetGroups" using SMESH_Mesh::GetGroups()
TPythonDump pydump; // to prevent dump at mesh creation
- mesh = makeMesh( theMeshName );
+ mesh = makeMesh( theMeshName );
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
if ( mesh_i )
return 0;
}
+//=======================================================================
+//function : IsManifold
+//purpose : Check if a 2D mesh is manifold
+//=======================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::IsManifold()
+ throw (SALOME::SALOME_Exception)
+{
+ bool isManifold = true;
+
+ SMESH_TRY;
+ SMESH_MeshAlgos::TFreeBorderVec foundFreeBordes;
+ SMESH_MeshAlgos::FindFreeBorders( *getMeshDS(),
+ foundFreeBordes,
+ /*closedOnly=*/true,
+ &isManifold );
+ SMESH_CATCH( SMESH::throwCorbaException );
+
+ return isManifold;
+}
+
+//=======================================================================
+//function : IsCoherentOrientation2D
+//purpose : Check if orientation of 2D elements is coherent
+//=======================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::IsCoherentOrientation2D()
+ throw (SALOME::SALOME_Exception)
+{
+ bool isGoodOri = true;
+
+ SMESH_TRY;
+ SMESH_MeshAlgos::TFreeBorderVec foundFreeBordes;
+ SMESH_MeshAlgos::FindFreeBorders( *getMeshDS(),
+ foundFreeBordes,
+ /*closedOnly=*/true,
+ /*isManifold=*/0,
+ &isGoodOri);
+ SMESH_CATCH( SMESH::throwCorbaException );
+
+ return isGoodOri;
+}
+
+//=======================================================================
+//function : FindFreeBorders
+//purpose : Returns all or only closed FreeBorder's.
+//=======================================================================
+
+SMESH::ListOfFreeBorders* SMESH_MeshEditor_i::FindFreeBorders(CORBA::Boolean closedOnly)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH::ListOfFreeBorders_var resBorders = new SMESH::ListOfFreeBorders;
+ SMESH_TRY;
+
+ SMESH_MeshAlgos::TFreeBorderVec foundFreeBordes;
+ SMESH_MeshAlgos::FindFreeBorders( *getMeshDS(), foundFreeBordes, closedOnly );
+
+ resBorders->length( foundFreeBordes.size() );
+ for ( size_t i = 0; i < foundFreeBordes.size(); ++i )
+ {
+ const SMESH_MeshAlgos::TFreeBorder& bordNodes = foundFreeBordes[i];
+ SMESH::FreeBorder& bordOut = resBorders[i];
+ bordOut.nodeIDs.length( bordNodes.size() );
+ for ( size_t iN = 0; iN < bordNodes.size(); ++iN )
+ bordOut.nodeIDs[ iN ] = bordNodes[ iN ]->GetID();
+ }
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+
+ return resBorders._retn();
+}
+
+//=======================================================================
+//function : FillHole
+//purpose : Fill with 2D elements a hole defined by a FreeBorder.
+//=======================================================================
+
+void SMESH_MeshEditor_i::FillHole(const SMESH::FreeBorder& theHole)
+ throw (SALOME::SALOME_Exception)
+{
+ initData();
+
+ if ( theHole.nodeIDs.length() < 4 )
+ THROW_SALOME_CORBA_EXCEPTION("A hole should be bound by at least 3 nodes", SALOME::BAD_PARAM);
+ if ( theHole.nodeIDs[0] != theHole.nodeIDs[ theHole.nodeIDs.length()-1 ] )
+ THROW_SALOME_CORBA_EXCEPTION("Not closed hole boundary. "
+ "First and last nodes must be same", SALOME::BAD_PARAM);
+
+ SMESH_MeshAlgos::TFreeBorder bordNodes;
+ bordNodes.resize( theHole.nodeIDs.length() );
+ for ( size_t iN = 0; iN < theHole.nodeIDs.length(); ++iN )
+ {
+ bordNodes[ iN ] = getMeshDS()->FindNode( theHole.nodeIDs[ iN ]);
+ if ( !bordNodes[ iN ] )
+ THROW_SALOME_CORBA_EXCEPTION(SMESH_Comment("Node #") << theHole.nodeIDs[ iN ]
+ << " does not exist", SALOME::BAD_PARAM);
+ }
+
+ SMESH_TRY;
+
+ MeshEditor_I::TPreviewMesh* previewMesh = 0;
+ SMDS_Mesh* meshDS = getMeshDS();
+ if ( myIsPreviewMode )
+ {
+ // copy faces sharing nodes of theHole
+ TIDSortedElemSet holeFaces;
+ previewMesh = getPreviewMesh( SMDSAbs_Face );
+ for ( size_t i = 0; i < bordNodes.size(); ++i )
+ {
+ SMDS_ElemIteratorPtr fIt = bordNodes[i]->GetInverseElementIterator( SMDSAbs_Face );
+ while ( fIt->more() )
+ {
+ const SMDS_MeshElement* face = fIt->next();
+ if ( holeFaces.insert( face ).second )
+ previewMesh->Copy( face );
+ }
+ bordNodes[i] = previewMesh->GetMeshDS()->FindNode( bordNodes[i]->GetID() );
+ ASSERT( bordNodes[i] );
+ }
+ meshDS = previewMesh->GetMeshDS();
+ }
+
+ std::vector<const SMDS_MeshElement*> newFaces;
+ SMESH_MeshAlgos::FillHole( bordNodes, *meshDS, newFaces );
+
+ if ( myIsPreviewMode )
+ {
+ previewMesh->Clear();
+ for ( size_t i = 0; i < newFaces.size(); ++i )
+ previewMesh->Copy( newFaces[i] );
+ }
+ else
+ {
+ getEditor().ClearLastCreated();
+ SMESH_SequenceOfElemPtr& aSeq =
+ const_cast<SMESH_SequenceOfElemPtr&>( getEditor().GetLastCreatedElems() );
+ for ( size_t i = 0; i < newFaces.size(); ++i )
+ aSeq.Append( newFaces[i] );
+
+ TPythonDump() << this << ".FillHole( SMESH.FreeBorder(" << theHole.nodeIDs << " ))";
+ }
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
//=======================================================================
//function : convError
//purpose :
SMESH::ElementType type)
throw (SALOME::SALOME_Exception);
/*!
- * Searching among the given elements, return elements of given type
+ * Searching among the given elements, return elements of given type
* where the given point is IN or ON.
* 'ALL' type means elements of any type excluding nodes
*/
CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z)
throw (SALOME::SALOME_Exception);
+ /*!
+ * Check if a 2D mesh is manifold
+ */
+ CORBA::Boolean IsManifold()
+ throw (SALOME::SALOME_Exception);
+
+ /*!
+ * Check if orientation of 2D elements is coherent
+ */
+ CORBA::Boolean IsCoherentOrientation2D()
+ throw (SALOME::SALOME_Exception);
+
+ /*!
+ * Returns all or only closed FreeBorder's.
+ */
+ SMESH::ListOfFreeBorders* FindFreeBorders(CORBA::Boolean closedOnly)
+ throw (SALOME::SALOME_Exception);
+
+ /*!
+ * Fill with 2D elements a hole defined by a FreeBorder.
+ */
+ void FillHole(const SMESH::FreeBorder& hole)
+ throw (SALOME::SALOME_Exception);
+
SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
CORBA::Boolean createPolygons,
throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Sew_Error
- SewFreeBorders(CORBA::Long FirstNodeID1,
- CORBA::Long SecondNodeID1,
- CORBA::Long LastNodeID1,
- CORBA::Long FirstNodeID2,
- CORBA::Long SecondNodeID2,
- CORBA::Long LastNodeID2,
- CORBA::Boolean CreatePolygons,
- CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
+ SewFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2,
+ CORBA::Long LastNodeID2,
+ CORBA::Boolean CreatePolygons,
+ CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Sew_Error
- SewConformFreeBorders(CORBA::Long FirstNodeID1,
- CORBA::Long SecondNodeID1,
- CORBA::Long LastNodeID1,
- CORBA::Long FirstNodeID2,
- CORBA::Long SecondNodeID2) throw (SALOME::SALOME_Exception);
+ SewConformFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2) throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Sew_Error
- SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
- CORBA::Long SecondNodeIDOnFreeBorder,
- CORBA::Long LastNodeIDOnFreeBorder,
- CORBA::Long FirstNodeIDOnSide,
- CORBA::Long LastNodeIDOnSide,
- CORBA::Boolean CreatePolygons,
- CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
+ SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
+ CORBA::Long SecondNodeIDOnFreeBorder,
+ CORBA::Long LastNodeIDOnFreeBorder,
+ CORBA::Long FirstNodeIDOnSide,
+ CORBA::Long LastNodeIDOnSide,
+ CORBA::Boolean CreatePolygons,
+ CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Sew_Error
- SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
- const SMESH::long_array& IDsOfSide2Elements,
- CORBA::Long NodeID1OfSide1ToMerge,
- CORBA::Long NodeID1OfSide2ToMerge,
- CORBA::Long NodeID2OfSide1ToMerge,
- CORBA::Long NodeID2OfSide2ToMerge) throw (SALOME::SALOME_Exception);
+ SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
+ const SMESH::long_array& IDsOfSide2Elements,
+ CORBA::Long NodeID1OfSide1ToMerge,
+ CORBA::Long NodeID1OfSide2ToMerge,
+ CORBA::Long NodeID2OfSide1ToMerge,
+ CORBA::Long NodeID2OfSide2ToMerge) throw (SALOME::SALOME_Exception);
/*!
* Set new nodes for given element.
#define __SMESH_MeshPartDS_HXX__
#include "SMESHDS_Mesh.hxx"
+#include "SMESH_TypeDefs.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
virtual SMDS_ElemIteratorPtr elementGeomIterator(SMDSAbs_GeometryType type) const;
virtual SMDS_ElemIteratorPtr elementEntityIterator(SMDSAbs_EntityType type) const;
+ virtual const SMDS_MeshElement *FindElement(int IDelem) const;
+
private:
TIDSortedElemSet _elements[ SMDSAbs_NbElementTypes ];
SMESHDS_Mesh* _meshDS;
{
void Add(const SMDS_MeshElement* e) { SMDS_MeshInfo::addWithPoly( e ); }
};
+ /*!
+ * \brief Element holing its ID only
+ */
+ struct TElemID : public SMDS_MeshElement
+ {
+ TElemID(int ID) : SMDS_MeshElement( ID ) {}
+ virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_All; }
+ virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Last; }
+ virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_NONE; }
+ virtual vtkIdType GetVtkType() const { return -1; }
+ };
};
#endif
SMESH::SMESH_Mesh_var mesh = meshPart->GetMesh();
SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+ mesh_i->Load();
_meshDS = mesh_i->GetImpl().GetMeshDS();
SetPersistentId( _meshDS->GetPersistentId() );
myInfo = tmpInfo;
}
// -------------------------------------------------------------------------------------
+const SMDS_MeshElement * SMESH_MeshPartDS::FindElement(int IDelem) const
+{
+ if ( _meshDS ) return _meshDS->FindElement( IDelem );
+
+ TElemID elem( IDelem );
+ for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
+ if ( !_elements[ iType ].empty() )
+ {
+ TIDSortedElemSet::const_iterator it = _elements[ iType ].find( &elem );
+ if ( it != _elements[ iType ].end() )
+ return *it;
+ }
+ return 0;
+}
+// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
{
if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );
## 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
functor = aFilterMgr.CreateLength()
elif theCriterion == FT_Length2D:
functor = aFilterMgr.CreateLength2D()
+ elif theCriterion == FT_Deflection2D:
+ functor = aFilterMgr.CreateDeflection2D()
elif theCriterion == FT_NodeConnectivityNumber:
functor = aFilterMgr.CreateNodeConnectivityNumber()
elif theCriterion == FT_BallDiameter:
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):
def GetPointState(self, x, y, z):
return self.editor.GetPointState(x, y, z)
+ ## Check if a 2D mesh is manifold
+ # @ingroup l1_controls
+ def IsManifold(self):
+ return self.editor.IsManifold()
+
+ ## Check if orientation of 2D elements is coherent
+ # @ingroup l1_controls
+ def IsCoherentOrientation2D(self):
+ return self.editor.IsCoherentOrientation2D()
+
## Find the node closest to a point and moves it to a point location
# @param x the X coordinate of a point
# @param y the Y coordinate of a point
# Type SMESH.FunctorType._items in the Python Console to see all items.
# Note that not all items correspond to numerical functors.
# @param MaxAngle is the maximum angle between element normals at which the fusion
- # is still performed; theMaxAngle is mesured in radians.
+ # is still performed; theMaxAngle is measured in radians.
# Also it could be a name of variable which defines angle in degrees.
# @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_unitetri
# Type SMESH.FunctorType._items in the Python Console to see all items.
# Note that not all items correspond to numerical functors.
# @param MaxAngle a max angle between element normals at which the fusion
- # is still performed; theMaxAngle is mesured in radians.
+ # is still performed; theMaxAngle is measured in radians.
# @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_unitetri
def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
def MergeEqualElements(self):
self.editor.MergeEqualElements()
+ ## Returns all or only closed free borders
+ # @return list of SMESH.FreeBorder's
+ # @ingroup l2_modif_trsf
+ def FindFreeBorders(self, ClosedOnly=True):
+ return self.editor.FindFreeBorders( ClosedOnly )
+
+ ## Fill with 2D elements a hole defined by a SMESH.FreeBorder.
+ # @param FreeBorder either a SMESH.FreeBorder or a list on node IDs. These nodes
+ # must describe all sequential nodes of the hole border. The first and the last
+ # nodes must be the same. Use FindFreeBorders() to get nodes of holes.
+ # @ingroup l2_modif_trsf
+ def FillHole(self, holeNodes):
+ if holeNodes and isinstance( holeNodes, list ) and isinstance( holeNodes[0], int ):
+ holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes)
+ if not isinstance( holeNodes, SMESH.FreeBorder ):
+ raise TypeError, "holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes
+ self.editor.FillHole( holeNodes )
+
## Return groups of FreeBorder's coincident within the given tolerance.
# @param tolerance the tolerance. If the tolerance <= 0.0 then one tenth of an average
# size of elements adjacent to free borders being compared is used.
## 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)
def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords):
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
- def _getFunctor(self, funcType ):
+ ## Return a cached numerical functor by its type.
+ # @param theCriterion functor type - an item of SMESH.FunctorType enumeration.
+ # Type SMESH.FunctorType._items in the Python Console to see all items.
+ # Note that not all items correspond to numerical functors.
+ # @return SMESH_NumericalFunctor. The functor is already initialized
+ # with a mesh
+ # @ingroup l1_measurements
+ def GetFunctor(self, funcType ):
fn = self.functors[ funcType._v ]
if not fn:
fn = self.smeshpyD.GetFunctor(funcType)
# @return the functor value or zero in case of invalid arguments
# @ingroup l1_measurements
def FunctorValue(self, funcType, elemId, isElem=True):
- fn = self._getFunctor( funcType )
+ fn = self.GetFunctor( funcType )
if fn.GetElementType() == self.GetElementType(elemId, isElem):
val = fn.GetValue(elemId)
else:
unRegister.set( meshPart )
if isinstance( meshPart, Mesh ):
meshPart = meshPart.mesh
- fun = self._getFunctor( funType )
+ fun = self.GetFunctor( funType )
if fun:
if meshPart:
if hasattr( meshPart, "SetMesh" ):
if not algoType:
algoType = self.defaultAlgoType
if not algoType and self.algoTypeToClass:
- algoType = self.algoTypeToClass.keys()[0]
+ algoType = sorted( self.algoTypeToClass.keys() )[0]
if self.algoTypeToClass.has_key( algoType ):
#print "Create algo",algoType
return self.algoTypeToClass[ algoType ]( self.mesh, shape )
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
const SMDS_MeshElement* cornerQuad,
const SMDS_MeshNode* nCorner)
{
- // Find out size of block side mesured in nodes and by the way find two rows
+ // Find out size of block side measured in nodes and by the way find two rows
// of nodes in two directions.
int x, y, nbX, nbY;
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
{
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 ]];
</message>
<message>
<source>SMESH_DISTR_EXPR</source>
- <translation>Distribution with analitic density</translation>
+ <translation>Distribution with analytic density</translation>
</message>
<message>
<source>SMESH_DISTR_REGULAR</source>
def RevolveMesh(MainMesh,**args):
"""
- This function premits to revolute and scale a 2D mesh while transforming the edge
+ This function permits to revolute and scale a 2D mesh while transforming the edge
groups into face groups. Moreover, the function automatically creates the face groups
corresponding to the symmetry lower and upper faces
Facultatif arguments are :
def ExtrudeMesh(MainMesh,**args):
"""
- This function premits to extrude and scale a 2D mesh while transforming the edge
+ This function permits to extrude and scale a 2D mesh while transforming the edge
groups into face groups. Moreover, the function automatically creates the face groups
corresponding to the symmetry lower and upper faces
Facultatif arguments are :
// Lecture des infos concernant le premier maillage
if (MEDmeshInfo(fid, 1, maa, &spacedim, &mdim, &type, desc, dtunit, &sortingtype, &nPasTemps, &axistype, axisname,
unitname) < 0)
- ERREUR("Error while reading mesh informations ");
+ ERREUR("Error while reading mesh information ");
//cout << chrono() << " --- inputMED: MEDmeshInfo: OK" << endl;
// cerr << "maa=" << maa << endl;
- **File**
-You can change the file used to store remeshing hypotheses, see :ref:`hypothesis-label` for further informations.
+You can change the file used to store remeshing hypotheses, see :ref:`hypothesis-label` for further information.
.. image:: images/Generic.png
:align: center
//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:
// >>>
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;
// 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;
// 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;
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<std::string, MESHJOB::ConfigParameter> _configMap;