//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
#include "SMDS_FaceOfEdges.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
int SMDS_FaceOfEdges::NbEdges() const
{
- return myEdges.size();
+ return myNbEdges;
}
int SMDS_FaceOfEdges::NbFaces() const
return SMDSAbs_Face;
}
+//=======================================================================
+//function : elementsIterator
+//purpose :
+//=======================================================================
+
class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
{
- const vector<const SMDS_MeshEdge*>& mySet;
+ const SMDS_MeshEdge* const *mySet;
+ int myLength;
int index;
public:
- SMDS_FaceOfEdges_MyIterator(const vector<const SMDS_MeshEdge*>& s):
- mySet(s),index(0) {}
+ SMDS_FaceOfEdges_MyIterator(const SMDS_MeshEdge* const *s, int l):
+ mySet(s),myLength(l),index(0) {}
bool more()
{
- return index<mySet.size();
+ return index<myLength;
}
const SMDS_MeshElement* next()
return mySet[index-1];
}
};
-SMDS_ElemIteratorPtr SMDS_FaceOfEdges::
- elementsIterator(SMDSAbs_ElementType type) const
+
+SMDS_ElemIteratorPtr SMDS_FaceOfEdges::elementsIterator
+ (SMDSAbs_ElementType type) const
{
- switch(type)
- {
- case SMDSAbs_Face:
- return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
- case SMDSAbs_Edge:
- return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges));
- default:
- return SMDS_ElemIteratorPtr
- (new SMDS_IteratorOfElements
- (this,type, SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges))));
- }
+ switch(type)
+ {
+ case SMDSAbs_Face:
+ return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
+ case SMDSAbs_Edge:
+ return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges));
+ default:
+ return SMDS_ElemIteratorPtr
+ (new SMDS_IteratorOfElements
+ (this,type, SMDS_ElemIteratorPtr
+ (new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges))));
+ }
}
SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3)
{
- myEdges.resize(3);
+ myNbEdges = 3;
myEdges[0]=edge1;
myEdges[1]=edge2;
myEdges[2]=edge3;
+ myEdges[3]=0;
}
SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
const SMDS_MeshEdge* edge3,
const SMDS_MeshEdge* edge4)
{
- myEdges.resize(4);
+ myNbEdges = 4;
myEdges[0]=edge1;
myEdges[1]=edge2;
myEdges[2]=edge3;
elementsIterator(SMDSAbs_ElementType type) const;
private:
- std::vector<const SMDS_MeshEdge*> myEdges;
+ const SMDS_MeshEdge* myEdges[4];
+ int myNbEdges;
};
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
#include "SMDS_FaceOfNodes.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
int SMDS_FaceOfNodes::NbNodes() const
{
- return myNodes.size();
+ return myNbNodes;
}
+
//=======================================================================
//function : Print
//purpose :
OS << myNodes[i] << ") " << endl;
}
+//=======================================================================
+//function : elementsIterator
+//purpose :
+//=======================================================================
+
class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
{
- const vector<const SMDS_MeshNode*>& mySet;
+ const SMDS_MeshNode* const *mySet;
+ int myLength;
int index;
public:
- SMDS_FaceOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
- mySet(s),index(0) {}
+ SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
+ mySet(s),myLength(l),index(0) {}
bool more()
{
- return index<mySet.size();
+ return index<myLength;
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
- }
+ }
};
-SMDS_ElemIteratorPtr SMDS_FaceOfNodes::
- elementsIterator(SMDSAbs_ElementType type) const
+
+SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
+ (SMDSAbs_ElementType type) const
{
switch(type)
{
case SMDSAbs_Face:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Node:
- return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes));
+ return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes,myNbNodes));
case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
break;
default:
return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements
- (this,type,SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes))));
+ (this,type,SMDS_ElemIteratorPtr
+ (new SMDS_FaceOfNodes_MyIterator(myNodes,myNbNodes))));
}
return SMDS_ElemIteratorPtr();
}
const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3)
{
- myNodes.resize(3);
+ myNbNodes = 3;
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
+ myNodes[3]=0;
}
SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
const SMDS_MeshNode* node3,
const SMDS_MeshNode* node4)
{
- myNodes.resize(4);
+ myNbNodes = 4;
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
const int nbNodes)
{
- if (nbNodes == 3) {
- myNodes.resize(3);
- myNodes[0]=nodes[0];
- myNodes[1]=nodes[1];
- myNodes[2]=nodes[2];
- }
- else if ( nbNodes == 4) {
- myNodes.resize(4);
- myNodes[0]=nodes[0];
- myNodes[1]=nodes[1];
- myNodes[2]=nodes[2];
+ myNbNodes = nbNodes;
+ myNodes[0]=nodes[0];
+ myNodes[1]=nodes[1];
+ myNodes[2]=nodes[2];
+ if (nbNodes == 4)
myNodes[3]=nodes[3];
- }
- else
+ else if (nbNodes != 3)
return false;
return true;
elementsIterator(SMDSAbs_ElementType type) const;
private:
- std::vector<const SMDS_MeshNode*> myNodes;
+ const SMDS_MeshNode* myNodes[4];
+ int myNbNodes;
};
// Author : Jean-Michel BOULCOURT
// Module : SMESH
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
#include "SMDS_VolumeOfFaces.hxx"
#include "SMDS_IteratorOfElements.hxx"
{
OS << "volume <" << GetID() << "> : ";
int i;
- for (i = 0; i < myFaces.size()-1; ++i) OS << myFaces[i] << ",";
+ for (i = 0; i < NbFaces()-1; ++i) OS << myFaces[i] << ",";
OS << myFaces[i]<< ") " << endl;
}
int SMDS_VolumeOfFaces::NbFaces() const
{
- return myFaces.size();
+ return myNbFaces;
}
class SMDS_VolumeOfFaces_MyIterator:public SMDS_ElemIterator
{
- const vector<const SMDS_MeshFace*>& mySet;
+ const SMDS_MeshFace* const *mySet;
+ int myLength;
int index;
public:
- SMDS_VolumeOfFaces_MyIterator(const vector<const SMDS_MeshFace*>& s):
- mySet(s),index(0) {}
+ SMDS_VolumeOfFaces_MyIterator(const SMDS_MeshFace* const *s, int l):
+ mySet(s),myLength(l),index(0) {}
bool more()
{
- return index<mySet.size();
+ return index<myLength;
}
const SMDS_MeshElement* next()
case SMDSAbs_Volume:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Face:
- return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces));
+ return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces,myNbFaces));
default:
return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements
- (this,type,SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces))));
+ (this,type,SMDS_ElemIteratorPtr
+ (new SMDS_VolumeOfFaces_MyIterator(myFaces,myNbFaces))));
}
}
const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4)
{
- myFaces.resize(4);
+ myNbFaces = 4;
myFaces[0]=face1;
myFaces[1]=face2;
myFaces[2]=face3;
myFaces[3]=face4;
+ myFaces[4]=0;
+ myFaces[5]=0;
}
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5)
{
- myFaces.resize(5);
+ myNbFaces = 5;
myFaces[0]=face1;
myFaces[1]=face2;
myFaces[2]=face3;
myFaces[3]=face4;
myFaces[4]=face5;
+ myFaces[5]=0;
}
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6)
{
- myFaces.resize(6);
+ myNbFaces = 6;
myFaces[0]=face1;
myFaces[1]=face2;
myFaces[2]=face3;
#include "SMDS_MeshVolume.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_Iterator.hxx"
-#include <vector>
#include <iostream>
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
- std::vector<const SMDS_MeshFace *> myFaces;
+ const SMDS_MeshFace * myFaces[6];
+ int myNbFaces;
};
#endif
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
#include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
const SMDS_MeshNode * node7,
const SMDS_MeshNode * node8)
{
- myNodes.resize(8);
+ myNbNodes = 8;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4)
{
- myNodes.resize(4);
+ myNbNodes = 4;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5)
{
- myNodes.resize(5);
+ myNbNodes = 5;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6)
{
- myNodes.resize(6);
+ myNbNodes = 6;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[4]=node5;
myNodes[5]=node6;
}
+
bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
const int nbNodes)
{
if (nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
return false;
- myNodes.resize( nbNodes );
+ delete [] myNodes;
+ myNbNodes = nbNodes;
+ myNodes = new const SMDS_MeshNode* [myNbNodes];
for ( int i = 0; i < nbNodes; i++ )
myNodes[ i ] = nodes [ i ];
return true;
}
+
+SMDS_VolumeOfNodes::~SMDS_VolumeOfNodes()
+{
+ if (myNodes != NULL) {
+ delete [] myNodes;
+ myNodes = NULL;
+ }
+}
+
//=======================================================================
//function : Print
//purpose :
int SMDS_VolumeOfNodes::NbNodes() const
{
- return myNodes.size();
+ return myNbNodes;
}
int SMDS_VolumeOfNodes::NbEdges() const
class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
{
- const vector<const SMDS_MeshNode*>& mySet;
+ const SMDS_MeshNode* const* mySet;
+ int myLength;
int index;
public:
- SMDS_VolumeOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
- mySet(s),index(0) {}
+ SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
+ mySet(s),myLength(l),index(0) {}
bool more()
{
- return index<mySet.size();
+ return index<myLength;
}
const SMDS_MeshElement* next()
case SMDSAbs_Volume:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Node:
- return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes));
+ return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes,myNbNodes));
default:
MESSAGE("ERROR : Iterator not implemented");
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
#define _SMDS_VolumeOfNodes_HeaderFile
#include "SMDS_MeshVolume.hxx"
-#include <vector>
class SMDS_VolumeOfNodes:public SMDS_MeshVolume
const SMDS_MeshNode * node8);
bool ChangeNodes(const SMDS_MeshNode* nodes[],
const int nbNodes);
+ ~SMDS_VolumeOfNodes();
void Print(std::ostream & OS) const;
int NbFaces() const;
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
- std::vector<const SMDS_MeshNode *> myNodes;
+ const SMDS_MeshNode** myNodes;
+ int myNbNodes;
};
#endif