return ar;
}
- else { // nbNodes==8 - quadratic quadrangle
+ else if( nbNodes == 8 ){ // nbNodes==8 - quadratic quadrangle
// return aspect ratio of the worst triange which can be built
// taking three nodes of the quadrangle
TSequenceOfXYZ triaPnts(3);
return ar;
}
+ return 0;
}
double AspectRatio::GetBadRate( double Value, int /*nbNodes*/ ) const
*/
double Area::GetValue( const TSequenceOfXYZ& P )
{
- gp_Vec aVec1( P(2) - P(1) );
- gp_Vec aVec2( P(3) - P(1) );
- gp_Vec SumVec = aVec1 ^ aVec2;
- for (int i=4; i<=P.size(); i++) {
- gp_Vec aVec1( P(i-1) - P(1) );
- gp_Vec aVec2( P(i) - P(1) );
- gp_Vec tmp = aVec1 ^ aVec2;
- SumVec.Add(tmp);
+ double val = 0.0;
+ if ( P.size() > 2 ) {
+ gp_Vec aVec1( P(2) - P(1) );
+ gp_Vec aVec2( P(3) - P(1) );
+ gp_Vec SumVec = aVec1 ^ aVec2;
+ for (int i=4; i<=P.size(); i++) {
+ gp_Vec aVec1( P(i-1) - P(1) );
+ gp_Vec aVec2( P(i) - P(1) );
+ gp_Vec tmp = aVec1 ^ aVec2;
+ SumVec.Add(tmp);
+ }
+ val = SumVec.Magnitude() * 0.5;
}
- return SumVec.Magnitude() * 0.5;
+ return val;
}
double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
## @defgroup l2_modif_tofromqu Convert to/from Quadratic Mesh
## @}
+## @defgroup l1_measurements Measurements
import salome
import geompyDC
def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape)
+ def _valueFromFunctor(self, funcType, elemId):
+ fn = self.smeshpyD.GetFunctor(funcType)
+ fn.SetMesh(self.mesh)
+ if fn.GetElementType() == self.GetElementType(elemId, True):
+ val = fn.GetValue(elemId)
+ else:
+ val = 0
+ return val
+
+ ## Get length of 1D element.
+ # @param elemId mesh element ID
+ # @return element's length value
+ # @ingroup l1_measurements
+ def GetLength(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Length, elemId)
+
+ ## Get area of 2D element.
+ # @param elemId mesh element ID
+ # @return element's area value
+ # @ingroup l1_measurements
+ def GetArea(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Area, elemId)
+
+ ## Get volume of 3D element.
+ # @param elemId mesh element ID
+ # @return element's volume value
+ # @ingroup l1_measurements
+ def GetVolume(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
+
+ ## Get aspect ratio of 2D or 3D element.
+ # @param elemId mesh element ID
+ # @return element's aspect ratio value
+ # @ingroup l1_measurements
+ def GetAspectRatio(self, elemId):
+ if self.GetElementType(elemId, True) == SMESH.VOLUME:
+ ftype = SMESH.FT_AspectRatio3D
+ else:
+ ftype = SMESH.FT_AspectRatio
+ return self._valueFromFunctor(ftype, elemId)
+
+ ## Get warping angle of 2D element.
+ # @param elemId mesh element ID
+ # @return element's warping angle value
+ # @ingroup l1_measurements
+ def GetWarping(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Warping, elemId)
+
+ ## Get minimum angle of 2D element.
+ # @param elemId mesh element ID
+ # @return element's minimum angle value
+ # @ingroup l1_measurements
+ def GetMinimumAngle(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_MinimumAngle, elemId)
+
+ ## Get taper of 2D element.
+ # @param elemId mesh element ID
+ # @return element's taper value
+ # @ingroup l1_measurements
+ def GetTaper(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Taper, elemId)
+
+ ## Get skew of 2D element.
+ # @param elemId mesh element ID
+ # @return element's skew value
+ # @ingroup l1_measurements
+ def GetSkew(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Skew, elemId)
+
## The mother class to define algorithm, it is not recommended to use it directly.
#
# More details.