Salome HOME
0021543: EDF 1978 SMESH: Viscous layer for 2D meshes
[modules/smesh.git] / src / SMESHUtils / SMESH_TypeDefs.hxx
index 404565812b569e11a856db3b303426b3a740aa96..0dbdd74226f2f5ef47a19b241e021a0b25823b07 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -36,6 +36,7 @@
 #include <map>
 #include <list>
 #include <set>
+#include <cassert>
 
 typedef std::map<const SMDS_MeshElement*,
                  std::list<const SMDS_MeshElement*> >        TElemOfElemListMap;
@@ -45,7 +46,7 @@ typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
 typedef std::set< const SMDS_MeshElement*, TIDCompare >      TIDSortedElemSet;
 typedef std::set< const SMDS_MeshNode*,    TIDCompare >      TIDSortedNodeSet;
 
-typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* >   NLink;
+typedef std::pair< const SMDS_MeshNode*, const SMDS_MeshNode* >   NLink;
 
 
 namespace SMESHUtils
@@ -59,6 +60,12 @@ namespace SMESHUtils
     TVECTOR v2;
     vec.swap( v2 );
   }
+  template <class TVECTOR>
+  void CompactVector(TVECTOR& vec)
+  {
+    TVECTOR v2( vec );
+    vec.swap( v2 );
+  }
 }
 
 //=======================================================================
@@ -98,11 +105,13 @@ struct SMESH_OrientedLink: public SMESH_TLink
 struct SMESH_TNodeXYZ : public gp_XYZ
 {
   const SMDS_MeshNode* _node;
+  double               _xyz[3];
   SMESH_TNodeXYZ( const SMDS_MeshElement* e):gp_XYZ(0,0,0),_node(0) {
     if (e) {
       assert( e->GetType() == SMDSAbs_Node );
       _node = static_cast<const SMDS_MeshNode*>(e);
-      SetCoord( _node->X(), _node->Y(), _node->Z() );
+      _node->GetXYZ(_xyz); // - thread safe getting coords
+      SetCoord( _xyz[0], _xyz[1], _xyz[2] );
     }
   }
   double Distance(const SMDS_MeshNode* n)       const { return (SMESH_TNodeXYZ( n )-*this).Modulus(); }
@@ -110,6 +119,28 @@ struct SMESH_TNodeXYZ : public gp_XYZ
   bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; }
 };
 
+//--------------------------------------------------
+/*!
+ * \brief Data of a node generated on FACE boundary
+ */
+//--------------------------------------------------
+typedef struct uvPtStruct
+{
+  double param;
+  double normParam;
+  double u, v; // original 2d parameter
+  double x, y; // 2d parameter, normalized [0,1]
+  const SMDS_MeshNode * node;
+
+  struct NodeAccessor // accessor to iterate on nodes in UVPtStructVec
+  {
+    static const SMDS_MeshNode* value(std::vector< uvPtStruct >::const_iterator it)
+    { return it->node; }
+  };
+} UVPtStruct;
+
+typedef std::vector< UVPtStruct > UVPtStructVec;
+
 // --------------------------------------------------------------------------------
 // class SMESH_SequenceOfElemPtr
 #include <NCollection_DefineSequence.hxx>