Back to index

salome-smesh  6.5.0
StdMeshers_ProjectionUtils.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMESH : idl implementation based on 'SMESH' unit's calsses
00024 // File      : StdMeshers_ProjectionUtils.hxx
00025 // Created   : Thu Oct 26 15:37:24 2006
00026 // Author    : Edward AGAPOV (eap)
00027 //
00028 #ifndef StdMeshers_ProjectionUtils_HeaderFile
00029 #define StdMeshers_ProjectionUtils_HeaderFile
00030 
00031 #include "SMESH_StdMeshers.hxx"
00032 
00033 #include <TopTools_DataMapOfShapeShape.hxx>
00034 #include <TopoDS_Edge.hxx>
00035 #include <TopoDS_Vertex.hxx>
00036 #include <TopoDS_Face.hxx>
00037 
00038 #include <list>
00039 #include <map>
00040 
00041 class TopoDS_Shape;
00042 class SMDS_MeshNode;
00043 class SMESH_Mesh;
00044 class SMESH_Hypothesis;
00045 class SMESH_subMesh;
00046 class TopTools_IndexedDataMapOfShapeListOfShape;
00047 
00052 struct StdMeshers_ShapeShapeBiDirectionMap
00053 {
00054   TopTools_DataMapOfShapeShape _map1to2, _map2to1;
00055 
00056   // convension: s1 - target, s2 - source
00057   bool Bind( const TopoDS_Shape& s1, const TopoDS_Shape& s2 )
00058   { _map1to2.Bind( s1, s2 ); return _map2to1.Bind( s2, s1 ); }
00059   bool IsBound( const TopoDS_Shape& s, const bool isShape2=false ) const 
00060   { return (isShape2 ? _map2to1 : _map1to2).IsBound( s ); }
00061   bool IsEmpty() const { return _map1to2.IsEmpty(); }
00062   int Extent() const { return _map1to2.Extent(); }
00063   void Clear() { _map1to2.Clear(); _map2to1.Clear(); }
00064   const TopoDS_Shape& operator()( const TopoDS_Shape& s, const bool isShape2=false ) const
00065   { // if we get a Standard_NoSuchObject here, it means that the calling code
00066     // passes incorrect isShape2
00067     return (isShape2 ? _map2to1 : _map1to2)( s );
00068   }
00069 };
00070 
00074 class StdMeshers_ProjectionUtils
00075 {
00076  public:
00077 
00078   typedef StdMeshers_ShapeShapeBiDirectionMap                  TShapeShapeMap;
00079   typedef TopTools_IndexedDataMapOfShapeListOfShape            TAncestorMap;
00080   typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
00081 
00092   static bool FindSubShapeAssociation(const TopoDS_Shape& theShape1,
00093                                       SMESH_Mesh*         theMesh1,
00094                                       const TopoDS_Shape& theShape2,
00095                                       SMESH_Mesh*         theMesh2,
00096                                       TShapeShapeMap &    theAssociationMap);
00097 
00108   static int FindFaceAssociation(const TopoDS_Face&         face1,
00109                                  TopoDS_Vertex              VV1[2],
00110                                  const TopoDS_Face&         face2,
00111                                  TopoDS_Vertex              VV2[2],
00112                                  std::list< TopoDS_Edge > & edges1,
00113                                  std::list< TopoDS_Edge > & edges2);
00114 
00121   static void InitVertexAssociation( const SMESH_Hypothesis* theHyp,
00122                                      TShapeShapeMap &        theAssociationMap);
00123 
00132   static bool InsertAssociation( const TopoDS_Shape& theShape1, // target
00133                                  const TopoDS_Shape& theShape2, // source
00134                                  TShapeShapeMap &    theAssociationMap);
00135 
00139   static TopoDS_Edge GetEdgeByVertices( SMESH_Mesh*          aMesh,
00140                                         const TopoDS_Vertex& V1,
00141                                         const TopoDS_Vertex& V2);
00142                                         
00147   static TopoDS_Face GetNextFace( const TAncestorMap& edgeToFaces,
00148                                   const TopoDS_Edge&  edge,
00149                                   const TopoDS_Face&  face);
00153   static TopoDS_Vertex GetNextVertex(const TopoDS_Edge&   edge,
00154                                      const TopoDS_Vertex& vertex);
00155 
00162   static std::pair<int,TopoDS_Edge> GetPropagationEdge( SMESH_Mesh*        aMesh,
00163                                                         const TopoDS_Edge& anEdge,
00164                                                         const TopoDS_Edge& fromEdge);
00165 
00176   static bool FindMatchingNodesOnFaces( const TopoDS_Face&     face1,
00177                                         SMESH_Mesh*            mesh1,
00178                                         const TopoDS_Face&     face2,
00179                                         SMESH_Mesh*            mesh2,
00180                                         const TShapeShapeMap & assocMap,
00181                                         TNodeNodeMap &         nodeIn2OutMap);
00188   static TopoDS_Shape OuterShape( const TopoDS_Face& face,
00189                                   TopAbs_ShapeEnum   type);
00190 
00197   static bool MakeComputed(SMESH_subMesh * sm, const int iterationNb = 0);
00198 
00206   static int Count(const TopoDS_Shape&    shape,
00207                    const TopAbs_ShapeEnum type,
00208                    const bool             ignoreSame);
00209 
00216   static void SetEventListener(SMESH_subMesh* subMesh,
00217                                TopoDS_Shape   srcShape,
00218                                SMESH_Mesh*    srcMesh);
00219 
00223   static TopoDS_Edge GetBoundaryEdge(const TopoDS_Shape& edgeContainer,
00224                                      const SMESH_Mesh&   mesh);
00225 };
00226 
00227 #endif