#include <SMESH_Block.hxx>

Classes

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

bool ComputeParameters (const gp_Pnt &thePoint, gp_XYZ &theParams, const int theShapeID=ID_Shell, const gp_XYZ &theParamsHint=gp_XYZ(-1,-1,-1))
 
Standard_Boolean Derivatives (const math_Vector &X, math_Matrix &D)
 
double DistanceReached () const
 
bool EdgeParameters (const int theEdgeID, const double theU, gp_XYZ &theParams)
 
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
 
Standard_Integer GetStateNumber ()
 
double GetTolerance () const
 
bool IsToleranceReached () const
 
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 LoadFace (const TopoDS_Face &theFace, const int theFaceID, const TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 Load face geometry. More...
 
bool LoadMeshBlock (const SMDS_MeshVolume *theVolume, const int theNode000Index, const int theNode001Index, std::vector< const SMDS_MeshNode * > &theOrderedNodes)
 
Standard_Integer NbEquations () const
 
Standard_Integer NbVariables () const
 
void SetTolerance (const double tol)
 
bool ShellPoint (const gp_XYZ &theParams, gp_XYZ &thePoint) const
 
 SMESH_Block ()
 
Standard_Boolean Value (const math_Vector &X, math_Vector &F)
 
Standard_Boolean Values (const math_Vector &X, math_Vector &F, math_Matrix &D)
 
bool VertexParameters (const int theVertexID, gp_XYZ &theParams)
 
bool VertexPoint (const int theVertexID, gp_XYZ &thePoint) const
 

Static Public Member Functions

static std::ostream & DumpShapeID (const int theBlockShapeID, std::ostream &stream)
 
static bool FindBlockShapes (const TopoDS_Shell &theShell, const TopoDS_Vertex &theVertex000, const TopoDS_Vertex &theVertex001, TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 
static int GetCoordIndOnEdge (const int theEdgeID)
 
static void GetEdgeVertexIDs (const int edgeID, std::vector< int > &vertexVec)
 
static void GetFaceEdgesIDs (const int faceID, std::vector< int > &edgeVec)
 
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...
 
static double * GetShapeCoef (const int theShapeID)
 
static int GetShapeIDByParams (const gp_XYZ &theParams)
 
static bool Insert (const TopoDS_Shape &theShape, const int theShapeID, TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 / Insert theShape into theShapeIDMap with theShapeID More...
 
static bool IsEdgeID (int theShapeID)
 
static bool IsFaceID (int theShapeID)
 
static bool IsForwardEdge (const TopoDS_Edge &theEdge, const TopTools_IndexedMapOfOrientedShape &theShapeIDMap)
 
static bool IsVertexID (int theShapeID)
 
static int NbEdges ()
 
static int NbFaces ()
 
static int NbSubShapes ()
 
static int NbVertices ()
 
static int ShapeIndex (int theShapeID)
 
static bool ShellPoint (const gp_XYZ &theParams, const std::vector< gp_XYZ > &thePointOnShape, gp_XYZ &thePoint)
 

Protected Types

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

Protected Member Functions

bool computeParameters (const gp_Pnt &thePoint, gp_XYZ &theParams, const gp_XYZ &theParamsHint, int)
 
double distance () const
 
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 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...
 
double funcValue (double sqDist) const
 
void init ()
 Call it after geometry initialisation. More...
 
void refineParametersOnFace (const gp_Pnt &thePoint, gp_XYZ &theParams, int theFaceID)
 Find more precise 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

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

Member Typedef Documentation

◆ TxyzPair

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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
SQUARE_DIST 
DRV_1 
DRV_2 
DRV_3 

◆ TShapeID

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::SMESH_Block ( )

Member Function Documentation

◆ computeParameters()

bool SMESH_Block::computeParameters ( const gp_Pnt &  thePoint,
gp_XYZ &  theParams,
const gp_XYZ &  theParamsHint,
int  theShapeID 
)
protected

◆ ComputeParameters()

◆ Derivatives()

Standard_Boolean SMESH_Block::Derivatives ( const math_Vector &  X,
math_Matrix &  D 
)

References Values().

◆ distance()

◆ DistanceReached()

double SMESH_Block::DistanceReached ( ) const

◆ DumpShapeID()

ostream & SMESH_Block::DumpShapeID ( const int  theBlockShapeID,
std::ostream &  stream 
)
static

◆ EdgeParameters()

bool SMESH_Block::EdgeParameters ( const int  theEdgeID,
const double  theU,
gp_XYZ &  theParams 
)

◆ EdgePoint()

bool SMESH_Block::EdgePoint ( const int  theEdgeID,
const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const

◆ EdgeU()

bool SMESH_Block::EdgeU ( const int  theEdgeID,
const gp_XYZ &  theParams,
double &  theU 
) const

◆ FacePoint()

bool SMESH_Block::FacePoint ( const int  theFaceID,
const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const

◆ FaceUV()

bool SMESH_Block::FaceUV ( const int  theFaceID,
const gp_XYZ &  theParams,
gp_XY &  theUV 
) const

◆ FindBlockShapes()

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

◆ findUVAround()

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 DraftVecUtils::dist(), distance(), SMESH_Block::TFace::GetUInd(), SMESH_Block::TFace::GetVInd(), SMESH_Block::TFace::Point(), and saveBetterSolution().

Referenced by refineParametersOnFace().

◆ findUVByHalfDivision()

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(), SMESH_Block::TFace::Point(), and saveBetterSolution().

Referenced by refineParametersOnFace().

◆ funcValue()

double SMESH_Block::funcValue ( double  sqDist) const
protected

Referenced by Value(), and Values().

◆ GetCoordIndOnEdge()

static int SMESH_Block::GetCoordIndOnEdge ( const int  theEdgeID)
static

◆ GetEdgeVertexIDs()

void SMESH_Block::GetEdgeVertexIDs ( const int  edgeID,
std::vector< int > &  vertexVec 
)
static

◆ GetFaceEdgesIDs()

◆ GetOrderedEdges()

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

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

◆ GetShapeCoef()

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

Referenced by ComputeParameters().

◆ GetShapeIDByParams()

int SMESH_Block::GetShapeIDByParams ( const gp_XYZ &  theParams)
static

◆ GetStateNumber()

Standard_Integer SMESH_Block::GetStateNumber ( )

◆ GetTolerance()

double SMESH_Block::GetTolerance ( ) const

◆ init()

void SMESH_Block::init ( )
protected

◆ Insert()

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().

◆ IsEdgeID()

◆ IsFaceID()

static bool SMESH_Block::IsFaceID ( int  theShapeID)
static

◆ IsForwardEdge()

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

◆ IsToleranceReached()

bool SMESH_Block::IsToleranceReached ( ) const

References distance(), and myTolerance.

◆ IsVertexID()

static bool SMESH_Block::IsVertexID ( int  theShapeID)
static

◆ LoadBlockShapes() [1/2]

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

◆ LoadBlockShapes() [2/2]

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 ID_FirstE, ID_V000, ID_V111, init(), IsEdgeID(), IsForwardEdge(), IsVertexID(), LoadFace(), myEdge, myPnt, and SMESH_Block::TEdge::Set().

◆ LoadFace()

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 GetFaceEdgesIDs(), ID_FirstF, IsFaceID(), IsForwardEdge(), myFace, and SMESH_Block::TFace::Set().

Referenced by LoadBlockShapes().

◆ LoadMeshBlock()

◆ NbEdges()

static int SMESH_Block::NbEdges ( )
static

◆ NbEquations()

Standard_Integer SMESH_Block::NbEquations ( ) const

◆ NbFaces()

static int SMESH_Block::NbFaces ( )
static

◆ NbSubShapes()

static int SMESH_Block::NbSubShapes ( )
static

◆ NbVariables()

Standard_Integer SMESH_Block::NbVariables ( ) const

◆ NbVertices()

static int SMESH_Block::NbVertices ( )
static

◆ refineParametersOnFace()

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().

◆ saveBetterSolution()

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().

◆ SetTolerance()

void SMESH_Block::SetTolerance ( const double  tol)

References myTolerance.

◆ ShapeIndex()

◆ ShellPoint() [1/2]

bool SMESH_Block::ShellPoint ( const gp_XYZ &  theParams,
const std::vector< gp_XYZ > &  thePointOnShape,
gp_XYZ &  thePoint 
)
static

◆ ShellPoint() [2/2]

◆ Value()

Standard_Boolean SMESH_Block::Value ( const math_Vector &  X,
math_Vector &  F 
)

◆ Values()

Standard_Boolean SMESH_Block::Values ( const math_Vector &  X,
math_Vector &  F,
math_Matrix &  D 
)

◆ VertexParameters()

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().

◆ VertexPoint()

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

Member Data Documentation

◆ my3x3x3GridNodes

TxyzPair SMESH_Block::my3x3x3GridNodes[1000]
protected

Referenced by ComputeParameters().

◆ myEdge

◆ myFace

TFace SMESH_Block::myFace[6]
protected

◆ myFaceIndex

int SMESH_Block::myFaceIndex
protected

◆ myFaceParam

double SMESH_Block::myFaceParam
protected

◆ myGridComputed

bool SMESH_Block::myGridComputed
protected

Referenced by ComputeParameters(), and init().

◆ myNbIterations

int SMESH_Block::myNbIterations
protected

◆ myParam

gp_XYZ SMESH_Block::myParam
protected

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

◆ myPnt

gp_XYZ SMESH_Block::myPnt[8]
protected

◆ myPoint

gp_XYZ SMESH_Block::myPoint
protected

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

◆ mySquareFunc

bool SMESH_Block::mySquareFunc
protected

Referenced by computeParameters().

◆ mySumDist

double SMESH_Block::mySumDist
protected

◆ myTolerance

◆ myValues

double SMESH_Block::myValues[4]
protected

The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/3rdParty/salomesmesh/inc/SMESH_Block.hxx
  • Sources/FreeCAD/src/3rdParty/salomesmesh/src/SMESH/SMESH_Block.cpp