#include "DriverUNV_R_SMDS_Mesh.h"
#include "DriverSTL_R_SMDS_Mesh.h"
+#include <BRepBndLib.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
+#include <Bnd_Box.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
_myMeshDS = theDocument->GetMesh(_idDoc);
_isShapeToMesh = false;
_isAutoColor = false;
+ _shapeDiagonal = 0.0;
_myMeshDS->ShapeToMesh( PseudoShape() );
}
// clear SMESHDS
TopoDS_Shape aNullShape;
_myMeshDS->ShapeToMesh( aNullShape );
+
+ _shapeDiagonal = 0.0;
}
// set a new geometry
return aSolid;
}
+//=======================================================================
+/*!
+ * \brief Return diagonal size of bounding box of a shape
+ */
+//=======================================================================
+
+double SMESH_Mesh::GetShapeDiagonalSize(const TopoDS_Shape & aShape)
+{
+ Bnd_Box Box;
+ BRepBndLib::Add(aShape, Box);
+ return sqrt( Box.SquareExtent() );
+}
+
+//=======================================================================
+/*!
+ * \brief Return diagonal size of bounding box of shape to mesh
+ */
+//=======================================================================
+
+double SMESH_Mesh::GetShapeDiagonalSize() const
+{
+ if ( _shapeDiagonal == 0. && _isShapeToMesh )
+ const_cast<SMESH_Mesh*>(this)->_shapeDiagonal = GetShapeDiagonalSize( GetShapeToMesh() );
+
+ return _shapeDiagonal;
+}
+
//=======================================================================
/*!
* \brief Remove all nodes and elements
* \brief Return true if there is a geometry to be meshed, not PseudoShape()
*/
bool HasShapeToMesh() const { return _isShapeToMesh; }
+ /*!
+ * \brief Return diagonal size of bounding box of shape to mesh.
+ */
+ double GetShapeDiagonalSize() const;
+ /*!
+ * \brief Return diagonal size of bounding box of a shape.
+ */
+ static double GetShapeDiagonalSize(const TopoDS_Shape & aShape);
/*!
* \brief Return a solid which is returned by GetShapeToMesh() if
* a real geometry to be meshed was not set
std::list <const SMESHDS_Hypothesis * >& aHypList,
const bool andAncestors) const;
+ void SetNbElementsPerDiagonal(int nb) { _nbElemPerDiagonal = nb ;}
+
+ int GetNbElementsPerDiagonal() { return _nbElemPerDiagonal; }
+
const std::list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
void ClearLog() throw(SALOME_Exception);
SMESH_Gen * _gen;
bool _isAutoColor;
+
+ double _shapeDiagonal; //!< diagonal size of bounding box of shape to mesh
+ int _nbElemPerDiagonal; //!< nb elements per diagonal
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;