X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshCell.hxx;h=3241d0943ba607fe6694fa9340b614bfed6e25f2;hp=ca006b5ff203d8f9b7b052e3a01395bcbda2d435;hb=a274ade365bd0f0e19d56c577acc4a13aa1972a7;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMDS/SMDS_MeshCell.hxx b/src/SMDS/SMDS_MeshCell.hxx index ca006b5ff..3241d0943 100644 --- a/src/SMDS/SMDS_MeshCell.hxx +++ b/src/SMDS/SMDS_MeshCell.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2010-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2010-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,51 +22,91 @@ #include "SMDS_MeshElement.hxx" +#include + /*! * \brief Base class for all cells */ class SMDS_EXPORT SMDS_MeshCell: public SMDS_MeshElement { -public: - SMDS_MeshCell(); - virtual ~SMDS_MeshCell(); + protected: + + void init( SMDSAbs_EntityType entityType, int nbNodes, ... ); + + void init( SMDSAbs_EntityType entityType, const std::vector& nodes ); + + void init( SMDSAbs_EntityType entityType, const std::vector& vtkNodeIds ); + + friend class SMDS_Mesh; + + public: + + virtual int NbEdges() const; + virtual int NbFaces() const; + virtual int NbNodes() const; + virtual int NbCornerNodes() const; + virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes); + virtual int GetNodeIndex( const SMDS_MeshNode* node ) const; + virtual const SMDS_MeshNode* GetNode(const int ind) const; + + virtual SMDSAbs_ElementType GetType() const; + virtual SMDSAbs_EntityType GetEntityType() const; + virtual SMDSAbs_GeometryType GetGeomType() const; + virtual VTKCellType GetVtkType() const; + + virtual bool IsPoly() const; + virtual bool IsQuadratic() const; - virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)= 0; - virtual bool vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes) {return true; } + virtual SMDS_ElemIteratorPtr nodesIterator() const; + virtual SMDS_NodeIteratorPtr nodeIterator() const; + virtual SMDS_NodeIteratorPtr interlacedNodesIterator() const; + virtual SMDS_NodeIteratorPtr nodesIteratorToUNV() const; - static VTKCellType toVtkType (SMDSAbs_EntityType vtkType); - static SMDSAbs_EntityType toSmdsType(VTKCellType vtkType); - static SMDSAbs_ElementType toSmdsType(SMDSAbs_GeometryType geomType); - static SMDSAbs_ElementType toSmdsType(SMDSAbs_EntityType entityType); + + static void InitStaticMembers(); + static VTKCellType toVtkType ( SMDSAbs_EntityType entityType ); + static SMDSAbs_EntityType toSmdsType ( VTKCellType vtkType ); + static SMDSAbs_ElementType ElemType ( SMDSAbs_GeometryType geomType ); + static SMDSAbs_ElementType ElemType ( SMDSAbs_EntityType entityType ); + static SMDSAbs_GeometryType GeomType ( SMDSAbs_EntityType entityType ); + static bool IsPoly ( SMDSAbs_EntityType entityType ); + static bool IsQuadratic ( SMDSAbs_EntityType entityType ); + static int NbCornerNodes( SMDSAbs_EntityType entityType ); + static int NbNodes ( SMDSAbs_EntityType entityType ); + static int NbEdges ( SMDSAbs_EntityType entityType ); + static int NbFaces ( SMDSAbs_EntityType entityType ); static const std::vector& toVtkOrder(VTKCellType vtkType); static const std::vector& toVtkOrder(SMDSAbs_EntityType smdsType); static const std::vector& fromVtkOrder(VTKCellType vtkType); static const std::vector& fromVtkOrder(SMDSAbs_EntityType smdsType); - static const std::vector& reverseSmdsOrder(SMDSAbs_EntityType smdsType); - static const std::vector& interlacedSmdsOrder(SMDSAbs_EntityType smdsType); + static const std::vector& reverseSmdsOrder(SMDSAbs_EntityType smdsType, + const size_t nbNodes=0); + static const std::vector& interlacedSmdsOrder(SMDSAbs_EntityType smdsType, + const size_t nbNodes=0); + - template< class VECT > + template< class VECT > // interlacedIDs[i] = smdsIDs[ indices[ i ]] static void applyInterlace( const std::vector& interlace, VECT & data) { - if ( interlace.empty() ) return; + if ( interlace.size() < data.size() ) return; VECT tmpData( data.size() ); for ( size_t i = 0; i < data.size(); ++i ) tmpData[i] = data[ interlace[i] ]; data.swap( tmpData ); } - - static int nbCells; - -protected: - inline void exchange(const SMDS_MeshNode* nodes[],int a, int b) + template< class VECT > // interlacedIDs[ indices[ i ]] = smdsIDs[i] + static void applyInterlaceRev( const std::vector& interlace, VECT & data) { - const SMDS_MeshNode* noda = nodes[a]; - nodes[a] = nodes[b]; - nodes[b] = noda; + if ( interlace.size() < data.size() ) return; + VECT tmpData( data.size() ); + for ( size_t i = 0; i < data.size(); ++i ) + tmpData[ interlace[i] ] = data[i]; + data.swap( tmpData ); } + }; #endif