Salome HOME
IMP 10199 (add Volume Control). Add Volume NumericalFunctor.
[modules/smesh.git] / src / Controls / SMESH_Controls.cxx
index 0714f7ea4b8027f389c0dea1d8ae4a6b41dcc161..3ebd18b907798734bf2ebb70ef940725c955589b 100644 (file)
@@ -204,6 +204,42 @@ double NumericalFunctor::GetValue( long theId )
   return 0.;
 }
 
+//=======================================================================
+//function : GetValue
+//purpose  : 
+//=======================================================================
+
+double Volume::GetValue( long theElementId )
+{
+  if ( theElementId && myMesh ) {
+    SMDS_VolumeTool aVolumeTool;
+    if ( aVolumeTool.Set( myMesh->FindElement( theElementId )))
+      return aVolumeTool.GetSize();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : GetBadRate
+//purpose  : meaningless as it is not quality control functor
+//=======================================================================
+
+double Volume::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+  return Value;
+}
+
+//=======================================================================
+//function : GetType
+//purpose  : 
+//=======================================================================
+
+SMDSAbs_ElementType Volume::GetType() const
+{
+  return SMDSAbs_Volume;
+}
+
+
 /*
   Class       : MinimumAngle
   Description : Functor for calculation of minimum angle
@@ -253,7 +289,13 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
 
   // Compute lengths of the sides
 
-  double aLen[ nbNodes ];
+  //double aLen[ nbNodes ];
+#ifndef WNT
+  double aLen [nbNodes];
+#else
+  double* aLen = (double *)new double[nbNodes];
+#endif
+
   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 ) );
@@ -279,6 +321,9 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
       aMinLen = Min( aMinLen, aLen[ i ] );
       aMaxLen = Max( aMaxLen, aLen[ i ] );
     }
+#ifdef WNT
+  delete [] aLen;
+#endif
     if ( aMinLen <= Precision::Confusion() )
       return 0.;
 
@@ -783,6 +828,7 @@ double Area::GetValue( const TSequenceOfXYZ& P )
 
 double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
@@ -803,6 +849,7 @@ double Length::GetValue( const TSequenceOfXYZ& P )
 
 double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
@@ -934,6 +981,7 @@ double Length2D::GetValue( long theElementId)
 
 double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
@@ -1013,6 +1061,7 @@ double MultiConnection::GetValue( long theId )
 
 double MultiConnection::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
@@ -1090,6 +1139,7 @@ double MultiConnection2D::GetValue( long theElementId )
 
 double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
@@ -1270,7 +1320,12 @@ bool FreeEdges::IsSatisfy( long theId )
     return false;
 
   int nbNodes = aFace->NbNodes();
-  const SMDS_MeshNode* aNodes[ nbNodes ];
+  //const SMDS_MeshNode* aNodes[ nbNodes ];
+#ifndef WNT
+  const SMDS_MeshNode* aNodes [nbNodes];
+#else
+  const SMDS_MeshNode** aNodes = (const SMDS_MeshNode **)new SMDS_MeshNode*[nbNodes];
+#endif
   int i = 0;
   SMDS_ElemIteratorPtr anIter = aFace->nodesIterator();
   if ( anIter != 0 )
@@ -1285,13 +1340,20 @@ bool FreeEdges::IsSatisfy( long theId )
   }
 
   for ( int i = 0; i < nbNodes - 1; i++ )
-    if ( IsFreeEdge( &aNodes[ i ], theId ) )
+         if ( IsFreeEdge( &aNodes[ i ], theId ) ) {
+#ifdef WNT
+               delete [] aNodes;
+#endif
       return true;
+         }
 
   aNodes[ 1 ] = aNodes[ nbNodes - 1 ];
-
-  return IsFreeEdge( &aNodes[ 0 ], theId );
-
+  const Standard_Boolean isFree = IsFreeEdge( &aNodes[ 0 ], theId );
+#ifdef WNT
+               delete [] aNodes;
+#endif
+//  return 
+ return isFree;
 }
 
 SMDSAbs_ElementType FreeEdges::GetType() const
@@ -2138,7 +2200,7 @@ void ManifoldPart::expandBoundary
 {
   ManifoldPart::TVectorOfLink aLinks;
   getLinks( theNextFace, aLinks );
-  int aNbLink = aLinks.size();
+  int aNbLink = (int)aLinks.size();
   for ( int i = 0; i < aNbLink; i++ )
   {
     ManifoldPart::Link aLink = aLinks[ i ];