mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-01 20:30:35 +05:00
ObjectPool and SMDS_Position
This commit is contained in:
parent
8f66923fb0
commit
178d2ef645
@ -58,17 +58,92 @@ enlever vtkId de SMDS_MeshCell, utiliser SMDS_MeshElementIDFactory.
|
|||||||
ajouter ID dans SMDS_Mesh::createTriangle
|
ajouter ID dans SMDS_Mesh::createTriangle
|
||||||
verifier ID dans SMDS_Mesh::Find*OrCreate
|
verifier ID dans SMDS_Mesh::Find*OrCreate
|
||||||
|
|
||||||
========================
|
===================================================
|
||||||
occupation memoire cube 100*100*100 sans affichage
|
occupation memoire cube 100*100*100 sans affichage
|
||||||
|
|
||||||
Ubuntu 9.10 64 bits 15/12/2009
|
Reference : V513 Debian Sarge 64 bits: --> 463 - 33 = 430 Mo
|
||||||
/home/prascle/projets/SALOME/SMESH/BR_SMDS_MEMIMP/SMESH_SRC/src/SMESH/SMESH_Gen.cxx:143
|
-------------------------------------
|
||||||
in use bytes = 32843200
|
Total (incl. mmap):
|
||||||
/home/prascle/projets/SALOME/SMESH/BR_SMDS_MEMIMP/SMESH_SRC/src/SMESH/SMESH_Gen.cxx [294] : VSR - SMESH_Gen::Compute() finished, OK = 1
|
system bytes = 43757568
|
||||||
in use bytes = 498773760
|
in use bytes = 32909584 = 33M
|
||||||
delta = 460 Mo (45 Mo de plus que sur Sarge 64 bits ?)
|
max mmap regions = 41
|
||||||
|
max mmap bytes = 16371712
|
||||||
|
----
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 464670720
|
||||||
|
in use bytes = 463105120 = 463M
|
||||||
|
max mmap regions = 47
|
||||||
|
max mmap bytes = 28188672
|
||||||
|
|
||||||
|
Debian Sarge 64 bits, vtkUnstructuredGrid nodes et hexa, 4 janvier 2010 --> 512 - 41 = 471M
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 52133888
|
||||||
|
in use bytes = 41340320 : 41M
|
||||||
|
max mmap regions = 72
|
||||||
|
max mmap bytes = 24625152
|
||||||
|
----
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 520560640
|
||||||
|
in use bytes = 518735584 : 512M
|
||||||
|
max mmap regions = 88
|
||||||
|
max mmap bytes = 198385664
|
||||||
|
|
||||||
|
idem avec pool SMDS_MeshNodes --> 483 -33 = 450M
|
||||||
|
-----------------------------
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 43696128
|
||||||
|
in use bytes = 32915184 : 33M
|
||||||
|
max mmap regions = 41
|
||||||
|
max mmap bytes = 16371712
|
||||||
|
----
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 484806656
|
||||||
|
in use bytes = 482980992 : 483M
|
||||||
|
max mmap regions = 58
|
||||||
|
max mmap bytes = 184557568
|
||||||
|
|
||||||
|
idem ci-dessus + pool SMDS_VolumeVtkNodes --> 475 -33 = 442M (git: add ObjectPool.hxx)
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 43200512
|
||||||
|
in use bytes = 32908576 : 33M
|
||||||
|
max mmap regions = 41
|
||||||
|
max mmap bytes = 16371712
|
||||||
|
----
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 478068736
|
||||||
|
in use bytes = 475144400 : 475M
|
||||||
|
max mmap regions = 59
|
||||||
|
max mmap bytes = 184692736
|
||||||
|
|
||||||
|
remplacement SMDS_PositionPtr: (boost::shared_ptr<SMDS_Position> --> SMDS_Position*) --> 436 - 35 = 401M (git SMDS_Position)
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 45408256
|
||||||
|
in use bytes = 35097680 : 35M
|
||||||
|
max mmap regions = 47
|
||||||
|
max mmap bytes = 18116608
|
||||||
|
----
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 438935552
|
||||||
|
in use bytes = 436116560 : 436M
|
||||||
|
max mmap regions = 65
|
||||||
|
max mmap bytes = 186437632
|
||||||
|
|
||||||
|
simplification SMDS_SpacePosition (pas de double[3]) --> 418 -33 = 385M (git SMDS_SpacePosition)
|
||||||
|
----------------------------------------------------
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 42582016
|
||||||
|
in use bytes = 32883552 : 33M
|
||||||
|
max mmap regions = 41
|
||||||
|
max mmap bytes = 16371712
|
||||||
|
----
|
||||||
|
Total (incl. mmap):
|
||||||
|
system bytes = 421728256
|
||||||
|
in use bytes = 418378000 : 418M
|
||||||
|
max mmap regions = 58
|
||||||
|
max mmap bytes = 183640064
|
||||||
|
|
||||||
Debian Sarge 64 bits
|
|
||||||
in use bytes = 17076352
|
|
||||||
in use bytes = 431600032
|
|
||||||
delta = 415 Mo
|
|
||||||
|
105
src/SMDS/ObjectPool.hxx
Normal file
105
src/SMDS/ObjectPool.hxx
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
|
||||||
|
#ifndef _OBJECTPOOL_HXX_
|
||||||
|
#define _OBJECTPOOL_HXX_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <stack>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
template <class X> class ObjectPool
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<X*> _chunkList;
|
||||||
|
std::vector<bool> _freeList;
|
||||||
|
int _nextFree;
|
||||||
|
int _maxAvail;
|
||||||
|
int _chunkSize;
|
||||||
|
|
||||||
|
int getNextFree()
|
||||||
|
{
|
||||||
|
for (int i=_nextFree; i< _maxAvail; i++)
|
||||||
|
if (_freeList[i] == true)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return _maxAvail;
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkDelete(int chunkId)
|
||||||
|
{
|
||||||
|
int i0 = _chunkSize*chunkId;
|
||||||
|
int i1 =_chunkSize*(chunkId+1);
|
||||||
|
for (int i=i0; i < i1; i++)
|
||||||
|
if (_freeList[i] == false)
|
||||||
|
return;
|
||||||
|
std::cerr << "a chunk to delete" << std::endl;
|
||||||
|
// compactage des vecteurs un peu lourd, pas necessaire
|
||||||
|
//X* chunk = _chunkList[chunkId];
|
||||||
|
//delete [] chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
ObjectPool(int nblk)
|
||||||
|
{
|
||||||
|
_chunkSize = nblk;
|
||||||
|
_nextFree = 0;
|
||||||
|
_maxAvail = 0;
|
||||||
|
_chunkList.clear();
|
||||||
|
_freeList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~ObjectPool()
|
||||||
|
{
|
||||||
|
for (int i=0; i<_chunkList.size(); i++)
|
||||||
|
delete [] _chunkList[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
X* getNew()
|
||||||
|
{
|
||||||
|
X *obj = 0;
|
||||||
|
_nextFree = getNextFree();
|
||||||
|
if (_nextFree == _maxAvail)
|
||||||
|
{
|
||||||
|
X* newChunk = new X[_chunkSize];
|
||||||
|
_chunkList.push_back(newChunk);
|
||||||
|
_freeList.insert(_freeList.end(), _chunkSize, true);
|
||||||
|
_maxAvail += _chunkSize;
|
||||||
|
_freeList[_nextFree] = false;
|
||||||
|
obj = newChunk; // &newChunk[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int chunkId = _nextFree/_chunkSize;
|
||||||
|
int rank = _nextFree - chunkId*_chunkSize;
|
||||||
|
_freeList[_nextFree] = false;
|
||||||
|
obj = _chunkList[chunkId] + rank; // &_chunkList[chunkId][rank];
|
||||||
|
}
|
||||||
|
//obj->init();
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroy(X* obj)
|
||||||
|
{
|
||||||
|
long adrobj = (long)(obj);
|
||||||
|
for (int i=0; i< _chunkList.size(); i++)
|
||||||
|
{
|
||||||
|
X* chunk = _chunkList[i];
|
||||||
|
long adrmin = (long)(chunk);
|
||||||
|
if (adrobj < adrmin) continue;
|
||||||
|
long adrmax = (long)(chunk + _chunkSize);
|
||||||
|
if (adrobj >= adrmax) continue;
|
||||||
|
int rank = (adrobj -adrmin)/sizeof(X);
|
||||||
|
int toFree = i*_chunkSize + rank;
|
||||||
|
_freeList[toFree] = true;
|
||||||
|
if (toFree < _nextFree) _nextFree = toFree;
|
||||||
|
//obj->clean();
|
||||||
|
//checkDelete(i); compactage non fait
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -51,7 +51,8 @@ using namespace std;
|
|||||||
#define CHECKMEMORY_INTERVAL 1000
|
#define CHECKMEMORY_INTERVAL 1000
|
||||||
|
|
||||||
vector<SMDS_Mesh*> SMDS_Mesh::_meshList = vector<SMDS_Mesh*>();
|
vector<SMDS_Mesh*> SMDS_Mesh::_meshList = vector<SMDS_Mesh*>();
|
||||||
int SMDS_Mesh::chunkSize = 1000;
|
int SMDS_Mesh::chunkSize = 1024;
|
||||||
|
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
@ -113,15 +114,21 @@ SMDS_Mesh::SMDS_Mesh()
|
|||||||
myElementIDFactory(new SMDS_MeshElementIDFactory()),
|
myElementIDFactory(new SMDS_MeshElementIDFactory()),
|
||||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||||
myHasInverseElements(true),
|
myHasInverseElements(true),
|
||||||
myNodeMin(0), myNodeMax(0), myCellLinksSize(0)
|
myNodeMin(0), myNodeMax(0), myCellLinksSize(0),
|
||||||
|
myNodePool(0), myVolumePool(0)
|
||||||
{
|
{
|
||||||
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);
|
||||||
myNodeIDFactory->SetMesh(this);
|
myNodeIDFactory->SetMesh(this);
|
||||||
myElementIDFactory->SetMesh(this);
|
myElementIDFactory->SetMesh(this);
|
||||||
_meshList.push_back(this);
|
_meshList.push_back(this);
|
||||||
|
myNodePool = new ObjectPool<SMDS_MeshNode>(SMDS_Mesh::chunkSize);
|
||||||
|
myVolumePool = new ObjectPool<SMDS_VolumeVtkNodes>(SMDS_Mesh::chunkSize);
|
||||||
|
|
||||||
myNodes.clear();
|
myNodes.clear();
|
||||||
myCells.clear();
|
myCells.clear();
|
||||||
|
myIDElements.clear();
|
||||||
|
myVtkIndex.clear();
|
||||||
myGrid = vtkUnstructuredGrid::New();
|
myGrid = vtkUnstructuredGrid::New();
|
||||||
myGrid->Initialize();
|
myGrid->Initialize();
|
||||||
myGrid->Allocate();
|
myGrid->Allocate();
|
||||||
@ -141,7 +148,9 @@ SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent)
|
|||||||
:myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
|
:myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
|
||||||
myElementIDFactory(parent->myElementIDFactory),
|
myElementIDFactory(parent->myElementIDFactory),
|
||||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||||
myHasInverseElements(true)
|
myHasInverseElements(true),
|
||||||
|
myNodePool(parent->myNodePool),
|
||||||
|
myVolumePool(parent->myVolumePool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +187,9 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID)
|
|||||||
const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
|
const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
|
||||||
if(!node){
|
if(!node){
|
||||||
//if ( myNodes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
//if ( myNodes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
||||||
SMDS_MeshNode * node=new SMDS_MeshNode(ID, myMeshId, -1, x, y, z);
|
//SMDS_MeshNode * node=new SMDS_MeshNode(ID, myMeshId, -1, x, y, z);
|
||||||
|
SMDS_MeshNode * node = myNodePool->getNew();
|
||||||
|
node->init(ID, myMeshId, -1, x, y, z);
|
||||||
if (ID >= myNodes.size())
|
if (ID >= myNodes.size())
|
||||||
{
|
{
|
||||||
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
|
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
|
||||||
@ -842,8 +853,22 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
|
// --- retreive nodes ID
|
||||||
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(n1->getId());
|
||||||
|
nodeIds.push_back(n2->getId());
|
||||||
|
nodeIds.push_back(n3->getId());
|
||||||
|
nodeIds.push_back(n4->getId());
|
||||||
|
nodeIds.push_back(n5->getId());
|
||||||
|
nodeIds.push_back(n6->getId());
|
||||||
|
nodeIds.push_back(n7->getId());
|
||||||
|
nodeIds.push_back(n8->getId());
|
||||||
|
|
||||||
|
//volume = new SMDS_VolumeVtkNodes(nodeIds, this);
|
||||||
|
SMDS_VolumeVtkNodes *volvtk = myVolumePool->getNew();
|
||||||
|
volvtk->init(nodeIds, this);
|
||||||
|
volume = volvtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = volume;
|
myCells[ID] = volume;
|
||||||
myInfo.myNbHexas++;
|
myInfo.myNbHexas++;
|
||||||
@ -1133,13 +1158,41 @@ SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolume
|
|||||||
bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
|
bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
|
||||||
{
|
{
|
||||||
//MESSAGE("registerElement " << ID)
|
//MESSAGE("registerElement " << ID)
|
||||||
if (myElementIDFactory->BindID(ID, element)) {
|
if ((ID < myIDElements.size()) && myIDElements[ID] >= 0) // --- already bound
|
||||||
return true;
|
{
|
||||||
}
|
MESSAGE(" --------------------------------- already bound "<< ID << " " << myIDElements[ID]);
|
||||||
MESSAGE("BindID " << ID << " false!---------------");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
element->myID = ID;
|
||||||
|
element->myMeshId = myMeshId;
|
||||||
|
|
||||||
|
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(element);
|
||||||
|
assert(cell);
|
||||||
|
int vtkId = cell->getVtkId();
|
||||||
|
if (vtkId == -1)
|
||||||
|
vtkId = myElementIDFactory->SetInVtkGrid(element);
|
||||||
|
|
||||||
|
if (ID >= myIDElements.size()) // --- resize local vector
|
||||||
|
{
|
||||||
|
MESSAGE(" ------------------- resize myIDElements " << ID << " --> " << ID + SMDS_Mesh::chunkSize);
|
||||||
|
myIDElements.resize(ID + SMDS_Mesh::chunkSize, -1); // fill new elements with -1
|
||||||
|
}
|
||||||
|
|
||||||
|
myIDElements[ID] = vtkId;
|
||||||
|
//MESSAGE("smds:" << ID << " vtk:" << cellId );
|
||||||
|
|
||||||
|
if (vtkId >= myVtkIndex.size()) // --- resize local vector
|
||||||
|
{
|
||||||
|
MESSAGE(" --------------------- resize myVtkIndex " << vtkId << " --> " << vtkId + SMDS_Mesh::chunkSize);
|
||||||
|
myVtkIndex.resize(vtkId + SMDS_Mesh::chunkSize, -1);
|
||||||
|
}
|
||||||
|
myVtkIndex[vtkId] = ID;
|
||||||
|
|
||||||
|
myElementIDFactory->updateMinMax(ID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Return the node whose ID is 'ID'.
|
/// Return the node whose ID is 'ID'.
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -3405,3 +3458,23 @@ void SMDS_Mesh::updateNodeMinMax()
|
|||||||
while (!myNodes[myNodeMax] && (myNodeMin>=0))
|
while (!myNodes[myNodeMax] && (myNodeMin>=0))
|
||||||
myNodeMin--;
|
myNodeMin--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMDS_Mesh::incrementNodesCapacity(int nbNodes)
|
||||||
|
{
|
||||||
|
int val = myIDElements.size();
|
||||||
|
MESSAGE(" ------------------- resize myIDElements " << val << " --> " << val + nbNodes);
|
||||||
|
myIDElements.resize(val + nbNodes, -1); // fill new elements with -1
|
||||||
|
val = myNodes.size();
|
||||||
|
MESSAGE(" ------------------- resize myNodes " << val << " --> " << val + nbNodes);
|
||||||
|
myNodes.resize(val +nbNodes, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_Mesh::incrementCellsCapacity(int nbCells)
|
||||||
|
{
|
||||||
|
int val = myVtkIndex.size();
|
||||||
|
MESSAGE(" ------------------- resize myVtkIndex " << val << " --> " << val + nbCells);
|
||||||
|
myVtkIndex.resize(val + nbCells, -1); // fill new elements with -1
|
||||||
|
val = myCells.size();
|
||||||
|
MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
|
||||||
|
myNodes.resize(val +nbCells, 0);
|
||||||
|
}
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include "SMDS_MeshElementIDFactory.hxx"
|
#include "SMDS_MeshElementIDFactory.hxx"
|
||||||
#include "SMDS_MeshInfo.hxx"
|
#include "SMDS_MeshInfo.hxx"
|
||||||
#include "SMDS_ElemIterator.hxx"
|
#include "SMDS_ElemIterator.hxx"
|
||||||
|
#include "SMDS_VolumeOfNodes.hxx"
|
||||||
|
#include "ObjectPool.hxx"
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -48,6 +50,8 @@ class vtkUnstructuredGrid;
|
|||||||
|
|
||||||
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
||||||
public:
|
public:
|
||||||
|
friend class SMDS_MeshElementIDFactory;
|
||||||
|
friend class SMDS_MeshVolumeVtkNodes;
|
||||||
|
|
||||||
static std::vector<SMDS_Mesh*> _meshList; // --- to find the SMDS_mesh from its elements
|
static std::vector<SMDS_Mesh*> _meshList; // --- to find the SMDS_mesh from its elements
|
||||||
|
|
||||||
@ -549,7 +553,10 @@ public:
|
|||||||
typedef std::vector<SMDS_MeshCell *> SetOfCells;
|
typedef std::vector<SMDS_MeshCell *> SetOfCells;
|
||||||
|
|
||||||
void updateNodeMinMax();
|
void updateNodeMinMax();
|
||||||
int fromVtkToSmds(int vtkid) { return myElementIDFactory->fromVtkToSmds(vtkid); };
|
int fromVtkToSmds(int vtkid) { return myVtkIndex[vtkid]; };
|
||||||
|
|
||||||
|
void incrementNodesCapacity(int nbNodes);
|
||||||
|
void incrementCellsCapacity(int nbCells);
|
||||||
|
|
||||||
int myCellLinksSize;
|
int myCellLinksSize;
|
||||||
|
|
||||||
@ -595,14 +602,12 @@ private:
|
|||||||
int myMeshId; // --- index for this mesh in the vector
|
int myMeshId; // --- index for this mesh in the vector
|
||||||
vtkUnstructuredGrid* myGrid;
|
vtkUnstructuredGrid* myGrid;
|
||||||
|
|
||||||
|
ObjectPool<SMDS_MeshNode>* myNodePool;
|
||||||
|
ObjectPool<SMDS_VolumeVtkNodes>* myVolumePool;
|
||||||
SetOfNodes myNodes;
|
SetOfNodes myNodes;
|
||||||
SetOfCells myCells;
|
SetOfCells myCells;
|
||||||
|
std::vector<int> myIDElements; // index = ID client, value = ID vtk
|
||||||
// SetOf0DElements my0DElements;
|
std::vector<int> myVtkIndex; // index = ID vtk, value = ID client
|
||||||
// SetOfEdges myEdges;
|
|
||||||
// SetOfFaces myFaces;
|
|
||||||
// SetOfVolumes myVolumes;
|
|
||||||
|
|
||||||
SMDS_Mesh * myParent;
|
SMDS_Mesh * myParent;
|
||||||
std::list<SMDS_Mesh *> myChildren;
|
std::list<SMDS_Mesh *> myChildren;
|
||||||
|
@ -34,7 +34,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID)
|
int SMDS_MeshCell::nbCells = 0;
|
||||||
|
|
||||||
|
SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,5 +248,11 @@ int SMDS_MeshElement::GetNodeIndex( const SMDS_MeshNode* node ) const
|
|||||||
|
|
||||||
SMDS_MeshCell::SMDS_MeshCell()
|
SMDS_MeshCell::SMDS_MeshCell()
|
||||||
{
|
{
|
||||||
|
nbCells++;
|
||||||
myVtkID = -1;
|
myVtkID = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SMDS_MeshCell::~SMDS_MeshCell()
|
||||||
|
{
|
||||||
|
nbCells--;
|
||||||
|
}
|
@ -42,6 +42,7 @@ typedef short ShortType;
|
|||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
class SMDS_MeshEdge;
|
class SMDS_MeshEdge;
|
||||||
class SMDS_MeshFace;
|
class SMDS_MeshFace;
|
||||||
|
class SMDS_Mesh;
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
/*!
|
/*!
|
||||||
@ -74,6 +75,7 @@ public:
|
|||||||
|
|
||||||
friend SMDS_EXPORT std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
friend SMDS_EXPORT std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
||||||
friend SMDS_EXPORT bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement* elem);
|
friend SMDS_EXPORT bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement* elem);
|
||||||
|
friend class SMDS_Mesh;
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Access to nodes by index
|
// Access to nodes by index
|
||||||
@ -119,7 +121,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
||||||
|
|
||||||
inline int getId() {return myID; };
|
inline int getId() const {return myID; };
|
||||||
inline UShortType getMeshId() {return myMeshId; };
|
inline UShortType getMeshId() {return myMeshId; };
|
||||||
inline ShortType getshapeId() {return myShapeId; };
|
inline ShortType getshapeId() {return myShapeId; };
|
||||||
inline void setShapeId(UShortType shapeId) {myShapeId = shapeId; };
|
inline void setShapeId(UShortType shapeId) {myShapeId = shapeId; };
|
||||||
@ -130,7 +132,7 @@ protected:
|
|||||||
virtual void Print(std::ostream & OS) const;
|
virtual void Print(std::ostream & OS) const;
|
||||||
|
|
||||||
int myID; // --- element index
|
int myID; // --- element index
|
||||||
UShortType myMeshId;
|
ShortType myMeshId;
|
||||||
ShortType myShapeId;
|
ShortType myShapeId;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -144,8 +146,10 @@ class SMDS_EXPORT SMDS_MeshCell:public SMDS_MeshElement
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SMDS_MeshCell();
|
SMDS_MeshCell();
|
||||||
|
virtual ~SMDS_MeshCell();
|
||||||
inline void setVtkId(int vtkId) { myVtkID = vtkId; };
|
inline void setVtkId(int vtkId) { myVtkID = vtkId; };
|
||||||
inline int getVtkId() const {return myVtkID; };
|
inline int getVtkId() const {return myVtkID; };
|
||||||
|
static int nbCells;
|
||||||
protected:
|
protected:
|
||||||
int myVtkID;
|
int myVtkID;
|
||||||
};
|
};
|
||||||
|
@ -46,8 +46,8 @@ using namespace std;
|
|||||||
SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
|
SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
|
||||||
SMDS_MeshNodeIDFactory()
|
SMDS_MeshNodeIDFactory()
|
||||||
{
|
{
|
||||||
myIDElements.clear();
|
// myIDElements.clear();
|
||||||
myVtkIndex.clear();
|
// myVtkIndex.clear();
|
||||||
myVtkCellTypes.clear();
|
myVtkCellTypes.clear();
|
||||||
myVtkCellTypes.reserve(SMDSEntity_Last);
|
myVtkCellTypes.reserve(SMDSEntity_Last);
|
||||||
myVtkCellTypes[SMDSEntity_Node] = VTK_VERTEX;
|
myVtkCellTypes[SMDSEntity_Node] = VTK_VERTEX;
|
||||||
@ -72,24 +72,8 @@ SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
|
|||||||
myVtkCellTypes[SMDSEntity_Quad_Polyhedra] = VTK_CONVEX_POINT_SET;
|
myVtkCellTypes[SMDSEntity_Quad_Polyhedra] = VTK_CONVEX_POINT_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
int SMDS_MeshElementIDFactory::SetInVtkGrid(SMDS_MeshElement * elem)
|
||||||
//function : BindID
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
|
|
||||||
{
|
{
|
||||||
if ((ID < myIDElements.size()) && myIDElements[ID] >= 0) // --- already bound
|
|
||||||
{
|
|
||||||
MESSAGE(" --------------------------------- already bound "<< ID << " " << myIDElements[ID]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ID >= myIDElements.size()) // --- resize local vector
|
|
||||||
{
|
|
||||||
//MESSAGE(" ------------------- resize myIDElements " << ID << " --> " << ID+SMDS_Mesh::chunkSize);
|
|
||||||
myIDElements.resize(ID+SMDS_Mesh::chunkSize,-1); // fill new elements with -1
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- retreive nodes ID
|
// --- retreive nodes ID
|
||||||
|
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
@ -106,25 +90,23 @@ bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
|
|||||||
vtkUnstructuredGrid * grid = myMesh->getGrid();
|
vtkUnstructuredGrid * grid = myMesh->getGrid();
|
||||||
int typ = GetVtkCellType(elem->GetType());
|
int typ = GetVtkCellType(elem->GetType());
|
||||||
int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
|
int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
|
||||||
|
|
||||||
// --- fill local vector
|
|
||||||
|
|
||||||
myIDElements[ID] = cellId;
|
|
||||||
//MESSAGE("smds:" << ID << " vtk:" << cellId );
|
|
||||||
|
|
||||||
if (cellId >= myVtkIndex.size()) // --- resize local vector
|
|
||||||
{
|
|
||||||
//MESSAGE(" --------------------- resize myVtkIndex " << cellId << " --> " << cellId+SMDS_Mesh::chunkSize);
|
|
||||||
myVtkIndex.resize(cellId+SMDS_Mesh::chunkSize, -1);
|
|
||||||
}
|
|
||||||
myVtkIndex[cellId] = ID;
|
|
||||||
|
|
||||||
elem->myID=ID;
|
|
||||||
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
|
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
|
||||||
assert(cell);
|
assert(cell);
|
||||||
cell->setVtkId(cellId);
|
cell->setVtkId(cellId);
|
||||||
updateMinMax (ID);
|
//MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId);
|
||||||
return true;
|
return cellId;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BindID
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
|
||||||
|
{
|
||||||
|
MESSAGE("SMDS_MeshElementIDFactory::BindID " << ID);
|
||||||
|
SetInVtkGrid(elem);
|
||||||
|
return myMesh->registerElement(ID, elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -133,7 +115,7 @@ bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
|
SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
|
||||||
{
|
{
|
||||||
if ((ID<0) || (ID>myMax) || (myIDElements[ID]<0))
|
if ((ID<0) || (ID>myMax) || (myMesh->myIDElements[ID]<0))
|
||||||
return NULL;
|
return NULL;
|
||||||
const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
|
const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
|
||||||
return (SMDS_MeshElement*)(elem);
|
return (SMDS_MeshElement*)(elem);
|
||||||
@ -145,7 +127,7 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
|
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
|
||||||
{
|
{
|
||||||
myIDElements[ID] = -1;
|
myMesh->myIDElements[ID] = -1;
|
||||||
SMDS_MeshIDFactory::ReleaseID(ID);
|
SMDS_MeshIDFactory::ReleaseID(ID);
|
||||||
if (ID == myMax)
|
if (ID == myMax)
|
||||||
myMax = 0;
|
myMax = 0;
|
||||||
@ -162,8 +144,8 @@ void SMDS_MeshElementIDFactory::updateMinMax() const
|
|||||||
{
|
{
|
||||||
myMin = IntegerLast();
|
myMin = IntegerLast();
|
||||||
myMax = 0;
|
myMax = 0;
|
||||||
for (int i=0; i<myIDElements.size(); i++)
|
for (int i=0; i<myMesh->myIDElements.size(); i++)
|
||||||
if (int id=myIDElements[i] >=0)
|
if (int id=myMesh->myIDElements[i] >=0)
|
||||||
{
|
{
|
||||||
if (id > myMax) myMax = id;
|
if (id > myMax) myMax = id;
|
||||||
if (id < myMin) myMin = id;
|
if (id < myMin) myMin = id;
|
||||||
@ -184,7 +166,7 @@ SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
|
|||||||
|
|
||||||
void SMDS_MeshElementIDFactory::Clear()
|
void SMDS_MeshElementIDFactory::Clear()
|
||||||
{
|
{
|
||||||
myIDElements.clear();
|
myMesh->myIDElements.clear();
|
||||||
myMin = myMax = 0;
|
myMin = myMax = 0;
|
||||||
SMDS_MeshIDFactory::Clear();
|
SMDS_MeshIDFactory::Clear();
|
||||||
}
|
}
|
||||||
|
@ -33,18 +33,21 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class SMDS_MeshElement;
|
class SMDS_MeshElement;
|
||||||
|
class SMDS_Mesh;
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_MeshElementIDFactory:public SMDS_MeshNodeIDFactory
|
class SMDS_EXPORT SMDS_MeshElementIDFactory:public SMDS_MeshNodeIDFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
friend class SMDS_Mesh;
|
||||||
|
|
||||||
SMDS_MeshElementIDFactory();
|
SMDS_MeshElementIDFactory();
|
||||||
bool BindID(int ID, SMDS_MeshElement * elem);
|
bool BindID(int ID, SMDS_MeshElement * elem);
|
||||||
|
int SetInVtkGrid(SMDS_MeshElement * elem);
|
||||||
SMDS_MeshElement * MeshElement(int ID);
|
SMDS_MeshElement * MeshElement(int ID);
|
||||||
virtual void ReleaseID(int ID);
|
virtual void ReleaseID(int ID);
|
||||||
SMDS_ElemIteratorPtr elementsIterator() const;
|
SMDS_ElemIteratorPtr elementsIterator() const;
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
int GetVtkCellType(int SMDSType);
|
int GetVtkCellType(int SMDSType);
|
||||||
int fromVtkToSmds(int vtkid) { return myVtkIndex[vtkid]; };
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateMinMax() const;
|
void updateMinMax() const;
|
||||||
@ -54,8 +57,6 @@ protected:
|
|||||||
if (id < myMin) myMin = id;
|
if (id < myMin) myMin = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> myIDElements; // index = ID client, value = ID vtk
|
|
||||||
std::vector<int> myVtkIndex; // index = ID vtk, value = ID client
|
|
||||||
std::vector<int> myVtkCellTypes;
|
std::vector<int> myVtkCellTypes;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -39,15 +39,31 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
int SMDS_MeshNode::nbNodes =0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SMDS_MeshNode
|
//function : SMDS_MeshNode
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
SMDS_MeshNode::SMDS_MeshNode() :
|
||||||
|
SMDS_MeshElement(-1, -1, -1),
|
||||||
|
myPosition(SMDS_SpacePosition::originSpacePosition())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y, double z):
|
SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y, double z):
|
||||||
SMDS_MeshElement(id, meshId, shapeId),
|
SMDS_MeshElement(id, meshId, shapeId),
|
||||||
myPosition(SMDS_SpacePosition::originSpacePosition())
|
myPosition(SMDS_SpacePosition::originSpacePosition())
|
||||||
{
|
{
|
||||||
|
init(id, meshId, shapeId, x, y ,z);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
|
||||||
|
{
|
||||||
|
nbNodes++;
|
||||||
|
myID = id;
|
||||||
|
myMeshId = meshId;
|
||||||
|
myShapeId = shapeId;
|
||||||
//MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
|
//MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
|
||||||
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
|
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||||
vtkUnstructuredGrid * grid = mesh->getGrid();
|
vtkUnstructuredGrid * grid = mesh->getGrid();
|
||||||
@ -90,6 +106,11 @@ SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y
|
|||||||
//setXYZ(x, y, z);
|
//setXYZ(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMDS_MeshNode::~SMDS_MeshNode()
|
||||||
|
{
|
||||||
|
nbNodes--;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : RemoveInverseElement
|
//function : RemoveInverseElement
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -36,7 +36,11 @@ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
SMDS_MeshNode();
|
||||||
SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
|
SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
|
||||||
|
virtual ~SMDS_MeshNode();
|
||||||
|
|
||||||
|
void init(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
|
||||||
|
|
||||||
double* getCoord() const;
|
double* getCoord() const;
|
||||||
|
|
||||||
@ -64,7 +68,7 @@ public:
|
|||||||
* \retval const SMDS_MeshNode* - the node
|
* \retval const SMDS_MeshNode* - the node
|
||||||
*/
|
*/
|
||||||
virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
|
virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
|
||||||
|
static int nbNodes;
|
||||||
protected:
|
protected:
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
class SMDS_Position;
|
class SMDS_Position;
|
||||||
typedef boost::shared_ptr<SMDS_Position> SMDS_PositionPtr;
|
//typedef boost::shared_ptr<SMDS_Position> SMDS_PositionPtr;
|
||||||
|
typedef SMDS_Position* SMDS_PositionPtr;
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_Position
|
class SMDS_EXPORT SMDS_Position
|
||||||
{
|
{
|
||||||
|
@ -24,35 +24,28 @@
|
|||||||
// Author : Jean-Michel BOULCOURT
|
// Author : Jean-Michel BOULCOURT
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "SMDS_SpacePosition.hxx"
|
#include "SMDS_SpacePosition.hxx"
|
||||||
|
|
||||||
//=======================================================================
|
SMDS_SpacePosition* SMDS_SpacePosition::_originPosition = new SMDS_SpacePosition();
|
||||||
//function : SMDS_SpacePosition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
SMDS_SpacePosition::SMDS_SpacePosition(double x, double y, double z):
|
SMDS_SpacePosition::SMDS_SpacePosition(double x, double y, double z):
|
||||||
SMDS_Position(0)
|
SMDS_Position(0)
|
||||||
{
|
{
|
||||||
myCoords[0]=x;
|
|
||||||
myCoords[1]=y;
|
|
||||||
myCoords[2]=z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const double* SMDS_SpacePosition::Coords() const
|
||||||
*/
|
{
|
||||||
|
static double origin[]={0,0,0};
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
SMDS_TypeOfPosition SMDS_SpacePosition::GetTypeOfPosition() const
|
SMDS_TypeOfPosition SMDS_SpacePosition::GetTypeOfPosition() const
|
||||||
{
|
{
|
||||||
return SMDS_TOP_3DSPACE;
|
return SMDS_TOP_3DSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double * SMDS_SpacePosition::Coords() const
|
|
||||||
{
|
|
||||||
return myCoords;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMDS_PositionPtr SMDS_SpacePosition::originSpacePosition()
|
SMDS_PositionPtr SMDS_SpacePosition::originSpacePosition()
|
||||||
{
|
{
|
||||||
static SMDS_PositionPtr staticpos (new SMDS_SpacePosition());
|
return _originPosition;
|
||||||
return staticpos;
|
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,9 @@ class SMDS_EXPORT SMDS_SpacePosition:public SMDS_Position
|
|||||||
SMDS_SpacePosition(double x=0, double y=0, double z=0);
|
SMDS_SpacePosition(double x=0, double y=0, double z=0);
|
||||||
const virtual double * Coords() const;
|
const virtual double * Coords() const;
|
||||||
virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const;
|
virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const;
|
||||||
inline void SetCoords(const double x, const double y, const double z);
|
|
||||||
static SMDS_PositionPtr originSpacePosition();
|
static SMDS_PositionPtr originSpacePosition();
|
||||||
private:
|
private:
|
||||||
double myCoords[3];
|
static SMDS_SpacePosition* _originPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,8 +29,11 @@
|
|||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
#include "SMDS_SetIterator.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "SMDS_VolumeTool.hxx"
|
#include "SMDS_VolumeTool.hxx"
|
||||||
|
#include "SMDS_Mesh.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
|
#include <vtkCell.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -258,6 +261,17 @@ SMDS_VolumeVtkNodes::SMDS_VolumeVtkNodes()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMDS_VolumeVtkNodes::SMDS_VolumeVtkNodes(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
|
{
|
||||||
|
init(nodeIds, mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_VolumeVtkNodes::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = mesh->getGrid();
|
||||||
|
myVtkID = grid->InsertNextLinkedCell(GetType(), nodeIds.size(), &nodeIds[0]);
|
||||||
|
}
|
||||||
|
|
||||||
bool SMDS_VolumeVtkNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
|
bool SMDS_VolumeVtkNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
|
||||||
const int nbNodes)
|
const int nbNodes)
|
||||||
{
|
{
|
||||||
@ -289,7 +303,9 @@ int SMDS_VolumeVtkNodes::NbFaces() const
|
|||||||
|
|
||||||
int SMDS_VolumeVtkNodes::NbNodes() const
|
int SMDS_VolumeVtkNodes::NbNodes() const
|
||||||
{
|
{
|
||||||
return 0;
|
vtkUnstructuredGrid* grid =SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
int nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints();
|
||||||
|
return nbPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SMDS_VolumeVtkNodes::NbEdges() const
|
int SMDS_VolumeVtkNodes::NbEdges() const
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "SMESH_SMDS.hxx"
|
#include "SMESH_SMDS.hxx"
|
||||||
|
|
||||||
#include "SMDS_MeshVolume.hxx"
|
#include "SMDS_MeshVolume.hxx"
|
||||||
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume
|
class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume
|
||||||
{
|
{
|
||||||
@ -91,9 +93,11 @@ class SMDS_EXPORT SMDS_VolumeVtkNodes:public SMDS_MeshVolume
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SMDS_VolumeVtkNodes();
|
SMDS_VolumeVtkNodes();
|
||||||
|
SMDS_VolumeVtkNodes(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
|
||||||
|
~SMDS_VolumeVtkNodes();
|
||||||
|
void init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
|
||||||
bool ChangeNodes(const SMDS_MeshNode* nodes[],
|
bool ChangeNodes(const SMDS_MeshNode* nodes[],
|
||||||
const int nbNodes);
|
const int nbNodes);
|
||||||
~SMDS_VolumeVtkNodes();
|
|
||||||
|
|
||||||
void Print(std::ostream & OS) const;
|
void Print(std::ostream & OS) const;
|
||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
|
@ -223,7 +223,7 @@ bool SMESH_Algo::IsReversedSubMesh (const TopoDS_Face& theFace,
|
|||||||
const SMDS_PositionPtr& pos = node->GetPosition();
|
const SMDS_PositionPtr& pos = node->GetPosition();
|
||||||
if ( !pos ) continue;
|
if ( !pos ) continue;
|
||||||
if ( pos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
|
if ( pos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
|
||||||
fPos = dynamic_cast< const SMDS_FacePosition* >( pos.get() );
|
fPos = dynamic_cast< const SMDS_FacePosition* >( pos );
|
||||||
}
|
}
|
||||||
else if ( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) {
|
else if ( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) {
|
||||||
vID = pos->GetShapeId();
|
vID = pos->GetShapeId();
|
||||||
@ -334,7 +334,7 @@ bool SMESH_Algo::GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh,
|
|||||||
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
|
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
|
||||||
return false;
|
return false;
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
if ( !paramSet.insert( epos->GetUParameter() ).second )
|
if ( !paramSet.insert( epos->GetUParameter() ).second )
|
||||||
return false; // equal parameters
|
return false; // equal parameters
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM
|
|||||||
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
|
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
|
||||||
return false;
|
return false;
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
theNodes.insert( make_pair( epos->GetUParameter(), node ));
|
theNodes.insert( make_pair( epos->GetUParameter(), node ));
|
||||||
++nbNodes;
|
++nbNodes;
|
||||||
}
|
}
|
||||||
|
@ -304,6 +304,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
total += subMesh->getSize();
|
total += subMesh->getSize();
|
||||||
}
|
}
|
||||||
cerr << "total elements and nodes in submesh sets:" << total << endl;
|
cerr << "total elements and nodes in submesh sets:" << total << endl;
|
||||||
|
cerr << "Number of node objects " << SMDS_MeshNode::nbNodes << endl;
|
||||||
|
cerr << "Number of cell objects " << SMDS_MeshCell::nbCells << endl;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ int SMESH_MeshEditor::FindShape (const SMDS_MeshElement * theElem)
|
|||||||
if ( theElem->GetType() == SMDSAbs_Node ) {
|
if ( theElem->GetType() == SMDSAbs_Node ) {
|
||||||
const SMDS_PositionPtr& aPosition =
|
const SMDS_PositionPtr& aPosition =
|
||||||
static_cast<const SMDS_MeshNode*>( theElem )->GetPosition();
|
static_cast<const SMDS_MeshNode*>( theElem )->GetPosition();
|
||||||
if ( aPosition.get() )
|
if ( aPosition )
|
||||||
return aPosition->GetShapeId();
|
return aPosition->GetShapeId();
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -348,7 +348,7 @@ int SMESH_MeshEditor::FindShape (const SMDS_MeshElement * theElem)
|
|||||||
while ( nodeIt->more() ) {
|
while ( nodeIt->more() ) {
|
||||||
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
const SMDS_PositionPtr& aPosition = node->GetPosition();
|
const SMDS_PositionPtr& aPosition = node->GetPosition();
|
||||||
if ( aPosition.get() ) {
|
if ( aPosition ) {
|
||||||
int aShapeID = aPosition->GetShapeId();
|
int aShapeID = aPosition->GetShapeId();
|
||||||
SMESHDS_SubMesh * sm = aMesh->MeshElements( aShapeID );
|
SMESHDS_SubMesh * sm = aMesh->MeshElements( aShapeID );
|
||||||
if ( sm ) {
|
if ( sm ) {
|
||||||
@ -2345,7 +2345,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
|
|||||||
while ( nn++ < nbn ) {
|
while ( nn++ < nbn ) {
|
||||||
node = static_cast<const SMDS_MeshNode*>( itN->next() );
|
node = static_cast<const SMDS_MeshNode*>( itN->next() );
|
||||||
const SMDS_PositionPtr& pos = node->GetPosition();
|
const SMDS_PositionPtr& pos = node->GetPosition();
|
||||||
posType = pos.get() ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
|
posType = pos ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
|
||||||
if (posType != SMDS_TOP_EDGE &&
|
if (posType != SMDS_TOP_EDGE &&
|
||||||
posType != SMDS_TOP_VERTEX &&
|
posType != SMDS_TOP_VERTEX &&
|
||||||
theFixedNodes.find( node ) == theFixedNodes.end())
|
theFixedNodes.find( node ) == theFixedNodes.end())
|
||||||
@ -2403,11 +2403,11 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
|
|||||||
node = *n;
|
node = *n;
|
||||||
gp_XY uv( 0, 0 );
|
gp_XY uv( 0, 0 );
|
||||||
const SMDS_PositionPtr& pos = node->GetPosition();
|
const SMDS_PositionPtr& pos = node->GetPosition();
|
||||||
posType = pos.get() ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
|
posType = pos ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
|
||||||
// get existing UV
|
// get existing UV
|
||||||
switch ( posType ) {
|
switch ( posType ) {
|
||||||
case SMDS_TOP_FACE: {
|
case SMDS_TOP_FACE: {
|
||||||
SMDS_FacePosition* fPos = ( SMDS_FacePosition* ) pos.get();
|
SMDS_FacePosition* fPos = ( SMDS_FacePosition* ) pos;
|
||||||
uv.SetCoord( fPos->GetUParameter(), fPos->GetVParameter() );
|
uv.SetCoord( fPos->GetUParameter(), fPos->GetVParameter() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2417,7 +2417,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
|
|||||||
if ( !S.IsNull() && S.ShapeType() == TopAbs_EDGE )
|
if ( !S.IsNull() && S.ShapeType() == TopAbs_EDGE )
|
||||||
pcurve = BRep_Tool::CurveOnSurface( TopoDS::Edge( S ), face, f,l );
|
pcurve = BRep_Tool::CurveOnSurface( TopoDS::Edge( S ), face, f,l );
|
||||||
if ( !pcurve.IsNull() ) {
|
if ( !pcurve.IsNull() ) {
|
||||||
double u = (( SMDS_EdgePosition* ) pos.get() )->GetUParameter();
|
double u = (( SMDS_EdgePosition* ) pos )->GetUParameter();
|
||||||
uv = pcurve->Value( u ).XY();
|
uv = pcurve->Value( u ).XY();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4020,7 +4020,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
|||||||
while ( aItN->more() ) {
|
while ( aItN->more() ) {
|
||||||
const SMDS_MeshNode* pNode = aItN->next();
|
const SMDS_MeshNode* pNode = aItN->next();
|
||||||
const SMDS_EdgePosition* pEPos =
|
const SMDS_EdgePosition* pEPos =
|
||||||
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
|
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition() );
|
||||||
double aT = pEPos->GetUParameter();
|
double aT = pEPos->GetUParameter();
|
||||||
aPrms.push_back( aT );
|
aPrms.push_back( aT );
|
||||||
}
|
}
|
||||||
@ -4064,7 +4064,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
|||||||
while ( aItN->more() ) {
|
while ( aItN->more() ) {
|
||||||
const SMDS_MeshNode* pNode = aItN->next();
|
const SMDS_MeshNode* pNode = aItN->next();
|
||||||
const SMDS_EdgePosition* pEPos =
|
const SMDS_EdgePosition* pEPos =
|
||||||
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
|
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition() );
|
||||||
double aT = pEPos->GetUParameter();
|
double aT = pEPos->GetUParameter();
|
||||||
aPrms.push_back( aT );
|
aPrms.push_back( aT );
|
||||||
}
|
}
|
||||||
@ -4192,7 +4192,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
|||||||
const SMDS_MeshNode* pNode = aItN->next();
|
const SMDS_MeshNode* pNode = aItN->next();
|
||||||
if( pNode==aN1 || pNode==aN2 ) continue;
|
if( pNode==aN1 || pNode==aN2 ) continue;
|
||||||
const SMDS_EdgePosition* pEPos =
|
const SMDS_EdgePosition* pEPos =
|
||||||
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
|
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition() );
|
||||||
double aT = pEPos->GetUParameter();
|
double aT = pEPos->GetUParameter();
|
||||||
aPrms.push_back( aT );
|
aPrms.push_back( aT );
|
||||||
}
|
}
|
||||||
@ -4239,7 +4239,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
|||||||
while ( aItN->more() ) {
|
while ( aItN->more() ) {
|
||||||
const SMDS_MeshNode* pNode = aItN->next();
|
const SMDS_MeshNode* pNode = aItN->next();
|
||||||
const SMDS_EdgePosition* pEPos =
|
const SMDS_EdgePosition* pEPos =
|
||||||
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
|
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition() );
|
||||||
double aT = pEPos->GetUParameter();
|
double aT = pEPos->GetUParameter();
|
||||||
aPrms.push_back( aT );
|
aPrms.push_back( aT );
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
|
|||||||
{
|
{
|
||||||
// node has position on face
|
// node has position on face
|
||||||
const SMDS_FacePosition* fpos =
|
const SMDS_FacePosition* fpos =
|
||||||
static_cast<const SMDS_FacePosition*>(n->GetPosition().get());
|
static_cast<const SMDS_FacePosition*>(n->GetPosition());
|
||||||
uv.SetCoord(fpos->GetUParameter(),fpos->GetVParameter());
|
uv.SetCoord(fpos->GetUParameter(),fpos->GetVParameter());
|
||||||
uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( F ));
|
uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( F ));
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
|
|||||||
// corresponding edge from face, get pcurve for this
|
// corresponding edge from face, get pcurve for this
|
||||||
// edge and retrieve value from this pcurve
|
// edge and retrieve value from this pcurve
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(n->GetPosition());
|
||||||
int edgeID = Pos->GetShapeId();
|
int edgeID = Pos->GetShapeId();
|
||||||
TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID));
|
TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID));
|
||||||
double f, l, u = epos->GetUParameter();
|
double f, l, u = epos->GetUParameter();
|
||||||
@ -548,7 +548,7 @@ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E,
|
|||||||
const SMDS_PositionPtr Pos = n->GetPosition();
|
const SMDS_PositionPtr Pos = n->GetPosition();
|
||||||
if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE) {
|
if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE) {
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(n->GetPosition());
|
||||||
param = epos->GetUParameter();
|
param = epos->GetUParameter();
|
||||||
}
|
}
|
||||||
else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX) {
|
else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX) {
|
||||||
@ -1176,7 +1176,7 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
|
|||||||
if(IsMedium(node, SMDSAbs_Edge))
|
if(IsMedium(node, SMDSAbs_Edge))
|
||||||
continue;
|
continue;
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
|
||||||
if ( !pos ) {
|
if ( !pos ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1198,7 +1198,7 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
|
|||||||
if(IsMedium(node))
|
if(IsMedium(node))
|
||||||
continue;
|
continue;
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
|
||||||
if ( !pos ) {
|
if ( !pos ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
{
|
{
|
||||||
const SMDS_MeshNode* node = smdsNode( nIt->next() );
|
const SMDS_MeshNode* node = smdsNode( nIt->next() );
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
double u = epos->GetUParameter();
|
double u = epos->GetUParameter();
|
||||||
paramNodeMap.insert( make_pair( u, node ));
|
paramNodeMap.insert( make_pair( u, node ));
|
||||||
}
|
}
|
||||||
@ -850,7 +850,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
p->myInitUV = project( node, projector );
|
p->myInitUV = project( node, projector );
|
||||||
else {
|
else {
|
||||||
const SMDS_FacePosition* pos =
|
const SMDS_FacePosition* pos =
|
||||||
static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_FacePosition*>(node->GetPosition());
|
||||||
p->myInitUV.SetCoord( pos->GetUParameter(), pos->GetVParameter() );
|
p->myInitUV.SetCoord( pos->GetUParameter(), pos->GetVParameter() );
|
||||||
}
|
}
|
||||||
p->myInitXYZ.SetCoord( p->myInitUV.X(), p->myInitUV.Y(), 0 );
|
p->myInitXYZ.SetCoord( p->myInitUV.X(), p->myInitUV.Y(), 0 );
|
||||||
@ -3208,7 +3208,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
{
|
{
|
||||||
const SMDS_MeshNode* node = smdsNode( nIt->next() );
|
const SMDS_MeshNode* node = smdsNode( nIt->next() );
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
double u = ( epos->GetUParameter() - f ) / ( l - f );
|
double u = ( epos->GetUParameter() - f ) / ( l - f );
|
||||||
(*pIt)->myInitXYZ.SetCoord( iCoord, isForward ? u : 1 - u );
|
(*pIt)->myInitXYZ.SetCoord( iCoord, isForward ? u : 1 - u );
|
||||||
}
|
}
|
||||||
|
@ -325,14 +325,14 @@ void SMESHDS_SubMesh::Clear()
|
|||||||
|
|
||||||
int SMESHDS_SubMesh::getSize()
|
int SMESHDS_SubMesh::getSize()
|
||||||
{
|
{
|
||||||
int a = sizeof(myElements);
|
// int a = sizeof(myElements);
|
||||||
int b = sizeof(myNodes);
|
// 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::myNodes " << b << endl;
|
||||||
cerr << "SMESHDS_SubMesh::myElements " << a << endl;
|
// cerr << "SMESHDS_SubMesh::myElements " << a << endl;
|
||||||
return c+d;
|
return c+d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ libSMESHEngine_la_CPPFLAGS = \
|
|||||||
libSMESHEngine_la_LDFLAGS = \
|
libSMESHEngine_la_LDFLAGS = \
|
||||||
../../idl/libSalomeIDLSMESH.la \
|
../../idl/libSalomeIDLSMESH.la \
|
||||||
../SMESH/libSMESHimpl.la \
|
../SMESH/libSMESHimpl.la \
|
||||||
|
../SMDS/libSMDS.la \
|
||||||
../Controls/libSMESHControls.la \
|
../Controls/libSMESHControls.la \
|
||||||
$(KERNEL_LDFLAGS) \
|
$(KERNEL_LDFLAGS) \
|
||||||
-lSalomeContainer \
|
-lSalomeContainer \
|
||||||
|
@ -2983,7 +2983,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
const SMDS_PositionPtr pos = node->GetPosition();
|
const SMDS_PositionPtr pos = node->GetPosition();
|
||||||
if ( onFace ) { // on FACE
|
if ( onFace ) { // on FACE
|
||||||
const SMDS_FacePosition* fPos =
|
const SMDS_FacePosition* fPos =
|
||||||
dynamic_cast<const SMDS_FacePosition*>( pos.get() );
|
dynamic_cast<const SMDS_FacePosition*>( pos );
|
||||||
if ( fPos ) {
|
if ( fPos ) {
|
||||||
aUPos[ iNode ] = fPos->GetUParameter();
|
aUPos[ iNode ] = fPos->GetUParameter();
|
||||||
aVPos[ iNode ] = fPos->GetVParameter();
|
aVPos[ iNode ] = fPos->GetVParameter();
|
||||||
@ -2994,7 +2994,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
}
|
}
|
||||||
else { // on EDGE
|
else { // on EDGE
|
||||||
const SMDS_EdgePosition* ePos =
|
const SMDS_EdgePosition* ePos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( pos.get() );
|
dynamic_cast<const SMDS_EdgePosition*>( pos );
|
||||||
if ( ePos ) {
|
if ( ePos ) {
|
||||||
aUPos[ iNode ] = ePos->GetUParameter();
|
aUPos[ iNode ] = ePos->GetUParameter();
|
||||||
iNode++;
|
iNode++;
|
||||||
@ -3973,7 +3973,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
// not fixed bugs in SMDS_MeshInfo
|
// not fixed bugs in SMDS_MeshInfo
|
||||||
if ( aPos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
|
if ( aPos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
|
||||||
SMDS_FacePosition* fPos = const_cast<SMDS_FacePosition*>
|
SMDS_FacePosition* fPos = const_cast<SMDS_FacePosition*>
|
||||||
( static_cast<const SMDS_FacePosition*>( aPos.get() ));
|
( static_cast<const SMDS_FacePosition*>( aPos ));
|
||||||
fPos->SetUParameter( aUPos[ iNode ]);
|
fPos->SetUParameter( aUPos[ iNode ]);
|
||||||
fPos->SetVParameter( aVPos[ iNode ]);
|
fPos->SetVParameter( aVPos[ iNode ]);
|
||||||
}
|
}
|
||||||
@ -3982,7 +3982,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
// ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE );-- issue 20182
|
// ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE );-- issue 20182
|
||||||
if ( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE ) {
|
if ( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE ) {
|
||||||
SMDS_EdgePosition* fPos = const_cast<SMDS_EdgePosition*>
|
SMDS_EdgePosition* fPos = const_cast<SMDS_EdgePosition*>
|
||||||
( static_cast<const SMDS_EdgePosition*>( aPos.get() ));
|
( static_cast<const SMDS_EdgePosition*>( aPos ));
|
||||||
fPos->SetUParameter( aUPos[ iNode ]);
|
fPos->SetUParameter( aUPos[ iNode ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2949,15 +2949,15 @@ SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID)
|
|||||||
aNodePosition->shapeType = GEOM::EDGE;
|
aNodePosition->shapeType = GEOM::EDGE;
|
||||||
aNodePosition->params.length(1);
|
aNodePosition->params.length(1);
|
||||||
aNodePosition->params[0] =
|
aNodePosition->params[0] =
|
||||||
static_cast<SMDS_EdgePosition*>( pos.get() )->GetUParameter();
|
static_cast<SMDS_EdgePosition*>( pos )->GetUParameter();
|
||||||
break;
|
break;
|
||||||
case SMDS_TOP_FACE:
|
case SMDS_TOP_FACE:
|
||||||
aNodePosition->shapeType = GEOM::FACE;
|
aNodePosition->shapeType = GEOM::FACE;
|
||||||
aNodePosition->params.length(2);
|
aNodePosition->params.length(2);
|
||||||
aNodePosition->params[0] =
|
aNodePosition->params[0] =
|
||||||
static_cast<SMDS_FacePosition*>( pos.get() )->GetUParameter();
|
static_cast<SMDS_FacePosition*>( pos )->GetUParameter();
|
||||||
aNodePosition->params[1] =
|
aNodePosition->params[1] =
|
||||||
static_cast<SMDS_FacePosition*>( pos.get() )->GetVParameter();
|
static_cast<SMDS_FacePosition*>( pos )->GetVParameter();
|
||||||
break;
|
break;
|
||||||
case SMDS_TOP_VERTEX:
|
case SMDS_TOP_VERTEX:
|
||||||
aNodePosition->shapeType = GEOM::VERTEX;
|
aNodePosition->shapeType = GEOM::VERTEX;
|
||||||
|
@ -238,7 +238,7 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
|
|||||||
if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
|
if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
|
||||||
continue;
|
continue;
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
double u = epos->GetUParameter();
|
double u = epos->GetUParameter();
|
||||||
// paramSize is signed so orientation is taken into account
|
// paramSize is signed so orientation is taken into account
|
||||||
double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize;
|
double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize;
|
||||||
@ -288,7 +288,7 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
|
|||||||
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
|
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
|
||||||
}
|
}
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>(uvPt.node->GetPosition().get());
|
dynamic_cast<const SMDS_EdgePosition*>(uvPt.node->GetPosition());
|
||||||
if ( epos ) {
|
if ( epos ) {
|
||||||
uvPt.param = epos->GetUParameter();
|
uvPt.param = epos->GetUParameter();
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ inline bool isCloser(const int i, const int j, const int nbhoriz,
|
|||||||
static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int& I, int& J)
|
static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int& I, int& J)
|
||||||
{
|
{
|
||||||
const SMDS_FacePosition* fpos =
|
const SMDS_FacePosition* fpos =
|
||||||
static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_FacePosition*>(node->GetPosition());
|
||||||
if ( ! fpos ) return false;
|
if ( ! fpos ) return false;
|
||||||
gp_Pnt2d uv( fpos->GetUParameter(), fpos->GetVParameter() );
|
gp_Pnt2d uv( fpos->GetUParameter(), fpos->GetVParameter() );
|
||||||
|
|
||||||
@ -206,9 +206,9 @@ static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int&
|
|||||||
* -0. - shape and face mesh verification
|
* -0. - shape and face mesh verification
|
||||||
* -1. - identify faces and vertices of the "cube"
|
* -1. - identify faces and vertices of the "cube"
|
||||||
* -2. - Algorithm from:
|
* -2. - Algorithm from:
|
||||||
* "Application de l'interpolation transfinie à la création de maillages
|
* "Application de l'interpolation transfinie a la creation de maillages
|
||||||
* C0 ou G1 continus sur des triangles, quadrangles, tetraedres, pentaedres
|
* C0 ou G1 continus sur des triangles, quadrangles, tetraedres, pentaedres
|
||||||
* et hexaedres déformés."
|
* et hexaedres deformes."
|
||||||
* Alain PERONNET - 8 janvier 1999
|
* Alain PERONNET - 8 janvier 1999
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -408,6 +408,9 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int i1, j1, nbxyz = nbx * nby * nbz;
|
int i1, j1, nbxyz = nbx * nby * nbz;
|
||||||
Point3DStruct *np = new Point3DStruct[nbxyz];
|
Point3DStruct *np = new Point3DStruct[nbxyz];
|
||||||
|
|
||||||
|
aMesh.GetMeshDS()->incrementNodesCapacity(nbx * nby * nbz);
|
||||||
|
aMesh.GetMeshDS()->incrementCellsCapacity((nbx-1) * (nby-1) * (nbz-1));
|
||||||
|
|
||||||
// 1.9 - store node indexes of faces
|
// 1.9 - store node indexes of faces
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -511,7 +511,7 @@ static bool fixCommonVertexUV (R2 & theUV,
|
|||||||
if ( theCreateQuadratic && SMESH_MesherHelper::IsMedium( node, SMDSAbs_Edge ))
|
if ( theCreateQuadratic && SMESH_MesherHelper::IsMedium( node, SMDSAbs_Edge ))
|
||||||
continue;
|
continue;
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
double u = epos->GetUParameter();
|
double u = epos->GetUParameter();
|
||||||
if ( u < umin )
|
if ( u < umin )
|
||||||
umin = u;
|
umin = u;
|
||||||
|
@ -234,7 +234,7 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
//
|
//
|
||||||
if ( SMESH_Block::IsEdgeID (aSID)) {
|
if ( SMESH_Block::IsEdgeID (aSID)) {
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(aNode->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(aNode->GetPosition());
|
||||||
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
|
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1470,7 +1470,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
if(myTool->IsMedium(node))
|
if(myTool->IsMedium(node))
|
||||||
continue;
|
continue;
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
|
||||||
if ( !pos ) {
|
if ( !pos ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1493,7 +1493,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
if(myTool->IsMedium(node))
|
if(myTool->IsMedium(node))
|
||||||
continue;
|
continue;
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
|
||||||
if ( !pos ) {
|
if ( !pos ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1750,7 +1750,7 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1,
|
|||||||
while ( nIt->more() ) {
|
while ( nIt->more() ) {
|
||||||
const SMDS_MeshNode* node = nIt->next();
|
const SMDS_MeshNode* node = nIt->next();
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
pos2nodes.insert( make_pair( pos->GetUParameter(), node ));
|
pos2nodes.insert( make_pair( pos->GetUParameter(), node ));
|
||||||
}
|
}
|
||||||
if ( pos2nodes.size() != edgeSM->NbNodes() )
|
if ( pos2nodes.size() != edgeSM->NbNodes() )
|
||||||
|
@ -339,7 +339,7 @@ namespace {
|
|||||||
RETURN_BAD_RESULT("Bad node position type: node " << node->GetID() <<
|
RETURN_BAD_RESULT("Bad node position type: node " << node->GetID() <<
|
||||||
" pos type " << node->GetPosition()->GetTypeOfPosition());
|
" pos type " << node->GetPosition()->GetTypeOfPosition());
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
u2nodes.insert( make_pair( pos->GetUParameter(), node ));
|
u2nodes.insert( make_pair( pos->GetUParameter(), node ));
|
||||||
seamNodes.insert( node );
|
seamNodes.insert( node );
|
||||||
}
|
}
|
||||||
@ -644,7 +644,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
|
|||||||
}
|
}
|
||||||
case SMDS_TOP_EDGE: {
|
case SMDS_TOP_EDGE: {
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
pos2nodes.insert( make_pair( pos->GetUParameter(), node ));
|
pos2nodes.insert( make_pair( pos->GetUParameter(), node ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user