mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-15 22:21:28 +05:00
Add SMDS_SetIterator.hxx, element->GetNode(index), fix some errors
This commit is contained in:
parent
75b33910e0
commit
28b1248d96
@ -63,20 +63,6 @@ LIB_SRC = \
|
|||||||
SMDS_QuadraticEdge.cxx \
|
SMDS_QuadraticEdge.cxx \
|
||||||
SMDS_QuadraticFaceOfNodes.cxx \
|
SMDS_QuadraticFaceOfNodes.cxx \
|
||||||
SMDS_QuadraticVolumeOfNodes.cxx
|
SMDS_QuadraticVolumeOfNodes.cxx
|
||||||
# SMDS_Tria3OfNodes.cxx \
|
|
||||||
# SMDS_HexahedronOfNodes.cxx
|
|
||||||
|
|
||||||
#SMDSControl_BoundaryEdges.cxx \
|
|
||||||
#SMDSControl_BoundaryFaces.cxx \
|
|
||||||
#SMDSControl.cxx \
|
|
||||||
#SMDSControl_MeshBoundary.cxx \
|
|
||||||
#SMDSEdit_Transform.cxx \
|
|
||||||
#SMDS_MeshNodeIDFactory.cxx \
|
|
||||||
#SMDS_MeshPrism.cxx \
|
|
||||||
#SMDS_MeshPyramid.cxx \
|
|
||||||
#SMDS_MeshQuadrangle.cxx \
|
|
||||||
#SMDS_MeshTetrahedron.cxx \
|
|
||||||
#SMDS_MeshTriangle.cxx \
|
|
||||||
|
|
||||||
|
|
||||||
LIB_CLIENT_IDL =
|
LIB_CLIENT_IDL =
|
||||||
@ -119,21 +105,8 @@ EXPORT_HEADERS= \
|
|||||||
SMDS_VolumeTool.hxx \
|
SMDS_VolumeTool.hxx \
|
||||||
SMDS_QuadraticEdge.hxx \
|
SMDS_QuadraticEdge.hxx \
|
||||||
SMDS_QuadraticFaceOfNodes.hxx \
|
SMDS_QuadraticFaceOfNodes.hxx \
|
||||||
SMDS_QuadraticVolumeOfNodes.hxx
|
SMDS_QuadraticVolumeOfNodes.hxx \
|
||||||
# SMDS_Tria3OfNodes.hxx \
|
SMDS_SetIterator.hxx
|
||||||
# SMDS_HexahedronOfNodes.hxx
|
|
||||||
|
|
||||||
#SMDSControl_BoundaryEdges.hxx \
|
|
||||||
#SMDSControl_BoundaryFaces.hxx \
|
|
||||||
#SMDSControl.hxx \
|
|
||||||
#SMDSControl_MeshBoundary.hxx \
|
|
||||||
#SMDSEdit_Transform.hxx \
|
|
||||||
#SMDS_MeshPrism.hxx \
|
|
||||||
#SMDS_MeshPyramid.hxx \
|
|
||||||
#SMDS_MeshQuadrangle.hxx \
|
|
||||||
#SMDS_MeshTetrahedron.hxx \
|
|
||||||
#SMDS_MeshTriangle.hxx \
|
|
||||||
#SMDS_MeshNodeIDFactory.hxx
|
|
||||||
|
|
||||||
# additionnal information to compil and link file
|
# additionnal information to compil and link file
|
||||||
CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
|
CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
|
||||||
|
@ -33,8 +33,24 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
class SMDS_MeshElement;
|
class SMDS_MeshElement;
|
||||||
|
class SMDS_MeshNode;
|
||||||
|
class SMDS_MeshEdge;
|
||||||
|
class SMDS_MeshFace;
|
||||||
|
class SMDS_MeshVolume;
|
||||||
|
|
||||||
typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
|
typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
|
||||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
|
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
|
||||||
|
|
||||||
|
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
|
||||||
|
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
|
||||||
|
|
||||||
|
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
|
||||||
|
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
|
||||||
|
|
||||||
|
typedef SMDS_Iterator<const SMDS_MeshFace *> SMDS_FaceIterator;
|
||||||
|
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIteratorPtr;
|
||||||
|
|
||||||
|
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
|
||||||
|
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -155,3 +155,29 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
int SMDS_FaceOfEdges::NbNodes() const
|
||||||
|
{
|
||||||
|
return myEdges[0]->NbNodes() + myEdges[1]->NbNodes() + myEdges[2]->NbNodes() +
|
||||||
|
( myNbEdges == 4 ? myEdges[3]->NbNodes() : 0 ) - myNbEdges;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_FaceOfEdges::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
int index = WrappedIndex( ind );
|
||||||
|
for ( int i = 0; i < myNbEdges; ++i ) {
|
||||||
|
if ( index >= myEdges[ i ]->NbNodes() )
|
||||||
|
index -= myEdges[ i ]->NbNodes();
|
||||||
|
else
|
||||||
|
return myEdges[ i ]->GetNode( index );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,21 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace
|
|||||||
const SMDS_MeshEdge* edge4);
|
const SMDS_MeshEdge* edge4);
|
||||||
|
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
// friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2);
|
// friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "SMDS_FaceOfNodes.hxx"
|
#include "SMDS_FaceOfNodes.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
@ -68,25 +69,11 @@ void SMDS_FaceOfNodes::Print(ostream & OS) const
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
|
class SMDS_FaceOfNodes_MyIterator:public SMDS_NodeArrayElemIterator
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* const *mySet;
|
|
||||||
int myLength;
|
|
||||||
int index;
|
|
||||||
public:
|
public:
|
||||||
SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
|
SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
|
||||||
mySet(s),myLength(l),index(0) {}
|
SMDS_NodeArrayElemIterator( s, & s[ l ] ) {}
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return index<myLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
return mySet[index-1];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
|
SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
|
||||||
@ -147,6 +134,18 @@ bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_FaceOfNodes::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ WrappedIndex( ind )];
|
||||||
|
}
|
||||||
|
|
||||||
/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
|
/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
|
||||||
{
|
{
|
||||||
set<SMDS_MeshNode> set1,set2;
|
set<SMDS_MeshNode> set1,set2;
|
||||||
|
@ -44,6 +44,16 @@ class SMDS_FaceOfNodes:public SMDS_MeshFace
|
|||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
@ -50,15 +50,6 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
|
|
||||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
|
|
||||||
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
|
|
||||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
|
|
||||||
typedef SMDS_Iterator<const SMDS_MeshFace *> SMDS_FaceIterator;
|
|
||||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIteratorPtr;
|
|
||||||
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
|
|
||||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
|
|
||||||
|
|
||||||
class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -135,6 +135,18 @@ bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2)
|
|||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_MeshEdge::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ WrappedIndex( ind )];
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ChangeNodes
|
//function : ChangeNodes
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -44,6 +44,16 @@ class SMDS_MeshEdge:public SMDS_MeshElement
|
|||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
|
friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
@ -200,18 +200,12 @@ bool SMDS_MeshElement::IsValidIndex(const int ind) const
|
|||||||
|
|
||||||
const SMDS_MeshNode* SMDS_MeshElement::GetNode(const int ind) const
|
const SMDS_MeshNode* SMDS_MeshElement::GetNode(const int ind) const
|
||||||
{
|
{
|
||||||
SMDS_MeshNode* N;
|
SMDS_ElemIteratorPtr it = nodesIterator();
|
||||||
if(IsValidIndex(ind)) {
|
int i = 0, index = WrappedIndex( ind );
|
||||||
int nbe = 0;
|
while ( index != i++ )
|
||||||
SMDS_ElemIteratorPtr it=edgesIterator();
|
|
||||||
while(nbe<ind) {
|
|
||||||
it->next();
|
it->next();
|
||||||
nbe++;
|
|
||||||
}
|
|
||||||
return static_cast<const SMDS_MeshNode*> (it->next());
|
return static_cast<const SMDS_MeshNode*> (it->next());
|
||||||
}
|
}
|
||||||
return N;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SMDS_MeshElement::IsQuadratic() const
|
bool SMDS_MeshElement::IsQuadratic() const
|
||||||
{
|
{
|
||||||
|
@ -68,15 +68,6 @@ public:
|
|||||||
virtual int NbFaces() const;
|
virtual int NbFaces() const;
|
||||||
int GetID() const;
|
int GetID() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if index of node is valid (0...NbNodes()-1)
|
|
||||||
*/
|
|
||||||
virtual bool IsValidIndex(const int ind) const;
|
|
||||||
/**
|
|
||||||
* Return node by it index (if index is valid)
|
|
||||||
*/
|
|
||||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
|
||||||
|
|
||||||
///Return the type of the current element
|
///Return the type of the current element
|
||||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||||
virtual bool IsPoly() const { return false; };
|
virtual bool IsPoly() const { return false; };
|
||||||
@ -87,6 +78,36 @@ public:
|
|||||||
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
||||||
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
||||||
|
|
||||||
|
// ===========================
|
||||||
|
// Access to nodes by index
|
||||||
|
// ===========================
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return true if index of node is valid (0 <= ind < NbNodes())
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval bool - index check result
|
||||||
|
*/
|
||||||
|
virtual bool IsValidIndex(const int ind) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Make index valid
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval int - valid node index
|
||||||
|
*/
|
||||||
|
int WrappedIndex(const int ind) const {
|
||||||
|
if ( ind < 0 ) return -( ind % NbNodes());
|
||||||
|
if ( ind >= NbNodes() ) return ind % NbNodes();
|
||||||
|
return ind;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_MeshElement(int ID=-1);
|
SMDS_MeshElement(int ID=-1);
|
||||||
virtual void Print(std::ostream & OS) const;
|
virtual void Print(std::ostream & OS) const;
|
||||||
|
@ -64,6 +64,15 @@ class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement
|
|||||||
void setXYZ(double x, double y, double z);
|
void setXYZ(double x, double y, double z);
|
||||||
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
|
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "SMDS_PolygonalFaceOfNodes.hxx"
|
#include "SMDS_PolygonalFaceOfNodes.hxx"
|
||||||
|
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
//#include "SMDS_MeshNode.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -128,28 +128,11 @@ void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
|
|||||||
//function : elementsIterator
|
//function : elementsIterator
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator
|
class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_NodeVectorElemIterator
|
||||||
{
|
{
|
||||||
//const SMDS_MeshNode* const *mySet;
|
|
||||||
const std::vector<const SMDS_MeshNode *> mySet;
|
|
||||||
//int myLength;
|
|
||||||
int index;
|
|
||||||
public:
|
public:
|
||||||
//SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
|
SMDS_PolygonalFaceOfNodes_MyIterator(const vector<const SMDS_MeshNode *>& s):
|
||||||
// mySet(s),myLength(l),index(0) {}
|
SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {}
|
||||||
SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
|
|
||||||
mySet(s),index(0) {}
|
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return index < mySet.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
return mySet[index-1];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
|
SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
|
||||||
@ -172,3 +155,16 @@ SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
|
|||||||
}
|
}
|
||||||
return SMDS_ElemIteratorPtr();
|
return SMDS_ElemIteratorPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_PolygonalFaceOfNodes::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ WrappedIndex( ind )];
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,15 @@ class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace
|
|||||||
|
|
||||||
virtual void Print (std::ostream & OS) const;
|
virtual void Print (std::ostream & OS) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
||||||
|
|
||||||
|
@ -1,11 +1,34 @@
|
|||||||
|
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
// File: SMDS_QuadraticEdge.cxx
|
// File: SMDS_QuadraticEdge.cxx
|
||||||
// Created: 16.01.06 16:25:42
|
// Created: 16.01.06 16:25:42
|
||||||
// Author: Sergey KUUL
|
// Author: Sergey KUUL
|
||||||
// Copyright: Open CASCADE 2006
|
|
||||||
|
|
||||||
|
|
||||||
#include "SMDS_QuadraticEdge.hxx"
|
#include "SMDS_QuadraticEdge.hxx"
|
||||||
|
|
||||||
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
|
||||||
@ -47,49 +70,6 @@ int SMDS_QuadraticEdge::NbNodes() const
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Iterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
class SMDS_QuadraticEdge_MyNodeIterator:public SMDS_ElemIterator
|
|
||||||
{
|
|
||||||
const SMDS_MeshNode *const* myNodes;
|
|
||||||
int myIndex;
|
|
||||||
public:
|
|
||||||
SMDS_QuadraticEdge_MyNodeIterator(const SMDS_MeshNode * const* nodes):
|
|
||||||
myNodes(nodes),myIndex(0) {}
|
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return myIndex<3;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
myIndex++;
|
|
||||||
return myNodes[myIndex-1];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_QuadraticEdge::
|
|
||||||
elementsIterator(SMDSAbs_ElementType type) const
|
|
||||||
{
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case SMDSAbs_Edge:
|
|
||||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
|
|
||||||
case SMDSAbs_Node:
|
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_QuadraticEdge_MyNodeIterator(myNodes));
|
|
||||||
default:
|
|
||||||
return SMDS_ElemIteratorPtr
|
|
||||||
(new SMDS_IteratorOfElements
|
|
||||||
(this,type, SMDS_ElemIteratorPtr(new SMDS_QuadraticEdge_MyNodeIterator(myNodes))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ChangeNodes
|
//function : ChangeNodes
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -105,7 +85,6 @@ bool SMDS_QuadraticEdge::ChangeNodes(const SMDS_MeshNode * node1,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsMediumNode
|
//function : IsMediumNode
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -116,5 +95,93 @@ bool SMDS_QuadraticEdge::IsMediumNode(const SMDS_MeshNode * node) const
|
|||||||
return (myNodes[2]==node);
|
return (myNodes[2]==node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
//class : _MyInterlacedNodeIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class _MyInterlacedNodeIterator: public SMDS_NodeArrayIterator
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode * myNodes[3];
|
||||||
|
public:
|
||||||
|
_MyInterlacedNodeIterator(const SMDS_MeshNode * const * nodes):
|
||||||
|
SMDS_NodeArrayIterator( myNodes, & myNodes[3] )
|
||||||
|
{
|
||||||
|
myNodes[0] = nodes[0];
|
||||||
|
myNodes[1] = nodes[2];
|
||||||
|
myNodes[2] = nodes[1];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : _MyInterlacedNodeElemIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class _MyInterlacedNodeElemIterator : public SMDS_ElemIterator
|
||||||
|
{
|
||||||
|
SMDS_NodeIteratorPtr myItr;
|
||||||
|
public:
|
||||||
|
_MyInterlacedNodeElemIterator(SMDS_NodeIteratorPtr interlacedNodeItr):
|
||||||
|
myItr( interlacedNodeItr ) {}
|
||||||
|
bool more() { return myItr->more(); }
|
||||||
|
const SMDS_MeshElement* next() { return myItr->next(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : _MyNodeIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class _MyNodeIterator:public SMDS_NodeArrayElemIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
_MyNodeIterator(const SMDS_MeshNode * const * nodes):
|
||||||
|
SMDS_NodeArrayElemIterator( nodes, & nodes[3] ) {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : interlacedNodesIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMDS_NodeIteratorPtr SMDS_QuadraticEdge::interlacedNodesIterator() const
|
||||||
|
{
|
||||||
|
return SMDS_NodeIteratorPtr (new _MyInterlacedNodeIterator (myNodes));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : interlacedNodesElemIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_QuadraticEdge::interlacedNodesElemIterator() const
|
||||||
|
{
|
||||||
|
return SMDS_ElemIteratorPtr
|
||||||
|
(new _MyInterlacedNodeElemIterator ( interlacedNodesIterator() ));
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : elementsIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_QuadraticEdge::elementsIterator(SMDSAbs_ElementType type) const
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SMDSAbs_Edge:
|
||||||
|
return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
|
||||||
|
case SMDSAbs_Node:
|
||||||
|
return SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes));
|
||||||
|
default:
|
||||||
|
return SMDS_ElemIteratorPtr
|
||||||
|
(new SMDS_IteratorOfElements
|
||||||
|
(this,type, SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,10 @@ public:
|
|||||||
|
|
||||||
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
|
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
|
||||||
|
|
||||||
|
SMDS_NodeIteratorPtr interlacedNodesIterator() const;
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
@ -1,10 +1,33 @@
|
|||||||
|
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
// File: SMDS_QuadraticFaceOfNodes.cxx
|
// File: SMDS_QuadraticFaceOfNodes.cxx
|
||||||
// Created: 16.01.06 17:12:58
|
// Created: 16.01.06 17:12:58
|
||||||
// Author: Sergey KUUL
|
// Author: Sergey KUUL
|
||||||
// Copyright: Open CASCADE 2006
|
|
||||||
|
|
||||||
#include "SMDS_QuadraticFaceOfNodes.hxx"
|
#include "SMDS_QuadraticFaceOfNodes.hxx"
|
||||||
|
|
||||||
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
|
||||||
@ -25,12 +48,13 @@ SMDS_QuadraticFaceOfNodes::SMDS_QuadraticFaceOfNodes(const SMDS_MeshNode * n1,
|
|||||||
const SMDS_MeshNode * n23,
|
const SMDS_MeshNode * n23,
|
||||||
const SMDS_MeshNode * n31)
|
const SMDS_MeshNode * n31)
|
||||||
{
|
{
|
||||||
myNodes.push_back(n1);
|
myNodes.resize( 6 );
|
||||||
myNodes.push_back(n2);
|
myNodes[ 0 ] = n1;
|
||||||
myNodes.push_back(n3);
|
myNodes[ 1 ] = n2;
|
||||||
myNodes.push_back(n12);
|
myNodes[ 2 ] = n3;
|
||||||
myNodes.push_back(n23);
|
myNodes[ 3 ] = n12;
|
||||||
myNodes.push_back(n31);
|
myNodes[ 4 ] = n23;
|
||||||
|
myNodes[ 5 ] = n31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,14 +72,15 @@ SMDS_QuadraticFaceOfNodes::SMDS_QuadraticFaceOfNodes(const SMDS_MeshNode * n1,
|
|||||||
const SMDS_MeshNode * n34,
|
const SMDS_MeshNode * n34,
|
||||||
const SMDS_MeshNode * n41)
|
const SMDS_MeshNode * n41)
|
||||||
{
|
{
|
||||||
myNodes.push_back(n1);
|
myNodes.resize( 8 );
|
||||||
myNodes.push_back(n2);
|
myNodes[ 0 ] = n1;
|
||||||
myNodes.push_back(n3);
|
myNodes[ 1 ] = n2;
|
||||||
myNodes.push_back(n4);
|
myNodes[ 2 ] = n3;
|
||||||
myNodes.push_back(n12);
|
myNodes[ 3 ] = n4;
|
||||||
myNodes.push_back(n23);
|
myNodes[ 4 ] = n12;
|
||||||
myNodes.push_back(n34);
|
myNodes[ 5 ] = n23;
|
||||||
myNodes.push_back(n41);
|
myNodes[ 6 ] = n34;
|
||||||
|
myNodes[ 7 ] = n41;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +148,6 @@ int SMDS_QuadraticFaceOfNodes::NbFaces() const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Print
|
//function : Print
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -137,79 +161,91 @@ void SMDS_QuadraticFaceOfNodes::Print(ostream & OS) const
|
|||||||
OS << myNodes[i] << ") " << endl;
|
OS << myNodes[i] << ") " << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : _MyInterlacedNodeIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class _MyInterlacedNodeIterator:public SMDS_NodeIterator
|
||||||
|
{
|
||||||
|
const vector<const SMDS_MeshNode *>& mySet;
|
||||||
|
int myIndex;
|
||||||
|
const int * myInterlace;
|
||||||
|
public:
|
||||||
|
_MyInterlacedNodeIterator(const vector<const SMDS_MeshNode *>& s,
|
||||||
|
const int * interlace):
|
||||||
|
mySet(s),myIndex(0),myInterlace(interlace) {}
|
||||||
|
|
||||||
|
bool more()
|
||||||
|
{
|
||||||
|
return myIndex < mySet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshNode* next()
|
||||||
|
{
|
||||||
|
return mySet[ myInterlace[ myIndex++ ]];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : _MyInterlacedNodeElemIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class _MyInterlacedNodeElemIterator : public SMDS_ElemIterator
|
||||||
|
{
|
||||||
|
SMDS_NodeIteratorPtr myItr;
|
||||||
|
public:
|
||||||
|
_MyInterlacedNodeElemIterator(SMDS_NodeIteratorPtr interlacedNodeItr):
|
||||||
|
myItr( interlacedNodeItr ) {}
|
||||||
|
bool more() { return myItr->more(); }
|
||||||
|
const SMDS_MeshElement* next() { return myItr->next(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : _MyNodeIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class _MyNodeIterator : public SMDS_NodeVectorElemIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
_MyNodeIterator(const vector<const SMDS_MeshNode *>& s):
|
||||||
|
SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : interlacedNodesIterator
|
//function : interlacedNodesIterator
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
class SMDS_QuadraticFaceOfNodes_MyInterlacedNodeIterator:public SMDS_NodeIterator
|
|
||||||
{
|
|
||||||
const std::vector<const SMDS_MeshNode *> mySet;
|
|
||||||
int index;
|
|
||||||
public:
|
|
||||||
SMDS_QuadraticFaceOfNodes_MyInterlacedNodeIterator(const std::vector<const SMDS_MeshNode *> s):
|
|
||||||
mySet(s),index(0) {}
|
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return index < mySet.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshNode* next()
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
int num=0;
|
|
||||||
if(mySet.size()==6) {
|
|
||||||
if(index==2) num=3;
|
|
||||||
else if(index==3) num=1;
|
|
||||||
else if(index==4) num=4;
|
|
||||||
else if(index==5) num=2;
|
|
||||||
else if(index==6) num=5;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(index==2) num=4;
|
|
||||||
else if(index==3) num=1;
|
|
||||||
else if(index==4) num=5;
|
|
||||||
else if(index==5) num=2;
|
|
||||||
else if(index==6) num=6;
|
|
||||||
else if(index==7) num=3;
|
|
||||||
else if(index==8) num=7;
|
|
||||||
}
|
|
||||||
return mySet[num];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SMDS_NodeIteratorPtr SMDS_QuadraticFaceOfNodes::interlacedNodesIterator() const
|
SMDS_NodeIteratorPtr SMDS_QuadraticFaceOfNodes::interlacedNodesIterator() const
|
||||||
{
|
{
|
||||||
|
static int triaInterlace [] = { 0, 3, 1, 4, 2, 5 };
|
||||||
|
static int quadInterlace [] = { 0, 4, 1, 5, 2, 6, 3, 7 };
|
||||||
return SMDS_NodeIteratorPtr
|
return SMDS_NodeIteratorPtr
|
||||||
(new SMDS_QuadraticFaceOfNodes_MyInterlacedNodeIterator(myNodes));
|
(new _MyInterlacedNodeIterator (myNodes, myNodes.size()==6 ? triaInterlace : quadInterlace));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : interlacedNodesElemIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::interlacedNodesElemIterator() const
|
||||||
|
{
|
||||||
|
return SMDS_ElemIteratorPtr
|
||||||
|
(new _MyInterlacedNodeElemIterator ( interlacedNodesIterator() ));
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : elementsIterator
|
//function : elementsIterator
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
class SMDS_QuadraticFaceOfNodes_MyIterator:public SMDS_ElemIterator
|
|
||||||
{
|
|
||||||
const std::vector<const SMDS_MeshNode *> mySet;
|
|
||||||
int index;
|
|
||||||
public:
|
|
||||||
SMDS_QuadraticFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
|
|
||||||
mySet(s),index(0) {}
|
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return index < mySet.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
return mySet[index-1];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::elementsIterator
|
SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::elementsIterator
|
||||||
(SMDSAbs_ElementType type) const
|
(SMDSAbs_ElementType type) const
|
||||||
@ -219,15 +255,27 @@ SMDS_ElemIteratorPtr SMDS_QuadraticFaceOfNodes::elementsIterator
|
|||||||
case SMDSAbs_Face:
|
case SMDSAbs_Face:
|
||||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
|
return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
|
||||||
case SMDSAbs_Node:
|
case SMDSAbs_Node:
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_QuadraticFaceOfNodes_MyIterator(myNodes));
|
return SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes));
|
||||||
case SMDSAbs_Edge:
|
case SMDSAbs_Edge:
|
||||||
MESSAGE("Error : edge iterator for SMDS_QuadraticFaceOfNodes not implemented");
|
MESSAGE("Error : edge iterator for SMDS_QuadraticFaceOfNodes not implemented");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SMDS_ElemIteratorPtr
|
return SMDS_ElemIteratorPtr
|
||||||
(new SMDS_IteratorOfElements
|
(new SMDS_IteratorOfElements
|
||||||
(this,type,SMDS_ElemIteratorPtr
|
(this,type,SMDS_ElemIteratorPtr (new _MyNodeIterator(myNodes))));
|
||||||
(new SMDS_QuadraticFaceOfNodes_MyIterator(myNodes))));
|
|
||||||
}
|
}
|
||||||
return SMDS_ElemIteratorPtr();
|
return SMDS_ElemIteratorPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_QuadraticFaceOfNodes::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ WrappedIndex( ind )];
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,6 @@
|
|||||||
|
|
||||||
#include "SMDS_MeshFace.hxx"
|
#include "SMDS_MeshFace.hxx"
|
||||||
|
|
||||||
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
|
|
||||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
|
|
||||||
|
|
||||||
class SMDS_WNT_EXPORT SMDS_QuadraticFaceOfNodes:public SMDS_MeshFace
|
class SMDS_WNT_EXPORT SMDS_QuadraticFaceOfNodes:public SMDS_MeshFace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -66,6 +63,17 @@ public:
|
|||||||
|
|
||||||
SMDS_NodeIteratorPtr interlacedNodesIterator() const;
|
SMDS_NodeIteratorPtr interlacedNodesIterator() const;
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
||||||
|
|
||||||
|
@ -1,12 +1,35 @@
|
|||||||
|
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
// File: SMDS_QuadraticVolumeOfNodes.cxx
|
// File: SMDS_QuadraticVolumeOfNodes.cxx
|
||||||
// Created: 17.01.06 09:46:11
|
// Created: 17.01.06 09:46:11
|
||||||
// Author: Sergey KUUL
|
// Author: Sergey KUUL
|
||||||
// Copyright: Open CASCADE 2006
|
|
||||||
|
|
||||||
#include "SMDS_QuadraticVolumeOfNodes.hxx"
|
#include "SMDS_QuadraticVolumeOfNodes.hxx"
|
||||||
|
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "SMDS_SetIterator.hxx"
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
@ -30,16 +53,17 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n24,
|
const SMDS_MeshNode * n24,
|
||||||
const SMDS_MeshNode * n34)
|
const SMDS_MeshNode * n34)
|
||||||
{
|
{
|
||||||
myNodes.push_back(n1);
|
myNodes.resize( 10 );
|
||||||
myNodes.push_back(n2);
|
myNodes[ 0 ] = n1;
|
||||||
myNodes.push_back(n3);
|
myNodes[ 1 ] = n2;
|
||||||
myNodes.push_back(n4);
|
myNodes[ 2 ] = n3;
|
||||||
myNodes.push_back(n12);
|
myNodes[ 3 ] = n4;
|
||||||
myNodes.push_back(n23);
|
myNodes[ 4 ] = n12;
|
||||||
myNodes.push_back(n31);
|
myNodes[ 5 ] = n23;
|
||||||
myNodes.push_back(n14);
|
myNodes[ 6 ] = n31;
|
||||||
myNodes.push_back(n24);
|
myNodes[ 7 ] = n14;
|
||||||
myNodes.push_back(n34);
|
myNodes[ 8 ] = n24;
|
||||||
|
myNodes[ 9 ] = n34;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,19 +87,20 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n35,
|
const SMDS_MeshNode * n35,
|
||||||
const SMDS_MeshNode * n45)
|
const SMDS_MeshNode * n45)
|
||||||
{
|
{
|
||||||
myNodes.push_back(n1);
|
myNodes.resize( 13 );
|
||||||
myNodes.push_back(n2);
|
myNodes[ 0 ] = n1;
|
||||||
myNodes.push_back(n3);
|
myNodes[ 1 ] = n2;
|
||||||
myNodes.push_back(n4);
|
myNodes[ 2 ] = n3;
|
||||||
myNodes.push_back(n5);
|
myNodes[ 3 ] = n4;
|
||||||
myNodes.push_back(n12);
|
myNodes[ 4 ] = n5;
|
||||||
myNodes.push_back(n23);
|
myNodes[ 5 ] = n12;
|
||||||
myNodes.push_back(n34);
|
myNodes[ 6 ] = n23;
|
||||||
myNodes.push_back(n41);
|
myNodes[ 7 ] = n34;
|
||||||
myNodes.push_back(n15);
|
myNodes[ 8 ] = n41;
|
||||||
myNodes.push_back(n25);
|
myNodes[ 9 ] = n15;
|
||||||
myNodes.push_back(n35);
|
myNodes[ 10 ] = n25;
|
||||||
myNodes.push_back(n45);
|
myNodes[ 11 ] = n35;
|
||||||
|
myNodes[ 12 ] = n45;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,21 +126,22 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n25,
|
const SMDS_MeshNode * n25,
|
||||||
const SMDS_MeshNode * n36)
|
const SMDS_MeshNode * n36)
|
||||||
{
|
{
|
||||||
myNodes.push_back(n1);
|
myNodes.resize( 15 );
|
||||||
myNodes.push_back(n2);
|
myNodes[ 0 ] = n1;
|
||||||
myNodes.push_back(n3);
|
myNodes[ 1 ] = n2;
|
||||||
myNodes.push_back(n4);
|
myNodes[ 2 ] = n3;
|
||||||
myNodes.push_back(n5);
|
myNodes[ 3 ] = n4;
|
||||||
myNodes.push_back(n6);
|
myNodes[ 4 ] = n5;
|
||||||
myNodes.push_back(n12);
|
myNodes[ 5 ] = n6;
|
||||||
myNodes.push_back(n23);
|
myNodes[ 6 ] = n12;
|
||||||
myNodes.push_back(n31);
|
myNodes[ 7 ] = n23;
|
||||||
myNodes.push_back(n45);
|
myNodes[ 8 ] = n31;
|
||||||
myNodes.push_back(n56);
|
myNodes[ 9 ] = n45;
|
||||||
myNodes.push_back(n64);
|
myNodes[ 10 ] = n56;
|
||||||
myNodes.push_back(n14);
|
myNodes[ 11 ] = n64;
|
||||||
myNodes.push_back(n25);
|
myNodes[ 12 ] = n14;
|
||||||
myNodes.push_back(n36);
|
myNodes[ 13 ] = n25;
|
||||||
|
myNodes[ 14 ] = n36;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,26 +172,27 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n37,
|
const SMDS_MeshNode * n37,
|
||||||
const SMDS_MeshNode * n48)
|
const SMDS_MeshNode * n48)
|
||||||
{
|
{
|
||||||
myNodes.push_back(n1);
|
myNodes.resize( 20 );
|
||||||
myNodes.push_back(n2);
|
myNodes[ 0 ] = n1;
|
||||||
myNodes.push_back(n3);
|
myNodes[ 1 ] = n2;
|
||||||
myNodes.push_back(n4);
|
myNodes[ 2 ] = n3;
|
||||||
myNodes.push_back(n5);
|
myNodes[ 3 ] = n4;
|
||||||
myNodes.push_back(n6);
|
myNodes[ 4 ] = n5;
|
||||||
myNodes.push_back(n7);
|
myNodes[ 5 ] = n6;
|
||||||
myNodes.push_back(n8);
|
myNodes[ 6 ] = n7;
|
||||||
myNodes.push_back(n12);
|
myNodes[ 7 ] = n8;
|
||||||
myNodes.push_back(n23);
|
myNodes[ 8 ] = n12;
|
||||||
myNodes.push_back(n34);
|
myNodes[ 9 ] = n23;
|
||||||
myNodes.push_back(n41);
|
myNodes[ 10 ] = n34;
|
||||||
myNodes.push_back(n56);
|
myNodes[ 11 ] = n41;
|
||||||
myNodes.push_back(n67);
|
myNodes[ 12 ] = n56;
|
||||||
myNodes.push_back(n78);
|
myNodes[ 13 ] = n67;
|
||||||
myNodes.push_back(n85);
|
myNodes[ 14 ] = n78;
|
||||||
myNodes.push_back(n15);
|
myNodes[ 15 ] = n85;
|
||||||
myNodes.push_back(n26);
|
myNodes[ 16 ] = n15;
|
||||||
myNodes.push_back(n37);
|
myNodes[ 17 ] = n26;
|
||||||
myNodes.push_back(n48);
|
myNodes[ 18 ] = n37;
|
||||||
|
myNodes[ 19 ] = n48;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,30 +203,16 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
|
|
||||||
bool SMDS_QuadraticVolumeOfNodes::IsMediumNode(const SMDS_MeshNode* node) const
|
bool SMDS_QuadraticVolumeOfNodes::IsMediumNode(const SMDS_MeshNode* node) const
|
||||||
{
|
{
|
||||||
if(NbNodes()==10) {
|
int nbCorners = 0;
|
||||||
int i=4;
|
switch (myNodes.size()) {
|
||||||
for(; i<10; i++) {
|
case 10: nbCorners = 4; break;
|
||||||
|
case 13: nbCorners = 5; break;
|
||||||
|
case 15: nbCorners = 6; break;
|
||||||
|
default: nbCorners = 8;
|
||||||
|
}
|
||||||
|
for ( int i = nbCorners; i<myNodes.size(); i++) {
|
||||||
if(myNodes[i]==node) return true;
|
if(myNodes[i]==node) return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if(NbNodes()==13) {
|
|
||||||
int i=5;
|
|
||||||
for(; i<13; i++) {
|
|
||||||
if(myNodes[i]==node) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(NbNodes()==15) {
|
|
||||||
int i=6;
|
|
||||||
for(; i<15; i++) {
|
|
||||||
if(myNodes[i]==node) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
int i=8;
|
|
||||||
for(; i<20; i++) {
|
|
||||||
if(myNodes[i]==node) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,11 +253,11 @@ int SMDS_QuadraticVolumeOfNodes::NbNodes() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
int SMDS_QuadraticVolumeOfNodes::NbEdges() const
|
int SMDS_QuadraticVolumeOfNodes::NbEdges() const
|
||||||
{
|
{
|
||||||
if(NbNodes()==10)
|
if(myNodes.size()==10)
|
||||||
return 6;
|
return 6;
|
||||||
else if(NbNodes()==13)
|
else if(myNodes.size()==13)
|
||||||
return 8;
|
return 8;
|
||||||
else if(NbNodes()==15)
|
else if(myNodes.size()==15)
|
||||||
return 9;
|
return 9;
|
||||||
else
|
else
|
||||||
return 12;
|
return 12;
|
||||||
@ -257,9 +270,9 @@ int SMDS_QuadraticVolumeOfNodes::NbEdges() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
int SMDS_QuadraticVolumeOfNodes::NbFaces() const
|
int SMDS_QuadraticVolumeOfNodes::NbFaces() const
|
||||||
{
|
{
|
||||||
if(NbNodes()==10)
|
if(myNodes.size()==10)
|
||||||
return 4;
|
return 4;
|
||||||
else if(NbNodes()==20)
|
else if(myNodes.size()==20)
|
||||||
return 6;
|
return 6;
|
||||||
else
|
else
|
||||||
return 5;
|
return 5;
|
||||||
@ -279,29 +292,22 @@ void SMDS_QuadraticVolumeOfNodes::Print(ostream & OS) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//private class : SMDS_QuadraticVolumeOfNodes_MyIterator
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
class SMDS_QuadraticVolumeOfNodes_MyIterator : public SMDS_NodeVectorElemIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SMDS_QuadraticVolumeOfNodes_MyIterator(const vector<const SMDS_MeshNode *>& s):
|
||||||
|
SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {}
|
||||||
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : elementsIterator
|
//function : elementsIterator
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
class SMDS_QuadraticVolumeOfNodes_MyIterator:public SMDS_ElemIterator
|
|
||||||
{
|
|
||||||
const std::vector<const SMDS_MeshNode *> mySet;
|
|
||||||
int index;
|
|
||||||
public:
|
|
||||||
SMDS_QuadraticVolumeOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
|
|
||||||
mySet(s),index(0) {}
|
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return index < mySet.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
return mySet[index-1];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_QuadraticVolumeOfNodes::elementsIterator
|
SMDS_ElemIteratorPtr SMDS_QuadraticVolumeOfNodes::elementsIterator
|
||||||
(SMDSAbs_ElementType type) const
|
(SMDSAbs_ElementType type) const
|
||||||
@ -327,3 +333,15 @@ SMDS_ElemIteratorPtr SMDS_QuadraticVolumeOfNodes::elementsIterator
|
|||||||
return SMDS_ElemIteratorPtr();
|
return SMDS_ElemIteratorPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_QuadraticVolumeOfNodes::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ WrappedIndex( ind )];
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,15 @@ public:
|
|||||||
|
|
||||||
virtual void Print (std::ostream & OS) const;
|
virtual void Print (std::ostream & OS) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
||||||
|
|
||||||
|
101
src/SMDS/SMDS_SetIterator.hxx
Normal file
101
src/SMDS/SMDS_SetIterator.hxx
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// File : SMDS_SetIterator.hxx
|
||||||
|
// Created : Mon Feb 27 16:57:43 2006
|
||||||
|
// Author : Edward AGAPOV (eap)
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SMDS_SetIterator_HeaderFile
|
||||||
|
#define SMDS_SetIterator_HeaderFile
|
||||||
|
|
||||||
|
#include "SMDS_Iterator.hxx"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// specific SMDS_Iterator iterating over abstract set of values like STL containers
|
||||||
|
///
|
||||||
|
/// BE CAREFUL: iterator pointed value is static_cast'ed to VALUE
|
||||||
|
///
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<typename VALUE, typename VALUE_SET_ITERATOR>
|
||||||
|
class SMDS_SetIterator : public SMDS_Iterator<VALUE>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
VALUE_SET_ITERATOR _beg, _end;
|
||||||
|
public:
|
||||||
|
SMDS_SetIterator(const VALUE_SET_ITERATOR & begin,
|
||||||
|
const VALUE_SET_ITERATOR & end)
|
||||||
|
{ init ( begin, end ); }
|
||||||
|
|
||||||
|
/// Initialization
|
||||||
|
virtual void init(const VALUE_SET_ITERATOR & begin,
|
||||||
|
const VALUE_SET_ITERATOR & end)
|
||||||
|
{ _beg = begin; _end = end; }
|
||||||
|
|
||||||
|
/// Return true if and only if there are other object in this iterator
|
||||||
|
virtual bool more() { return _beg != _end; }
|
||||||
|
|
||||||
|
/// Return the current object and step to the next one
|
||||||
|
virtual VALUE next() { return static_cast<VALUE>( *_beg++ ); }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// useful specifications
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class SMDS_MeshElement;
|
||||||
|
class SMDS_MeshNode;
|
||||||
|
|
||||||
|
typedef const SMDS_MeshElement* SMDS_pElement;
|
||||||
|
typedef const SMDS_MeshNode* SMDS_pNode;
|
||||||
|
|
||||||
|
// element iterators
|
||||||
|
|
||||||
|
typedef SMDS_SetIterator< SMDS_pElement, std::vector< SMDS_pElement >::const_iterator>
|
||||||
|
SMDS_ElementVectorIterator;
|
||||||
|
|
||||||
|
|
||||||
|
typedef SMDS_SetIterator< SMDS_pElement, SMDS_pElement const *>
|
||||||
|
SMDS_ElementArrayIterator;
|
||||||
|
|
||||||
|
|
||||||
|
typedef SMDS_SetIterator< SMDS_pElement, std::vector< SMDS_pNode >::const_iterator>
|
||||||
|
SMDS_NodeVectorElemIterator;
|
||||||
|
|
||||||
|
|
||||||
|
typedef SMDS_SetIterator< SMDS_pElement, SMDS_pNode const * >
|
||||||
|
SMDS_NodeArrayElemIterator;
|
||||||
|
|
||||||
|
// node iterators
|
||||||
|
|
||||||
|
typedef SMDS_SetIterator< SMDS_pNode, std::vector< SMDS_pNode >::const_iterator >
|
||||||
|
SMDS_NodeVectorIterator;
|
||||||
|
|
||||||
|
|
||||||
|
typedef SMDS_SetIterator< SMDS_pNode, SMDS_pNode const * >
|
||||||
|
SMDS_NodeArrayIterator;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "SMDS_VolumeOfNodes.hxx"
|
#include "SMDS_VolumeOfNodes.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -170,29 +171,14 @@ int SMDS_VolumeOfNodes::NbEdges() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
|
class SMDS_VolumeOfNodes_MyIterator:public SMDS_NodeArrayElemIterator
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* const* mySet;
|
|
||||||
int myLength;
|
|
||||||
int index;
|
|
||||||
public:
|
public:
|
||||||
SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
|
SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
|
||||||
mySet(s),myLength(l),index(0) {}
|
SMDS_NodeArrayElemIterator( s, & s[ l ]) {}
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return index<myLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
return mySet[index-1];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
|
SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::elementsIterator(SMDSAbs_ElementType type) const
|
||||||
elementsIterator(SMDSAbs_ElementType type) const
|
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
@ -210,3 +196,15 @@ SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
|
|||||||
{
|
{
|
||||||
return SMDSAbs_Volume;
|
return SMDSAbs_Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_VolumeOfNodes::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ WrappedIndex( ind )];
|
||||||
|
}
|
||||||
|
@ -70,6 +70,16 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
|
|||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*
|
||||||
|
* Index is wrapped if it is out of a valid range
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user