Salome HOME
bos #20256: [CEA 18523] Porting SMESH to int 64 bits
[modules/smesh.git] / src / StdMeshers / StdMeshers_Prism_3D.hxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SMESH SMESH : implementation of SMESH idl descriptions
24 //  File   : StdMeshers_Prism_3D.hxx
25 //  Module : SMESH
26 //
27 #ifndef _SMESH_Prism_3D_HXX_
28 #define _SMESH_Prism_3D_HXX_
29
30 #include "SMESH_StdMeshers.hxx"
31
32 #include "SMESHDS_Mesh.hxx"
33 #include "SMESH_Block.hxx"
34 #include "SMESH_Comment.hxx"
35 #include "SMESH_Mesh.hxx"
36 #include "SMESH_MesherHelper.hxx"
37 #include "SMESH_TypeDefs.hxx"
38 #include "SMESH_subMesh.hxx"
39 #include "StdMeshers_ProjectionUtils.hxx"
40
41 #include <Adaptor2d_Curve2d.hxx>
42 #include <Adaptor3d_Curve.hxx>
43 #include <Adaptor3d_Surface.hxx>
44 #include <BRepAdaptor_Surface.hxx>
45 #include <TColStd_DataMapOfIntegerInteger.hxx>
46 #include <TopTools_IndexedMapOfOrientedShape.hxx>
47 #include <TopoDS_Face.hxx>
48 #include <gp_Trsf.hxx>
49 #include <gp_XYZ.hxx>
50
51 #include <vector>
52
53 namespace Prism_3D
54 {
55   struct TNode;
56   struct TPrismTopo;
57 }
58 class SMESHDS_SubMesh;
59 class TopoDS_Edge;
60
61 typedef TopTools_IndexedMapOfOrientedShape                       TBlockShapes;
62 typedef std::vector<const SMDS_MeshNode* >                       TNodeColumn;
63 typedef std::map< double,          TNodeColumn >                 TParam2ColumnMap;
64 typedef std::map< double,          TNodeColumn >::const_iterator TParam2ColumnIt;
65 // map of bottom nodes to the column of nodes above them
66 // (the column includes the bottom nodes)
67 typedef std::map< Prism_3D::TNode, TNodeColumn >                 TNode2ColumnMap;
68
69
70 namespace Prism_3D
71 {
72   // ===============================================
73   /*!
74    * \brief Structure containing node relative data
75    */
76   struct TNode
77   {
78     const SMDS_MeshNode* myNode;
79     mutable gp_XYZ       myParams;
80
81     gp_XYZ GetCoords() const { return gp_XYZ( myNode->X(), myNode->Y(), myNode->Z() ); }
82     gp_XYZ GetParams() const { return myParams; }
83     gp_XYZ& ChangeParams() const { return myParams; }
84     bool HasParams() const { return myParams.X() >= 0.0; }
85     SMDS_TypeOfPosition GetPositionType() const
86     { return myNode ? myNode->GetPosition()->GetTypeOfPosition() : SMDS_TOP_UNSPEC; }
87     bool IsNeighbor( const TNode& other ) const;
88
89     TNode(const SMDS_MeshNode* node = 0): myNode(node), myParams(-1,-1,-1) {}
90     bool operator < (const TNode& other) const { return myNode->GetID() < other.myNode->GetID(); }
91   };
92   // ===============================================
93   /*!
94    * \brief Topological data of the prism
95    */
96   typedef std::list< TFaceQuadStructPtr > TQuadList;
97
98   struct TPrismTopo
99   {
100     TopoDS_Shape             myShape3D;
101     TopoDS_Face              myBottom;
102     TopoDS_Face              myTop;
103     std::list< TopoDS_Edge > myBottomEdges;
104     std::vector< TQuadList>  myWallQuads;      // wall sides can be vertically composite
105     std::vector< int >       myRightQuadIndex; // index of right neighbour wall quad
106     std::list< int >         myNbEdgesInWires;
107
108     bool                     myNotQuadOnTop;
109     mutable SMESH_subMesh*   myAlgoSM; // sub-mesh with algo which computed myBottom
110
111     size_t NbWires() const { return myNbEdgesInWires.size(); }
112
113     void Clear();
114     void SetUpsideDown();
115   };
116 }
117
118 // ===============================================================
119 /*!
120  * \brief Tool analyzing and giving access to a prism geometry 
121  *  treating it like a block, i.e. the four side faces are
122  *  emulated by division/uniting of missing/excess faces.
123  *  It also manage associations between block sub-shapes and a mesh.
124  */
125 class STDMESHERS_EXPORT StdMeshers_PrismAsBlock: public SMESH_Block
126 {
127  public:
128   /*!
129    * \brief Constructor. Initialization is needed
130    */
131   StdMeshers_PrismAsBlock();
132
133   ~StdMeshers_PrismAsBlock();
134
135   /*!
136    * \brief Initialization.
137    * \param helper - helper loaded with mesh and 3D shape
138    * \param prism - prism topology
139    * \retval bool - false if a mesh or a shape are KO
140    */
141   bool Init(SMESH_MesherHelper* helper, const Prism_3D::TPrismTopo& prism);
142
143   /*!
144    * \brief Return problem description
145    */
146   SMESH_ComputeErrorPtr GetError() const { return myError; }
147
148   /*!
149    * \brief Free allocated memory
150    */
151   void Clear();
152
153   /*!
154    * \brief Return number of nodes on every vertical edge
155     * \retval int - number of nodes including end nodes
156    */
157   size_t VerticalSize() const { return myParam2ColumnMaps[0].begin()->second.size(); }
158
159   bool HasNotQuadElemOnTop() const { return myNotQuadOnTop; }
160
161   /*!
162    * \brief Return pointer to column of nodes
163     * \param node - bottom node from which the returned column goes up
164     * \retval const TNodeColumn* - the found column
165    */
166   const TNodeColumn* GetNodeColumn(const SMDS_MeshNode* node) const;
167
168   /*!
169    * \brief Return TParam2ColumnMap for a base edge
170     * \param baseEdgeID - base edge SMESHDS Index
171     * \param isReverse - columns in-block orientation
172     * \retval const TParam2ColumnMap* - map
173    */
174   const TParam2ColumnMap* GetParam2ColumnMap(const int baseEdgeID,
175                                              bool &    isReverse) const
176   {
177     std::map< int, std::pair< TParam2ColumnMap*, bool > >::const_iterator i_mo =
178       myShapeIndex2ColumnMap.find( baseEdgeID );
179     if ( i_mo == myShapeIndex2ColumnMap.end() ) return 0;
180
181     const std::pair< TParam2ColumnMap*, bool >& col_frw = i_mo->second;
182     isReverse = !col_frw.second;
183     return col_frw.first;
184   }
185
186   /*!
187    * \brief Return pointer to column of nodes
188     * \param node - bottom node from which the returned column goes up
189     * \retval const TNodeColumn* - the found column
190    */
191   bool HasNodeColumn(const SMDS_MeshNode* node) const
192   {
193     return myShapeIndex2ColumnMap.count( node->getshapeId() );
194   }
195
196   /*!
197    * \brief Return transformations to get coordinates of nodes of each internal layer
198    *        by nodes of the bottom. Layer is a set of nodes at a certain step
199    *        from bottom to top.
200    */
201   bool GetLayersTransformation(std::vector<gp_Trsf> &      trsf,
202                                const Prism_3D::TPrismTopo& prism) const;
203   
204   /*!
205    * \brief Return pointer to mesh
206     * \retval SMESH_Mesh - mesh
207    */
208   SMESH_Mesh* Mesh() const { return myHelper->GetMesh(); }
209
210   /*!
211    * \brief Return pointer to mesh DS
212     * \retval SMESHDS_Mesh - mesh DS
213    */
214   SMESHDS_Mesh* MeshDS() const { return Mesh()->GetMeshDS(); }
215
216   /*!
217    * \brief Return submesh of a shape
218     * \param shapeID - shape given by in-block index
219     * \retval SMESH_subMesh* - found submesh
220    */
221   SMESH_subMesh* SubMesh(const int shapeID) const
222   { return Mesh()->GetSubMesh( Shape( shapeID )); }
223
224   /*!
225    * \brief Return submesh DS of a shape
226     * \param shapeID - shape given by in-block index
227     * \retval SMESHDS_SubMesh* - found submesh DS
228    */
229   SMESHDS_SubMesh* SubMeshDS(const int shapeID) const
230   { return SubMesh(shapeID)->GetSubMeshDS(); }
231
232   /*!
233    * \brief Return a in-block shape
234     * \param shapeID - shape given by in-block index
235     * \retval SMESHDS_SubMesh* - found submesh
236    */
237   const TopoDS_Shape& Shape(const int shapeID) const
238   { return myShapeIDMap( shapeID ); }
239
240   /*!
241    * \brief Return in-block ID of a shape
242     * \param shape - block sub-shape
243     * \retval int - ID or zero if the shape has no ID
244    */
245   int ShapeID(const TopoDS_Shape& shape) const
246   { return myShapeIDMap.FindIndex( shape ); }
247
248   /*!
249    * \brief Check curve orientation of a bottom edge
250    *  \param meshDS - mesh DS
251    *  \param columnsMap - node columns map of side face
252    *  \param bottomEdge - the bottom edge
253    *  \param sideFaceID - side face in-block ID
254    *  \retval bool - true if orientation coincide with in-block forward orientation
255    */
256   static bool IsForwardEdge(SMESHDS_Mesh*           meshDS,
257                             const TParam2ColumnMap& columnsMap,
258                             const TopoDS_Edge &     bottomEdge,
259                             const int               sideFaceID);
260
261 private:
262
263   // --------------------------------------------------------------------
264   /*!
265    * \brief Class representing a part of a geom face or
266    * a union of seleral faces. Or just an ordinary geom face
267    *
268    * It's parametrization is within [0,1] range.
269    * It redefines Adaptor3d_Surface::Value(U,V) where U and V are within [0,1]
270    */
271   // --------------------------------------------------------------------
272   class TSideFace: public Adaptor3d_Surface
273   {
274     typedef boost::shared_ptr<BRepAdaptor_Surface> PSurface;
275
276     int                             myID; //!< in-block ID
277     // map used to find out real UV by it's normalized UV
278     TParam2ColumnMap*               myParamToColumnMap;
279     PSurface                        mySurface;
280     TopoDS_Edge                     myBaseEdge;
281     std::map< int, PSurface >       myShapeID2Surf;
282     // first and last normalized params and orientation for each component or it-self
283     std::vector< std::pair< double, double> > myParams; // select my columns in myParamToColumnMap
284     bool                            myIsForward;
285     std::vector< TSideFace* >       myComponents;
286     SMESH_MesherHelper              myHelper;
287   public:
288     TSideFace( SMESH_Mesh&                mesh,
289                const int                  faceID,
290                const Prism_3D::TQuadList& quadList,
291                const TopoDS_Edge&         baseEdge,
292                TParam2ColumnMap*          columnsMap,
293                const double               first = 0.0,
294                const double               last  = 1.0);
295     TSideFace( SMESH_Mesh&                                       mesh,
296                const std::vector< TSideFace* >&                  components,
297                const std::vector< std::pair< double, double> > & params);
298     TSideFace( const TSideFace& other );
299     ~TSideFace();
300     bool IsComplex() const
301     { return ( NbComponents() > 0 || myParams[0].first != 0. || myParams[0].second != 1. ); }
302     int FaceID() const { return myID; }
303     SMESH_Mesh* GetMesh() const { return myHelper.GetMesh(); }
304     TParam2ColumnMap* GetColumns() const { return myParamToColumnMap; }
305     gp_XY GetNodeUV(const TopoDS_Face& F, const SMDS_MeshNode* n, const SMDS_MeshNode* n2=0) const
306     { return ((SMESH_MesherHelper&) myHelper).SetSubShape(F), myHelper.GetNodeUV( F, n, n2 ); }
307     const TopoDS_Edge & BaseEdge() const { return myBaseEdge; }
308     int ColumnHeight() const {
309       if ( NbComponents() ) return GetComponent(0)->GetColumns()->begin()->second.size();
310       else                  return GetColumns()->begin()->second.size(); }
311     double GetColumns(const double U, TParam2ColumnIt & col1, TParam2ColumnIt& col2 ) const;
312     void GetNodesAtZ(const int Z, std::map<double, const SMDS_MeshNode* >& nodes ) const;
313     int NbComponents() const { return myComponents.size(); }
314     TSideFace* GetComponent(const int i) const { return myComponents.at( i ); }
315     void SetComponent(const int i, TSideFace* c)
316     { if ( myComponents[i] ) delete myComponents[i]; myComponents[i]=c; }
317     TSideFace* GetComponent(const double U, double& localU) const;
318     bool IsForward() const { return myIsForward; }
319     // boundary geometry for a face
320     Adaptor3d_Surface* Surface() const { return new TSideFace( *this ); }
321     bool GetPCurves(Adaptor2d_Curve2d* pcurv[4]) const;
322     Adaptor2d_Curve2d* HorizPCurve(const bool isTop, const TopoDS_Face& horFace) const;
323     Adaptor3d_Curve* HorizCurve(const bool isTop) const;
324     Adaptor3d_Curve* VertiCurve(const bool isMax) const;
325     TopoDS_Edge GetEdge( const int edge ) const;
326     int InsertSubShapes( TBlockShapes& shapeMap ) const;
327     // redefine Adaptor methods
328     gp_Pnt Value(const Standard_Real U,const Standard_Real V) const;
329     // debug
330     void dumpNodes(int nbNodes) const;
331   };
332
333   // --------------------------------------------------------------------
334   /*!
335    * \brief Class emulating geometry of a vertical edge
336    */
337   // --------------------------------------------------------------------
338   class STDMESHERS_EXPORT TVerticalEdgeAdaptor: public Adaptor3d_Curve
339   {
340     const TNodeColumn* myNodeColumn;
341   public:
342     TVerticalEdgeAdaptor( const TParam2ColumnMap* columnsMap, const double parameter );
343     gp_Pnt Value(const Standard_Real U) const;
344     Standard_Real FirstParameter() const { return 0; }
345     Standard_Real LastParameter() const { return 1; }
346     // debug
347     void dumpNodes(int nbNodes) const;
348   };
349
350   // --------------------------------------------------------------------
351   /*!
352    * \brief Class emulating geometry of a hirizontal edge
353    */
354   // --------------------------------------------------------------------
355   class STDMESHERS_EXPORT THorizontalEdgeAdaptor: public Adaptor3d_Curve
356   {
357     const TSideFace* mySide;
358     double           myV;
359   public:
360     THorizontalEdgeAdaptor( const TSideFace* sideFace, const bool isTop)
361       :mySide(sideFace), myV( isTop ? 1.0 : 0.0 ) {}
362     gp_Pnt Value(const Standard_Real U) const;
363     Standard_Real FirstParameter() const { return 0; }
364     Standard_Real LastParameter() const { return 1; }
365     // debug
366     void dumpNodes(int nbNodes) const;
367   };
368
369   // --------------------------------------------------------------------
370   /*!
371    * \brief Class emulating pcurve on a hirizontal face
372    */
373   // --------------------------------------------------------------------
374   class STDMESHERS_EXPORT TPCurveOnHorFaceAdaptor: public Adaptor2d_Curve2d
375   {
376     std::map< double, gp_XY > myUVmap; // normalized parameter to UV on a horizontal face
377   public:
378     TPCurveOnHorFaceAdaptor( const TSideFace*   sideFace,
379                              const bool         isTop,
380                              const TopoDS_Face& horFace);
381     gp_Pnt2d Value(const Standard_Real U) const;
382     Standard_Real FirstParameter() const { return 0; }
383     Standard_Real LastParameter() const { return 1; }
384   };
385
386   bool                  myNotQuadOnTop;
387   SMESH_MesherHelper*   myHelper;
388   TBlockShapes          myShapeIDMap;
389   SMESH_ComputeErrorPtr myError;
390
391   // container of 4 side faces
392   TSideFace*            mySide; 
393   // node columns for each base edge
394   std::vector< TParam2ColumnMap >                       myParam2ColumnMaps;
395   // to find a column for a node by edge SMESHDS Index
396   std::map< int, std::pair< TParam2ColumnMap*, bool > > myShapeIndex2ColumnMap;
397
398   /*!
399    * \brief store error and comment and then return ( error == COMPERR_OK )
400    */
401   bool error(int error, const SMESH_Comment& comment = "") {
402     myError = SMESH_ComputeError::New(error,comment);
403     return myError->IsOK();
404   }
405   /*!
406    * \brief Prints a script creating a normal grid on the prism side
407    */
408   void faceGridToPythonDump(const SMESH_Block::TShapeID face,
409                             const int                   nb=10);
410
411 }; // class StdMeshers_PrismAsBlock
412
413 // ===============================================
414 /*!
415  * \brief Tool building internal nodes in a prism
416  */
417 struct StdMeshers_Sweeper
418 {
419   // input data
420   SMESH_MesherHelper*         myHelper;
421   TopoDS_Face                 myBotFace;
422   TopoDS_Face                 myTopFace;
423   std::vector< TNodeColumn* > myBndColumns; // boundary nodes
424   // output data
425   std::vector< TNodeColumn* > myIntColumns; // internal nodes
426
427   bool ComputeNodesByTrsf( const double tol,
428                            const bool   allowHighBndError );
429
430   bool CheckSameZ();
431
432   bool ComputeNodesOnStraightSameZ();
433
434   bool ComputeNodesOnStraight();
435
436 private:
437
438   gp_XYZ bndPoint( int iP, int z ) const
439   { return SMESH_TNodeXYZ( (*myBndColumns[ iP ])[ z ]); }
440
441   gp_XYZ intPoint( int iP, int z ) const
442   { return SMESH_TNodeXYZ( (*myIntColumns[ iP ])[ z ]); }
443
444   bool projectIntPoints(const std::vector< gp_XYZ >& fromBndPoints,
445                         const std::vector< gp_XYZ >& toBndPoints,
446                         const std::vector< gp_XYZ >& fromIntPoints,
447                         std::vector< gp_XYZ >&       toIntPoints,
448                         const double                 r,
449                         StdMeshers_ProjectionUtils::TrsfFinder3D& trsf,
450                         std::vector< gp_XYZ > *      bndError);
451
452   typedef std::vector< double > TZColumn;
453   static void fillZColumn( TZColumn&    zColumn,
454                            TNodeColumn& nodes );
455
456   void prepareTopBotDelaunay();
457   bool findDelaunayTriangles();
458
459   std::vector< TZColumn >                 myZColumns; // Z distribution of boundary nodes
460
461   StdMeshers_ProjectionUtils::DelaunayPtr myTopDelaunay;
462   StdMeshers_ProjectionUtils::DelaunayPtr myBotDelaunay;
463   TColStd_DataMapOfIntegerInteger         myNodeID2ColID;
464
465   // top and bottom Delaulay triangles including an internal column
466   struct TopBotTriangles
467   {
468     double myBotBC[3], myTopBC[3]; // barycentric coordinates of a node within a triangle
469     int    myBotTriaNodes[3], myTopTriaNodes[3]; // indices of boundary columns
470     TopBotTriangles();
471     void SetTopByBottom();
472   };
473   std::vector< TopBotTriangles> myTopBotTriangles;
474 };
475
476 // ===============================================
477 /*!
478  * \brief Algo building prisms on a prism shape
479  */
480 class STDMESHERS_EXPORT StdMeshers_Prism_3D: public SMESH_3D_Algo
481 {
482 public:
483   StdMeshers_Prism_3D(int hypId, SMESH_Gen* gen);
484   virtual ~StdMeshers_Prism_3D();
485
486   virtual bool CheckHypothesis(SMESH_Mesh&                          aMesh,
487                                const TopoDS_Shape&                  aShape,
488                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
489
490   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
491
492   virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
493                         MapShapeNbElems& aResMap);
494
495   /*!
496    * \brief Enable removal of quadrangles from the bottom face and
497    * triangles creation there by projection from the top
498    * (sole face meshed with triangles is considered to be a bottom one).
499    * If there are two faces with triangles, triangles must
500    * be of the same topology, else the algo fails.
501    * The method must be called before Compute()
502    */
503   void ProjectTriangles() { myProjectTriangles = true; }
504
505   /*!
506    * \brief Create prisms
507     * \param nodeColumns - columns of nodes generated from nodes of a mesh face
508     * \param helper - helper initialized by mesh and shape to add prisms to
509    */
510   static bool AddPrisms( std::vector<const TNodeColumn*> & nodeColumns,
511                          SMESH_MesherHelper*               helper);
512
513   static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll);
514   virtual bool IsApplicableToShape(const TopoDS_Shape & shape, bool toCheckAll) const
515   {
516     return IsApplicable( shape, toCheckAll );
517   }
518
519  private:
520
521   /*!
522    * \brief Analyse shape geometry and mesh.
523     * If there are triangles on one of faces, it becomes 'bottom'
524    */
525   bool initPrism(Prism_3D::TPrismTopo& thePrism,
526                  const TopoDS_Shape&   theSolid,
527                  const bool            selectBottom = true);
528
529   /*!
530    * \brief Fill thePrism.myWallQuads and thePrism.myTopEdges
531    */
532   bool getWallFaces( Prism_3D::TPrismTopo& thePrism,
533                      const int             totalNbFaces);
534
535   /*!
536    * \brief Compute mesh on a SOLID
537    */
538   bool compute(const Prism_3D::TPrismTopo& thePrism);
539
540   /*!
541    * \brief Compute the base face of a prism
542    */
543   bool computeBase(const Prism_3D::TPrismTopo& thePrism);
544
545   /*!
546    * \brief Compute 2D mesh on walls FACEs of a prism
547    */
548   bool computeWalls(const Prism_3D::TPrismTopo& thePrism);
549
550   /*!
551    * \brief Create artificial wall quads for vertical projection between the outer and inner walls
552    */
553   void makeQuadsForOutInProjection( const Prism_3D::TPrismTopo&      thePrism,
554                                     std::multimap< int, int >&       wgt2quad,
555                                     std::map< int, FaceQuadStruct >& iW2oiQuads);
556   /*!
557    * \brief Returns a source EDGE of propagation to a given EDGE
558    */
559   TopoDS_Edge findPropagationSource( const TopoDS_Edge& E );
560
561   /*!
562    * \brief Find correspondence between bottom and top nodes.
563    *  If elements on the bottom and top faces are topologically different,
564    *  and projection is possible and allowed, perform the projection
565     * \retval bool - is a success or not
566    */
567   bool assocOrProjBottom2Top( const gp_Trsf & bottomToTopTrsf,
568                               const Prism_3D::TPrismTopo& thePrism);
569
570   /*!
571    * \brief Remove quadrangles from the top face and
572    *        create triangles there by projection from the bottom
573     * \retval bool - a success or not
574    */
575   bool projectBottomToTop( const gp_Trsf & bottomToTopTrsf,
576                            const Prism_3D::TPrismTopo& thePrism );
577
578   /*!
579    * \brief Compute tolerance to pass to StdMeshers_Sweeper
580    */
581   double getSweepTolerance( const Prism_3D::TPrismTopo& thePrism );
582
583   /*!
584    * \brief Defines if it's safe to use the block approach
585    */
586   bool isSimpleBottom( const Prism_3D::TPrismTopo& thePrism );
587
588   /*!
589    * \brief Defines if all "vertical" EDGEs are straight
590    */
591   bool allVerticalEdgesStraight( const Prism_3D::TPrismTopo& thePrism );
592
593   /*!
594    * \brief Project mesh faces from a source FACE of one prism to
595    *        a source FACE of another prism
596    *  \retval bool - a success or not
597    */
598   bool project2dMesh(const TopoDS_Face& source, const TopoDS_Face& target);
599
600   /*!
601    * \brief Set projection coordinates of a node to a face and it's sub-shapes
602     * \param faceID - the face given by in-block ID
603     * \param params - node normalized parameters
604     * \retval bool - is a success
605    */
606   bool setFaceAndEdgesXYZ( const int faceID, const gp_XYZ& params, int z );
607
608   /*!
609    * \brief If (!isOK), sets the error to a sub-mesh of a current SOLID
610    */
611   bool toSM( bool isOK );
612
613   /*!
614    * \brief Return index of a shape
615    */
616   int shapeID( const TopoDS_Shape& S );
617
618 private:
619
620   bool myProjectTriangles;
621   bool mySetErrorToSM;
622   bool myUseBlock;
623
624   StdMeshers_PrismAsBlock myBlock;
625   SMESH_MesherHelper*     myHelper;
626   SMESH_subMesh*          myPrevBottomSM;
627
628   std::vector<gp_XYZ>     myShapeXYZ; // point on each sub-shape of the block
629
630   // map of bottom nodes to the column of nodes above them
631   // (the column includes the bottom node)
632   TNode2ColumnMap         myBotToColumnMap;
633
634   TopTools_IndexedMapOfShape* myPropagChains;
635
636 }; // class StdMeshers_Prism_3D
637
638 #endif