mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
PAL13504 (Mesh from an imported mesh)
add PseudoShape(), HasShapeToMesh()
This commit is contained in:
parent
c0e60da668
commit
b4888f2b96
@ -49,6 +49,7 @@
|
|||||||
#include "DriverSTL_R_SMDS_Mesh.h"
|
#include "DriverSTL_R_SMDS_Mesh.h"
|
||||||
|
|
||||||
#include <BRepTools_WireExplorer.hxx>
|
#include <BRepTools_WireExplorer.hxx>
|
||||||
|
#include <BRepPrimAPI_MakeBox.hxx>
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
@ -94,6 +95,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
|
|||||||
_myDocument = theDocument;
|
_myDocument = theDocument;
|
||||||
_idDoc = theDocument->NewMesh(theIsEmbeddedMode);
|
_idDoc = theDocument->NewMesh(theIsEmbeddedMode);
|
||||||
_myMeshDS = theDocument->GetMesh(_idDoc);
|
_myMeshDS = theDocument->GetMesh(_idDoc);
|
||||||
|
_myMeshDS->ShapeToMesh( PseudoShape() );
|
||||||
_isShapeToMesh = false;
|
_isShapeToMesh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +119,7 @@ SMESH_Mesh::~SMESH_Mesh()
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
* \brief Set geometry to be meshed
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
@ -125,7 +127,11 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
|||||||
{
|
{
|
||||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::ShapeToMesh");
|
if(MYDEBUG) MESSAGE("SMESH_Mesh::ShapeToMesh");
|
||||||
|
|
||||||
if ( !_myMeshDS->ShapeToMesh().IsNull() && aShape.IsNull() )
|
if ( !aShape.IsNull() && _isShapeToMesh )
|
||||||
|
throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined"));
|
||||||
|
|
||||||
|
// clear current data
|
||||||
|
if ( !_myMeshDS->ShapeToMesh().IsNull() )
|
||||||
{
|
{
|
||||||
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
||||||
// - sub-meshes
|
// - sub-meshes
|
||||||
@ -144,28 +150,57 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
|||||||
else
|
else
|
||||||
i_gr++;
|
i_gr++;
|
||||||
}
|
}
|
||||||
|
_mapAncestors.Clear();
|
||||||
_mapPropagationChains.Clear();
|
_mapPropagationChains.Clear();
|
||||||
|
|
||||||
|
// clear SMESHDS
|
||||||
|
TopoDS_Shape aNullShape;
|
||||||
|
_myMeshDS->ShapeToMesh( aNullShape );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// set a new geometry
|
||||||
|
if ( !aShape.IsNull() )
|
||||||
{
|
{
|
||||||
if (_isShapeToMesh)
|
_myMeshDS->ShapeToMesh(aShape);
|
||||||
throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined"));
|
_isShapeToMesh = true;
|
||||||
|
|
||||||
|
// fill _mapAncestors
|
||||||
|
int desType, ancType;
|
||||||
|
for ( desType = TopAbs_VERTEX; desType > TopAbs_COMPOUND; desType-- )
|
||||||
|
for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
|
||||||
|
TopExp::MapShapesAndAncestors ( aShape,
|
||||||
|
(TopAbs_ShapeEnum) desType,
|
||||||
|
(TopAbs_ShapeEnum) ancType,
|
||||||
|
_mapAncestors );
|
||||||
}
|
}
|
||||||
_isShapeToMesh = true;
|
}
|
||||||
_myMeshDS->ShapeToMesh(aShape);
|
|
||||||
|
|
||||||
// fill _mapAncestors
|
//=======================================================================
|
||||||
_mapAncestors.Clear();
|
/*!
|
||||||
int desType, ancType;
|
* \brief Return geometry to be meshed. (It may be a PseudoShape()!)
|
||||||
for ( desType = TopAbs_VERTEX; desType > TopAbs_COMPOUND; desType-- )
|
*/
|
||||||
for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
|
//=======================================================================
|
||||||
TopExp::MapShapesAndAncestors ( aShape,
|
|
||||||
(TopAbs_ShapeEnum) desType,
|
|
||||||
(TopAbs_ShapeEnum) ancType,
|
|
||||||
_mapAncestors );
|
|
||||||
|
|
||||||
// NRI : 24/02/03
|
TopoDS_Shape SMESH_Mesh::GetShapeToMesh() const
|
||||||
//EAP: 1/9/04 TopExp::MapShapes(aShape, _subShapes); USE the same map of _myMeshDS
|
{
|
||||||
|
return _myMeshDS->ShapeToMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return a solid which is returned by GetShapeToMesh() if
|
||||||
|
* a real geometry to be meshed was not set
|
||||||
|
*/
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
const TopoDS_Solid& SMESH_Mesh::PseudoShape()
|
||||||
|
{
|
||||||
|
static TopoDS_Solid aSolid;
|
||||||
|
if ( aSolid.IsNull() )
|
||||||
|
{
|
||||||
|
aSolid = BRepPrimAPI_MakeBox(1,1,1);
|
||||||
|
}
|
||||||
|
return aSolid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -494,17 +529,6 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
SMESHDS_Mesh * SMESH_Mesh::GetMeshDS()
|
|
||||||
{
|
|
||||||
return _myMeshDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
const list<const SMESHDS_Hypothesis*>&
|
const list<const SMESHDS_Hypothesis*>&
|
||||||
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
@ -649,29 +673,6 @@ void SMESH_Mesh::ClearLog() throw(SALOME_Exception)
|
|||||||
_myMeshDS->GetScript()->Clear();
|
_myMeshDS->GetScript()->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
int SMESH_Mesh::GetId()
|
|
||||||
{
|
|
||||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::GetId");
|
|
||||||
return _id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
SMESH_Gen *SMESH_Mesh::GetGen()
|
|
||||||
{
|
|
||||||
return _gen;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Get or Create the SMESH_subMesh object implementation
|
* Get or Create the SMESH_subMesh object implementation
|
||||||
@ -857,7 +858,8 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* t
|
|||||||
if ( GetHypotheses( aSubShape, compatibleHypoKind, usedHyps, true ) &&
|
if ( GetHypotheses( aSubShape, compatibleHypoKind, usedHyps, true ) &&
|
||||||
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
|
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
|
||||||
{
|
{
|
||||||
aSubMesh->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
|
aSubMesh->AlgoStateEngine(SMESH_subMesh::MODIF_HYP,
|
||||||
|
const_cast< SMESH_Hypothesis*>( hyp ));
|
||||||
|
|
||||||
if ( algo->GetDim() == 1 && IsPropagationHypothesis( aSubShape ))
|
if ( algo->GetDim() == 1 && IsPropagationHypothesis( aSubShape ))
|
||||||
CleanMeshOnPropagationChain( aSubShape );
|
CleanMeshOnPropagationChain( aSubShape );
|
||||||
|
@ -70,6 +70,7 @@ class SMESH_Group;
|
|||||||
class TopTools_ListOfShape;
|
class TopTools_ListOfShape;
|
||||||
class SMESH_subMesh;
|
class SMESH_subMesh;
|
||||||
class SMESH_HypoFilter;
|
class SMESH_HypoFilter;
|
||||||
|
class TopoDS_Solid;
|
||||||
|
|
||||||
//typedef NMTTools_IndexedDataMapOfShapeIndexedMapOfShape IndexedMapOfChain;
|
//typedef NMTTools_IndexedDataMapOfShapeIndexedMapOfShape IndexedMapOfChain;
|
||||||
typedef SMESH_IndexedDataMapOfShapeIndexedMapOfShape IndexedMapOfChain;
|
typedef SMESH_IndexedDataMapOfShapeIndexedMapOfShape IndexedMapOfChain;
|
||||||
@ -87,8 +88,25 @@ public:
|
|||||||
|
|
||||||
virtual ~SMESH_Mesh();
|
virtual ~SMESH_Mesh();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Set geometry to be meshed
|
||||||
|
*/
|
||||||
void ShapeToMesh(const TopoDS_Shape & aShape);
|
void ShapeToMesh(const TopoDS_Shape & aShape);
|
||||||
|
/*!
|
||||||
|
* \brief Return geometry to be meshed. (It may be a PseudoShape()!)
|
||||||
|
*/
|
||||||
|
TopoDS_Shape GetShapeToMesh() const;
|
||||||
|
/*!
|
||||||
|
* \brief Return true if there is a geometry to be meshed, not PseudoShape()
|
||||||
|
*/
|
||||||
|
bool HasShapeToMesh() const { return _isShapeToMesh; }
|
||||||
|
/*!
|
||||||
|
* \brief Return a solid which is returned by GetShapeToMesh() if
|
||||||
|
* a real geometry to be meshed was not set
|
||||||
|
*/
|
||||||
|
static const TopoDS_Solid& PseudoShape();
|
||||||
|
|
||||||
|
|
||||||
int UNVToMesh(const char* theFileName);
|
int UNVToMesh(const char* theFileName);
|
||||||
/*!
|
/*!
|
||||||
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
|
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
|
||||||
@ -122,11 +140,11 @@ public:
|
|||||||
|
|
||||||
void ClearLog() throw(SALOME_Exception);
|
void ClearLog() throw(SALOME_Exception);
|
||||||
|
|
||||||
int GetId();
|
int GetId() { return _id; }
|
||||||
|
|
||||||
SMESHDS_Mesh * GetMeshDS();
|
SMESHDS_Mesh * GetMeshDS() { return _myMeshDS; }
|
||||||
|
|
||||||
SMESH_Gen *GetGen();
|
SMESH_Gen *GetGen() { return _gen; }
|
||||||
|
|
||||||
SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
|
SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||||
throw(SALOME_Exception);
|
throw(SALOME_Exception);
|
||||||
|
Loading…
Reference in New Issue
Block a user