Version: 6.3.1

src/SMESH/SMESH_TypeDefs.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 // File      : SMESH_TypeDefs.hxx
00023 // Created   : Thu Jan 27 18:38:33 2011
00024 // Author    : Edward AGAPOV (eap)
00025 
00026 
00027 #ifndef __SMESH_TypeDefs_HXX__
00028 #define __SMESH_TypeDefs_HXX__
00029 
00030 #include "SMESH_SMESH.hxx"
00031 
00032 #include <SMDS_MeshNode.hxx>
00033 
00034 #include <gp_XYZ.hxx>
00035 
00036 #include <map>
00037 #include <list>
00038 #include <set>
00039 
00040 typedef std::map<const SMDS_MeshElement*,
00041                  std::list<const SMDS_MeshElement*> >        TElemOfElemListMap;
00042 typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
00043 
00045 typedef std::set< const SMDS_MeshElement*, TIDCompare >      TIDSortedElemSet;
00046 typedef std::set< const SMDS_MeshNode*,    TIDCompare >      TIDSortedNodeSet;
00047 
00048 typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* >   NLink;
00049 
00050 
00051 //=======================================================================
00055 //=======================================================================
00056 
00057 struct SMESH_TLink: public NLink
00058 {
00059   SMESH_TLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 ):NLink( n1, n2 )
00060   { if ( n1->GetID() < n2->GetID() ) std::swap( first, second ); }
00061   SMESH_TLink(const NLink& link ):NLink( link )
00062   { if ( first->GetID() < second->GetID() ) std::swap( first, second ); }
00063   const SMDS_MeshNode* node1() const { return first; }
00064   const SMDS_MeshNode* node2() const { return second; }
00065 };
00066 
00067 //=======================================================================
00071 //=======================================================================
00072 
00073 struct SMESH_OrientedLink: public SMESH_TLink
00074 {
00075   bool _reversed;
00076   SMESH_OrientedLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 )
00077     : SMESH_TLink( n1, n2 ), _reversed( n1 != node1() ) {}
00078 };
00079 
00080 //------------------------------------------
00084 //------------------------------------------
00085 struct SMESH_TNodeXYZ : public gp_XYZ
00086 {
00087   const SMDS_MeshNode* _node;
00088   SMESH_TNodeXYZ( const SMDS_MeshElement* e):gp_XYZ(0,0,0),_node(0) {
00089     if (e) {
00090       assert( e->GetType() == SMDSAbs_Node );
00091       _node = static_cast<const SMDS_MeshNode*>(e);
00092       SetCoord( _node->X(), _node->Y(), _node->Z() );
00093     }
00094   }
00095   double Distance(const SMDS_MeshNode* n)       const { return (SMESH_TNodeXYZ( n )-*this).Modulus(); }
00096   double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); }
00097   bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; }
00098 };
00099 
00100 // --------------------------------------------------------------------------------
00101 // class SMESH_SequenceOfElemPtr
00102 #include <NCollection_DefineSequence.hxx>
00103 
00104 class SMDS_MeshElement;
00105 
00106 typedef const SMDS_MeshElement* SMDS_MeshElementPtr;
00107 
00108 DEFINE_BASECOLLECTION (SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr)
00109 DEFINE_SEQUENCE (SMESH_SequenceOfElemPtr, SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr)
00110 
00111 
00112 // --------------------------------------------------------------------------------
00113 // class SMESH_SequenceOfNode
00114 typedef const SMDS_MeshNode* SMDS_MeshNodePtr;
00115 
00116 DEFINE_BASECOLLECTION (SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr)
00117 DEFINE_SEQUENCE(SMESH_SequenceOfNode,
00118                 SMESH_BaseCollectionNodePtr, SMDS_MeshNodePtr)
00119 
00120 // --------------------------------------------------------------------------------
00121 // #include "SMESHDS_DataMapOfShape.hxx"
00122 
00123 // #include <NCollection_DefineIndexedMap.hxx>
00124 
00125 // #include <TopoDS_Shape.hxx>
00126 
00128 
00129 // DEFINE_BASECOLLECTION (SMESH_BaseCollectionShape, TopoDS_Shape)
00130 // DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape)
00131 
00133 
00134 // DEFINE_BASECOLLECTION (SMESH_BaseCollectionIndexedMapOfShape, SMESH_IndexedMapOfShape)
00135 // DEFINE_INDEXEDDATAMAP (SMESH_IndexedDataMapOfShapeIndexedMapOfShape,
00136 //                        SMESH_BaseCollectionIndexedMapOfShape, TopoDS_Shape,
00137 //                        SMESH_IndexedMapOfShape)
00138 
00139 // --------------------------------------------------------------------------------
00140 // class SMESH_DataMapOfElemPtrSequenceOfElemPtr
00141 
00142 // SMESH_EXPORT 
00143 // inline Standard_Integer HashCode(SMDS_MeshElementPtr theElem,
00144 //                                  const Standard_Integer theUpper)
00145 // {
00146 //   void* anElem = (void*) theElem;
00147 //   return HashCode(anElem,theUpper);
00148 // }
00149 
00150 // SMESH_EXPORT 
00151 // inline Standard_Boolean IsEqual(SMDS_MeshElementPtr theOne,
00152 //                                 SMDS_MeshElementPtr theTwo)
00153 // {
00154 //   return theOne == theTwo;
00155 // }
00156 
00157 // DEFINE_BASECOLLECTION (SMESH_BaseCollectionSequenceOfElemPtr, SMESH_SequenceOfElemPtr)
00158 // DEFINE_DATAMAP (SMESH_DataMapOfElemPtrSequenceOfElemPtr,
00159 //                 SMESH_BaseCollectionSequenceOfElemPtr,
00160 //                 SMDS_MeshElementPtr, SMESH_SequenceOfElemPtr)
00161 
00162 #endif
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