max mmap regions = 58
max mmap bytes = 183640064
+sizeof(SMDS_MeshElement) 16
+sizeof(SMDS_MeshNode) 24
+sizeof(SMDS_MeshCell) 24
+sizeof(SMDS_VolumeVtkNodes) 24
+sizeof(SMDS_Position) 16
+sizeof(SMDS_SpacePosition) 16
+
+impact d'un int en plus dans SMDS_MeshElement --> 426 - 33 = 393M
+---------------------------------------------
+
+sizeof(SMDS_MeshElement) 24
+sizeof(SMDS_MeshNode) 32 --> on retrouve bien les 8M
+sizeof(SMDS_MeshCell) 24
+sizeof(SMDS_VolumeVtkNodes) 24
+sizeof(SMDS_Position) 16
+sizeof(SMDS_SpacePosition) 16
+
+Total (incl. mmap):
+system bytes = 43192320
+in use bytes = 32681088 : 33M
+max mmap regions = 41
+max mmap bytes = 16371712
+----
+Total (incl. mmap):
+system bytes = 429334528
+in use bytes = 426424576 : 426M
+max mmap regions = 59
+max mmap bytes = 184692736
#include "SMDS_QuadraticEdge.hxx"
#include "SMDS_QuadraticFaceOfNodes.hxx"
#include "SMDS_QuadraticVolumeOfNodes.hxx"
+#include "SMDS_SpacePosition.hxx"
#include <vtkUnstructuredGrid.h>
{
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
MESSAGE("myMeshId=" << myMeshId);
+ MESSAGE("sizeof(SMDS_MeshElement) " << sizeof(SMDS_MeshElement) );
+ MESSAGE("sizeof(SMDS_MeshNode) " << sizeof(SMDS_MeshNode) );
+ MESSAGE("sizeof(SMDS_MeshCell) " << sizeof(SMDS_MeshCell) );
+ MESSAGE("sizeof(SMDS_VolumeVtkNodes) " << sizeof(SMDS_VolumeVtkNodes) );
+ MESSAGE("sizeof(SMDS_Position) " << sizeof(SMDS_Position) );
+ MESSAGE("sizeof(SMDS_SpacePosition) " << sizeof(SMDS_SpacePosition) );
myNodeIDFactory->SetMesh(this);
myElementIDFactory->SetMesh(this);
_meshList.push_back(this);
int SMDS_MeshCell::nbCells = 0;
-SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(-1)
+SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(-1), myIdInShape(-1)
{
}
-SMDS_MeshElement::SMDS_MeshElement(int id, UShortType meshId, ShortType shapeId):
- myID(id), myMeshId(meshId), myShapeId(shapeId)
+SMDS_MeshElement::SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId):
+ myID(id), myMeshId(meshId), myShapeId(shapeId), myIdInShape(-1)
{
}
return -1;
}
-SMDS_MeshCell::SMDS_MeshCell()
+SMDS_MeshCell::SMDS_MeshCell() : SMDS_MeshElement(-1)
{
nbCells++;
myVtkID = -1;
SMDS_MeshCell::~SMDS_MeshCell()
{
nbCells--;
-}
\ No newline at end of file
+}
#include <vector>
#include <iostream>
-typedef unsigned short UShortType;
+//typedef unsigned short UShortType;
typedef short ShortType;
class SMDS_MeshNode;
int GetNodeIndex( const SMDS_MeshNode* node ) const;
inline int getId() const {return myID; };
- inline UShortType getMeshId() {return myMeshId; };
- inline ShortType getshapeId() {return myShapeId; };
- inline void setShapeId(UShortType shapeId) {myShapeId = shapeId; };
+ inline ShortType getMeshId() const {return myMeshId; };
+ inline ShortType getshapeId() const {return myShapeId; };
+ inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
+ inline int getIdInShape() const { return myIdInShape; };
+ inline void setIdInShape(int id) { myIdInShape = id; };
protected:
SMDS_MeshElement(int ID=-1);
- SMDS_MeshElement(int id, UShortType meshId, ShortType shapeId=-1);
+ SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId=-1);
virtual void Print(std::ostream & OS) const;
- int myID; // --- element index
+ //! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
+ int myID;
+
+ //! SMDS_Mesh identification in SMESH
ShortType myMeshId;
+
+ //! SubShape and SubMesh identification in SMESHDS (not in use?)
ShortType myShapeId;
+
+ //! Element index in SMESHDS_SubMesh vector
+ int myIdInShape;
};
// ============================================================
// $Header:
//
#include "SMESHDS_Script.hxx"
+#include <iostream>
using namespace std;
//=======================================================================
SMESHDS_Script::SMESHDS_Script(bool theIsEmbeddedMode):
myIsEmbeddedMode(theIsEmbeddedMode)
-{}
+{
+ cerr << "=========================== myIsEmbeddedMode " << myIsEmbeddedMode << endl;
+}
//=======================================================================
//function : Destructor
#include "utilities.h"
#include "SMDS_SetIterator.hxx"
#include <iostream>
+#include <cassert>
using namespace std;
+SMESHDS_SubMesh::SMESHDS_SubMesh()
+{
+ myElements.clear();
+ myNodes.clear();
+ myUnusedIdNodes = 0;
+ myUnusedIdElements = 0;
+}
+
//=======================================================================
//function : AddElement
//purpose :
void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
{
if ( !IsComplexSubmesh() )
- myElements.insert(ME);
+ {
+ int idInSubShape = ME->getIdInShape();
+ assert(idInSubShape == -1);
+ SMDS_MeshElement* elem = (SMDS_MeshElement*)(ME);
+ elem->setIdInShape(myElements.size());
+ myElements.push_back(ME);
+ }
}
//=======================================================================
//=======================================================================
bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted)
{
- if ( !IsComplexSubmesh() && NbElements() ) {
+// if ( !IsComplexSubmesh() && NbElements() ) {
if (!isElemDeleted) // alive element has valid ID and can be found
- return myElements.erase(ME);
-
- TElemSet::iterator e = myElements.begin(), eEnd = myElements.end();
- for ( ; e != eEnd; ++e )
- if ( ME == *e ) {
- myElements.erase( e );
+ {
+ int idInSubShape = ME->getIdInShape();
+ assert(idInSubShape >= 0);
+ assert(idInSubShape < myElements.size());
+ myElements[idInSubShape] = 0; // this vector entry is no more used
+ myUnusedIdElements++;
return true;
}
- }
+
+
+// --- strange ?
+// TElemSet::iterator e = myElements.begin(), eEnd = myElements.end();
+// for ( ; e != eEnd; ++e )
+// if ( ME == *e ) {
+// myElements.erase( e );
+// return true;
+// }
+// }
return false;
}
void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
{
if ( !IsComplexSubmesh() )
- myNodes.insert(N);
+ {
+ int idInSubShape = N->getIdInShape();
+ assert(idInSubShape == -1);
+ SMDS_MeshNode* node = (SMDS_MeshNode*)(N);
+ node->setIdInShape(myNodes.size());
+ myNodes.push_back(N);
+ }
}
//=======================================================================
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
{
- if ( !IsComplexSubmesh() && NbNodes() ) {
+// if ( !IsComplexSubmesh() && NbNodes() ) {
if (!isNodeDeleted) // alive node has valid ID and can be found
- return myNodes.erase(N);
-
- TElemSet::iterator e = myNodes.begin(), eEnd = myNodes.end();
- for ( ; e != eEnd; ++e )
- if ( N == *e ) {
- myNodes.erase( e );
+ {
+ int idInSubShape = N->getIdInShape();
+ assert(idInSubShape >= 0);
+ assert(idInSubShape < myNodes.size());
+ myNodes[idInSubShape] = 0; // this vector entry is no more used
+ myUnusedIdNodes++;
return true;
}
- }
+
+// --- strange ?
+// TElemSet::iterator e = myNodes.begin(), eEnd = myNodes.end();
+// for ( ; e != eEnd; ++e )
+// if ( N == *e ) {
+// myNodes.erase( e );
+// return true;
+// }
+// }
return false;
}
int SMESHDS_SubMesh::NbElements() const
{
if ( !IsComplexSubmesh() )
- return myElements.size();
+ return myElements.size() - myUnusedIdElements;
int nbElems = 0;
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
int SMESHDS_SubMesh::NbNodes() const
{
if ( !IsComplexSubmesh() )
- return myNodes.size();
+ return myNodes.size() - myUnusedIdNodes;
int nbElems = 0;
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
}
if ( ME->GetType() == SMDSAbs_Node )
- return ( myNodes.find( ME ) != myNodes.end() );
-
- return ( myElements.find( ME ) != myElements.end() );
+ {
+ int idInShape = ME->getIdInShape();
+ if ((idInShape >= 0) && (idInShape < myNodes.size()))
+ if (myNodes[idInShape] == ME) return true;
+ }
+ else
+ {
+ int idInShape = ME->getIdInShape();
+ if ((idInShape >= 0) && (idInShape < myElements.size()))
+ if (myElements[idInShape] == ME) return true;
+ }
+ return false;
}
//=======================================================================
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;
}
#include "SMDS_Mesh.hxx"
#include <set>
+#include <vector>
class SMESHDS_SubMesh;
typedef SMDS_Iterator<const SMESHDS_SubMesh*> SMESHDS_SubMeshIterator;
class SMESHDS_EXPORT SMESHDS_SubMesh
{
public:
+ SMESHDS_SubMesh();
bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
private:
- typedef std::set<const SMDS_MeshElement*, TIDCompare > TElemSet;
- TElemSet myElements, myNodes;
+ typedef std::vector<const SMDS_MeshElement*> TElemSet;
+
+ TElemSet myElements;
+ TElemSet myNodes;
+
+ int myUnusedIdNodes;
+ int myUnusedIdElements;
std::set<const SMESHDS_SubMesh*> mySubMeshes;
};