mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-01 20:30:35 +05:00
SMESHDS_Mesh structures
This commit is contained in:
parent
178d2ef645
commit
7724b590e3
@ -147,3 +147,31 @@ in use bytes = 418378000 : 418M
|
|||||||
max mmap regions = 58
|
max mmap regions = 58
|
||||||
max mmap bytes = 183640064
|
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
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "SMDS_QuadraticEdge.hxx"
|
#include "SMDS_QuadraticEdge.hxx"
|
||||||
#include "SMDS_QuadraticFaceOfNodes.hxx"
|
#include "SMDS_QuadraticFaceOfNodes.hxx"
|
||||||
#include "SMDS_QuadraticVolumeOfNodes.hxx"
|
#include "SMDS_QuadraticVolumeOfNodes.hxx"
|
||||||
|
#include "SMDS_SpacePosition.hxx"
|
||||||
|
|
||||||
#include <vtkUnstructuredGrid.h>
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
|
||||||
@ -119,6 +120,12 @@ SMDS_Mesh::SMDS_Mesh()
|
|||||||
{
|
{
|
||||||
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
|
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
|
||||||
MESSAGE("myMeshId=" << myMeshId);
|
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);
|
myNodeIDFactory->SetMesh(this);
|
||||||
myElementIDFactory->SetMesh(this);
|
myElementIDFactory->SetMesh(this);
|
||||||
_meshList.push_back(this);
|
_meshList.push_back(this);
|
||||||
|
@ -36,12 +36,12 @@ using namespace std;
|
|||||||
|
|
||||||
int SMDS_MeshCell::nbCells = 0;
|
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):
|
SMDS_MeshElement::SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId):
|
||||||
myID(id), myMeshId(meshId), myShapeId(shapeId)
|
myID(id), myMeshId(meshId), myShapeId(shapeId), myIdInShape(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ int SMDS_MeshElement::GetNodeIndex( const SMDS_MeshNode* node ) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_MeshCell::SMDS_MeshCell()
|
SMDS_MeshCell::SMDS_MeshCell() : SMDS_MeshElement(-1)
|
||||||
{
|
{
|
||||||
nbCells++;
|
nbCells++;
|
||||||
myVtkID = -1;
|
myVtkID = -1;
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
typedef unsigned short UShortType;
|
//typedef unsigned short UShortType;
|
||||||
typedef short ShortType;
|
typedef short ShortType;
|
||||||
|
|
||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
@ -122,18 +122,28 @@ public:
|
|||||||
int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
||||||
|
|
||||||
inline int getId() const {return myID; };
|
inline int getId() const {return myID; };
|
||||||
inline UShortType getMeshId() {return myMeshId; };
|
inline ShortType getMeshId() const {return myMeshId; };
|
||||||
inline ShortType getshapeId() {return myShapeId; };
|
inline ShortType getshapeId() const {return myShapeId; };
|
||||||
inline void setShapeId(UShortType shapeId) {myShapeId = shapeId; };
|
inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
|
||||||
|
inline int getIdInShape() const { return myIdInShape; };
|
||||||
|
inline void setIdInShape(int id) { myIdInShape = id; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMDS_MeshElement(int ID=-1);
|
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;
|
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;
|
ShortType myMeshId;
|
||||||
|
|
||||||
|
//! SubShape and SubMesh identification in SMESHDS (not in use?)
|
||||||
ShortType myShapeId;
|
ShortType myShapeId;
|
||||||
|
|
||||||
|
//! Element index in SMESHDS_SubMesh vector
|
||||||
|
int myIdInShape;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
// $Header:
|
// $Header:
|
||||||
//
|
//
|
||||||
#include "SMESHDS_Script.hxx"
|
#include "SMESHDS_Script.hxx"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -35,7 +36,9 @@ using namespace std;
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHDS_Script::SMESHDS_Script(bool theIsEmbeddedMode):
|
SMESHDS_Script::SMESHDS_Script(bool theIsEmbeddedMode):
|
||||||
myIsEmbeddedMode(theIsEmbeddedMode)
|
myIsEmbeddedMode(theIsEmbeddedMode)
|
||||||
{}
|
{
|
||||||
|
cerr << "=========================== myIsEmbeddedMode " << myIsEmbeddedMode << endl;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Destructor
|
//function : Destructor
|
||||||
|
@ -30,9 +30,18 @@
|
|||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "SMDS_SetIterator.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
SMESHDS_SubMesh::SMESHDS_SubMesh()
|
||||||
|
{
|
||||||
|
myElements.clear();
|
||||||
|
myNodes.clear();
|
||||||
|
myUnusedIdNodes = 0;
|
||||||
|
myUnusedIdElements = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AddElement
|
//function : AddElement
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -40,7 +49,13 @@ using namespace std;
|
|||||||
void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
||||||
{
|
{
|
||||||
if ( !IsComplexSubmesh() )
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -49,18 +64,27 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted)
|
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
|
if (!isElemDeleted) // alive element has valid ID and can be found
|
||||||
return myElements.erase(ME);
|
{
|
||||||
|
int idInSubShape = ME->getIdInShape();
|
||||||
TElemSet::iterator e = myElements.begin(), eEnd = myElements.end();
|
assert(idInSubShape >= 0);
|
||||||
for ( ; e != eEnd; ++e )
|
assert(idInSubShape < myElements.size());
|
||||||
if ( ME == *e ) {
|
myElements[idInSubShape] = 0; // this vector entry is no more used
|
||||||
myElements.erase( e );
|
myUnusedIdElements++;
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@ -72,7 +96,13 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele
|
|||||||
void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
|
void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
|
||||||
{
|
{
|
||||||
if ( !IsComplexSubmesh() )
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -82,18 +112,26 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
|
|||||||
|
|
||||||
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
|
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
|
if (!isNodeDeleted) // alive node has valid ID and can be found
|
||||||
return myNodes.erase(N);
|
{
|
||||||
|
int idInSubShape = N->getIdInShape();
|
||||||
TElemSet::iterator e = myNodes.begin(), eEnd = myNodes.end();
|
assert(idInSubShape >= 0);
|
||||||
for ( ; e != eEnd; ++e )
|
assert(idInSubShape < myNodes.size());
|
||||||
if ( N == *e ) {
|
myNodes[idInSubShape] = 0; // this vector entry is no more used
|
||||||
myNodes.erase( e );
|
myUnusedIdNodes++;
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@ -105,7 +143,7 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
|
|||||||
int SMESHDS_SubMesh::NbElements() const
|
int SMESHDS_SubMesh::NbElements() const
|
||||||
{
|
{
|
||||||
if ( !IsComplexSubmesh() )
|
if ( !IsComplexSubmesh() )
|
||||||
return myElements.size();
|
return myElements.size() - myUnusedIdElements;
|
||||||
|
|
||||||
int nbElems = 0;
|
int nbElems = 0;
|
||||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||||
@ -123,7 +161,7 @@ int SMESHDS_SubMesh::NbElements() const
|
|||||||
int SMESHDS_SubMesh::NbNodes() const
|
int SMESHDS_SubMesh::NbNodes() const
|
||||||
{
|
{
|
||||||
if ( !IsComplexSubmesh() )
|
if ( !IsComplexSubmesh() )
|
||||||
return myNodes.size();
|
return myNodes.size() - myUnusedIdNodes;
|
||||||
|
|
||||||
int nbElems = 0;
|
int nbElems = 0;
|
||||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||||
@ -258,9 +296,18 @@ bool SMESHDS_SubMesh::Contains(const SMDS_MeshElement * ME) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ME->GetType() == SMDSAbs_Node )
|
if ( ME->GetType() == SMDSAbs_Node )
|
||||||
return ( myNodes.find( ME ) != myNodes.end() );
|
{
|
||||||
|
int idInShape = ME->getIdInShape();
|
||||||
return ( myElements.find( ME ) != myElements.end() );
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -325,14 +372,10 @@ void SMESHDS_SubMesh::Clear()
|
|||||||
|
|
||||||
int SMESHDS_SubMesh::getSize()
|
int SMESHDS_SubMesh::getSize()
|
||||||
{
|
{
|
||||||
// int a = sizeof(myElements);
|
|
||||||
// int b = sizeof(myNodes);
|
|
||||||
int c = NbNodes();
|
int c = NbNodes();
|
||||||
int d = NbElements();
|
int d = NbElements();
|
||||||
cerr << "SMESHDS_SubMesh::NbNodes " << c << endl;
|
cerr << "SMESHDS_SubMesh::NbNodes " << c << endl;
|
||||||
cerr << "SMESHDS_SubMesh::NbElements " << d << endl;
|
cerr << "SMESHDS_SubMesh::NbElements " << d << endl;
|
||||||
// cerr << "SMESHDS_SubMesh::myNodes " << b << endl;
|
|
||||||
// cerr << "SMESHDS_SubMesh::myElements " << a << endl;
|
|
||||||
return c+d;
|
return c+d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "SMDS_Mesh.hxx"
|
#include "SMDS_Mesh.hxx"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class SMESHDS_SubMesh;
|
class SMESHDS_SubMesh;
|
||||||
typedef SMDS_Iterator<const SMESHDS_SubMesh*> SMESHDS_SubMeshIterator;
|
typedef SMDS_Iterator<const SMESHDS_SubMesh*> SMESHDS_SubMeshIterator;
|
||||||
@ -38,6 +39,7 @@ typedef boost::shared_ptr< SMESHDS_SubMeshIterator > SMESHDS_SubMeshIteratorPtr;
|
|||||||
class SMESHDS_EXPORT SMESHDS_SubMesh
|
class SMESHDS_EXPORT SMESHDS_SubMesh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SMESHDS_SubMesh();
|
||||||
|
|
||||||
bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
|
bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
|
||||||
|
|
||||||
@ -67,8 +69,13 @@ class SMESHDS_EXPORT SMESHDS_SubMesh
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::set<const SMDS_MeshElement*, TIDCompare > TElemSet;
|
typedef std::vector<const SMDS_MeshElement*> TElemSet;
|
||||||
TElemSet myElements, myNodes;
|
|
||||||
|
TElemSet myElements;
|
||||||
|
TElemSet myNodes;
|
||||||
|
|
||||||
|
int myUnusedIdNodes;
|
||||||
|
int myUnusedIdElements;
|
||||||
|
|
||||||
std::set<const SMESHDS_SubMesh*> mySubMeshes;
|
std::set<const SMESHDS_SubMesh*> mySubMeshes;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user