Add needed class for the new DS

This commit is contained in:
jrt 2003-09-03 17:09:43 +00:00
parent e7d23aeebf
commit 8d51808a8f
8 changed files with 719 additions and 0 deletions

View File

@ -0,0 +1,135 @@
// 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
#include "SMDS_FaceOfEdges.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
//=======================================================================
//function : NbEdges
//purpose :
//=======================================================================
int SMDS_FaceOfEdges::NbEdges() const
{
return myEdges.size();
}
int SMDS_FaceOfEdges::NbFaces() const
{
return 1;
}
//=======================================================================
//function : Print
//purpose :
//=======================================================================
void SMDS_FaceOfEdges::Print(ostream & OS) const
{
OS << "face <" << GetID() << " > : ";
int i;
for (i = 0; i < NbEdges() - 1; i++) OS << myEdges[i] << ",";
OS << myEdges[i] << ") " << endl;
}
SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
{
return SMDSAbs_Face;
}
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_FaceOfEdges::
elementsIterator(SMDSAbs_ElementType type) const
{
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
{
const vector<const SMDS_MeshEdge*>& mySet;
int index;
public:
MyIterator(const vector<const SMDS_MeshEdge*>& s):mySet(s),index(0)
{}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Edge:return new MyIterator(myEdges);
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myEdges));
}
}
SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
SMDS_MeshEdge* edge3)
{
myEdges.resize(3);
myEdges[0]=edge1;
myEdges[1]=edge2;
myEdges[2]=edge3;
}
SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
SMDS_MeshEdge* edge3, SMDS_MeshEdge* edge4)
{
myEdges.resize(4);
myEdges[0]=edge1;
myEdges[1]=edge2;
myEdges[2]=edge3;
myEdges[3]=edge4;
}
/*bool operator<(const SMDS_FaceOfEdges& f1, const SMDS_FaceOfEdges& f2)
{
set<SMDS_MeshNode> set1,set2;
SMDS_Iterator<const SMDS_MeshElement*> * it;
const SMDS_MeshNode * n;
it=f1.nodesIterator();
while(it->more())
{
n=static_cast<const SMDS_MeshNode *>(it->next());
set1.insert(*n);
}
delete it;
it=f2.nodesIterator();
while(it->more())
{
n=static_cast<const SMDS_MeshNode *>(it->next());
set2.insert(*n);
}
delete it;
return set1<set2;
}*/

View File

@ -0,0 +1,53 @@
// 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
#ifndef _SMDS_FaceOfEdges_HeaderFile
#define _SMDS_FaceOfEdges_HeaderFile
#include <ostream>
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_Iterator.hxx"
class SMDS_FaceOfEdges:public SMDS_MeshFace
{
public:
void Print(ostream & OS) const;
SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
SMDS_MeshEdge* edge3);
SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
SMDS_MeshEdge* edge3, SMDS_MeshEdge* edge4);
SMDSAbs_ElementType GetType() const;
int NbEdges() const;
int NbFaces() const;
// friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2);
protected:
SMDS_Iterator<const SMDS_MeshElement *> *
elementsIterator(SMDSAbs_ElementType type) const;
private:
vector<const SMDS_MeshEdge*> myEdges;
};
#endif

View File

@ -0,0 +1,139 @@
// 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
#include "SMDS_FaceOfNodes.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
//=======================================================================
//function : NbEdges
//purpose :
//=======================================================================
int SMDS_FaceOfNodes::NbEdges() const
{
return NbNodes();
}
int SMDS_FaceOfNodes::NbFaces() const
{
return 1;
}
int SMDS_FaceOfNodes::NbNodes() const
{
return myNodes.size();
}
//=======================================================================
//function : Print
//purpose :
//=======================================================================
void SMDS_FaceOfNodes::Print(ostream & OS) const
{
OS << "face <" << GetID() << " > : ";
int i;
for (i = 0; i < NbNodes() - 1; i++) OS << myNodes[i] << ",";
OS << myNodes[i] << ") " << endl;
}
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_FaceOfNodes::
elementsIterator(SMDSAbs_ElementType type) const
{
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
{
const vector<const SMDS_MeshNode*>& mySet;
int index;
public:
MyIterator(const vector<const SMDS_MeshNode*>& s):mySet(s),index(0)
{}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Node:return new MyIterator(myNodes);
case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
break;
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myNodes));
}
}
SMDS_FaceOfNodes::SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
SMDS_MeshNode* node3)
{
myNodes.resize(3);
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
}
SMDS_FaceOfNodes::SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
SMDS_MeshNode* node3, SMDS_MeshNode* node4)
{
myNodes.resize(4);
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
}
/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
{
set<SMDS_MeshNode> set1,set2;
SMDS_Iterator<const SMDS_MeshElement*> * it;
const SMDS_MeshNode * n;
it=f1.nodesIterator();
while(it->more())
{
n=static_cast<const SMDS_MeshNode *>(it->next());
set1.insert(*n);
}
delete it;
it=f2.nodesIterator();
while(it->more())
{
n=static_cast<const SMDS_MeshNode *>(it->next());
set2.insert(*n);
}
delete it;
return set1<set2;
}*/

View File

@ -0,0 +1,51 @@
// 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
#ifndef _SMDS_FaceOfNodes_HeaderFile
#define _SMDS_FaceOfNodes_HeaderFile
#include <ostream>
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_Iterator.hxx"
class SMDS_FaceOfNodes:public SMDS_MeshFace
{
public:
void Print(ostream & OS) const;
SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
SMDS_MeshNode* node3);
SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
SMDS_MeshNode* node3, SMDS_MeshNode* node4);
int NbEdges() const;
int NbFaces() const;
int NbNodes() const;
protected:
SMDS_Iterator<const SMDS_MeshElement *> *
elementsIterator(SMDSAbs_ElementType type) const;
private:
vector<const SMDS_MeshNode*> myNodes;
};
#endif

View File

@ -0,0 +1,114 @@
// 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_MeshVolume.cxx
// Author : Jean-Michel BOULCOURT
// Module : SMESH
#include "SMDS_VolumeOfFaces.hxx"
#include "SMDS_IteratorOfElements.hxx"
//=======================================================================
//function : Print
//purpose :
//=======================================================================
void SMDS_VolumeOfFaces::Print(ostream & OS) const
{
OS << "volume <" << GetID() << "> : ";
int i;
for (i = 0; i < myFaces.size()-1; ++i) OS << myFaces[i] << ",";
OS << myFaces[i]<< ") " << endl;
}
int SMDS_VolumeOfFaces::NbFaces() const
{
return myFaces.size();
}
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_VolumeOfFaces::
elementsIterator(SMDSAbs_ElementType type) const
{
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
{
const vector<SMDS_MeshFace*>& mySet;
int index;
public:
MyIterator(const vector<SMDS_MeshFace*>& s):mySet(s),index(0)
{}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Volume:return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Face:return new MyIterator(myFaces);
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myFaces));
}
}
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4)
{
myFaces.resize(4);
myFaces[0]=face1;
myFaces[1]=face2;
myFaces[2]=face3;
myFaces[3]=face4;
}
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4,
SMDS_MeshFace * face5)
{
myFaces.resize(5);
myFaces[0]=face1;
myFaces[1]=face2;
myFaces[2]=face3;
myFaces[3]=face4;
myFaces[4]=face5;
}
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4,
SMDS_MeshFace * face5,SMDS_MeshFace * face6)
{
myFaces.resize(6);
myFaces[0]=face1;
myFaces[1]=face2;
myFaces[2]=face3;
myFaces[3]=face4;
myFaces[4]=face5;
myFaces[5]=face6;
}

View File

@ -0,0 +1,59 @@
// 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_MeshVolume.hxx
// Module : SMESH
#ifndef _SMDS_VolumeOfFaces_HeaderFile
#define _SMDS_VolumeOfFaces_HeaderFile
#include "SMDS_MeshVolume.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_Iterator.hxx"
#include <vector>
#include <ostream>
using namespace std;
class SMDS_VolumeOfFaces:public SMDS_MeshVolume
{
public:
SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4);
SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4,
SMDS_MeshFace * face5);
SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4,
SMDS_MeshFace * face5,SMDS_MeshFace * face6);
void Print(ostream & OS) const;
int NbFaces() const;
protected:
SMDS_Iterator<const SMDS_MeshElement *> *
elementsIterator(SMDSAbs_ElementType type) const;
vector<SMDS_MeshFace *> myFaces;
};
#endif

View File

@ -0,0 +1,112 @@
// 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
#include "utilities.h"
#include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_MeshNode.hxx"
///////////////////////////////////////////////////////////////////////////////
/// Create an hexahedron. node 1,2,3,4 and 5,6,7,8 are quadrangle and
/// 5,1 and 7,3 are an edges.
///////////////////////////////////////////////////////////////////////////////
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
SMDS_MeshNode * node1,
SMDS_MeshNode * node2,
SMDS_MeshNode * node3,
SMDS_MeshNode * node4,
SMDS_MeshNode * node5,
SMDS_MeshNode * node6,
SMDS_MeshNode * node7,
SMDS_MeshNode * node8)
{
myNodes[0]=node1;
myNodes[1]=node2;
myNodes[2]=node3;
myNodes[3]=node4;
myNodes[4]=node5;
myNodes[5]=node6;
myNodes[6]=node7;
myNodes[7]=node8;
}
//=======================================================================
//function : Print
//purpose :
//=======================================================================
void SMDS_VolumeOfNodes::Print(ostream & OS) const
{
OS << "volume <" << GetID() << "> : ";
int i;
for (i = 0; i < 7; ++i) OS << myNodes[i] << ",";
OS << myNodes[7]<< ") " << endl;
}
int SMDS_VolumeOfNodes::NbFaces() const
{
return 6;
}
int SMDS_VolumeOfNodes::NbNodes() const
{
return 8;
}
int SMDS_VolumeOfNodes::NbEdges() const
{
return 12;
}
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_VolumeOfNodes::
elementsIterator(SMDSAbs_ElementType type) const
{
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
{
const SMDS_MeshNode * const* mySet;
int index;
public:
MyIterator(const SMDS_MeshNode * const* s):mySet(s),index(0)
{}
bool more()
{
return index<8;
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Volume:return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Node:return new MyIterator(myNodes);
default: MESSAGE("ERROR : Iterator not implemented");
}
}
SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
{
return SMDSAbs_Volume;
}

View File

@ -0,0 +1,56 @@
// 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_MeshVolume.hxx
// Module : SMESH
#ifndef _SMDS_VolumeOfNodes_HeaderFile
#define _SMDS_VolumeOfNodes_HeaderFile
#include "SMDS_MeshVolume.hxx"
class SMDS_VolumeOfNodes:public SMDS_MeshVolume
{
public:
SMDS_VolumeOfNodes(
SMDS_MeshNode * node1,
SMDS_MeshNode * node2,
SMDS_MeshNode * node3,
SMDS_MeshNode * node4,
SMDS_MeshNode * node5,
SMDS_MeshNode * node6,
SMDS_MeshNode * node7,
SMDS_MeshNode * node8);
void Print(ostream & OS) const;
int NbFaces() const;
int NbNodes() const;
int NbEdges() const;
SMDSAbs_ElementType GetType() const;
protected:
SMDS_Iterator<const SMDS_MeshElement *> *
elementsIterator(SMDSAbs_ElementType type) const;
SMDS_MeshNode * myNodes[8];
};
#endif