mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
Add HexahedronOfNodes and Tria3OfNodes to improve performance
This commit is contained in:
parent
aa64a62c43
commit
e0b529896b
@ -56,7 +56,9 @@ LIB_SRC = \
|
||||
SMDS_VolumeOfFaces.cxx \
|
||||
SMDS_VolumeOfNodes.cxx \
|
||||
SMDS_FaceOfEdges.cxx \
|
||||
SMDS_FaceOfNodes.cxx
|
||||
SMDS_FaceOfNodes.cxx \
|
||||
SMDS_Tria3OfNodes.cxx \
|
||||
SMDS_HexahedronOfNodes.cxx
|
||||
|
||||
#SMDSControl_BoundaryEdges.cxx \
|
||||
#SMDSControl_BoundaryFaces.cxx \
|
||||
@ -104,7 +106,9 @@ EXPORT_HEADERS= \
|
||||
SMDS_VolumeOfFaces.hxx \
|
||||
SMDS_VolumeOfNodes.hxx \
|
||||
SMDS_FaceOfEdges.hxx \
|
||||
SMDS_FaceOfNodes.hxx
|
||||
SMDS_FaceOfNodes.hxx \
|
||||
SMDS_Tria3OfNodes.hxx \
|
||||
SMDS_HexahedronOfNodes.hxx
|
||||
|
||||
#SMDSControl_BoundaryEdges.hxx \
|
||||
#SMDSControl_BoundaryFaces.hxx \
|
||||
|
95
src/SMDS/SMDS_HexahedronOfNodes.cxx
Normal file
95
src/SMDS/SMDS_HexahedronOfNodes.cxx
Normal file
@ -0,0 +1,95 @@
|
||||
// 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_HexahedronOfNodes.hxx"
|
||||
#include "SMDS_IteratorOfArray.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_HexahedronOfNodes::SMDS_HexahedronOfNodes(
|
||||
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_HexahedronOfNodes::Print(ostream & OS) const
|
||||
{
|
||||
OS << "volume <" << GetID() << "> : ";
|
||||
int i;
|
||||
for (i = 0; i < 7; ++i) OS << myNodes[i] << ",";
|
||||
OS << myNodes[7]<< ") " << endl;
|
||||
}
|
||||
|
||||
int SMDS_HexahedronOfNodes::NbFaces() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
int SMDS_HexahedronOfNodes::NbNodes() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
int SMDS_HexahedronOfNodes::NbEdges() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_HexahedronOfNodes::
|
||||
elementsIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case SMDSAbs_Volume:
|
||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
|
||||
case SMDSAbs_Node:
|
||||
return new SMDS_IteratorOfArray<const SMDS_MeshElement *, 8,
|
||||
const SMDS_MeshNode*>(myNodes);
|
||||
default: MESSAGE("ERROR : Iterator not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
SMDSAbs_ElementType SMDS_HexahedronOfNodes::GetType() const
|
||||
{
|
||||
return SMDSAbs_Volume;
|
||||
}
|
58
src/SMDS/SMDS_HexahedronOfNodes.hxx
Normal file
58
src/SMDS/SMDS_HexahedronOfNodes.hxx
Normal file
@ -0,0 +1,58 @@
|
||||
// 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_HexahedronOfNodes_HeaderFile
|
||||
#define _SMDS_HexahedronOfNodes_HeaderFile
|
||||
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
class SMDS_HexahedronOfNodes:public SMDS_MeshVolume
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_HexahedronOfNodes(
|
||||
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;
|
||||
const SMDS_MeshNode * myNodes[8];
|
||||
};
|
||||
#endif
|
@ -24,6 +24,8 @@
|
||||
#include "SMDS_VolumeOfNodes.hxx"
|
||||
#include "SMDS_VolumeOfFaces.hxx"
|
||||
#include "SMDS_FaceOfNodes.hxx"
|
||||
#include "SMDS_Tria3OfNodes.hxx"
|
||||
#include "SMDS_HexahedronOfNodes.hxx"
|
||||
#include "SMDS_FaceOfEdges.hxx"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -593,10 +595,10 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, int idnode2,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///Create a new prism and add it to the mesh.
|
||||
///Create a new hexahedron and add it to the mesh.
|
||||
///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
|
||||
///@param ID The ID of the new volume
|
||||
///@return The created prism or NULL if an edge with this ID already exists
|
||||
///@return The created prism or NULL if an hexadron with this ID already exists
|
||||
///or if input nodes are not found.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -638,7 +640,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(
|
||||
}
|
||||
else
|
||||
{
|
||||
volume=new SMDS_VolumeOfNodes(node1,node2,node3,node4,node5,node6,
|
||||
volume=new SMDS_HexahedronOfNodes(node1,node2,node3,node4,node5,node6,
|
||||
node7,node8);
|
||||
myVolumes.insert(volume);
|
||||
}
|
||||
@ -690,7 +692,7 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(SMDS_MeshNode * node1,
|
||||
}
|
||||
else
|
||||
{
|
||||
SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3);
|
||||
SMDS_MeshFace * face = new SMDS_Tria3OfNodes(node1,node2,node3);
|
||||
myFaces.insert(face);
|
||||
return face;
|
||||
}
|
||||
|
101
src/SMDS/SMDS_Tria3OfNodes.cxx
Normal file
101
src/SMDS/SMDS_Tria3OfNodes.cxx
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
|
||||
|
||||
#include "SMDS_Tria3OfNodes.hxx"
|
||||
#include "SMDS_IteratorOfElements.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMDS_Tria3OfNodes::NbEdges() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
int SMDS_Tria3OfNodes::NbFaces() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
int SMDS_Tria3OfNodes::NbNodes() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMDS_Tria3OfNodes::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_Tria3OfNodes::
|
||||
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<3;
|
||||
}
|
||||
|
||||
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_Tria3OfNodes::SMDS_Tria3OfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
|
||||
SMDS_MeshNode* node3)
|
||||
{
|
||||
myNodes[0]=node1;
|
||||
myNodes[1]=node2;
|
||||
myNodes[2]=node3;
|
||||
}
|
||||
|
||||
|
49
src/SMDS/SMDS_Tria3OfNodes.hxx
Normal file
49
src/SMDS/SMDS_Tria3OfNodes.hxx
Normal file
@ -0,0 +1,49 @@
|
||||
// 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_Tria3OfNodes_HeaderFile
|
||||
#define _SMDS_Tria3OfNodes_HeaderFile
|
||||
|
||||
#include <ostream>
|
||||
#include "SMDS_MeshFace.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_Iterator.hxx"
|
||||
|
||||
class SMDS_Tria3OfNodes:public SMDS_MeshFace
|
||||
{
|
||||
public:
|
||||
void Print(ostream & OS) const;
|
||||
SMDS_Tria3OfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
|
||||
SMDS_MeshNode* node3);
|
||||
|
||||
int NbEdges() const;
|
||||
int NbFaces() const;
|
||||
int NbNodes() const;
|
||||
protected:
|
||||
SMDS_Iterator<const SMDS_MeshElement *> *
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
const SMDS_MeshNode* myNodes[3];
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user