mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 21:10:32 +05:00
0019923: EDF 765 SMESH : default values of hypothesis
add access methods to new fields + double _shapeDiagonal; //!< diagonal size of bounding box of shape to mesh + int _nbElemPerDiagonal; //!< nb elements per diagonal
This commit is contained in:
parent
2420f68007
commit
95e7e98096
@ -50,7 +50,9 @@
|
||||
#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>
|
||||
@ -95,6 +97,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
|
||||
_myMeshDS = theDocument->GetMesh(_idDoc);
|
||||
_isShapeToMesh = false;
|
||||
_isAutoColor = false;
|
||||
_shapeDiagonal = 0.0;
|
||||
_myMeshDS->ShapeToMesh( PseudoShape() );
|
||||
}
|
||||
|
||||
@ -155,6 +158,8 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||
// clear SMESHDS
|
||||
TopoDS_Shape aNullShape;
|
||||
_myMeshDS->ShapeToMesh( aNullShape );
|
||||
|
||||
_shapeDiagonal = 0.0;
|
||||
}
|
||||
|
||||
// set a new geometry
|
||||
@ -202,6 +207,33 @@ const TopoDS_Solid& SMESH_Mesh::PseudoShape()
|
||||
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
|
||||
|
@ -76,6 +76,14 @@ public:
|
||||
* \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
|
||||
@ -122,6 +130,10 @@ public:
|
||||
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);
|
||||
@ -260,6 +272,9 @@ protected:
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user