From 8f66923fb0cddac793068917f899d3b0b840dc07 Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 18 Dec 2009 15:26:39 +0000 Subject: [PATCH] PR: temporary --- src/SMDS/Notes | 20 ++++-- src/SMDS/SMDS_VolumeOfNodes.cxx | 113 ++++++++++++++++++++++++++++---- src/SMDS/SMDS_VolumeOfNodes.hxx | 34 +++++++++- src/SMESH/SMESH_Gen.cxx | 11 ++++ src/SMESHDS/SMESHDS_SubMesh.cxx | 15 +++++ src/SMESHDS/SMESHDS_SubMesh.hxx | 1 + 6 files changed, 177 insertions(+), 17 deletions(-) diff --git a/src/SMDS/Notes b/src/SMDS/Notes index ec76f9ae5..3107b51f3 100644 --- a/src/SMDS/Notes +++ b/src/SMDS/Notes @@ -8,7 +8,7 @@ n'utiliser que vtkUnstructuredGrid, ne pas avor d'objets SMDS_MeshElement mais s ==> en dernier ressort, lourd ================================================================================ -Essai a API SMDS a peu près constante +Essai a API SMDS a peu pres constante ===================================== SMDS_Mesh @@ -36,14 +36,21 @@ SMDS_MeshCell: SMDS_MeshElement --> generique pour tous les elements SMDS_MeshVolume: SMDS_MeshCell -SMDS_VolumeOfNodes: SMDS_MeshVolume - const SMDS_MeshNode **myNodes; --> A SUPPRIMER, utiliser myID - int myNbNodes; --> A SUPPRIMER +SMDS_VolumeOfNodes: SMDS_MeshVolume --> Garder temporairement, utilisation dans StdMesher et SMDS_VolumeTool + const SMDS_MeshNode **myNodes; --> Couteux + int myNbNodes; --> "" + +SMDS_VolumeVtkNodes: SMDS_MeshVolume --> Utiliser systematiquement dans SMDS, + --> IMPLEMENTER. + SMDS_MeshElementIDFactory: SMDS_MeshNodeIDFactory vector myIDElements; // index = ID client, value = ID vtk --> A SUPPRIMER, ne sert que dans SMDS_MeshElementIDFactory vector myVtkIndex; // index = ID vtk, value = ID client --> A REPORTER dans SMDS_Mesh + + + ========= TODO ============ enlever vtkId de SMDS_MeshCell, utiliser SMDS_MeshElementIDFactory. @@ -60,3 +67,8 @@ in use bytes = 32843200 /home/prascle/projets/SALOME/SMESH/BR_SMDS_MEMIMP/SMESH_SRC/src/SMESH/SMESH_Gen.cxx [294] : VSR - SMESH_Gen::Compute() finished, OK = 1 in use bytes = 498773760 delta = 460 Mo (45 Mo de plus que sur Sarge 64 bits ?) + +Debian Sarge 64 bits +in use bytes = 17076352 +in use bytes = 431600032 +delta = 415 Mo diff --git a/src/SMDS/SMDS_VolumeOfNodes.cxx b/src/SMDS/SMDS_VolumeOfNodes.cxx index 73b61ca3f..b44bae07c 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.cxx +++ b/src/SMDS/SMDS_VolumeOfNodes.cxx @@ -132,11 +132,6 @@ SMDS_VolumeOfNodes::~SMDS_VolumeOfNodes() } } -//======================================================================= -//function : Print -//purpose : -//======================================================================= - void SMDS_VolumeOfNodes::Print(ostream & OS) const { OS << "volume <" << GetID() << "> : "; @@ -176,12 +171,9 @@ int SMDS_VolumeOfNodes::NbEdges() const return 0; } -/// =================================================================== /*! * \brief Iterator on node of volume */ -/// =================================================================== - class SMDS_VolumeOfNodes_MyIterator:public SMDS_NodeArrayElemIterator { public: @@ -189,12 +181,9 @@ class SMDS_VolumeOfNodes_MyIterator:public SMDS_NodeArrayElemIterator SMDS_NodeArrayElemIterator( s, & s[ l ]) {} }; -/// =================================================================== /*! * \brief Iterator on faces or edges of volume */ -/// =================================================================== - class _MySubIterator : public SMDS_ElemIterator { vector< const SMDS_MeshElement* > myElems; @@ -260,3 +249,105 @@ SMDSAbs_EntityType SMDS_VolumeOfNodes::GetEntityType() const } return aType; } + + +// ************************************************************************************* +// + +SMDS_VolumeVtkNodes::SMDS_VolumeVtkNodes() +{ +} + +bool SMDS_VolumeVtkNodes::ChangeNodes(const SMDS_MeshNode* nodes[], + const int nbNodes) +{ + // utilise dans SMDS_Mesh + return true; +} + +SMDS_VolumeVtkNodes::~SMDS_VolumeVtkNodes() +{ +} + +void SMDS_VolumeVtkNodes::Print(ostream & OS) const +{ + OS << "volume <" << GetID() << "> : "; +} + +int SMDS_VolumeVtkNodes::NbFaces() const +{ + switch(NbNodes()) + { + case 4: return 4; + case 5: return 5; + case 6: return 5; + case 8: return 6; + default: MESSAGE("invalid number of nodes"); + } + return 0; +} + +int SMDS_VolumeVtkNodes::NbNodes() const +{ + return 0; +} + +int SMDS_VolumeVtkNodes::NbEdges() const +{ + switch(NbNodes()) + { + case 4: return 6; + case 5: return 8; + case 6: return 9; + case 8: return 12; + default: MESSAGE("invalid number of nodes"); + } + return 0; +} + +SMDS_ElemIteratorPtr SMDS_VolumeVtkNodes::elementsIterator(SMDSAbs_ElementType type) const +{ + switch(type) + { +// case SMDSAbs_Volume: +// return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume); +// case SMDSAbs_Node: +// return SMDS_ElemIteratorPtr(new SMDS_VolumeVtkNodes_MyIterator(myNodes,myNbNodes)); +// case SMDSAbs_Face: +// return SMDS_ElemIteratorPtr(new _MySubWNIterator(this,SMDSAbs_Face)); +// case SMDSAbs_Edge: +// return SMDS_ElemIteratorPtr(new _MySubWNIterator(this,SMDSAbs_Edge)); + default: + MESSAGE("ERROR : Iterator not implemented"); + return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL); + } +} + +SMDSAbs_ElementType SMDS_VolumeVtkNodes::GetType() const +{ + return SMDSAbs_Volume; +} + +/*! + * \brief Return node by its index + * \param ind - node index + * \retval const SMDS_MeshNode* - the node + */ +const SMDS_MeshNode* SMDS_VolumeVtkNodes::GetNode(const int ind) const +{ + return 0; +} + +SMDSAbs_EntityType SMDS_VolumeVtkNodes::GetEntityType() const +{ + SMDSAbs_EntityType aType = SMDSEntity_Tetra; + switch(NbNodes()) + { + case 4: aType = SMDSEntity_Tetra; break; + case 5: aType = SMDSEntity_Pyramid; break; + case 6: aType = SMDSEntity_Penta; break; + case 8: + default: aType = SMDSEntity_Hexa; break; + } + return aType; +} diff --git a/src/SMDS/SMDS_VolumeOfNodes.hxx b/src/SMDS/SMDS_VolumeOfNodes.hxx index ac62041f5..9c2aa7129 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.hxx +++ b/src/SMDS/SMDS_VolumeOfNodes.hxx @@ -82,7 +82,37 @@ class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume protected: SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; - const SMDS_MeshNode** myNodes; - int myNbNodes; + const SMDS_MeshNode** myNodes; + int myNbNodes; + +}; + +class SMDS_EXPORT SMDS_VolumeVtkNodes:public SMDS_MeshVolume +{ +public: + SMDS_VolumeVtkNodes(); + bool ChangeNodes(const SMDS_MeshNode* nodes[], + const int nbNodes); + ~SMDS_VolumeVtkNodes(); + + void Print(std::ostream & OS) const; + int NbFaces() const; + int NbNodes() const; + int NbEdges() const; + virtual SMDSAbs_ElementType GetType() const; + virtual SMDSAbs_EntityType GetEntityType() const; + + /*! + * \brief Return node by its index + * \param ind - node index + * \retval const SMDS_MeshNode* - the node + */ + virtual const SMDS_MeshNode* GetNode(const int ind) const; + + protected: + SMDS_ElemIteratorPtr + elementsIterator(SMDSAbs_ElementType type) const; }; + + #endif diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 92f5b3f6b..742a6ae62 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -293,6 +293,17 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret); MEMOSTAT; + + SMESHDS_Mesh *myMesh = aMesh.GetMeshDS(); + list listind = myMesh->SubMeshIndices(); + list::iterator it = listind.begin(); + int total = 0; + for(; it != listind.end(); ++it) + { + ::SMESHDS_SubMesh *subMesh = myMesh->MeshElements(*it); + total += subMesh->getSize(); + } + cerr << "total elements and nodes in submesh sets:" << total << endl; return ret; } diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx index 0013e54e1..146df73d1 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.cxx +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -29,6 +29,7 @@ #include "utilities.h" #include "SMDS_SetIterator.hxx" +#include using namespace std; @@ -321,3 +322,17 @@ void SMESHDS_SubMesh::Clear() sm->Clear(); } } + +int SMESHDS_SubMesh::getSize() +{ + int a = sizeof(myElements); + int b = sizeof(myNodes); + int c = NbNodes(); + int d = NbElements(); + cerr << "SMESHDS_SubMesh::NbNodes " << c << endl; + cerr << "SMESHDS_SubMesh::NbElements " << d << endl; + cerr << "SMESHDS_SubMesh::myNodes " << b << endl; + cerr << "SMESHDS_SubMesh::myElements " << a << endl; + return c+d; +} + diff --git a/src/SMESHDS/SMESHDS_SubMesh.hxx b/src/SMESHDS/SMESHDS_SubMesh.hxx index 0b18640f6..df5c32619 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.hxx +++ b/src/SMESHDS/SMESHDS_SubMesh.hxx @@ -63,6 +63,7 @@ class SMESHDS_EXPORT SMESHDS_SubMesh // clear the contents void Clear(); + int getSize(); private: -- 2.39.2