Version: 6.3.1
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

StdMeshers_PrismAsBlock Class Reference

Tool analyzing and giving access to a prism geometry treating it like a block, i.e. More...

#include <StdMeshers_Prism_3D.hxx>

Inheritance diagram for StdMeshers_PrismAsBlock:
Inheritance graph
[legend]

Data Structures

class  THorizontalEdgeAdaptor
 Class emulating geometry of a hirizontal edge. More...
class  TPCurveOnHorFaceAdaptor
 Class emulating pcurve on a hirizontal face. More...
class  TSideFace
 Class representing a part of a geom face or a union of seleral faces. More...
class  TVerticalEdgeAdaptor
 Class emulating geometry of a vertical edge. More...

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
}
enum  { ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0 }

Public Member Functions

 StdMeshers_PrismAsBlock ()
 Constructor.
 ~StdMeshers_PrismAsBlock ()
bool Init (SMESH_MesherHelper *helper, const TopoDS_Shape &shape3D)
 Initialization.
SMESH_ComputeErrorPtr GetError () const
 Return problem description.
void Clear ()
 Free allocated memory.
int VerticalSize () const
 Return number of nodes on every vertical edge.
bool HasNotQuadElemOnTop () const
const TNodeColumnGetNodeColumn (const SMDS_MeshNode *node) const
 Return pointer to column of nodes.
const TParam2ColumnMapGetParam2ColumnMap (const int baseEdgeID, bool &isReverse) const
 Return TParam2ColumnMap for a base edge.
bool GetLayersTransformation (std::vector< gp_Trsf > &trsf) const
 Return transformations to get coordinates of nodes of each internal layer by nodes of the bottom.
SMESH_MeshMesh () const
 Return pointer to mesh.
SMESHDS_MeshMeshDS () const
 Return pointer to mesh DS.
SMESH_subMeshSubMesh (const int shapeID) const
 Return submesh of a shape.
SMESHDS_SubMeshSubMeshDS (const int shapeID) const
 Return submesh DS of a shape.
const TopoDS_Shape & Shape (const int shapeID) const
 Return a in-block shape.
int ShapeID (const TopoDS_Shape &shape) const
 Return in-block ID of a shape.
bool GetWallFaces (SMESH_Mesh *mesh, const TopoDS_Shape &mainShape, const TopoDS_Shape &bottomFace, std::list< TopoDS_Edge > &bottomEdges, std::list< int > &nbEInW, std::list< TopoDS_Face > &wallFaces)
 Find wall faces by bottom edges.
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.
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.
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)
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 bool IsForwardEdge (SMESHDS_Mesh *meshDS, const TParam2ColumnMap &columnsMap, const TopoDS_Edge &bottomEdge, const int sideFaceID)
 Check curve orientation of a bootom edge.
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
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, TopoDS_Vertex theFirstVertex, std::list< TopoDS_Edge > &theEdges, std::list< int > &theNbEdgesInWires, const bool theShapeAnalysisAlgo=false)
 Return number of wires and a list of oredered edges.

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.
double distance () const
double funcValue (double sqDist) const
bool computeParameters (const gp_Pnt &thePoint, gp_XYZ &theParams, const gp_XYZ &theParamsHint)

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 [27]
bool myGridComputed

Private Member Functions

bool error (int error, const SMESH_Comment &comment="")
 store error and comment and then return ( error == COMPERR_OK )

Private Attributes

bool myNotQuadOnTop
SMESH_MesherHelpermyHelper
TBlockShapes myShapeIDMap
SMESH_ComputeErrorPtr myError
TSideFacemySide
std::vector< TParam2ColumnMapmyParam2ColumnMaps
std::map< int, std::pair
< TParam2ColumnMap *, bool > > 
myShapeIndex2ColumnMap

Detailed Description

Tool analyzing and giving access to a prism geometry treating it like a block, i.e.

the four side faces are emulated by division/uniting of missing/excess faces. It also manage associations between block subshapes and a mesh.

Definition at line 101 of file StdMeshers_Prism_3D.hxx.


Member Typedef Documentation

typedef std::pair<gp_XYZ,gp_XYZ> SMESH_Block.TxyzPair [protected, inherited]

Definition at line 385 of file SMESH_Block.hxx.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
ID_FirstV 
ID_FirstE 
ID_FirstF 

Definition at line 81 of file SMESH_Block.hxx.

       { // to use TShapeID for indexing certain type subshapes

    ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0

  };
anonymous enum [protected, inherited]
Enumerator:
SQUARE_DIST 
DRV_1 
DRV_2 
DRV_3 

Definition at line 369 of file SMESH_Block.hxx.

enum SMESH_Block::TShapeID [inherited]
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 

Definition at line 65 of file SMESH_Block.hxx.

                {
    // ----------------------------
    // Ids of the block sub-shapes
    // ----------------------------
    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
    };

Constructor & Destructor Documentation

StdMeshers_PrismAsBlock::StdMeshers_PrismAsBlock ( )

Constructor.

Initialization is needed

Definition at line 1045 of file StdMeshers_Prism_3D.cxx.

{
  mySide = 0;
}
StdMeshers_PrismAsBlock::~StdMeshers_PrismAsBlock ( )

Definition at line 1050 of file StdMeshers_Prism_3D.cxx.

{
  Clear();
}

Member Function Documentation

void StdMeshers_PrismAsBlock::Clear ( )

Free allocated memory.

Definition at line 1054 of file StdMeshers_Prism_3D.cxx.

{
  myHelper = 0;
  myShapeIDMap.Clear();
  myError.reset();

  if ( mySide ) {
    delete mySide; mySide = 0;
  }
  myParam2ColumnMaps.clear();
  myShapeIndex2ColumnMap.clear();
}
bool SMESH_Block::ComputeParameters ( const gp_Pnt &  thePoint,
gp_XYZ &  theParams,
const int  theShapeID = ID_Shell,
const gp_XYZ &  theParamsHint = gp_XYZ(-1,-1,-1) 
) [inherited]

Definition at line 635 of file SMESH_Block.cxx.

References ex13_hole1partial.box, SMESH_Block.computeParameters(), ex10_grid4geometry.dir, SMESH_Block.EdgeParameters(), SMESH_Block.TEdge.GetCurve(), SMESH_Block.GetShapeCoef(), SMESH_Block.ID_FirstE, SMESH_Block.IsEdgeID(), SMESH_Block.IsFaceID(), MESSAGE, SMESH_Block.my3x3x3GridNodes, SMESH_Block.myEdge, SMESH_Block.myFaceIndex, SMESH_Block.myFaceParam, SMESH_Block.myGridComputed, SMESH_Block.myNbIterations, SMESH_Block.mySumDist, SMESH_Block.myTolerance, SMESH_fixation.p0, PAL_MESH_041_mesh.p1, SMESH_Block.TEdge.Point(), SMESH_Block.ShellPoint(), SMESH_Block.VertexParameters(), ex13_hole1partial.x, ex13_hole1partial.y, and SMESH_demo_hexa2_upd.zero.

Referenced by StdMeshers_Projection_3D.Compute(), StdMeshers_SMESHBlock.ComputeParameters(), and SMESH_Pattern.Load().

{
  if ( VertexParameters( theShapeID, theParams ))
    return true;

  if ( IsEdgeID( theShapeID )) {
    TEdge& e = myEdge[ theShapeID - ID_FirstE ];
    Adaptor3d_Curve* curve = e.GetCurve();
    Extrema_ExtPC anExtPC( thePoint, *curve, curve->FirstParameter(), curve->LastParameter() );
    int i, nb = anExtPC.IsDone() ? anExtPC.NbExt() : 0;
    for ( i = 1; i <= nb; i++ ) {
      if ( anExtPC.IsMin( i ))
        return EdgeParameters( theShapeID, anExtPC.Point( i ).Parameter(), theParams );
    }
    return false;
  }

  const bool isOnFace = IsFaceID( theShapeID );
  double * coef = GetShapeCoef( theShapeID );

  // Find the first guess paremeters

  gp_XYZ start(0, 0, 0);

  bool hasHint = ( 0 <= theParamsHint.X() && theParamsHint.X() <= 1 &&
                   0 <= theParamsHint.Y() && theParamsHint.Y() <= 1 &&
                   0 <= theParamsHint.Y() && theParamsHint.Y() <= 1 );
  if ( !hasHint && !myGridComputed )
  {
    // define the first guess by thePoint projection on lines
    // connecting vertices
    bool needGrid = false;
    gp_XYZ par000( 0, 0, 0 ), par111( 1, 1, 1 );
    double zero = DBL_MIN * DBL_MIN;
    for ( int iEdge = 0, iParam = 1; iParam <= 3 && !needGrid; iParam++ )
    {
      if ( isOnFace && coef[ iParam - 1 ] != 0 ) {
        iEdge += 4;
        continue;
      }
      double sumParam = 0;
      for ( int iE = 0; iE < 4; iE++, iEdge++ ) { // loop on 4 parallel edges
        gp_Pnt p0 = myEdge[ iEdge ].Point( par000 );
        gp_Pnt p1 = myEdge[ iEdge ].Point( par111 );
        gp_Vec v01( p0, p1 ), v0P( p0, thePoint );
        double len2 = v01.SquareMagnitude();
        double par = 0;
        if ( len2 > zero ) {
          par = v0P.Dot( v01 ) / len2;
          if ( par < 0 || par > 1 ) { // projection falls out of line ends => needGrid
            needGrid = true;
            break;
          }
        }
        sumParam += par;
      }
      start.SetCoord( iParam, sumParam / 4.);
    }
    if ( needGrid ) {
      // compute nodes of 3 x 3 x 3 grid
      int iNode = 0;
      Bnd_Box box;
      for ( double x = 0.25; x < 0.9; x += 0.25 )
        for ( double y = 0.25; y < 0.9; y += 0.25 )
          for ( double z = 0.25; z < 0.9; z += 0.25 ) {
            TxyzPair & prmPtn = my3x3x3GridNodes[ iNode++ ];
            prmPtn.first.SetCoord( x, y, z );
            ShellPoint( prmPtn.first, prmPtn.second );
            box.Add( gp_Pnt( prmPtn.second ));
          }
      myGridComputed = true;
      myTolerance = sqrt( box.SquareExtent() ) * 1e-5;
    }
  }

  if ( hasHint )
  {
    start = theParamsHint;
  }
  else if ( myGridComputed )
  {
    double minDist = DBL_MAX;
    gp_XYZ* bestParam = 0;
    for ( int iNode = 0; iNode < 27; iNode++ ) {
      TxyzPair & prmPtn = my3x3x3GridNodes[ iNode ];
      double dist = ( thePoint.XYZ() - prmPtn.second ).SquareModulus();
      if ( dist < minDist ) {
        minDist = dist;
        bestParam = & prmPtn.first;
      }
    }
    start = *bestParam;
  }

  myFaceIndex = -1;
  myFaceParam = 0.;
  if ( isOnFace ) {
    // put a point on the face
    for ( int iCoord = 0; iCoord < 3; iCoord++ )
      if ( coef[ iCoord ] ) {
        myFaceIndex = iCoord + 1;
        myFaceParam = ( coef[ iCoord ] < 0.5 ) ? 0.0 : 1.0;
        start.SetCoord( myFaceIndex, myFaceParam );
      }
  }

#ifdef DEBUG_PARAM_COMPUTE
  MESSAGE ( " #### POINT " <<thePoint.X()<<" "<<thePoint.Y()<<" "<<thePoint.Z()<<" ####" );
#endif

  if ( myTolerance < 0 ) myTolerance = 1e-6;

  const double parDelta = 1e-4;
  const double sqTolerance = myTolerance * myTolerance;

  gp_XYZ solution = start, params = start;
  double sqDistance = 1e100; 
  int nbLoops = 0, nbGetWorst = 0;

  while ( nbLoops <= 100 )
  {
    gp_XYZ P, Pi;
    ShellPoint( params, P );

    gp_Vec dP( thePoint, P );
    double sqDist = dP.SquareMagnitude();

    if ( sqDist > sqDistance ) { // solution get worse
      if ( ++nbGetWorst > 2 )
        return computeParameters( thePoint, theParams, solution );
    }
#ifdef DEBUG_PARAM_COMPUTE
    MESSAGE ( "PARAMS: ( " << params.X() <<" "<< params.Y() <<" "<< params.Z() <<" )" );
    MESSAGE ( "DIST: " << sqrt( sqDist ) );
#endif

    if ( sqDist < sqDistance ) { // get better
      sqDistance = sqDist;
      solution   = params;
      nbGetWorst = 0;
      if ( sqDistance < sqTolerance ) // a solution found
        break;
    }

        // look for a next better solution
    for ( int iP = 1; iP <= 3; iP++ ) {
      if ( iP == myFaceIndex )
        continue;
      // see where we move with a small (=parDelta) step in this direction
      gp_XYZ nearParams = params;
      bool onEdge = ( params.Coord( iP ) + parDelta > 1. );
      if ( onEdge )
        nearParams.SetCoord( iP, params.Coord( iP ) - parDelta );
      else
        nearParams.SetCoord( iP, params.Coord( iP ) + parDelta );
      ShellPoint( nearParams, Pi );
      gp_Vec dPi ( P, Pi );
      if ( onEdge ) dPi *= -1.;
      // modify a parameter
      double mag = dPi.Magnitude();
      if ( mag < DBL_MIN )
        continue;
      gp_Vec dir = dPi / mag; // dir we move modifying the parameter
      double dist = dir * dP; // where we should get to
      double dPar = dist / mag * parDelta; // predict parameter change
      double curPar = params.Coord( iP );
      double par = curPar - dPar; // new parameter value
      while ( par > 1 || par < 0 ) {
        dPar /= 2.;
        par = curPar - dPar;
      }
      params.SetCoord( iP, par );
    }

    nbLoops++;
  }
#ifdef DEBUG_PARAM_COMPUTE
  myNbIterations += nbLoops*4; // how many times ShellPoint called
  mySumDist += sqrt( sqDistance );
  MESSAGE ( " ------ SOLUTION: ( "<<solution.X()<<" "<<solution.Y()<<" "<<solution.Z()<<" )"<< std::endl
         << " ------ DIST : " << sqrt( sqDistance ) << "\t Tol=" << myTolerance << "\t Nb LOOPS=" << nbLoops << std::endl
         << " ------ NB IT: " << myNbIterations << ",  SUM DIST: " << mySumDist );
#endif

  theParams = solution;

  if ( myFaceIndex > 0 )
    theParams.SetCoord( myFaceIndex, myFaceParam );

  return true;
}
bool SMESH_Block::computeParameters ( const gp_Pnt &  thePoint,
gp_XYZ &  theParams,
const gp_XYZ &  theParamsHint 
) [protected, inherited]

Definition at line 581 of file SMESH_Block.cxx.

References SMESH_Block.distance(), MESSAGE, SMESH_Block.myFaceIndex, SMESH_Block.myFaceParam, SMESH_Block.myNbIterations, SMESH_Block.myParam, SMESH_Block.myPoint, SMESH_Block.mySquareFunc, SMESH_Block.mySumDist, SMESH_Block.myTolerance, SMESH_Block.myValues, SMESH_Block.SQUARE_DIST, and SMESH_AdvancedEditor.tol.

Referenced by SMESH_Block.ComputeParameters().

{
  myPoint = thePoint.XYZ();

  myParam.SetCoord( -1,-1,-1 );
  myValues[ SQUARE_DIST ] = 1e100;

  math_Vector low  ( 1, 3, 0.0 );
  math_Vector up   ( 1, 3, 1.0 );
  math_Vector tol  ( 1, 3, 1e-4 );
  math_Vector start( 1, 3, 0.0 );
  start( 1 ) = theParamsHint.X();
  start( 2 ) = theParamsHint.Y();
  start( 3 ) = theParamsHint.Z();

  math_FunctionSetRoot paramSearch( *this, tol );

  mySquareFunc = 0; // large approaching steps
  //if ( hasHint ) mySquareFunc = 1; // small approaching steps

  double loopTol = 10 * myTolerance;
  int nbLoops = 0;
  while ( distance() > loopTol && nbLoops <= 3 )
  {
    paramSearch.Perform ( *static_cast<math_FunctionSetWithDerivatives*>(this),
                          start, low, up );
    start( 1 ) = myParam.X();
    start( 2 ) = myParam.Y();
    start( 3 ) = myParam.Z();
    mySquareFunc = !mySquareFunc;
    nbLoops++;
  }
#ifdef DEBUG_PARAM_COMPUTE
  mySumDist += distance();
  MESSAGE ( " ------ SOLUTION: ( "<< myParam.X() <<" "<< myParam.Y() <<" "<< myParam.Z() <<" )"<<endl
         << " ------ DIST : " << distance() << "\t Tol=" << myTolerance << "\t Nb LOOPS=" << nbLoops << endl
         << " ------ NB IT: " << myNbIterations << ",  SUM DIST: " << mySumDist );
#endif

  theParams = myParam;

  if ( myFaceIndex > 0 )
    theParams.SetCoord( myFaceIndex, myFaceParam );

  return true;
}
Standard_Boolean SMESH_Block::Derivatives ( const math_Vector &  X,
math_Matrix &  D 
) [inherited]

Definition at line 466 of file SMESH_Block.cxx.

References SMESH_Block.Values().

{
  math_Vector F(1,3);
  return Values(XYZ,F,Df);
}
double SMESH_Block.distance ( ) const [protected, inherited]

Definition at line 370 of file SMESH_Block.hxx.

Referenced by SMESH_Block.computeParameters().

{ return sqrt( myValues[ SQUARE_DIST ]); }
ostream & SMESH_Block::DumpShapeID ( const int  theBlockShapeID,
std::ostream &  stream 
) [static, inherited]

Definition at line 873 of file SMESH_Block.cxx.

References CASEDUMP, SMESH_Block.ID_E00z, SMESH_Block.ID_E01z, SMESH_Block.ID_E0y0, SMESH_Block.ID_E0y1, SMESH_Block.ID_E10z, SMESH_Block.ID_E11z, SMESH_Block.ID_E1y0, SMESH_Block.ID_E1y1, SMESH_Block.ID_Ex00, SMESH_Block.ID_Ex01, SMESH_Block.ID_Ex10, SMESH_Block.ID_Ex11, SMESH_Block.ID_F0yz, SMESH_Block.ID_F1yz, SMESH_Block.ID_Fx0z, SMESH_Block.ID_Fx1z, SMESH_Block.ID_Fxy0, SMESH_Block.ID_Fxy1, SMESH_Block.ID_Shell, SMESH_Block.ID_V000, SMESH_Block.ID_V001, SMESH_Block.ID_V010, SMESH_Block.ID_V011, SMESH_Block.ID_V100, SMESH_Block.ID_V101, SMESH_Block.ID_V110, and SMESH_Block.ID_V111.

Referenced by StdMeshers_PrismAsBlock.TSideFace.dumpNodes().

{
  switch ( id ) {
  CASEDUMP( ID_V000, stream );
  CASEDUMP( ID_V100, stream );
  CASEDUMP( ID_V010, stream );
  CASEDUMP( ID_V110, stream );
  CASEDUMP( ID_V001, stream );
  CASEDUMP( ID_V101, stream );
  CASEDUMP( ID_V011, stream );
  CASEDUMP( ID_V111, stream );
  CASEDUMP( ID_Ex00, stream );
  CASEDUMP( ID_Ex10, stream );
  CASEDUMP( ID_Ex01, stream );
  CASEDUMP( ID_Ex11, stream );
  CASEDUMP( ID_E0y0, stream );
  CASEDUMP( ID_E1y0, stream );
  CASEDUMP( ID_E0y1, stream );
  CASEDUMP( ID_E1y1, stream );
  CASEDUMP( ID_E00z, stream );
  CASEDUMP( ID_E10z, stream );
  CASEDUMP( ID_E01z, stream );
  CASEDUMP( ID_E11z, stream );
  CASEDUMP( ID_Fxy0, stream );
  CASEDUMP( ID_Fxy1, stream );
  CASEDUMP( ID_Fx0z, stream );
  CASEDUMP( ID_Fx1z, stream );
  CASEDUMP( ID_F0yz, stream );
  CASEDUMP( ID_F1yz, stream );
  CASEDUMP( ID_Shell, stream );
  default: stream << "ID_INVALID";
  }
  return stream;
}
bool SMESH_Block::EdgeParameters ( const int  theEdgeID,
const double  theU,
gp_XYZ &  theParams 
) [inherited]

Definition at line 852 of file SMESH_Block.cxx.

References SMESH_Block.TEdge.CoordInd(), SMESH_Block.TEdge.EndParam(), SMESH_Block.GetEdgeVertexIDs(), SMESH_Block.ID_Ex00, SMESH_Block.IsEdgeID(), SMESH_Block.myEdge, and SMESH_Block.VertexParameters().

Referenced by StdMeshers_SMESHBlock.ComputeParameters(), and SMESH_Block.ComputeParameters().

{
  if ( IsEdgeID( theEdgeID )) {
    vector< int > vertexVec;
    GetEdgeVertexIDs( theEdgeID, vertexVec );
    VertexParameters( vertexVec[0], theParams );
    TEdge& e = myEdge[ theEdgeID - ID_Ex00 ];
    double param = ( theU - e.EndParam(0) ) / ( e.EndParam(1) - e.EndParam(0) );
    theParams.SetCoord( e.CoordInd(), param );
    return true;
  }
  return false;
}
bool SMESH_Block.EdgePoint ( const int  theEdgeID,
const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const [inherited]

Definition at line 202 of file SMESH_Block.hxx.

Referenced by SMESH_Pattern.Apply(), StdMeshers_SMESHBlock.Point(), and StdMeshers_Penta_3D.SetHorizEdgeXYZ().

                                                                                         {
    if ( !IsEdgeID( theEdgeID ))                                 return false;
    thePoint = myEdge[ theEdgeID - ID_FirstE ].Point( theParams ); return true;
  }
bool SMESH_Block.EdgeU ( const int  theEdgeID,
const gp_XYZ &  theParams,
double &  theU 
) const [inherited]

Definition at line 208 of file SMESH_Block.hxx.

                                                                                 {
    if ( !IsEdgeID( theEdgeID ))                              return false;
    theU = myEdge[ theEdgeID - ID_FirstE ].GetU( theParams ); return true;
  }
bool StdMeshers_PrismAsBlock.error ( int  error,
const SMESH_Comment comment = "" 
) [private]

store error and comment and then return ( error == COMPERR_OK )

Definition at line 377 of file StdMeshers_Prism_3D.hxx.

References SMESH_ComputeError.New().

                                                           {
    myError = SMESH_ComputeError::New(error,comment);
    return myError->IsOK();
  }
bool SMESH_Block.FacePoint ( const int  theFaceID,
const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const [inherited]

Definition at line 214 of file SMESH_Block.hxx.

Referenced by SMESH_Pattern.Apply(), and StdMeshers_SMESHBlock.Point().

                                                                                         {
    if ( !IsFaceID ( theFaceID ))                                return false;
    thePoint = myFace[ theFaceID - ID_FirstF ].Point( theParams ); return true;
  }
bool SMESH_Block.FaceUV ( const int  theFaceID,
const gp_XYZ &  theParams,
gp_XY &  theUV 
) const [inherited]

Definition at line 220 of file SMESH_Block.hxx.

                                                                                  {
    if ( !IsFaceID ( theFaceID ))                               return false;
    theUV = myFace[ theFaceID - ID_FirstF ].GetUV( theParams ); return true;
  }
bool SMESH_Block::FindBlockShapes ( const TopoDS_Shell &  theShell,
const TopoDS_Vertex &  theVertex000,
const TopoDS_Vertex &  theVertex001,
TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
) [static, inherited]

Definition at line 1241 of file SMESH_Block.cxx.

References SMESH_test.edge, SMESH_Block.GetOrderedEdges(), and MESSAGE.

Referenced by Init(), and SMESH_Block.LoadBlockShapes().

{
  MESSAGE(" ::FindBlockShapes()");

  // 8 vertices
  TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111;
  // 12 edges
  TopoDS_Shape Ex00, Ex10, Ex01, Ex11;
  TopoDS_Shape E0y0, E1y0, E0y1, E1y1;
  TopoDS_Shape E00z, E10z, E01z, E11z;
  // 6 faces
  TopoDS_Shape Fxy0, Fx0z, F0yz, Fxy1, Fx1z, F1yz;

  // nb of faces bound to a vertex in TopTools_IndexedDataMapOfShapeListOfShape
  // filled by TopExp::MapShapesAndAncestors()
  const int NB_FACES_BY_VERTEX = 6;

  TopTools_IndexedDataMapOfShapeListOfShape vfMap;
  TopExp::MapShapesAndAncestors( theShell, TopAbs_VERTEX, TopAbs_FACE, vfMap );
  if ( vfMap.Extent() != 8 ) {
    MESSAGE(" Wrong nb of vertices in the block: " << vfMap.Extent() );
    return false;
  }

  V000 = theVertex000;
  V001 = theVertex001;

  if ( V000.IsNull() ) {
    // find vertex 000 - the one with smallest coordinates
    double minVal = DBL_MAX, minX, val;
    for ( int i = 1; i <= 8; i++ ) {
      const TopoDS_Vertex& v = TopoDS::Vertex( vfMap.FindKey( i ));
      gp_Pnt P = BRep_Tool::Pnt( v );
      val = P.X() + P.Y() + P.Z();
      if ( val < minVal || ( val == minVal && P.X() < minX )) {
        V000 = v;
        minVal = val;
        minX = P.X();
      }
    }
    // find vertex 001 - the one on the most vertical edge passing through V000
    TopTools_IndexedDataMapOfShapeListOfShape veMap;
    TopExp::MapShapesAndAncestors( theShell, TopAbs_VERTEX, TopAbs_EDGE, veMap );
    gp_Vec dir001 = gp::DZ();
    gp_Pnt p000 = BRep_Tool::Pnt( TopoDS::Vertex( V000 ));
    double maxVal = -DBL_MAX;
    TopTools_ListIteratorOfListOfShape eIt ( veMap.FindFromKey( V000 ));
    for (  ; eIt.More(); eIt.Next() ) {
      const TopoDS_Edge& e = TopoDS::Edge( eIt.Value() );
      TopoDS_Vertex v = TopExp::FirstVertex( e );
      if ( v.IsSame( V000 ))
        v = TopExp::LastVertex( e );
      val = dir001 * gp_Vec( p000, BRep_Tool::Pnt( v )).Normalized();
      if ( val > maxVal ) {
        V001 = v;
        maxVal = val;
      }
    }
  }

  // find the bottom (Fxy0), Fx0z and F0yz faces

  const TopTools_ListOfShape& f000List = vfMap.FindFromKey( V000 );
  const TopTools_ListOfShape& f001List = vfMap.FindFromKey( V001 );
  if (f000List.Extent() != NB_FACES_BY_VERTEX ||
      f001List.Extent() != NB_FACES_BY_VERTEX ) {
    MESSAGE(" LoadBlockShapes() " << f000List.Extent() << " " << f001List.Extent());
    return false;
  }
  TopTools_ListIteratorOfListOfShape f001It, f000It ( f000List );
  int i, j, iFound1, iFound2;
  for ( j = 0; f000It.More(); f000It.Next(), j++ )
  {
    if ( NB_FACES_BY_VERTEX == 6 && j % 2 ) continue; // each face encounters twice
    const TopoDS_Shape& F = f000It.Value();
    for ( i = 0, f001It.Initialize( f001List ); f001It.More(); f001It.Next(), i++ ) {
      if ( NB_FACES_BY_VERTEX == 6 && i % 2 ) continue; // each face encounters twice
      if ( F.IsSame( f001It.Value() ))
        break;
    }
    if ( f001It.More() ) // Fx0z or F0yz found
      if ( Fx0z.IsNull() ) {
        Fx0z = F;
        iFound1 = i;
      } else {
        F0yz = F;
        iFound2 = i;
      }
    else // F is the bottom face
      Fxy0 = F;
  }
  if ( Fxy0.IsNull() || Fx0z.IsNull() || F0yz.IsNull() ) {
    MESSAGE( Fxy0.IsNull() <<" "<< Fx0z.IsNull() <<" "<< F0yz.IsNull() );
    return false;
  }

  // choose the top face (Fxy1)
  for ( i = 0, f001It.Initialize( f001List ); f001It.More(); f001It.Next(), i++ ) {
    if ( NB_FACES_BY_VERTEX == 6 && i % 2 ) continue; // each face encounters twice
    if ( i != iFound1 && i != iFound2 )
      break;
  }
  Fxy1 = f001It.Value();
  if ( Fxy1.IsNull() ) {
    MESSAGE(" LoadBlockShapes() error ");
    return false;
  }

  // find bottom edges and veritices
  list< TopoDS_Edge > eList;
  list< int >         nbVertexInWires;
  GetOrderedEdges( TopoDS::Face( Fxy0 ), TopoDS::Vertex( V000 ), eList, nbVertexInWires );
  if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) {
    MESSAGE(" LoadBlockShapes() error ");
    return false;
  }
  list< TopoDS_Edge >::iterator elIt = eList.begin();
  for ( i = 0; elIt != eList.end(); elIt++, i++ )
    switch ( i ) {
    case 0: E0y0 = *elIt; V010 = TopExp::LastVertex( *elIt, true ); break;
    case 1: Ex10 = *elIt; V110 = TopExp::LastVertex( *elIt, true ); break;
    case 2: E1y0 = *elIt; V100 = TopExp::LastVertex( *elIt, true ); break;
    case 3: Ex00 = *elIt; break;
    default:;
    }
  if ( i != 4 || E0y0.IsNull() || Ex10.IsNull() || E1y0.IsNull() || Ex00.IsNull() ) {
    MESSAGE(" LoadBlockShapes() error, eList.size()=" << eList.size());
    return false;
  }


  // find top edges and veritices
  eList.clear();
  GetOrderedEdges( TopoDS::Face( Fxy1 ), TopoDS::Vertex( V001 ), eList, nbVertexInWires );
  if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) {
    MESSAGE(" LoadBlockShapes() error ");
    return false;
  }
  for ( i = 0, elIt = eList.begin(); elIt != eList.end(); elIt++, i++ )
    switch ( i ) {
    case 0: Ex01 = *elIt; V101 = TopExp::LastVertex( *elIt, true ); break;
    case 1: E1y1 = *elIt; V111 = TopExp::LastVertex( *elIt, true ); break;
    case 2: Ex11 = *elIt; V011 = TopExp::LastVertex( *elIt, true ); break;
    case 3: E0y1 = *elIt; break;
    default:;
    }
  if ( i != 4 || Ex01.IsNull() || E1y1.IsNull() || Ex11.IsNull() || E0y1.IsNull() ) {
    MESSAGE(" LoadBlockShapes() error, eList.size()=" << eList.size());
    return false;
  }

  // swap Fx0z and F0yz if necessary
  TopExp_Explorer exp( Fx0z, TopAbs_VERTEX );
  for ( ; exp.More(); exp.Next() ) // Fx0z shares V101 and V100
    if ( V101.IsSame( exp.Current() ) || V100.IsSame( exp.Current() ))
      break; // V101 or V100 found
  if ( !exp.More() ) { // not found
    std::swap( Fx0z, F0yz);
  }

  // find Fx1z and F1yz faces
  const TopTools_ListOfShape& f111List = vfMap.FindFromKey( V111 );
  const TopTools_ListOfShape& f110List = vfMap.FindFromKey( V110 );
  if (f111List.Extent() != NB_FACES_BY_VERTEX ||
      f110List.Extent() != NB_FACES_BY_VERTEX ) {
    MESSAGE(" LoadBlockShapes() " << f111List.Extent() << " " << f110List.Extent());
    return false;
  }
  TopTools_ListIteratorOfListOfShape f111It, f110It ( f110List);
  for ( j = 0 ; f110It.More(); f110It.Next(), j++ ) {
    if ( NB_FACES_BY_VERTEX == 6 && j % 2 ) continue; // each face encounters twice
    const TopoDS_Shape& F = f110It.Value();
    for ( i = 0, f111It.Initialize( f111List ); f111It.More(); f111It.Next(), i++ ) {
      if ( NB_FACES_BY_VERTEX == 6 && i % 2 ) continue; // each face encounters twice
      if ( F.IsSame( f111It.Value() )) { // Fx1z or F1yz found
        if ( Fx1z.IsNull() )
          Fx1z = F;
        else
          F1yz = F;
      }
    }
  }
  if ( Fx1z.IsNull() || F1yz.IsNull() ) {
    MESSAGE(" LoadBlockShapes() error ");
    return false;
  }

  // swap Fx1z and F1yz if necessary
  for ( exp.Init( Fx1z, TopAbs_VERTEX ); exp.More(); exp.Next() )
    if ( V010.IsSame( exp.Current() ) || V011.IsSame( exp.Current() ))
      break;
  if ( !exp.More() ) {
    std::swap( Fx1z, F1yz);
  }

  // find vertical edges
  for ( exp.Init( Fx0z, TopAbs_EDGE ); exp.More(); exp.Next() ) {
    const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() );
    const TopoDS_Shape& vFirst = TopExp::FirstVertex( edge, true );
    if ( vFirst.IsSame( V001 ))
      E00z = edge;
    else if ( vFirst.IsSame( V100 ))
      E10z = edge;
  }
  if ( E00z.IsNull() || E10z.IsNull() ) {
    MESSAGE(" LoadBlockShapes() error ");
    return false;
  }
  for ( exp.Init( Fx1z, TopAbs_EDGE ); exp.More(); exp.Next() ) {
    const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() );
    const TopoDS_Shape& vFirst = TopExp::FirstVertex( edge, true );
    if ( vFirst.IsSame( V111 ))
      E11z = edge;
    else if ( vFirst.IsSame( V010 ))
      E01z = edge;
  }
  if ( E01z.IsNull() || E11z.IsNull() ) {
    MESSAGE(" LoadBlockShapes() error ");
    return false;
  }

  // load shapes in theShapeIDMap

  theShapeIDMap.Clear();
  
  theShapeIDMap.Add(V000.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V100.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V010.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V110.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V001.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V101.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V011.Oriented( TopAbs_FORWARD ));
  theShapeIDMap.Add(V111.Oriented( TopAbs_FORWARD ));

  theShapeIDMap.Add(Ex00);
  theShapeIDMap.Add(Ex10);
  theShapeIDMap.Add(Ex01);
  theShapeIDMap.Add(Ex11);

  theShapeIDMap.Add(E0y0);
  theShapeIDMap.Add(E1y0);
  theShapeIDMap.Add(E0y1);
  theShapeIDMap.Add(E1y1);

  theShapeIDMap.Add(E00z);
  theShapeIDMap.Add(E10z);
  theShapeIDMap.Add(E01z);
  theShapeIDMap.Add(E11z);

  theShapeIDMap.Add(Fxy0);
  theShapeIDMap.Add(Fxy1);
  theShapeIDMap.Add(Fx0z);
  theShapeIDMap.Add(Fx1z);
  theShapeIDMap.Add(F0yz);
  theShapeIDMap.Add(F1yz);
  
  theShapeIDMap.Add(theShell);

  return true;
}
double SMESH_Block.funcValue ( double  sqDist) const [protected, inherited]

Definition at line 371 of file SMESH_Block.hxx.

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

{ return mySquareFunc ? sqDist : sqrt(sqDist); }
static int SMESH_Block.GetCoordIndOnEdge ( const int  theEdgeID) [static, inherited]

Definition at line 126 of file SMESH_Block.hxx.

Referenced by SMESH_Pattern.Load(), SMESH_Block.TEdge.Set(), and StdMeshers_Penta_3D.SetHorizEdgeXYZ().

  { return (theEdgeID < ID_E0y0) ? 1 : (theEdgeID < ID_E00z) ? 2 : 3; }
void SMESH_Block::GetEdgeVertexIDs ( const int  edgeID,
std::vector< int > &  vertexVec 
) [static, inherited]

Definition at line 1678 of file SMESH_Block.cxx.

References SMESH_Block.ID_E00z, SMESH_Block.ID_E01z, SMESH_Block.ID_E0y0, SMESH_Block.ID_E0y1, SMESH_Block.ID_E10z, SMESH_Block.ID_E11z, SMESH_Block.ID_E1y0, SMESH_Block.ID_E1y1, SMESH_Block.ID_Ex00, SMESH_Block.ID_Ex01, SMESH_Block.ID_Ex10, SMESH_Block.ID_Ex11, SMESH_Block.ID_V000, SMESH_Block.ID_V001, SMESH_Block.ID_V010, SMESH_Block.ID_V011, SMESH_Block.ID_V100, SMESH_Block.ID_V101, SMESH_Block.ID_V110, SMESH_Block.ID_V111, and MESSAGE.

Referenced by SMESH_Pattern.Apply(), StdMeshers_Projection_3D.Compute(), SMESH_Block.EdgeParameters(), Init(), StdMeshers_PrismAsBlock.TSideFace.InsertSubShapes(), and SMESH_Block.LoadMeshBlock().

{
  vertexVec.resize( 2 );
  switch ( edgeID ) {

  case ID_Ex00:
    vertexVec[ 0 ] = ID_V000;
    vertexVec[ 1 ] = ID_V100;
    break;
  case ID_Ex10:
    vertexVec[ 0 ] = ID_V010;
    vertexVec[ 1 ] = ID_V110;
    break;
  case ID_Ex01:
    vertexVec[ 0 ] = ID_V001;
    vertexVec[ 1 ] = ID_V101;
    break;
  case ID_Ex11:
    vertexVec[ 0 ] = ID_V011;
    vertexVec[ 1 ] = ID_V111;
    break;

  case ID_E0y0:
    vertexVec[ 0 ] = ID_V000;
    vertexVec[ 1 ] = ID_V010;
    break;
  case ID_E1y0:
    vertexVec[ 0 ] = ID_V100;
    vertexVec[ 1 ] = ID_V110;
    break;
  case ID_E0y1:
    vertexVec[ 0 ] = ID_V001;
    vertexVec[ 1 ] = ID_V011;
    break;
  case ID_E1y1:
    vertexVec[ 0 ] = ID_V101;
    vertexVec[ 1 ] = ID_V111;
    break;

  case ID_E00z:
    vertexVec[ 0 ] = ID_V000;
    vertexVec[ 1 ] = ID_V001;
    break;
  case ID_E10z:
    vertexVec[ 0 ] = ID_V100;
    vertexVec[ 1 ] = ID_V101;
    break;
  case ID_E01z:
    vertexVec[ 0 ] = ID_V010;
    vertexVec[ 1 ] = ID_V011;
    break;
  case ID_E11z:
    vertexVec[ 0 ] = ID_V110;
    vertexVec[ 1 ] = ID_V111;
    break;
  default:
    vertexVec.resize(0);
    MESSAGE(" GetEdgeVertexIDs(), wrong edge ID: " << edgeID );
  }
}
SMESH_ComputeErrorPtr StdMeshers_PrismAsBlock.GetError ( ) const

Return problem description.

Definition at line 125 of file StdMeshers_Prism_3D.hxx.

{ return myError; }
void SMESH_Block::GetFaceEdgesIDs ( const int  faceID,
std::vector< int > &  edgeVec 
) [static, inherited]

Definition at line 1628 of file SMESH_Block.cxx.

References SMESH_Block.ID_E00z, SMESH_Block.ID_E01z, SMESH_Block.ID_E0y0, SMESH_Block.ID_E0y1, SMESH_Block.ID_E10z, SMESH_Block.ID_E11z, SMESH_Block.ID_E1y0, SMESH_Block.ID_E1y1, SMESH_Block.ID_Ex00, SMESH_Block.ID_Ex01, SMESH_Block.ID_Ex10, SMESH_Block.ID_Ex11, SMESH_Block.ID_F0yz, SMESH_Block.ID_F1yz, SMESH_Block.ID_Fx0z, SMESH_Block.ID_Fx1z, SMESH_Block.ID_Fxy0, SMESH_Block.ID_Fxy1, and MESSAGE.

Referenced by SMESH_Pattern.Apply(), StdMeshers_Projection_3D.Compute(), Init(), StdMeshers_PrismAsBlock.TSideFace.InsertSubShapes(), SMESH_Block.LoadFace(), SMESH_Block.LoadMeshBlock(), StdMeshers_Prism_3D.setFaceAndEdgesXYZ(), and StdMeshers_Penta_3D.SetHorizEdgeXYZ().

{
  edgeVec.resize( 4 );
  switch ( faceID ) {
  case ID_Fxy0:
    edgeVec[ 0 ] = ID_Ex00;
    edgeVec[ 1 ] = ID_Ex10;
    edgeVec[ 2 ] = ID_E0y0;
    edgeVec[ 3 ] = ID_E1y0;
    break;
  case ID_Fxy1:
    edgeVec[ 0 ] = ID_Ex01;
    edgeVec[ 1 ] = ID_Ex11;
    edgeVec[ 2 ] = ID_E0y1;
    edgeVec[ 3 ] = ID_E1y1;
    break;
  case ID_Fx0z:
    edgeVec[ 0 ] = ID_Ex00;
    edgeVec[ 1 ] = ID_Ex01;
    edgeVec[ 2 ] = ID_E00z;
    edgeVec[ 3 ] = ID_E10z;
    break;
  case ID_Fx1z:
    edgeVec[ 0 ] = ID_Ex10;
    edgeVec[ 1 ] = ID_Ex11;
    edgeVec[ 2 ] = ID_E01z;
    edgeVec[ 3 ] = ID_E11z;
    break;
  case ID_F0yz:
    edgeVec[ 0 ] = ID_E0y0;
    edgeVec[ 1 ] = ID_E0y1;
    edgeVec[ 2 ] = ID_E00z;
    edgeVec[ 3 ] = ID_E01z;
    break;
  case ID_F1yz:
    edgeVec[ 0 ] = ID_E1y0;
    edgeVec[ 1 ] = ID_E1y1;
    edgeVec[ 2 ] = ID_E10z;
    edgeVec[ 3 ] = ID_E11z;
    break;
  default:
    MESSAGE(" GetFaceEdgesIDs(), wrong face ID: " << faceID );
  }
}
bool StdMeshers_PrismAsBlock::GetLayersTransformation ( std::vector< gp_Trsf > &  trsf) const

Return transformations to get coordinates of nodes of each internal layer by nodes of the bottom.

Layer is a set of nodes at a certain step from bottom to top.

Definition at line 1665 of file StdMeshers_Prism_3D.cxx.

References gpXYZ, ID_BOT_FACE, isReverse(), SMESH_fixation.p0, and ex15_cyl2geometry.pz.

{
  const int zSize = VerticalSize();
  if ( zSize < 3 ) return true;
  trsf.resize( zSize - 2 );

  // Select some node columns by which we will define coordinate system of layers

  vector< const TNodeColumn* > columns;
  {
    const TopoDS_Shape& baseFace = Shape(ID_BOT_FACE);
    list< TopoDS_Edge > orderedEdges;
    list< int >         nbEdgesInWires;
    GetOrderedEdges( TopoDS::Face( baseFace ), TopoDS_Vertex(), orderedEdges, nbEdgesInWires );
    bool isReverse;
    list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin();
    for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt )
    {
      if ( BRep_Tool::Degenerated( *edgeIt )) continue;
      const TParam2ColumnMap& u2colMap =
        GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse );
      isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED );
      double f = u2colMap.begin()->first, l = u2colMap.rbegin()->first;
      if ( isReverse ) swap ( f, l );
      const int nbCol = 5;
      for ( int i = 0; i < nbCol; ++i )
      {
        double u = f + i/double(nbCol) * ( l - f );
        const TNodeColumn* col = & getColumn( & u2colMap, u )->second;
        if ( columns.empty() || col != columns.back() )
          columns.push_back( col );
      }
    }
  }

  // Find tolerance to check transformations

  double tol2;
  {
    Bnd_B3d bndBox;
    for ( int i = 0; i < columns.size(); ++i )
      bndBox.Add( gpXYZ( columns[i]->front() ));
    tol2 = bndBox.SquareExtent() * 1e-5;
  }

  // Compute transformations

  int xCol = -1;
  gp_Trsf fromCsZ, toCs0;
  gp_Ax3 cs0 = getLayerCoordSys(0, columns, xCol );
  //double dist0 = cs0.Location().Distance( gpXYZ( (*columns[0])[0]));
  toCs0.SetTransformation( cs0 );
  for ( int z = 1; z < zSize-1; ++z )
  {
    gp_Ax3 csZ = getLayerCoordSys(z, columns, xCol );
    //double distZ = csZ.Location().Distance( gpXYZ( (*columns[0])[z]));
    fromCsZ.SetTransformation( csZ );
    fromCsZ.Invert();
    gp_Trsf& t = trsf[ z-1 ];
    t = fromCsZ * toCs0;
    //t.SetScaleFactor( distZ/dist0 ); - it does not work properly, wrong base point

    // check a transformation
    for ( int i = 0; i < columns.size(); ++i )
    {
      gp_Pnt p0 = gpXYZ( (*columns[i])[0] );
      gp_Pnt pz = gpXYZ( (*columns[i])[z] );
      t.Transforms( p0.ChangeCoord() );
      if ( p0.SquareDistance( pz ) > tol2 )
        return false;
    }
  }
  return true;
}
const TNodeColumn * StdMeshers_PrismAsBlock::GetNodeColumn ( const SMDS_MeshNode node) const

Return pointer to column of nodes.

Parameters:
node- bottom node from which the returned column goes up
Return values:
constTNodeColumn* - the found column

Definition at line 1642 of file StdMeshers_Prism_3D.cxx.

References SMDS_MeshElement.getshapeId().

{
  int sID = node->getshapeId();

  map<int, pair< TParam2ColumnMap*, bool > >::const_iterator col_frw =
    myShapeIndex2ColumnMap.find( sID );
  if ( col_frw != myShapeIndex2ColumnMap.end() ) {
    const TParam2ColumnMap* cols = col_frw->second.first;
    TParam2ColumnIt u_col = cols->begin();
    for ( ; u_col != cols->end(); ++u_col )
      if ( u_col->second[ 0 ] == node )
        return & u_col->second;
  }
  return 0;
}
int SMESH_Block::GetOrderedEdges ( const TopoDS_Face &  theFace,
TopoDS_Vertex  theFirstVertex,
std::list< TopoDS_Edge > &  theEdges,
std::list< int > &  theNbEdgesInWires,
const bool  theShapeAnalysisAlgo = false 
) [static, inherited]

Return number of wires and a list of oredered edges.

Parameters:
theFace- the face to process
theFirstVertex- the vertex of the outer wire to set first in the returned list ( theFirstVertex may be NULL )
theEdges- all ordered edges of theFace (outer edges goes first).
theNbEdgesInWires- nb of edges (== nb of vertices in closed wire) in each wire
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

Definition at line 974 of file SMESH_Block.cxx.

References SMESH_test.edge, ex06_hole1boolean.edge2, ex19_sphereINcube.f1, ex19_sphereINcube.f2, Handle(), MESSAGE, and PAL_MESH_041_mesh.p2.

Referenced by SMESH_Pattern.Apply(), StdMeshers_Quadrangle_2D.CheckNbEdges(), StdMeshers_Quadrangle_2D.CheckNbEdgesForEvaluate(), SMESH_Block.FindBlockShapes(), StdMeshers_ProjectionUtils.FindFaceAssociation(), StdMeshers_FaceSide.GetFaceWires(), Init(), and _QuadFaceGrid.Init().

{
  // put wires in a list, so that an outer wire comes first
  list<TopoDS_Wire> aWireList;
  TopoDS_Wire anOuterWire =
    theShapeAnalysisAlgo ? ShapeAnalysis::OuterWire( theFace ) : BRepTools::OuterWire( theFace );
  for ( TopoDS_Iterator wIt (theFace); wIt.More(); wIt.Next() )
    if ( wIt.Value().ShapeType() == TopAbs_WIRE ) // it can be internal vertex!
    {
      if ( !anOuterWire.IsSame( wIt.Value() ))
        aWireList.push_back( TopoDS::Wire( wIt.Value() ));
      else
        aWireList.push_front( TopoDS::Wire( wIt.Value() ));
    }

  // loop on edges of wires
  theNbEdgesInWires.clear();
  list<TopoDS_Wire>::iterator wlIt = aWireList.begin();
  for ( ; wlIt != aWireList.end(); wlIt++ )
  {
    int iE;
    BRepTools_WireExplorer wExp( *wlIt, theFace );
    for ( iE = 0; wExp.More(); wExp.Next(), iE++ )
    {
      TopoDS_Edge edge = wExp.Current();
      // commented for issue 0020557, other related ones: 0020526, PAL19080
      // edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
      theEdges.push_back( edge );
    }
    if ( iE == 0 ) // wExp returns nothing if e.g. the wire contains one internal edge
    { // Issue 0020676
      for ( TopoDS_Iterator e( *wlIt ); e.More(); e.Next(), ++iE )
        theEdges.push_back( TopoDS::Edge( e.Value() ));
    }
    theNbEdgesInWires.push_back( iE );
    iE = 0;
    if ( wlIt == aWireList.begin() && theEdges.size() > 1 ) { // the outer wire
      // orient closed edges
      list< TopoDS_Edge >::iterator eIt, eIt2;
      for ( eIt = theEdges.begin(); eIt != theEdges.end(); eIt++ )
      {
        TopoDS_Edge& edge = *eIt;
        if ( TopExp::FirstVertex( edge ).IsSame( TopExp::LastVertex( edge ) ))
        {
          eIt2 = eIt;
          bool isNext = ( eIt2 == theEdges.begin() );
          TopoDS_Edge edge2 = isNext ? *(++eIt2) : *(--eIt2);
          double f1,l1,f2,l2;
          Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface( edge, theFace, f1,l1 );
          Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface( edge2, theFace, f2,l2 );
          gp_Pnt2d pf = c1->Value( edge.Orientation() == TopAbs_FORWARD ? f1 : l1 );
          gp_Pnt2d pl = c1->Value( edge.Orientation() == TopAbs_FORWARD ? l1 : f1 );
          bool isFirst = ( edge2.Orientation() == TopAbs_FORWARD ? isNext : !isNext );
          gp_Pnt2d p2 = c2->Value( isFirst ? f2 : l2 );
          isFirst = ( p2.SquareDistance( pf ) < p2.SquareDistance( pl ));
          if ( isNext ? isFirst : !isFirst )
            edge.Reverse();
          // to make a seam go first
          if ( theFirstVertex.IsNull() )
            theFirstVertex = TopExp::FirstVertex( edge, true );
        }
      }
      // rotate theEdges until it begins from theFirstVertex
      if ( ! theFirstVertex.IsNull() ) {
        TopoDS_Vertex vv[2];
        TopExp::Vertices( theEdges.front(), vv[0], vv[1], true );
        // on closed face, make seam edge the first in the list
        while ( !vv[0].IsSame( theFirstVertex ) || vv[0].IsSame( vv[1] ))
        {
          theEdges.splice(theEdges.end(), theEdges,
                          theEdges.begin(), ++theEdges.begin());
          TopExp::Vertices( theEdges.front(), vv[0], vv[1], true );
          if ( iE++ > theNbEdgesInWires.back() ) {
#ifdef _DEBUG_
            gp_Pnt p = BRep_Tool::Pnt( theFirstVertex );
            MESSAGE ( " : Warning : vertex "<< theFirstVertex.TShape().operator->()
                   << " ( " << p.X() << " " << p.Y() << " " << p.Z() << " )" 
                   << " not found in outer wire of face "<< theFace.TShape().operator->()
                   << " with vertices: " );
            wExp.Init( *wlIt, theFace );
            for ( int i = 0; wExp.More(); wExp.Next(), i++ )
            {
              TopoDS_Edge edge = wExp.Current();
              edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
              TopoDS_Vertex v = TopExp::FirstVertex( edge, true );
              gp_Pnt p = BRep_Tool::Pnt( v );
              MESSAGE_ADD ( i << " " << v.TShape().operator->() << " "
                            << p.X() << " " << p.Y() << " " << p.Z() << " " << std::endl );
            }
#endif
            break; // break infinite loop
          }
        }
      }
    } // end outer wire
  }

  return aWireList.size();
}
const TParam2ColumnMap& StdMeshers_PrismAsBlock.GetParam2ColumnMap ( const int  baseEdgeID,
bool isReverse 
) const

Return TParam2ColumnMap for a base edge.

Parameters:
baseEdgeID- base edge SMESHDS Index
isReverse- columns in-block orientation
Return values:
constTParam2ColumnMap& - map

Definition at line 153 of file StdMeshers_Prism_3D.hxx.

  {
    std::pair< TParam2ColumnMap*, bool > col_frw =
      myShapeIndex2ColumnMap.find( baseEdgeID )->second;
    isReverse = !col_frw.second;
    return * col_frw.first;
  }
double * SMESH_Block::GetShapeCoef ( const int  theShapeID) [static, inherited]

Definition at line 310 of file SMESH_Block.cxx.

Referenced by SMESH_Block.ComputeParameters(), and SMESH_Pattern.Load().

{
  static double shapeCoef[][3] = {
    //    V000,        V100,        V010,         V110
    { -1,-1,-1 }, {  1,-1,-1 }, { -1, 1,-1 }, {  1, 1,-1 },
    //    V001,        V101,        V011,         V111,
    { -1,-1, 1 }, {  1,-1, 1 }, { -1, 1, 1 }, {  1, 1, 1 },
    //    Ex00,        Ex10,        Ex01,         Ex11,
    {  0,-1,-1 }, {  0, 1,-1 }, {  0,-1, 1 }, {  0, 1, 1 },
    //    E0y0,        E1y0,        E0y1,         E1y1,
    { -1, 0,-1 }, {  1, 0,-1 }, { -1, 0, 1 }, {  1, 0, 1 },
    //    E00z,        E10z,        E01z,         E11z,
    { -1,-1, 0 }, {  1,-1, 0 }, { -1, 1, 0 }, {  1, 1, 0 },
    //    Fxy0,        Fxy1,        Fx0z,         Fx1z,         F0yz,           F1yz,
    {  0, 0,-1 }, {  0, 0, 1 }, {  0,-1, 0 }, {  0, 1, 0 }, { -1, 0, 0 }, {  1, 0, 0 },
    // ID_Shell
    {  0, 0, 0 }
  };
  if ( theShapeID < ID_V000 || theShapeID > ID_F1yz )
    return shapeCoef[ ID_Shell - 1 ];

  return shapeCoef[ theShapeID - 1 ];
}
int SMESH_Block::GetShapeIDByParams ( const gp_XYZ &  theParams) [static, inherited]

Definition at line 913 of file SMESH_Block.cxx.

References MESSAGE.

Referenced by SMESH_Pattern.findBoundaryPoints(), and StdMeshers_Penta_3D.FindNodeOnShape().

{
  //   id ( 0 - 26 ) computation:

  //   vertex     ( 0 - 7 )  : id = 1*x + 2*y + 4*z

  //   edge || X  ( 8 - 11 ) : id = 8   + 1*y + 2*z
  //   edge || Y  ( 12 - 15 ): id = 1*x + 12  + 2*z
  //   edge || Z  ( 16 - 19 ): id = 1*x + 2*y + 16 

  //   face || XY ( 20 - 21 ): id = 8   + 12  + 1*z - 0
  //   face || XZ ( 22 - 23 ): id = 8   + 1*y + 16  - 2
  //   face || YZ ( 24 - 25 ): id = 1*x + 12  + 16  - 4

  static int iAddBnd[]    = { 1, 2, 4 };
  static int iAddNotBnd[] = { 8, 12, 16 };
  static int iFaceSubst[] = { 0, 2, 4 };

  int id = 0;
  int iOnBoundary = 0;
  for ( int iCoord = 0; iCoord < 3; iCoord++ )
  {
    double val = theCoord.Coord( iCoord + 1 );
    if ( val == 0.0 )
      iOnBoundary++;
    else if ( val == 1.0 )
      id += iAddBnd[ iOnBoundary++ ];
    else
      id += iAddNotBnd[ iCoord ];
  }
  if ( iOnBoundary == 1 ) // face
    id -= iFaceSubst[ (id - 20) / 4 ];
  else if ( iOnBoundary == 0 ) // shell
    id = 26;

  if ( id > 26 || id < 0 ) {
    MESSAGE( "GetShapeIDByParams() = " << id
            <<" "<< theCoord.X() <<" "<< theCoord.Y() <<" "<< theCoord.Z() );
  }

  return id + 1; // shape ids start at 1
}
Standard_Integer SMESH_Block::GetStateNumber ( ) [inherited]

Definition at line 477 of file SMESH_Block.cxx.

{
  return 0; //myValues[0] < 1e-1;
}
bool StdMeshers_PrismAsBlock::GetWallFaces ( SMESH_Mesh mesh,
const TopoDS_Shape &  mainShape,
const TopoDS_Shape &  bottomFace,
std::list< TopoDS_Edge > &  bottomEdges,
std::list< int > &  nbEInW,
std::list< TopoDS_Face > &  wallFaces 
)

Find wall faces by bottom edges.

Parameters:
mesh- the mesh
mainShape- the prism
bottomFace- the bottom face
bottomEdges- edges bounding the bottom face
wallFaces- faces list to fill in

Definition at line 1785 of file StdMeshers_Prism_3D.cxx.

References SMESH_test.edge.

{
  wallFaces.clear();

  TopTools_IndexedMapOfShape faceMap;
  TopExp::MapShapes( mainShape, TopAbs_FACE, faceMap );

  list< TopoDS_Edge >::iterator edge = bottomEdges.begin();
  std::list< int >::iterator nbE = nbEInW.begin();
  int iE = 0;
  while ( edge != bottomEdges.end() )
  {
    ++iE;
    if ( BRep_Tool::Degenerated( *edge ))
    {
      edge = bottomEdges.erase( edge );
      --iE;
      --(*nbE);
    }
    else
    {
      PShapeIteratorPtr fIt = myHelper->GetAncestors( *edge, *mesh, TopAbs_FACE );
      while ( fIt->more() )
      {
        const TopoDS_Shape* face = fIt->next();
        if ( !bottomFace.IsSame( *face ) &&      // not bottom
             faceMap.FindIndex( *face ))         // belongs to the prism
        {
          wallFaces.push_back( TopoDS::Face( *face ));
          break;
        }
      }
      ++edge;
    }
    if ( iE == *nbE )
    {
      iE = 0;
      ++nbE;
    }
  }
  return ( wallFaces.size() == bottomEdges.size() );
}
bool StdMeshers_PrismAsBlock.HasNotQuadElemOnTop ( ) const

Definition at line 138 of file StdMeshers_Prism_3D.hxx.

{ return myNotQuadOnTop; }
bool StdMeshers_PrismAsBlock::Init ( SMESH_MesherHelper helper,
const TopoDS_Shape &  shape3D 
)

Initialization.

Parameters:
helper- helper loaded with mesh and 3D shape
shape3D- a closed shell or solid
Return values:
bool- false if a mesh or a shape are KO

Analyse shape geometry and mesh. If there are triangles on one of faces, it becomes 'bottom'

Parameters:
helper- helper loaded with mesh and 3D shape
shape3D- a closed shell or solid
Return values:
bool- false if a mesh or a shape are KO

Definition at line 1076 of file StdMeshers_Prism_3D.cxx.

References BOTTOM_EDGE, SMESH_Partition1_tetra.comp, COMPERR_BAD_INPUT_MESH, COMPERR_BAD_SHAPE, SMESH_test.edge, SMESH_Algo.EdgeLength(), StdMeshers_PrismAsBlock.TSideFace.FaceID(), SMESH_Block.FindBlockShapes(), StdMeshers_PrismAsBlock.TSideFace.GetComponent(), SMESH_Block.TEdge.GetCurve(), SMESH_Block.GetEdgeVertexIDs(), SMESHDS_SubMesh.GetElements(), SMESH_Block.GetFaceEdgesIDs(), SMESH_Block.GetOrderedEdges(), StdMeshers_PrismAsBlock.TSideFace.GetPCurves(), SMDS_MeshElement.getshapeId(), SMDS_MeshElement.GetType(), gpXYZ, StdMeshers_PrismAsBlock.TSideFace.HorizCurve(), StdMeshers_PrismAsBlock.TSideFace.HorizPCurve(), ID_BOT_FACE, SMESH_Block.ID_F0yz, SMESH_Block.ID_F1yz, SMESH_Block.ID_Fx0z, SMESH_Block.ID_Fx1z, ID_TOP_FACE, SMESH_Block.init(), SMESH_Block.Insert(), StdMeshers_PrismAsBlock.TSideFace.InsertSubShapes(), StdMeshers_PrismAsBlock.TSideFace.IsComplex(), StdMeshers_PrismAsBlock.TSideFace.IsForward(), SMDS_MeshElement.IsQuadratic(), SMESH_MesherHelper.IsSubShape(), SMESHDS_Mesh.MeshElements(), MESSAGE, SMESH_AdvancedEditor.n1, NB_WALL_FACES, SMESHDS_SubMesh.NbElements(), SMESHDS_SubMesh.NbNodes(), SMDS_MeshElement.NbNodes(), SMESH_ComputeError.New(), RETURN_BAD_RESULT, SMESH_Block.TEdge.Set(), SMESH_Block.TFace.Set(), SMESH_box2_tetra.shell, SHOWYXZ, SMDSAbs_Face, StdMeshers_PrismAsBlock.TSideFace.Surface(), StdMeshers_PrismAsBlock.TSideFace.Value(), and StdMeshers_PrismAsBlock.TSideFace.VertiCurve().

{
  if ( mySide ) {
    delete mySide; mySide = 0;
  }
  vector< TSideFace* > sideFaces( NB_WALL_FACES, 0 );
  vector< pair< double, double> > params ( NB_WALL_FACES );
  mySide = new TSideFace( sideFaces, params );

  myHelper = helper;
  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();

  SMESH_Block::init();
  myShapeIDMap.Clear();
  myShapeIndex2ColumnMap.clear();
  
  int wallFaceIds[ NB_WALL_FACES ] = { // to walk around a block
    SMESH_Block::ID_Fx0z, SMESH_Block::ID_F1yz,
    SMESH_Block::ID_Fx1z, SMESH_Block::ID_F0yz
  };

  myError = SMESH_ComputeError::New();

  // -------------------------------------------------------------
  // Look for top and bottom faces: not quadrangle ones or meshed
  // with not quadrangle elements
  // -------------------------------------------------------------

  list< SMESH_subMesh* > notQuadGeomSubMesh;
  list< SMESH_subMesh* > notQuadElemSubMesh;
  int nbFaces = 0;
  //
  SMESH_subMesh* mainSubMesh = myHelper->GetMesh()->GetSubMeshContaining( shape3D );
  if ( !mainSubMesh ) return error(COMPERR_BAD_INPUT_MESH,"Null submesh of shape3D");

  // analyse face submeshes
  SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,false);
  while ( smIt->more() )
  {
    SMESH_subMesh* sm = smIt->next();
    const TopoDS_Shape& face = sm->GetSubShape();
    if ( face.ShapeType() != TopAbs_FACE )
      continue;
    nbFaces++;

    // is quadrangle face?
    list< TopoDS_Edge > orderedEdges;
    list< int >         nbEdgesInWires;
    TopoDS_Vertex       V000;
    int nbWires = GetOrderedEdges( TopoDS::Face( face ),
                                   V000, orderedEdges, nbEdgesInWires );
    if ( nbWires != 1 || nbEdgesInWires.front() != 4 )
      notQuadGeomSubMesh.push_back( sm );

    // look for not quadrangle mesh elements
    if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) {
      bool hasNotQuad = false;
      SMDS_ElemIteratorPtr eIt = smDS->GetElements();
      while ( eIt->more() && !hasNotQuad ) {
        const SMDS_MeshElement* elem = eIt->next();
        if ( elem->GetType() == SMDSAbs_Face ) {
          int nbNodes = elem->NbNodes();
          if ( elem->IsQuadratic() )
            nbNodes /= 2;
          hasNotQuad = ( nbNodes != 4 );
        }
      }
      if ( hasNotQuad )
        notQuadElemSubMesh.push_back( sm );
    }
    else {
      return error(COMPERR_BAD_INPUT_MESH,TCom("Not meshed face #")<<sm->GetId());
    }
    // check if a quadrangle face is meshed with a quadranglar grid
    if ( notQuadGeomSubMesh.back() != sm &&
         notQuadElemSubMesh.back() != sm )
    {
      // count nb edges on face sides
      vector< int > nbEdges;
      nbEdges.reserve( nbEdgesInWires.front() );
      for ( list< TopoDS_Edge >::iterator edge = orderedEdges.begin();
            edge != orderedEdges.end(); ++edge )
      {
        if ( SMESHDS_SubMesh* smDS = meshDS->MeshElements( *edge ))
          nbEdges.push_back ( smDS->NbElements() );
        else
          nbEdges.push_back ( 0 );
      }
      int nbQuads = sm->GetSubMeshDS()->NbElements();
      if ( nbEdges[0] *  nbEdges[1] != nbQuads ||
           nbEdges[0] != nbEdges[2] ||
           nbEdges[1] != nbEdges[3] )
        notQuadElemSubMesh.push_back( sm );
    }
  }

  // ----------------------------------------------------------------------
  // Analyse mesh and topology of faces: choose the bottom submesh.
  // If there are not quadrangle geom faces, they are top and bottom ones.
  // Not quadrangle geom faces must be only on top and bottom.
  // ----------------------------------------------------------------------

  SMESH_subMesh * botSM = 0;
  SMESH_subMesh * topSM = 0;

  int nbNotQuad       = notQuadGeomSubMesh.size();
  int nbNotQuadMeshed = notQuadElemSubMesh.size();
  bool hasNotQuad = ( nbNotQuad || nbNotQuadMeshed );

  // detect bad cases
  if ( nbNotQuadMeshed > 2 )
  {
    return error(COMPERR_BAD_INPUT_MESH,
                 TCom("More than 2 faces with not quadrangle elements: ")
                 <<nbNotQuadMeshed);
  }
  int nbQuasiQuads = 0;
  if ( nbNotQuad > 0 && nbNotQuad != 2 )
  {
    // Issue 0020843 - one of side faces is quasi-quadrilateral.
    // Remove from notQuadGeomSubMesh faces meshed with regular grid
    nbQuasiQuads = removeQuasiQuads( notQuadGeomSubMesh );
    nbNotQuad -= nbQuasiQuads;
    if ( nbNotQuad > 0 && nbNotQuad != 2 )
      return error(COMPERR_BAD_SHAPE,
                   TCom("More than 2 not quadrilateral faces: ")
                   <<nbNotQuad);
  }

  // get found submeshes
  if ( hasNotQuad )
  {
    if ( nbNotQuadMeshed > 0 ) botSM = notQuadElemSubMesh.front();
    else                       botSM = notQuadGeomSubMesh.front();
    if ( nbNotQuadMeshed > 1 ) topSM = notQuadElemSubMesh.back();
    else if ( nbNotQuad  > 1 ) topSM = notQuadGeomSubMesh.back();
  }
  // detect other bad cases
  if ( nbNotQuad == 2 && nbNotQuadMeshed > 0 ) {
    bool ok = false;
    if ( nbNotQuadMeshed == 1 )
      ok = ( find( notQuadGeomSubMesh.begin(),
                   notQuadGeomSubMesh.end(), botSM ) != notQuadGeomSubMesh.end() );
    else
      ok = ( notQuadGeomSubMesh == notQuadElemSubMesh );
    if ( !ok )
      return error(COMPERR_BAD_INPUT_MESH, "Side face meshed with not quadrangle elements");
  }

  myNotQuadOnTop = ( nbNotQuadMeshed > 1 );
  MESSAGE("myNotQuadOnTop " << myNotQuadOnTop << " nbNotQuadMeshed " << nbNotQuadMeshed);
 
  // ----------------------------------------------------------

  if ( nbNotQuad == 0 ) // Standard block of 6 quadrangle faces ?
  {
    // SMESH_Block will perform geometry analysis, we need just to find 2
    // connected vertices on top and bottom

    TopoDS_Vertex Vbot, Vtop;
    if ( nbNotQuadMeshed > 0 ) // Look for vertices
    {
      TopTools_IndexedMapOfShape edgeMap;
      TopExp::MapShapes( botSM->GetSubShape(), TopAbs_EDGE, edgeMap );
      // vertex 1 is any vertex of the bottom face
      Vbot = TopExp::FirstVertex( TopoDS::Edge( edgeMap( 1 )));
      // vertex 2 is end vertex of edge sharing Vbot and not belonging to the bottom face
      TopTools_ListIteratorOfListOfShape ancestIt = Mesh()->GetAncestors( Vbot );
      for ( ; Vtop.IsNull() && ancestIt.More(); ancestIt.Next() )
      {
        const TopoDS_Shape & ancestor = ancestIt.Value();
        if ( ancestor.ShapeType() == TopAbs_EDGE && !edgeMap.FindIndex( ancestor ))
        {
          TopoDS_Vertex V1, V2;
          TopExp::Vertices( TopoDS::Edge( ancestor ), V1, V2);
          if      ( Vbot.IsSame ( V1 )) Vtop = V2;
          else if ( Vbot.IsSame ( V2 )) Vtop = V1;
          // check that Vtop belongs to shape3D
          TopExp_Explorer exp( shape3D, TopAbs_VERTEX );
          for ( ; exp.More(); exp.Next() )
            if ( Vtop.IsSame( exp.Current() ))
              break;
          if ( !exp.More() )
            Vtop.Nullify();
        }
      }
    }
    // get shell from shape3D
    TopoDS_Shell shell;
    TopExp_Explorer exp( shape3D, TopAbs_SHELL );
    int nbShell = 0;
    for ( ; exp.More(); exp.Next(), ++nbShell )
      shell = TopoDS::Shell( exp.Current() );
//     if ( nbShell != 1 )
//       RETURN_BAD_RESULT("There must be 1 shell in the block");

    // Load geometry in SMESH_Block
    if ( !SMESH_Block::FindBlockShapes( shell, Vbot, Vtop, myShapeIDMap )) {
      if ( !hasNotQuad )
        return error(COMPERR_BAD_SHAPE, "Can't detect top and bottom of a prism");
    }
    else {
      if ( !botSM ) botSM = Mesh()->GetSubMeshContaining( myShapeIDMap( ID_BOT_FACE ));
      if ( !topSM ) topSM = Mesh()->GetSubMeshContaining( myShapeIDMap( ID_TOP_FACE ));
    }

  } // end  Standard block of 6 quadrangle faces
  // --------------------------------------------------------

  // Here the top and bottom faces are found
  if ( nbNotQuadMeshed == 2 ) // roughly check correspondence of horiz meshes
  {
//     SMESHDS_SubMesh* topSMDS = topSM->GetSubMeshDS();
//     SMESHDS_SubMesh* botSMDS = botSM->GetSubMeshDS();
//     if ( topSMDS->NbNodes() != botSMDS->NbNodes() ||
//          topSMDS->NbElements() != botSMDS->NbElements() )
//       RETURN_BAD_RESULT("Top mesh doesn't correspond to bottom one");
  }

  // ---------------------------------------------------------
  // If there are not quadrangle geom faces, we emulate
  // a block of 6 quadrangle faces.
  // Load SMESH_Block with faces and edges geometry
  // ---------------------------------------------------------

  
  // find vertex 000 - the one with smallest coordinates (for easy DEBUG :-)
  TopoDS_Vertex V000;
  double minVal = DBL_MAX, minX, val;
  for ( TopExp_Explorer exp( botSM->GetSubShape(), TopAbs_VERTEX );
        exp.More(); exp.Next() )
  {
    const TopoDS_Vertex& v = TopoDS::Vertex( exp.Current() );
    gp_Pnt P = BRep_Tool::Pnt( v );
    val = P.X() + P.Y() + P.Z();
    if ( val < minVal || ( val == minVal && P.X() < minX )) {
      V000 = v;
      minVal = val;
      minX = P.X();
    }
  }

  // Get ordered bottom edges
  list< TopoDS_Edge > orderedEdges;
  list< int >         nbEInW;
  SMESH_Block::GetOrderedEdges( TopoDS::Face( botSM->GetSubShape().Reversed() ),
                                V000, orderedEdges, nbEInW );
//   if ( nbEInW.size() != 1 )
//     RETURN_BAD_RESULT("Wrong prism geometry");

  // Get Wall faces corresponding to the ordered bottom edges
  list< TopoDS_Face > wallFaces;
  if ( !GetWallFaces( Mesh(), shape3D, botSM->GetSubShape(), orderedEdges, nbEInW, wallFaces))
    return error(COMPERR_BAD_SHAPE, "Can't find side faces");

  // Protect from a distorted block (test 3D_mesh_HEXA3D/B7 on 32bit platform)
  // check that all wall faces have an edge common with the top face
  {
    list< TopoDS_Face >::iterator faceIt = wallFaces.begin();
    for ( ; faceIt != wallFaces.end(); ++faceIt )
    {
      bool hasCommon = false;
      for (TopExp_Explorer edge(*faceIt, TopAbs_EDGE); !hasCommon && edge.More(); edge.Next())
        if ( helper->IsSubShape( edge.Current(), topSM->GetSubShape() ))
          hasCommon = true;
      if ( !hasCommon )
        return error(COMPERR_BAD_SHAPE);
    }
  }

  // Find columns of wall nodes and calculate edges' lengths
  // --------------------------------------------------------

  myParam2ColumnMaps.clear();
  myParam2ColumnMaps.resize( orderedEdges.size() ); // total nb edges

  int iE, nbEdges = nbEInW.front(); // nb outer edges
  vector< double > edgeLength( nbEdges );
  map< double, int > len2edgeMap;

  list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin();
  list< TopoDS_Face >::iterator faceIt = wallFaces.begin();
  for ( iE = 0; iE < nbEdges; ++edgeIt, ++faceIt )
  {
    TParam2ColumnMap & faceColumns = myParam2ColumnMaps[ iE ];
    if ( !myHelper->LoadNodeColumns( faceColumns, *faceIt, *edgeIt, meshDS ))
      return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
                   << "on a side face #" << MeshDS()->ShapeToIndex( *faceIt ));

    SHOWYXZ("\np1 F "<<iE, gpXYZ(faceColumns.begin()->second.front() ));
    SHOWYXZ("p2 F "<<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
    SHOWYXZ("V First "<<iE, BRep_Tool::Pnt( TopExp::FirstVertex(*edgeIt,true )));

    edgeLength[ iE ] = SMESH_Algo::EdgeLength( *edgeIt );

    if ( nbEdges < NB_WALL_FACES ) // fill map used to split faces
    {
      SMESHDS_SubMesh* smDS = meshDS->MeshElements( *edgeIt);
      if ( !smDS )
        return error(COMPERR_BAD_INPUT_MESH, TCom("Null submesh on the edge #")
                     << MeshDS()->ShapeToIndex( *edgeIt ));
      // assure length uniqueness
      edgeLength[ iE ] *= smDS->NbNodes() + edgeLength[ iE ] / ( 1000 + iE );
      len2edgeMap[ edgeLength[ iE ]] = iE;
    }
    ++iE;
  }
  // Load columns of internal edges (forming holes)
  // and fill map ShapeIndex to TParam2ColumnMap for them
  for ( ; edgeIt != orderedEdges.end() ; ++edgeIt, ++faceIt )
  {
    TParam2ColumnMap & faceColumns = myParam2ColumnMaps[ iE ];
    if ( !myHelper->LoadNodeColumns( faceColumns, *faceIt, *edgeIt, meshDS ))
      return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
                   << "on a side face #" << MeshDS()->ShapeToIndex( *faceIt ));
    // edge columns
    int id = MeshDS()->ShapeToIndex( *edgeIt );
    bool isForward = true; // meaningless for intenal wires
    myShapeIndex2ColumnMap[ id ] = make_pair( & faceColumns, isForward );
    // columns for vertices
    // 1
    const SMDS_MeshNode* n0 = faceColumns.begin()->second.front();
    id = n0->getshapeId();
    myShapeIndex2ColumnMap[ id ] = make_pair( & faceColumns, isForward );
    // 2
    const SMDS_MeshNode* n1 = faceColumns.rbegin()->second.front();
    id = n1->getshapeId();
    myShapeIndex2ColumnMap[ id ] = make_pair( & faceColumns, isForward );
//     SHOWYXZ("\np1 F "<<iE, gpXYZ(faceColumns.begin()->second.front() ));
//     SHOWYXZ("p2 F "<<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
//     SHOWYXZ("V First "<<iE, BRep_Tool::Pnt( TopExp::FirstVertex(*edgeIt,true )));
    ++iE;
  }

  // Create 4 wall faces of a block
  // -------------------------------

  if ( nbEdges <= NB_WALL_FACES ) // ************* Split faces if necessary
  {
    map< int, int > iE2nbSplit;
    if ( nbEdges != NB_WALL_FACES ) // define how to split
    {
      if ( len2edgeMap.size() != nbEdges )
        RETURN_BAD_RESULT("Uniqueness of edge lengths not assured");
      map< double, int >::reverse_iterator maxLen_i = len2edgeMap.rbegin();
      map< double, int >::reverse_iterator midLen_i = ++len2edgeMap.rbegin();
      double maxLen = maxLen_i->first;
      double midLen = ( len2edgeMap.size() == 1 ) ? 0 : midLen_i->first;
      switch ( nbEdges ) {
      case 1: // 0-th edge is split into 4 parts
        iE2nbSplit.insert( make_pair( 0, 4 )); break;
      case 2: // either the longest edge is split into 3 parts, or both edges into halves
        if ( maxLen / 3 > midLen / 2 ) {
          iE2nbSplit.insert( make_pair( maxLen_i->second, 3 ));
        }
        else {
          iE2nbSplit.insert( make_pair( maxLen_i->second, 2 ));
          iE2nbSplit.insert( make_pair( midLen_i->second, 2 ));
        }
        break;
      case 3:
        // split longest into halves
        iE2nbSplit.insert( make_pair( maxLen_i->second, 2 ));
      }
    }
    // Create TSideFace's
    faceIt = wallFaces.begin();
    edgeIt = orderedEdges.begin();
    int iSide = 0;
    for ( iE = 0; iE < nbEdges; ++edgeIt, ++faceIt )
    {
     // split?
      map< int, int >::iterator i_nb = iE2nbSplit.find( iE );
      if ( i_nb != iE2nbSplit.end() ) {
        // split!
        int nbSplit = i_nb->second;
        vector< double > params;
        splitParams( nbSplit, &myParam2ColumnMaps[ iE ], params );
        bool isForward = ( edgeIt->Orientation() == TopAbs_FORWARD );
        for ( int i = 0; i < nbSplit; ++i ) {
          double f = ( isForward ? params[ i ] : params[ nbSplit - i-1 ]);
          double l = ( isForward ? params[ i+1 ] : params[ nbSplit - i ]);
          TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
                                           *faceIt, *edgeIt,
                                           &myParam2ColumnMaps[ iE ], f, l );
          mySide->SetComponent( iSide++, comp );
        }
      }
      else {
        TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
                                         *faceIt, *edgeIt,
                                         &myParam2ColumnMaps[ iE ]);
        mySide->SetComponent( iSide++, comp );
      }
      ++iE;
    }
  }
  else { // **************************** Unite faces

    // unite first faces
    int nbExraFaces = nbEdges - 3;
    int iSide = 0, iE;
    double u0 = 0, sumLen = 0;
    for ( iE = 0; iE < nbExraFaces; ++iE )
      sumLen += edgeLength[ iE ];

    vector< TSideFace* > components( nbExraFaces );
    vector< pair< double, double> > params( nbExraFaces );
    faceIt = wallFaces.begin();
    edgeIt = orderedEdges.begin();
    for ( iE = 0; iE < nbExraFaces; ++edgeIt, ++faceIt )
    {
      components[ iE ] = new TSideFace( myHelper, wallFaceIds[ iSide ],
                                        *faceIt, *edgeIt,
                                        &myParam2ColumnMaps[ iE ]);
      double u1 = u0 + edgeLength[ iE ] / sumLen;
      params[ iE ] = make_pair( u0 , u1 );
      u0 = u1;
      ++iE;
    }
    mySide->SetComponent( iSide++, new TSideFace( components, params ));

    // fill the rest faces
    for ( ; iE < nbEdges; ++faceIt, ++edgeIt )
    {
      TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
                                       *faceIt, *edgeIt,
                                       &myParam2ColumnMaps[ iE ]);
      mySide->SetComponent( iSide++, comp );
      ++iE;
    }
  }


  // Fill geometry fields of SMESH_Block
  // ------------------------------------

  TopoDS_Face botF = TopoDS::Face( botSM->GetSubShape() );
  TopoDS_Face topF = TopoDS::Face( topSM->GetSubShape() );

  vector< int > botEdgeIdVec;
  SMESH_Block::GetFaceEdgesIDs( ID_BOT_FACE, botEdgeIdVec );

  bool isForward[NB_WALL_FACES] = { true, true, true, true };
  Adaptor2d_Curve2d* botPcurves[NB_WALL_FACES];
  Adaptor2d_Curve2d* topPcurves[NB_WALL_FACES];

  for ( int iF = 0; iF < NB_WALL_FACES; ++iF )
  {
    TSideFace * sideFace = mySide->GetComponent( iF );
    if ( !sideFace )
      RETURN_BAD_RESULT("NULL TSideFace");
    int fID = sideFace->FaceID();

    // fill myShapeIDMap
    if ( sideFace->InsertSubShapes( myShapeIDMap ) != 8 &&
         !sideFace->IsComplex())
      MESSAGE( ": Warning : InsertSubShapes() < 8 on side " << iF );

    // side faces geometry
    Adaptor2d_Curve2d* pcurves[NB_WALL_FACES];
    if ( !sideFace->GetPCurves( pcurves ))
      RETURN_BAD_RESULT("TSideFace::GetPCurves() failed");

    SMESH_Block::TFace& tFace = myFace[ fID - ID_FirstF ];
    tFace.Set( fID, sideFace->Surface(), pcurves, isForward );

    SHOWYXZ( endl<<"F "<< iF << " id " << fID << " FRW " << sideFace->IsForward(), sideFace->Value(0,0));
    // edges 3D geometry
    vector< int > edgeIdVec;
    SMESH_Block::GetFaceEdgesIDs( fID, edgeIdVec );
    for ( int isMax = 0; isMax < 2; ++isMax ) {
      {
        int eID = edgeIdVec[ isMax ];
        SMESH_Block::TEdge& tEdge = myEdge[ eID - ID_FirstE ];
        tEdge.Set( eID, sideFace->HorizCurve(isMax), true);
        SHOWYXZ(eID<<" HOR"<<isMax<<"(0)", sideFace->HorizCurve(isMax)->Value(0));
        SHOWYXZ(eID<<" HOR"<<isMax<<"(1)", sideFace->HorizCurve(isMax)->Value(1));
      }
      {
        int eID = edgeIdVec[ isMax+2 ];
        SMESH_Block::TEdge& tEdge = myEdge[ eID - ID_FirstE  ];
        tEdge.Set( eID, sideFace->VertiCurve(isMax), true);
        SHOWYXZ(eID<<" VER"<<isMax<<"(0)", sideFace->VertiCurve(isMax)->Value(0));
        SHOWYXZ(eID<<" VER"<<isMax<<"(1)", sideFace->VertiCurve(isMax)->Value(1));

        // corner points
        vector< int > vertexIdVec;
        SMESH_Block::GetEdgeVertexIDs( eID, vertexIdVec );
        myPnt[ vertexIdVec[0] - ID_FirstV ] = tEdge.GetCurve()->Value(0).XYZ();
        myPnt[ vertexIdVec[1] - ID_FirstV ] = tEdge.GetCurve()->Value(1).XYZ();
      }
    }
    // pcurves on horizontal faces
    for ( iE = 0; iE < NB_WALL_FACES; ++iE ) {
      if ( edgeIdVec[ BOTTOM_EDGE ] == botEdgeIdVec[ iE ] ) {
        botPcurves[ iE ] = sideFace->HorizPCurve( false, botF );
        topPcurves[ iE ] = sideFace->HorizPCurve( true,  topF );
        break;
      }
    }
    //sideFace->dumpNodes( 4 ); // debug
  }
  // horizontal faces geometry
  {
    SMESH_Block::TFace& tFace = myFace[ ID_BOT_FACE - ID_FirstF ];
    tFace.Set( ID_BOT_FACE, new BRepAdaptor_Surface( botF ), botPcurves, isForward );
    SMESH_Block::Insert( botF, ID_BOT_FACE, myShapeIDMap );
  }
  {
    SMESH_Block::TFace& tFace = myFace[ ID_TOP_FACE - ID_FirstF ];
    tFace.Set( ID_TOP_FACE, new BRepAdaptor_Surface( topF ), topPcurves, isForward );
    SMESH_Block::Insert( topF, ID_TOP_FACE, myShapeIDMap );
  }

  // Fill map ShapeIndex to TParam2ColumnMap
  // ----------------------------------------

  list< TSideFace* > fList;
  list< TSideFace* >::iterator fListIt;
  fList.push_back( mySide );
  for ( fListIt = fList.begin(); fListIt != fList.end(); ++fListIt)
  {
    int nb = (*fListIt)->NbComponents();
    for ( int i = 0; i < nb; ++i ) {
      if ( TSideFace* comp = (*fListIt)->GetComponent( i ))
        fList.push_back( comp );
    }
    if ( TParam2ColumnMap* cols = (*fListIt)->GetColumns()) {
      // columns for a base edge
      int id = MeshDS()->ShapeToIndex( (*fListIt)->BaseEdge() );
      bool isForward = (*fListIt)->IsForward();
      myShapeIndex2ColumnMap[ id ] = make_pair( cols, isForward );

      // columns for vertices
      const SMDS_MeshNode* n0 = cols->begin()->second.front();
      id = n0->getshapeId();
      myShapeIndex2ColumnMap[ id ] = make_pair( cols, isForward );

      const SMDS_MeshNode* n1 = cols->rbegin()->second.front();
      id = n1->getshapeId();
      myShapeIndex2ColumnMap[ id ] = make_pair( cols, !isForward );
    }
  }

//   gp_XYZ testPar(0.25, 0.25, 0), testCoord;
//   if ( !FacePoint( ID_BOT_FACE, testPar, testCoord ))
//     RETURN_BAD_RESULT("TEST FacePoint() FAILED");
//   SHOWYXZ("IN TEST PARAM" , testPar);
//   SHOWYXZ("OUT TEST CORD" , testCoord);
//   if ( !ComputeParameters( testCoord, testPar , ID_BOT_FACE))
//     RETURN_BAD_RESULT("TEST ComputeParameters() FAILED");
//   SHOWYXZ("OUT TEST PARAM" , testPar);

  return true;
}
void SMESH_Block::init ( ) [protected, inherited]

Call it after geometry initialisation.

Definition at line 1083 of file SMESH_Block.cxx.

References SMESH_Block.myGridComputed, SMESH_Block.myNbIterations, and SMESH_Block.mySumDist.

Referenced by Init(), SMESH_Block.LoadBlockShapes(), and SMESH_Block.LoadMeshBlock().

{
  myNbIterations = 0;
  mySumDist = 0;
  myGridComputed = false;
}
bool SMESH_Block::Insert ( const TopoDS_Shape &  theShape,
const int  theShapeID,
TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
) [static, inherited]

/ Insert theShape into theShapeIDMap with theShapeID

Parameters:
theShape- shape to insert
theShapeID- shape in-block ID
theShapeIDMap- map of block subshapes

Definition at line 1597 of file SMESH_Block.cxx.

References SMESH_Partition1_tetra.comp.

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

{
  if ( !theShape.IsNull() && theShapeID > 0 )
  {
    if ( theShapeIDMap.Contains( theShape ))
      return ( theShapeIDMap.FindIndex( theShape ) == theShapeID );

    if ( theShapeID <= theShapeIDMap.Extent() ) {
        theShapeIDMap.Substitute( theShapeID, theShape );
    }
    else {
      while ( theShapeIDMap.Extent() < theShapeID - 1 ) {
        TopoDS_Compound comp;
        BRep_Builder().MakeCompound( comp );
        theShapeIDMap.Add( comp );
      }
      theShapeIDMap.Add( theShape );
    }
    return true;
  }
  return false;
}
static bool SMESH_Block.IsEdgeID ( int  theShapeID) [static, inherited]
static bool SMESH_Block.IsFaceID ( int  theShapeID) [static, inherited]
static bool SMESH_Block.IsForwardEdge ( const TopoDS_Edge &  theEdge,
const TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
) [static, inherited]

Definition at line 269 of file SMESH_Block.hxx.

Referenced by StdMeshers_SMESHBlock.IsForwadEdge(), SMESH_Pattern.Load(), SMESH_Block.LoadBlockShapes(), and SMESH_Block.LoadFace().

                                                                                      {
    int v1ID = theShapeIDMap.FindIndex( TopExp::FirstVertex( theEdge ).Oriented( TopAbs_FORWARD ));
    int v2ID = theShapeIDMap.FindIndex( TopExp::LastVertex( theEdge ).Oriented( TopAbs_FORWARD ));
    return ( v1ID < v2ID );
  }
bool StdMeshers_PrismAsBlock::IsForwardEdge ( SMESHDS_Mesh meshDS,
const TParam2ColumnMap columnsMap,
const TopoDS_Edge &  bottomEdge,
const int  sideFaceID 
) [static]

Check curve orientation of a bootom edge.

Parameters:
meshDS- mesh DS
columnsMap- node columns map of side face
bottomEdge- the bootom edge
sideFaceID- side face in-block ID
Return values:
bool- true if orienation coinside with in-block froward orienation
Parameters:
meshDS- mesh DS
columnsMap- node columns map of side face
bottomEdge- the bootom edge
sideFaceID- side face in-block ID
Return values:
bool- true if orientation coinside with in-block froward orientation

Definition at line 1751 of file StdMeshers_Prism_3D.cxx.

References SMESH_MesherHelper.GetSubShapeByNode(), and SMESH_MesherHelper.IsClosedEdge().

Referenced by StdMeshers_PrismAsBlock.TSideFace.TSideFace().

{
  bool isForward = false;
  if ( SMESH_MesherHelper::IsClosedEdge( bottomEdge ))
  {
    isForward = ( bottomEdge.Orientation() == TopAbs_FORWARD );
  }
  else
  {
    const TNodeColumn& firstCol = columnsMap.begin()->second;
    const SMDS_MeshNode* bottomNode = firstCol[0];
    TopoDS_Shape firstVertex = SMESH_MesherHelper::GetSubShapeByNode( bottomNode, meshDS );
    isForward = ( firstVertex.IsSame( TopExp::FirstVertex( bottomEdge, true )));
  }
  // on 2 of 4 sides first vertex is end
  if ( sideFaceID == ID_Fx1z || sideFaceID == ID_F0yz )
    isForward = !isForward;
  return isForward;
}
static bool SMESH_Block.IsVertexID ( int  theShapeID) [static, inherited]
bool SMESH_Block::LoadBlockShapes ( const TopoDS_Shell &  theShell,
const TopoDS_Vertex &  theVertex000,
const TopoDS_Vertex &  theVertex001,
TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
) [inherited]

Definition at line 1225 of file SMESH_Block.cxx.

References SMESH_Block.FindBlockShapes(), and MESSAGE.

Referenced by SMESH_Pattern.Apply(), StdMeshers_Projection_3D.Compute(), StdMeshers_SMESHBlock.Load(), and SMESH_Pattern.Load().

{
  MESSAGE(" ::LoadBlockShapes()");
  return ( FindBlockShapes( theShell, theVertex000, theVertex001, theShapeIDMap ) &&
           LoadBlockShapes( theShapeIDMap ));
}
bool SMESH_Block::LoadBlockShapes ( const TopTools_IndexedMapOfOrientedShape &  theShapeIDMap) [inherited]

Initialize block geometry with shapes from theShapeIDMap.

Parameters:
theShapeIDMap- map of block subshapes
Return values:
bool- is a success

Definition at line 1513 of file SMESH_Block.cxx.

References SMESH_test.edge, SMESH_Block.ID_FirstE, SMESH_Block.ID_V000, SMESH_Block.ID_V111, SMESH_Block.init(), SMESH_Block.IsEdgeID(), SMESH_Block.IsForwardEdge(), SMESH_Block.IsVertexID(), SMESH_Block.LoadFace(), SMESH_Block.myEdge, SMESH_Block.myPnt, and SMESH_Block.TEdge.Set().

{
  init();

  // store shapes geometry
  for ( int shapeID = 1; shapeID < theShapeIDMap.Extent(); shapeID++ )
  {
    const TopoDS_Shape& S = theShapeIDMap( shapeID );
    switch ( S.ShapeType() )
    {
    case TopAbs_VERTEX: {

      if ( !IsVertexID( ID_V111 )) return false;
      myPnt[ shapeID - ID_V000 ] = BRep_Tool::Pnt( TopoDS::Vertex( S )).XYZ();
      break;
    }
    case TopAbs_EDGE: {

      if ( !IsEdgeID( shapeID )) return false;
      const TopoDS_Edge& edge = TopoDS::Edge( S );
      TEdge& tEdge = myEdge[ shapeID - ID_FirstE ];
      tEdge.Set( shapeID,
                 new BRepAdaptor_Curve( edge ),
                 IsForwardEdge( edge, theShapeIDMap ));
      break;
    }
    case TopAbs_FACE: {

      if ( !LoadFace( TopoDS::Face( S ), shapeID, theShapeIDMap ))
        return false;
      break;
    }
    default: break;
    }
  } // loop on shapes in theShapeIDMap

  return true;
}
bool SMESH_Block::LoadFace ( const TopoDS_Face &  theFace,
const int  theFaceID,
const TopTools_IndexedMapOfOrientedShape &  theShapeIDMap 
) [inherited]

Load face geometry.

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

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

Definition at line 1565 of file SMESH_Block.cxx.

References SMESH_test.edge, SMESH_Block.GetFaceEdgesIDs(), SMESH_Block.ID_FirstF, SMESH_Block.IsFaceID(), SMESH_Block.IsForwardEdge(), SMESH_Block.myFace, and SMESH_Block.TFace.Set().

Referenced by SMESH_Block.LoadBlockShapes().

{
  if ( !IsFaceID( theFaceID ) ) return false;
  // pcurves
  Adaptor2d_Curve2d* c2d[4];
  bool isForward[4];
  vector< int > edgeIdVec;
  GetFaceEdgesIDs( theFaceID, edgeIdVec );
  for ( int iE = 0; iE < edgeIdVec.size(); iE++ ) // loop on 4 edges
  {
    if ( edgeIdVec[ iE ] > theShapeIDMap.Extent() )
      return false;
    const TopoDS_Edge& edge = TopoDS::Edge( theShapeIDMap( edgeIdVec[ iE ]));
    c2d[ iE ] = new BRepAdaptor_Curve2d( edge, theFace );
    isForward[ iE ] = IsForwardEdge( edge, theShapeIDMap );
  }
  TFace& tFace = myFace[ theFaceID - ID_FirstF ];
  tFace.Set( theFaceID, new BRepAdaptor_Surface( theFace ), c2d, isForward );
  return true;
}
bool SMESH_Block::LoadMeshBlock ( const SMDS_MeshVolume theVolume,
const int  theNode000Index,
const int  theNode001Index,
std::vector< const SMDS_MeshNode * > &  theOrderedNodes 
) [inherited]

Definition at line 1097 of file SMESH_Block.cxx.

References SMESH_Block.GetEdgeVertexIDs(), SMESH_Block.GetFaceEdgesIDs(), SMDS_VolumeTool.GetFaceNodesIndices(), SMDS_VolumeTool.GetNodes(), gpXYZ, SMESH_Block.ID_Ex00, SMESH_Block.ID_FirstE, SMESH_Block.ID_FirstF, SMESH_Block.ID_Fxy0, SMESH_Block.ID_Shell, SMESH_Block.ID_V000, SMESH_Block.ID_V001, SMESH_Block.ID_V010, SMESH_Block.ID_V011, SMESH_Block.ID_V100, SMESH_Block.ID_V101, SMESH_Block.ID_V110, SMESH_Block.ID_V111, SMESH_Block.init(), SMDS_VolumeTool.IsLinked(), MESSAGE, SMESH_Block.myEdge, SMESH_Block.myFace, SMESH_Block.myPnt, SMESH_Block.NbEdges(), SMDS_VolumeTool.NbFaces(), SMDS_VolumeTool.NbNodes(), SMESH_Block.TFace.Set(), SMESH_Block.TEdge.Set(), SMDS_VolumeTool.Set(), and SMDS_VolumeTool.SetExternalNormal().

Referenced by SMESH_Pattern.Apply().

{
  MESSAGE(" ::LoadMeshBlock()");
  init();

  SMDS_VolumeTool vTool;
  if (!vTool.Set( theVolume ) || vTool.NbNodes() != 8 ||
      !vTool.IsLinked( theNode000Index, theNode001Index )) {
    MESSAGE(" Bad arguments ");
    return false;
  }
  vTool.SetExternalNormal();
  // In terms of indices used for access to nodes and faces in SMDS_VolumeTool:
  int V000, V100, V010, V110, V001, V101, V011, V111; // 8 vertices
  int Fxy0, Fxy1; // bottom and top faces
  // vertices of faces
  vector<int> vFxy0, vFxy1;

  V000 = theNode000Index;
  V001 = theNode001Index;

  // get faces sharing V000 and V001
  list<int> fV000, fV001;
  int i, iF, iE, iN;
  for ( iF = 0; iF < vTool.NbFaces(); ++iF ) {
    const int* nid = vTool.GetFaceNodesIndices( iF );
    for ( iN = 0; iN < 4; ++iN )
      if ( nid[ iN ] == V000 ) {
        fV000.push_back( iF );
      } else if ( nid[ iN ] == V001 ) {
        fV001.push_back( iF );
      }
  }

  // find the bottom (Fxy0), the top (Fxy1) faces
  list<int>::iterator fIt1, fIt2, Fxy0Pos;
  for ( fIt1 = fV000.begin(); fIt1 != fV000.end(); fIt1++) {
    fIt2 = std::find( fV001.begin(), fV001.end(), *fIt1 );
    if ( fIt2 != fV001.end() ) { // *fIt1 is in the both lists
      fV001.erase( fIt2 ); // erase Fx0z or F0yz from fV001
    } else { // *fIt1 is in fV000 only
      Fxy0Pos = fIt1; // points to Fxy0
    }
  }
  Fxy0 = *Fxy0Pos;
  Fxy1 = fV001.front();
  const SMDS_MeshNode** nn = vTool.GetNodes();

  // find bottom veritices, their order is that a face normal is external
  vFxy0.resize(4);
  const int* nid = vTool.GetFaceNodesIndices( Fxy0 );
  for ( i = 0; i < 4; ++i )
    if ( nid[ i ] == V000 )
      break;
  for ( iN = 0; iN < 4; ++iN, ++i ) {
    if ( i == 4 ) i = 0;
    vFxy0[ iN ] = nid[ i ];
  }
  // find top veritices, their order is that a face normal is external
  vFxy1.resize(4);
  nid = vTool.GetFaceNodesIndices( Fxy1 );
  for ( i = 0; i < 4; ++i )
    if ( nid[ i ] == V001 )
      break;
  for ( iN = 0; iN < 4; ++iN, ++i ) {
    if ( i == 4 ) i = 0;
    vFxy1[ iN ] = nid[ i ];
  }
  // find indices of the rest veritices 
  V100 = vFxy0[3];
  V010 = vFxy0[1];
  V110 = vFxy0[2];
  V101 = vFxy1[1];
  V011 = vFxy1[3];
  V111 = vFxy1[2];

  // set points coordinates
  myPnt[ ID_V000 - 1 ] = gpXYZ( nn[ V000 ] );
  myPnt[ ID_V100 - 1 ] = gpXYZ( nn[ V100 ] );
  myPnt[ ID_V010 - 1 ] = gpXYZ( nn[ V010 ] );
  myPnt[ ID_V110 - 1 ] = gpXYZ( nn[ V110 ] );
  myPnt[ ID_V001 - 1 ] = gpXYZ( nn[ V001 ] );
  myPnt[ ID_V101 - 1 ] = gpXYZ( nn[ V101 ] );
  myPnt[ ID_V011 - 1 ] = gpXYZ( nn[ V011 ] );
  myPnt[ ID_V111 - 1 ] = gpXYZ( nn[ V111 ] );

  // fill theOrderedNodes
  theOrderedNodes.resize( 8 );
  theOrderedNodes[ 0 ] = nn[ V000 ];
  theOrderedNodes[ 1 ] = nn[ V100 ];
  theOrderedNodes[ 2 ] = nn[ V010 ];
  theOrderedNodes[ 3 ] = nn[ V110 ];
  theOrderedNodes[ 4 ] = nn[ V001 ];
  theOrderedNodes[ 5 ] = nn[ V101 ];
  theOrderedNodes[ 6 ] = nn[ V011 ];
  theOrderedNodes[ 7 ] = nn[ V111 ];
  
  // fill edges
  vector< int > vertexVec;
  for ( iE = 0; iE < NbEdges(); ++iE ) {
    GetEdgeVertexIDs(( iE + ID_FirstE ), vertexVec );
    myEdge[ iE ].Set(( iE + ID_FirstE ),
                     myPnt[ vertexVec[0] - 1 ],
                     myPnt[ vertexVec[1] - 1 ]);
  }

  // fill faces' corners
  for ( iF = ID_Fxy0; iF < ID_Shell; ++iF )
  {
    TFace& tFace = myFace[ iF - ID_FirstF ];
    vector< int > edgeIdVec(4, -1);
    GetFaceEdgesIDs( iF, edgeIdVec );
    tFace.Set( iF, myEdge[ edgeIdVec [ 0 ] - ID_Ex00], myEdge[ edgeIdVec [ 1 ] - ID_Ex00]);
  }

  return true;
}
SMESH_Mesh* StdMeshers_PrismAsBlock.Mesh ( ) const

Return pointer to mesh.

Return values:
SMESH_Mesh- mesh

Definition at line 173 of file StdMeshers_Prism_3D.hxx.

{ return myHelper->GetMesh(); }
SMESHDS_Mesh* StdMeshers_PrismAsBlock.MeshDS ( ) const

Return pointer to mesh DS.

Return values:
SMESHDS_Mesh- mesh DS

Definition at line 179 of file StdMeshers_Prism_3D.hxx.

{ return Mesh()->GetMeshDS(); }
static int SMESH_Block.NbEdges ( ) [static, inherited]

Definition at line 94 of file SMESH_Block.hxx.

Referenced by SMESH_Block.LoadMeshBlock(), and StdMeshers_SMESHBlock.StdMeshers_SMESHBlock().

{ return 12; }
Standard_Integer SMESH_Block::NbEquations ( ) const [inherited]

Definition at line 437 of file SMESH_Block.cxx.

{
  return 1;
}
static int SMESH_Block.NbFaces ( ) [static, inherited]

Definition at line 95 of file SMESH_Block.hxx.

Referenced by StdMeshers_Penta_3D.StdMeshers_Penta_3D().

{ return  6; }
static int SMESH_Block.NbSubShapes ( ) [static, inherited]

Definition at line 96 of file SMESH_Block.hxx.

Referenced by StdMeshers_Penta_3D.StdMeshers_Penta_3D().

{ return ID_Shell; }
Standard_Integer SMESH_Block::NbVariables ( ) const [inherited]

Definition at line 427 of file SMESH_Block.cxx.

{
  return 3;
}
static int SMESH_Block.NbVertices ( ) [static, inherited]

Definition at line 93 of file SMESH_Block.hxx.

{ return  8; }
const TopoDS_Shape& StdMeshers_PrismAsBlock.Shape ( const int  shapeID) const

Return a in-block shape.

Parameters:
shapeID- shape given by in-block index
Return values:
SMESHDS_SubMesh*- found submesh

Definition at line 202 of file StdMeshers_Prism_3D.hxx.

  { return myShapeIDMap( shapeID ); }
int StdMeshers_PrismAsBlock.ShapeID ( const TopoDS_Shape &  shape) const

Return in-block ID of a shape.

Parameters:
shape- block subshape
Return values:
int- ID or zero if the shape has no ID

Definition at line 210 of file StdMeshers_Prism_3D.hxx.

  { return myShapeIDMap.FindIndex( shape ); }
static int SMESH_Block.ShapeIndex ( int  theShapeID) [static, inherited]

Definition at line 108 of file SMESH_Block.hxx.

Referenced by StdMeshers_Penta_3D.FindNodeOnShape(), StdMeshers_SMESHBlock.IsForwadEdge(), StdMeshers_Penta_3D.MakeNodes(), and StdMeshers_Penta_3D.SetHorizEdgeXYZ().

  {
    if ( IsVertexID( theShapeID )) return theShapeID - ID_V000;
    if ( IsEdgeID( theShapeID ))   return theShapeID - ID_Ex00;
    if ( IsFaceID( theShapeID ))   return theShapeID - ID_Fxy0;
    return 0;
  }
bool SMESH_Block::ShellPoint ( const gp_XYZ &  theParams,
gp_XYZ &  thePoint 
) const [inherited]

Definition at line 339 of file SMESH_Block.cxx.

Referenced by SMESH_Pattern.Apply(), StdMeshers_Projection_3D.Compute(), StdMeshers_HexaFromSkin_3D.Compute(), StdMeshers_Hexa_3D.Compute(), StdMeshers_CompositeHexa_3D.Compute(), SMESH_Block.ComputeParameters(), StdMeshers_SMESHBlock.Point(), SMESH_Block.Value(), and SMESH_Block.Values().

{
  thePoint.SetCoord( 0., 0., 0. );
  for ( int shapeID = ID_V000; shapeID < ID_Shell; shapeID++ )
  {
    // coef
    double* coefs = GetShapeCoef( shapeID );
    double k = 1;
    for ( int iCoef = 0; iCoef < 3; iCoef++ ) {
      if ( coefs[ iCoef ] != 0 ) {
        if ( coefs[ iCoef ] < 0 )
          k *= ( 1. - theParams.Coord( iCoef + 1 ));
        else
          k *= theParams.Coord( iCoef + 1 );
      }
    }
    // add point on a shape
    if ( fabs( k ) > DBL_MIN )
    {
      gp_XYZ Ps;
      if ( shapeID < ID_Ex00 ) // vertex
        VertexPoint( shapeID, Ps );
      else if ( shapeID < ID_Fxy0 ) { // edge
        EdgePoint( shapeID, theParams, Ps );
        k = -k;
      } else // face
        FacePoint( shapeID, theParams, Ps );

      thePoint += k * Ps;
    }
  }
  return true;
}
bool SMESH_Block::ShellPoint ( const gp_XYZ &  theParams,
const std::vector< gp_XYZ > &  thePointOnShape,
gp_XYZ &  thePoint 
) [static, inherited]

Definition at line 379 of file SMESH_Block.cxx.

References ex13_hole1partial.x, ex29_refine.x1, ex13_hole1partial.y, SMESH_fixation.y1, and SMESH_fixation.z1.

{
  if ( thePointOnShape.size() < ID_F1yz )
    return false;

  const double x = theParams.X(), y = theParams.Y(), z = theParams.Z();
  const double x1 = 1. - x,       y1 = 1. - y,       z1 = 1. - z;
  const vector<gp_XYZ>& p = thePointOnShape;

  thePoint = 
    x1 * p[ID_F0yz] + x * p[ID_F1yz] +
    y1 * p[ID_Fx0z] + y * p[ID_Fx1z] +
    z1 * p[ID_Fxy0] + z * p[ID_Fxy1] +
    x1 * (y1 * (z1 * p[ID_V000] + z * p[ID_V001])  +
          y  * (z1 * p[ID_V010] + z * p[ID_V011])) +
    x  * (y1 * (z1 * p[ID_V100] + z * p[ID_V101])  +
          y  * (z1 * p[ID_V110] + z * p[ID_V111]));
  thePoint -=
    x1 * (y1 * p[ID_E00z] + y * p[ID_E01z]) + 
    x  * (y1 * p[ID_E10z] + y * p[ID_E11z]) + 
    y1 * (z1 * p[ID_Ex00] + z * p[ID_Ex01]) + 
    y  * (z1 * p[ID_Ex10] + z * p[ID_Ex11]) + 
    z1 * (x1 * p[ID_E0y0] + x * p[ID_E1y0]) + 
    z  * (x1 * p[ID_E0y1] + x * p[ID_E1y1]);

  return true;
}
SMESH_subMesh* StdMeshers_PrismAsBlock.SubMesh ( const int  shapeID) const

Return submesh of a shape.

Parameters:
shapeID- shape given by in-block index
Return values:
SMESH_subMesh*- found submesh

Definition at line 186 of file StdMeshers_Prism_3D.hxx.

  { return Mesh()->GetSubMesh( Shape( shapeID )); }
SMESHDS_SubMesh* StdMeshers_PrismAsBlock.SubMeshDS ( const int  shapeID) const

Return submesh DS of a shape.

Parameters:
shapeID- shape given by in-block index
Return values:
SMESHDS_SubMesh*- found submesh DS

Definition at line 194 of file StdMeshers_Prism_3D.hxx.

  { return SubMesh(shapeID)->GetSubMeshDS(); }
Standard_Boolean SMESH_Block::Value ( const math_Vector &  X,
math_Vector &  F 
) [inherited]

Definition at line 447 of file SMESH_Block.cxx.

References SMESH_Block.funcValue(), SMESH_Block.myParam, SMESH_Block.myPoint, SMESH_Block.myValues, SMESH_Block.ShellPoint(), and SMESH_Block.SQUARE_DIST.

{
  gp_XYZ P, params( theXYZ(1), theXYZ(2), theXYZ(3) );
  if ( params.IsEqual( myParam, DBL_MIN )) { // same param
    theFxyz( 1 ) = funcValue( myValues[ SQUARE_DIST ]);
  }
  else {
    ShellPoint( params, P );
    gp_Vec dP( P - myPoint );
    theFxyz(1) = funcValue( dP.SquareMagnitude() );
  }
  return true;
}
Standard_Boolean SMESH_Block::Values ( const math_Vector &  X,
math_Vector &  F,
math_Matrix &  D 
) [inherited]

Definition at line 487 of file SMESH_Block.cxx.

References Abs(), SMESH_Block.DRV_1, SMESH_Block.DRV_2, SMESH_Block.DRV_3, SMESH_Block.funcValue(), MESSAGE, SMESH_Block.myFaceIndex, SMESH_Block.myNbIterations, SMESH_Block.myParam, SMESH_Block.myPoint, SMESH_Block.myTolerance, SMESH_Block.myValues, SMESH_Block.ShellPoint(), and SMESH_Block.SQUARE_DIST.

Referenced by SMESH_Block.Derivatives().

{
  gp_XYZ P, params( theXYZ(1), theXYZ(2), theXYZ(3) );
  if ( params.IsEqual( myParam, DBL_MIN )) { // same param
    theFxyz( 1 )      = funcValue( myValues[ SQUARE_DIST ] );
    theDf( 1, DRV_1 ) = myValues[ DRV_1 ];
    theDf( 1, DRV_2 ) = myValues[ DRV_2 ];
    theDf( 1, DRV_3 ) = myValues[ DRV_3 ];
    return true;
  }
#ifdef DEBUG_PARAM_COMPUTE
  MESSAGE ( "PARAM GUESS: " << params.X() << " "<< params.Y() << " "<< params.X() );
  myNbIterations++; // how many times call ShellPoint()
#endif
  ShellPoint( params, P );

  gp_Vec dP( myPoint, P );
  double sqDist = dP.SquareMagnitude();
  theFxyz(1) = funcValue( sqDist );

  if ( sqDist < myTolerance * myTolerance ) { // a solution found
    myParam = params;
    myValues[ SQUARE_DIST ] = sqDist;
    theFxyz(1)  = theDf( 1,1 ) = theDf( 1,2 ) = theDf( 1,3 ) = 0;
    return true;
  }

  if ( sqDist < myValues[ SQUARE_DIST ] ) // a better guess
  {
    // 3 partial derivatives
    gp_Vec drv[ 3 ]; // where we move with a small step in each direction
    for ( int iP = 1; iP <= 3; iP++ ) {
      if ( iP == myFaceIndex ) {
        drv[ iP - 1 ] = gp_Vec(0,0,0);
        continue;
      }
      gp_XYZ Pi;
      bool onEdge = ( theXYZ( iP ) + 0.001 > 1. );
      if ( onEdge )
        params.SetCoord( iP, theXYZ( iP ) - 0.001 );
      else
        params.SetCoord( iP, theXYZ( iP ) + 0.001 );
      ShellPoint( params, Pi );
      params.SetCoord( iP, theXYZ( iP ) ); // restore params
      gp_Vec dPi ( P, Pi );
      if ( onEdge ) dPi *= -1.;
      double mag = dPi.Magnitude();
      if ( mag > DBL_MIN )
        dPi /= mag;
      drv[ iP - 1 ] = dPi;
    }
    for ( int iP = 0; iP < 3; iP++ ) {
#if 1
      theDf( 1, iP + 1 ) = dP * drv[iP];
#else
      // Distance from P to plane passing through myPoint and defined
      // by the 2 other derivative directions:
      // like IntAna_IntConicQuad::Perform (const gp_Lin& L, const gp_Pln& P)
      // where L is (P -> myPoint), P is defined by the 2 other derivative direction
      int iPrev = ( iP ? iP - 1 : 2 );
      int iNext = ( iP == 2 ? 0 : iP + 1 );
      gp_Vec plnNorm = drv[ iPrev ].Crossed( drv [ iNext ] );
      double Direc = plnNorm * drv[ iP ];
      if ( Abs(Direc) <= DBL_MIN )
        theDf( 1, iP + 1 ) = dP * drv[ iP ];
      else {
        double Dis = plnNorm * P - plnNorm * myPoint;
        theDf( 1, iP + 1 ) = Dis/Direc;
      }
#endif
    }
#ifdef DEBUG_PARAM_COMPUTE
    MESSAGE ( "F = " << theFxyz(1) << " DRV: " << theDf(1,1) << " " << theDf(1,2) << " " << theDf(1,3) );
    myNbIterations +=3; // how many times call ShellPoint()
#endif

    // store better values
    myParam              = params;
    myValues[SQUARE_DIST]= sqDist;
    myValues[DRV_1]      = theDf(1,DRV_1);
    myValues[DRV_2]      = theDf(1,DRV_2);
    myValues[DRV_3]      = theDf(1,DRV_3);
  }

  return true;
}
bool SMESH_Block::VertexParameters ( const int  theVertexID,
gp_XYZ &  theParams 
) [inherited]

Definition at line 835 of file SMESH_Block.cxx.

References SMESH_Block.ID_V000, SMESH_Block.ID_V010, SMESH_Block.ID_V100, and SMESH_Block.ID_V110.

Referenced by SMESH_Block.ComputeParameters(), and SMESH_Block.EdgeParameters().

{
  switch ( theVertexID ) {
  case ID_V000: theParams.SetCoord(0., 0., 0.); return true;
  case ID_V100: theParams.SetCoord(1., 0., 0.); return true;
  case ID_V110: theParams.SetCoord(1., 1., 0.); return true;
  case ID_V010: theParams.SetCoord(0., 1., 0.); return true;
  default:;
  }
  return false;
}
bool SMESH_Block.VertexPoint ( const int  theVertexID,
gp_XYZ &  thePoint 
) const [inherited]

Definition at line 196 of file SMESH_Block.hxx.

Referenced by SMESH_Pattern.Apply(), and StdMeshers_SMESHBlock.Point().

                                                                    {
    if ( !IsVertexID( theVertexID ))           return false;
    thePoint = myPnt[ theVertexID - ID_FirstV ]; return true;
  }
int StdMeshers_PrismAsBlock.VerticalSize ( ) const

Return number of nodes on every vertical edge.

Return values:
int- number of nodes including end nodes

Definition at line 136 of file StdMeshers_Prism_3D.hxx.

{ return myParam2ColumnMaps[0].begin()->second.size(); }

Field Documentation

TxyzPair SMESH_Block.my3x3x3GridNodes[27] [protected, inherited]

Definition at line 386 of file SMESH_Block.hxx.

Referenced by SMESH_Block.ComputeParameters().

TEdge SMESH_Block.myEdge[12] [protected, inherited]

Definition at line 365 of file StdMeshers_Prism_3D.hxx.

TFace SMESH_Block.myFace[6] [protected, inherited]
int SMESH_Block.myFaceIndex [protected, inherited]
double SMESH_Block.myFaceParam [protected, inherited]
bool SMESH_Block.myGridComputed [protected, inherited]

Definition at line 387 of file SMESH_Block.hxx.

Referenced by SMESH_Block.ComputeParameters(), and SMESH_Block.init().

int SMESH_Block.myNbIterations [protected, inherited]

Definition at line 362 of file StdMeshers_Prism_3D.hxx.

gp_XYZ SMESH_Block.myParam [protected, inherited]

Definition at line 370 of file StdMeshers_Prism_3D.hxx.

gp_XYZ SMESH_Block.myPnt[8] [protected, inherited]

Definition at line 361 of file SMESH_Block.hxx.

Referenced by SMESH_Block.LoadBlockShapes(), and SMESH_Block.LoadMeshBlock().

gp_XYZ SMESH_Block.myPoint [protected, inherited]

Definition at line 364 of file StdMeshers_Prism_3D.hxx.

Definition at line 372 of file StdMeshers_Prism_3D.hxx.

bool SMESH_Block.mySquareFunc [protected, inherited]

Definition at line 379 of file SMESH_Block.hxx.

Referenced by SMESH_Block.computeParameters().

double SMESH_Block.mySumDist [protected, inherited]
double SMESH_Block.myTolerance [protected, inherited]
double SMESH_Block.myValues[4] [protected, inherited]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS