Version: 8.3.0
SMESH_Block Class Reference

#include <SMESH_Block.hxx>

Inheritance diagram for SMESH_Block:

Data Structures

class  TEdge
 
class  TFace
 

Public Types

enum  TShapeID {
  ID_NONE = 0, ID_V000 = 1, ID_V100, ID_V010,
  ID_V110, ID_V001, ID_V101, ID_V011,
  ID_V111, ID_Ex00, ID_Ex10, ID_Ex01,
  ID_Ex11, ID_E0y0, ID_E1y0, ID_E0y1,
  ID_E1y1, ID_E00z, ID_E10z, ID_E01z,
  ID_E11z, ID_Fxy0, ID_Fxy1, ID_Fx0z,
  ID_Fx1z, ID_F0yz, ID_F1yz, ID_Shell,
  ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0
}
 

Public Member Functions

 SMESH_Block ()
 
bool LoadBlockShapes (const TopoDS_Shell &theShell, const TopoDS_Vertex &theVertex000, const TopoDS_Vertex &theVertex001, TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 
bool LoadBlockShapes (const TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 Initialize block geometry with shapes from theShapeIDMap. More...
 
bool LoadMeshBlock (const SMDS_MeshVolume *theVolume, const int theNode000Index, const int theNode001Index, std::vector< const SMDS_MeshNode * > &theOrderedNodes)
 
bool LoadFace (const TopoDS_Face &theFace, const int theFaceID, const TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 Load face geometry. More...
 
bool VertexPoint (const int theVertexID, gp_XYZ &thePoint) const
 
bool EdgePoint (const int theEdgeID, const gp_XYZ &theParams, gp_XYZ &thePoint) const
 
bool EdgeU (const int theEdgeID, const gp_XYZ &theParams, double &theU) const
 
bool FacePoint (const int theFaceID, const gp_XYZ &theParams, gp_XYZ &thePoint) const
 
bool FaceUV (const int theFaceID, const gp_XYZ &theParams, gp_XY &theUV) const
 
bool ShellPoint (const gp_XYZ &theParams, gp_XYZ &thePoint) const
 
bool ComputeParameters (const gp_Pnt &thePoint, gp_XYZ &theParams, const int theShapeID=ID_Shell, const gp_XYZ &theParamsHint=gp_XYZ(-1,-1,-1))
 
bool VertexParameters (const int theVertexID, gp_XYZ &theParams)
 
bool EdgeParameters (const int theEdgeID, const double theU, gp_XYZ &theParams)
 
void SetTolerance (const double tol)
 
double GetTolerance () const
 
bool IsToleranceReached () const
 
double DistanceReached () const
 
Standard_Integer NbVariables () const
 
Standard_Integer NbEquations () const
 
Standard_Boolean Value (const math_Vector &X, math_Vector &F)
 
Standard_Boolean Derivatives (const math_Vector &X, math_Matrix &D)
 
Standard_Boolean Values (const math_Vector &X, math_Vector &F, math_Matrix &D)
 
Standard_Integer GetStateNumber ()
 

Static Public Member Functions

static int NbVertices ()
 
static int NbEdges ()
 
static int NbFaces ()
 
static int NbSubShapes ()
 
static bool IsVertexID (int theShapeID)
 
static bool IsEdgeID (int theShapeID)
 
static bool IsFaceID (int theShapeID)
 
static int ShapeIndex (int theShapeID)
 
static void GetFaceEdgesIDs (const int faceID, std::vector< int > &edgeVec)
 
static void GetEdgeVertexIDs (const int edgeID, std::vector< int > &vertexVec)
 
static int GetCoordIndOnEdge (const int theEdgeID)
 
static double * GetShapeCoef (const int theShapeID)
 
static int GetShapeIDByParams (const gp_XYZ &theParams)
 
static std::ostream & DumpShapeID (const int theBlockShapeID, std::ostream &stream)
 
static bool Insert (const TopoDS_Shape &theShape, const int theShapeID, TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 / Insert theShape into theShapeIDMap with theShapeID More...
 
static bool FindBlockShapes (const TopoDS_Shell &theShell, const TopoDS_Vertex &theVertex000, const TopoDS_Vertex &theVertex001, TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 
static bool ShellPoint (const gp_XYZ &theParams, const std::vector< gp_XYZ > &thePointOnShape, gp_XYZ &thePoint)
 
static bool IsForwardEdge (const TopoDS_Edge &theEdge, const TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 
static int GetOrderedEdges (const TopoDS_Face &theFace, std::list< TopoDS_Edge > &theEdges, std::list< int > &theNbEdgesInWires, TopoDS_Vertex theFirstVertex=TopoDS_Vertex(), const bool theShapeAnalysisAlgo=false)
 Return number of wires and a list of oredered edges. More...
 

Protected Types

enum  { SQUARE_DIST = 0, DRV_1, DRV_2, DRV_3 }
 
typedef std::pair< gp_XYZ, gp_XYZ > TxyzPair
 

Protected Member Functions

void init ()
 Call it after geometry initialisation. More...
 
double distance () const
 
double funcValue (double sqDist) const
 
bool computeParameters (const gp_Pnt &thePoint, gp_XYZ &theParams, const gp_XYZ &theParamsHint, int)
 
void refineParametersOnFace (const gp_Pnt &thePoint, gp_XYZ &theParams, int theFaceID)
 Find more precise solution. More...
 
bool findUVByHalfDivision (const gp_Pnt &thePoint, const gp_XY &theUV, const TFace &tface, gp_XYZ &theParams)
 Finds parameters corresponding to a given UV of a given face using half-division. More...
 
bool findUVAround (const gp_Pnt &thePoint, const gp_XY &theUV, const TFace &tface, gp_XYZ &theParams, int nbGetWorstLimit)
 Finds parameters corresponding to a given UV of a given face by searching around the starting solution. More...
 
bool saveBetterSolution (const gp_XYZ &theNewParams, gp_XYZ &theParams, double sqDistance)
 Store a solution if it's better than a previous one. More...
 

Protected Attributes

gp_XYZ myPnt [8]
 
TEdge myEdge [12]
 
TFace myFace [6]
 
int myFaceIndex
 
double myFaceParam
 
int myNbIterations
 
double mySumDist
 
double myTolerance
 
bool mySquareFunc
 
gp_XYZ myPoint
 
gp_XYZ myParam
 
double myValues [4]
 
TxyzPair my3x3x3GridNodes [1000]
 
bool myGridComputed
 

Member Typedef Documentation

typedef std::pair<gp_XYZ,gp_XYZ> SMESH_Block::TxyzPair
protected

Member Enumeration Documentation

anonymous enum
protected
Enumerator
SQUARE_DIST 
DRV_1 
DRV_2 
DRV_3 
Enumerator
ID_NONE 
ID_V000 
ID_V100 
ID_V010 
ID_V110 
ID_V001 
ID_V101 
ID_V011 
ID_V111 
ID_Ex00 
ID_Ex10 
ID_Ex01 
ID_Ex11 
ID_E0y0 
ID_E1y0 
ID_E0y1 
ID_E1y1 
ID_E00z 
ID_E10z 
ID_E01z 
ID_E11z 
ID_Fxy0 
ID_Fxy1 
ID_Fx0z 
ID_Fx1z 
ID_F0yz 
ID_F1yz 
ID_Shell 
ID_FirstV 
ID_FirstE 
ID_FirstF 

Constructor & Destructor Documentation

SMESH_Block::SMESH_Block ( )

Member Function Documentation

bool SMESH_Block::computeParameters ( const gp_Pnt &  thePoint,
gp_XYZ &  theParams,
const gp_XYZ &  theParamsHint,
int  theShapeID 
)
protected
Standard_Boolean SMESH_Block::Derivatives ( const math_Vector &  X,
math_Matrix &  D 
)

References Values().

double SMESH_Block::DistanceReached ( ) const
ostream & SMESH_Block::DumpShapeID ( const int  theBlockShapeID,
std::ostream &  stream 
)
static
bool SMESH_Block::EdgeParameters ( const int  theEdgeID,
const double  theU,
gp_XYZ &  theParams 
)
bool SMESH_Block::EdgePoint ( const int  theEdgeID,
const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const
bool SMESH_Block::EdgeU ( const int  theEdgeID,
const gp_XYZ &  theParams,
double &  theU 
) const
bool SMESH_Block::FacePoint ( const int  theFaceID,
const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const
bool SMESH_Block::FaceUV ( const int  theFaceID,
const gp_XYZ &  theParams,
gp_XY &  theUV 
) const
bool SMESH_Block::FindBlockShapes ( const TopoDS_Shell &  theShell,
const TopoDS_Vertex &  theVertex000,
const TopoDS_Vertex &  theVertex001,
TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
)
static
bool SMESH_Block::findUVAround ( const gp_Pnt &  thePoint,
const gp_XY &  theUV,
const TFace tface,
gp_XYZ &  theParams,
int  nbGetWorstLimit 
)
protected

Finds parameters corresponding to a given UV of a given face by searching around the starting solution.

Parameters
[in]theUV- the UV to locate
[in]tface- the face
[in,out]theParams- the starting parameters to improve
[in]nbGetWorstLimit- nb of steps from the starting solution w/o improvement to stop searching in this direction
Returns
bool - true if found solution is within myTolerance

References distance(), SMESH_Block::TFace::GetUInd(), SMESH_Block::TFace::GetVInd(), Max(), Min(), SMESH_Block::TFace::Point(), and saveBetterSolution().

Referenced by refineParametersOnFace().

bool SMESH_Block::findUVByHalfDivision ( const gp_Pnt &  thePoint,
const gp_XY &  theUV,
const TFace tface,
gp_XYZ &  theParams 
)
protected

Finds parameters corresponding to a given UV of a given face using half-division.

Parameters
[in]theUV- the UV to locate
[in]tface- the face
[in,out]theParams- the starting parameters to improve
Returns
bool - true if found solution is within myTolerance

References distance(), SMESH_Block::TFace::GetUInd(), SMESH_Block::TFace::GetVInd(), SMESH_Block::TFace::IsUVInQuad(), Max(), Min(), SMESH_Block::TFace::Point(), and saveBetterSolution().

Referenced by refineParametersOnFace().

double SMESH_Block::funcValue ( double  sqDist) const
protected

Referenced by Value(), and Values().

static int SMESH_Block::GetCoordIndOnEdge ( const int  theEdgeID)
static
int SMESH_Block::GetOrderedEdges ( const TopoDS_Face &  theFace,
std::list< TopoDS_Edge > &  theEdges,
std::list< int > &  theNbEdgesInWires,
TopoDS_Vertex  theFirstVertex = TopoDS_Vertex(),
const bool  theShapeAnalysisAlgo = false 
)
static

Return number of wires and a list of oredered edges.

Parameters
theFace- the face to process
theEdges- all ordered edges of theFace (outer edges go first).
theNbEdgesInWires- nb of edges (== nb of vertices in closed wire) in each wire
theFirstVertex- the vertex of the outer wire to set first in the returned list ( theFirstVertex may be NULL )
theShapeAnalysisAlgo- if true, ShapeAnalysis::OuterWire() is used to find the outer wire else BRepTools::OuterWire() is used.
Return values
int- nb of wires

Always try to set a seam edge first. BRepTools::OuterWire() fails e.g. in the case of issue 0020184, ShapeAnalysis::OuterWire() fails in the case of issue 0020452

References Edge, Handle(), and MESSAGE.

Referenced by SMESH_Pattern::Apply(), StdMeshers_Quadrangle_2D::CheckNbEdges(), StdMeshers_Quadrangle_2D::checkNbEdgesForEvaluate(), StdMeshers_Projection_2D::Compute(), FindBlockShapes(), StdMeshers_ProjectionUtils::FindFaceAssociation(), StdMeshers_FaceSide::GetFaceWires(), _QuadFaceGrid::Init(), StdMeshers_Prism_3D::initPrism(), and SMESH_MesherHelper::IsStructured().

double * SMESH_Block::GetShapeCoef ( const int  theShapeID)
static

Referenced by ComputeParameters().

int SMESH_Block::GetShapeIDByParams ( const gp_XYZ &  theParams)
static
Standard_Integer SMESH_Block::GetStateNumber ( )
double SMESH_Block::GetTolerance ( ) const
void SMESH_Block::init ( )
protected

Call it after geometry initialisation.

References myGridComputed, myNbIterations, and mySumDist.

Referenced by StdMeshers_PrismAsBlock::Init(), LoadBlockShapes(), and LoadMeshBlock().

bool SMESH_Block::Insert ( const TopoDS_Shape &  theShape,
const int  theShapeID,
TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
)
static

/ Insert theShape into theShapeIDMap with theShapeID

Parameters
theShape- shape to insert
theShapeID- shape in-block ID
theShapeIDMap- map of block sub-shapes

Referenced by StdMeshers_PrismAsBlock::Init(), and StdMeshers_PrismAsBlock::TSideFace::InsertSubShapes().

static bool SMESH_Block::IsForwardEdge ( const TopoDS_Edge &  theEdge,
const TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
)
static
bool SMESH_Block::IsToleranceReached ( ) const

References distance(), and myTolerance.

bool SMESH_Block::LoadBlockShapes ( const TopoDS_Shell &  theShell,
const TopoDS_Vertex &  theVertex000,
const TopoDS_Vertex &  theVertex001,
TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
)
bool SMESH_Block::LoadBlockShapes ( const TopTools_IndexedMapOfOrientedShape &  theShapeIDMap)

Initialize block geometry with shapes from theShapeIDMap.

Parameters
theShapeIDMap- map of block sub-shapes
Return values
bool- is a success

References Edge, Face, ID_FirstE, ID_V000, ID_V111, init(), IsEdgeID(), IsForwardEdge(), IsVertexID(), LoadFace(), myEdge, myPnt, and SMESH_Block::TEdge::Set().

bool SMESH_Block::LoadFace ( const TopoDS_Face &  theFace,
const int  theFaceID,
const TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
)

Load face geometry.

Parameters
theFace- face
theFaceID- face in-block ID
theShapeIDMap- map of block sub-shapes
Return values
bool- is a success

It is enough to compute params or coordinates on the face. Face sub-shapes must be loaded into theShapeIDMap before

References Edge, GetFaceEdgesIDs(), ID_FirstF, IsFaceID(), IsForwardEdge(), myFace, and SMESH_Block::TFace::Set().

Referenced by LoadBlockShapes().

static int SMESH_Block::NbEdges ( )
static
Standard_Integer SMESH_Block::NbEquations ( ) const
static int SMESH_Block::NbFaces ( )
static
static int SMESH_Block::NbSubShapes ( )
static
Standard_Integer SMESH_Block::NbVariables ( ) const
static int SMESH_Block::NbVertices ( )
static
void SMESH_Block::refineParametersOnFace ( const gp_Pnt &  thePoint,
gp_XYZ &  theParams,
int  theFaceID 
)
protected

Find more precise solution.

Parameters
[in]thePoint- the point
[in,out]theParams- solution to precise
[in]theFaceID- FACE ID

References distance(), findUVAround(), findUVByHalfDivision(), SMESH_Block::TFace::GetUInd(), SMESH_Block::TFace::GetVInd(), ID_FirstF, myFace, myTolerance, SMESH_Block::TFace::Point(), and SMESH_Block::TFace::Surface().

Referenced by ComputeParameters(), and computeParameters().

bool SMESH_Block::saveBetterSolution ( const gp_XYZ &  theNewParams,
gp_XYZ &  theParams,
double  sqDistance 
)
protected

Store a solution if it's better than a previous one.

Parameters
[in]theNewParams- a new solution
[out]theParams- the parameters to store solution in
[in]sqDistance- a square distance reached at theNewParams
Returns
bool - true if the reached distance is within the tolerance

References distance(), myTolerance, myValues, and SQUARE_DIST.

Referenced by findUVAround(), and findUVByHalfDivision().

void SMESH_Block::SetTolerance ( const double  tol)

References myTolerance.

bool SMESH_Block::ShellPoint ( const gp_XYZ &  theParams,
const std::vector< gp_XYZ > &  thePointOnShape,
gp_XYZ &  thePoint 
)
static
Standard_Boolean SMESH_Block::Value ( const math_Vector &  X,
math_Vector &  F 
)
Standard_Boolean SMESH_Block::Values ( const math_Vector &  X,
math_Vector &  F,
math_Matrix &  D 
)
bool SMESH_Block::VertexParameters ( const int  theVertexID,
gp_XYZ &  theParams 
)

References ID_V000, ID_V010, ID_V100, and ID_V110.

Referenced by ComputeParameters(), and EdgeParameters().

bool SMESH_Block::VertexPoint ( const int  theVertexID,
gp_XYZ &  thePoint 
) const

Field Documentation

TxyzPair SMESH_Block::my3x3x3GridNodes[1000]
protected

Referenced by ComputeParameters().

int SMESH_Block::myFaceIndex
protected
double SMESH_Block::myFaceParam
protected
bool SMESH_Block::myGridComputed
protected

Referenced by ComputeParameters(), and init().

int SMESH_Block::myNbIterations
protected
gp_XYZ SMESH_Block::myParam
protected

Referenced by computeParameters(), Value(), and Values().

gp_XYZ SMESH_Block::myPnt[8]
protected
gp_XYZ SMESH_Block::myPoint
protected

Referenced by computeParameters(), Value(), and Values().

bool SMESH_Block::mySquareFunc
protected

Referenced by computeParameters().

double SMESH_Block::mySumDist
protected
double SMESH_Block::myValues[4]
protected