BRepMesh_FaceAttribute: distinguish constructor and parameters initialization.
init();
}
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+BRepMesh_FaceAttribute::BRepMesh_FaceAttribute(
+ const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
+ const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints)
+ : myDefFace (0.),
+ myUMin (0.),
+ myUMax (0.),
+ myVMin (0.),
+ myVMax (0.),
+ myDeltaX (1.),
+ myDeltaY (1.),
+ myMinStep (-1.),
+ myStatus (BRepMesh_NoError),
+ myAdaptiveMin (Standard_False),
+ myBoundaryVertices(theBoundaryVertices),
+ myBoundaryPoints (theBoundaryPoints)
+{
+}
+
//=======================================================================
//function : Constructor
//purpose :
const TopoDS_Face& theFace,
const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints,
- const Standard_Boolean theAdaptiveMin)
+ const Standard_Boolean theAdaptiveMin)
: myDefFace (0.),
myUMin (0.),
myUMax (0.),
{
}
+//=======================================================================
+//function : SetFace
+//purpose :
+//=======================================================================
+void BRepMesh_FaceAttribute::SetFace (
+ const TopoDS_Face& theFace,
+ const Standard_Boolean theAdaptiveMin)
+{
+ myFace = theFace;
+ myAdaptiveMin = theAdaptiveMin;
+
+ init ();
+}
+
//=======================================================================
//function : init
//purpose :
{
public:
+ //! Constructor. Initializes empty attribute.
+ //! @param theBoundaryVertices shared map of shape vertices.
+ //! @param theBoundaryPoints shared discretization points of shape boundaries.
+ Standard_EXPORT BRepMesh_FaceAttribute(
+ const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
+ const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints);
+
//! Constructor.
//! @param theFace face the attribute is created for.
//! Used for default initialization. Attribute keeps reference
const TopoDS_Face& theFace,
const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints,
- const Standard_Boolean theAdaptiveMin);
+ const Standard_Boolean theAdaptiveMin);
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_FaceAttribute();
return mySurface;
}
+ //! Returns True in case if this attribute has already been intialized.
+ inline Standard_Boolean IsInitialized () const
+ {
+ return !myFace.IsNull ();
+ }
+
+ //! Initializes this attribute by the given face.
+ Standard_EXPORT void SetFace (
+ const TopoDS_Face& theFace,
+ const Standard_Boolean theAdaptiveMin);
//! Returns forward oriented face to be used for calculations.
inline const TopoDS_Face& Face() const
//=======================================================================
Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
{
+ myAttribute.Nullify();
+ GetFaceAttribute(theFace, myAttribute, Standard_True);
+
try
{
OCC_CATCH_SIGNALS
// Initialize face attributes
- myAttribute.Nullify();
- GetFaceAttribute(theFace, myAttribute);
- if (myAttribute.IsNull())
- {
- myAttribute = new BRepMesh_FaceAttribute(theFace,
- myBoundaryVertices, myBoundaryPoints,myParameters.AdaptiveMin);
-
- myAttributes.Bind(theFace, myAttribute);
- }
+ if (!myAttribute->IsInitialized ())
+ myAttribute->SetFace (theFace, myParameters.AdaptiveMin);
BRepMesh::HIMapOfInteger& aVertexEdgeMap = myAttribute->ChangeVertexEdgeMap();
BRepMesh::HDMapOfShapePairOfPolygon& aInternalEdges = myAttribute->ChangeInternalEdges();
myAttribute->SetDeltaX(deltaX);
myAttribute->SetDeltaY(deltaY);
}
+
+ myAttribute->ChangeMeshNodes() =
+ myAttribute->ChangeStructure()->Data()->Vertices();
}
catch(Standard_Failure)
{
myAttribute->SetStatus(BRepMesh_Failure);
}
- myAttribute->ChangeMeshNodes() =
- myAttribute->ChangeStructure()->Data()->Vertices();
-
myAttribute->ChangeStructure().Nullify();
return myAttribute->GetStatus();
}
//=======================================================================
Standard_Boolean BRepMesh_FastDiscret::GetFaceAttribute(
const TopoDS_Face& theFace,
- Handle(BRepMesh_FaceAttribute)& theAttribute ) const
+ Handle(BRepMesh_FaceAttribute)& theAttribute,
+ const Standard_Boolean isForceCreate) const
{
if (myAttributes.IsBound(theFace))
{
theAttribute = myAttributes(theFace);
return Standard_True;
}
+ else if (isForceCreate)
+ {
+ theAttribute = new BRepMesh_FaceAttribute(myBoundaryVertices, myBoundaryPoints);
+ myAttributes.Bind(theFace, theAttribute);
+ }
return Standard_False;
}
return mySharedFaces;
}
- //! Gives face attribute.
- Standard_EXPORT Standard_Boolean GetFaceAttribute
- ( const TopoDS_Face& theFace, Handle(BRepMesh_FaceAttribute)& theAttribute ) const;
+ //! Returns attribute descriptor for the given face.
+ //! @param theFace face the attribute should be returned for.
+ //! @param[out] theAttribute attribute found for the specified face.
+ //! @param isForceCreate if True creates new attribute in case if there
+ //! is no data for the given face.
+ Standard_EXPORT Standard_Boolean GetFaceAttribute (
+ const TopoDS_Face& theFace,
+ Handle(BRepMesh_FaceAttribute)& theAttribute,
+ const Standard_Boolean isForceCreate = Standard_False) const;
//! Remove face attribute as useless to free locate memory.
Standard_EXPORT void RemoveFaceAttribute( const TopoDS_Face& theFace );
TopoDS_Face myFace;
BRepMesh::DMapOfShapePairOfPolygon myEdges;
- BRepMesh::DMapOfFaceAttribute myAttributes;
+ mutable BRepMesh::DMapOfFaceAttribute myAttributes;
TopTools_DataMapOfShapeReal myMapdefle;
// Data shared for whole shape