mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 10:44:17 +05:00
PR: debug autotests in progress, still 41 bugs
This commit is contained in:
parent
56c2e29961
commit
7eead70477
@ -971,6 +971,9 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
|
|||||||
for(MED::TInt iDim=0;iDim<aMeshDim;iDim++)
|
for(MED::TInt iDim=0;iDim<aMeshDim;iDim++)
|
||||||
aCoords[(int)iDim] = aMEDNodeCoord[(int)iDim];
|
aCoords[(int)iDim] = aMEDNodeCoord[(int)iDim];
|
||||||
aNode = myMesh->AddNodeWithID(aCoords[0],aCoords[1],aCoords[2],(int)iNode);
|
aNode = myMesh->AddNodeWithID(aCoords[0],aCoords[1],aCoords[2],(int)iNode);
|
||||||
|
if (!aNode) {
|
||||||
|
EXCEPTION(runtime_error,"buildMeshGrille Error. Node not created! "<<(int)iNode);
|
||||||
|
}
|
||||||
|
|
||||||
if((aGrilleInfo->myFamNumNode).size() > 0){
|
if((aGrilleInfo->myFamNumNode).size() > 0){
|
||||||
TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
|
TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
|
||||||
@ -1026,7 +1029,9 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!anElement) {
|
||||||
|
EXCEPTION(runtime_error,"buildMeshGrille Error. Element not created! "<<iCell);
|
||||||
|
}
|
||||||
if((aGrilleInfo->myFamNum).size() > 0){
|
if((aGrilleInfo->myFamNum).size() > 0){
|
||||||
TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
|
TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
|
||||||
if ( checkFamilyID ( aFamily, aFamNum )){
|
if ( checkFamilyID ( aFamily, aFamNum )){
|
||||||
|
@ -158,7 +158,7 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
|||||||
TElementLab aLabel = anElem->GetID();
|
TElementLab aLabel = anElem->GetID();
|
||||||
|
|
||||||
int aNbNodes = anElem->NbNodes();
|
int aNbNodes = anElem->NbNodes();
|
||||||
MESSAGE("aNbNodes="<<aNbNodes);
|
//MESSAGE("aNbNodes="<<aNbNodes);
|
||||||
SMDS_ElemIteratorPtr aNodesIter;
|
SMDS_ElemIteratorPtr aNodesIter;
|
||||||
aNodesIter = anElem->nodesIteratorToUNV();
|
aNodesIter = anElem->nodesIteratorToUNV();
|
||||||
if ( anElem->IsPoly() ) {
|
if ( anElem->IsPoly() ) {
|
||||||
|
@ -156,7 +156,7 @@ vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
|
|||||||
TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
|
TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
|
||||||
return i == myVTK2SMDSNodes.end() ? -1 : i->second;
|
return i == myVTK2SMDSNodes.end() ? -1 : i->second;
|
||||||
}
|
}
|
||||||
return theVTKID;
|
return this->GetMesh()->FindNodeVtk(theVTKID)->GetID();
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
|
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
|
||||||
@ -166,7 +166,7 @@ vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
|
|||||||
TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
|
TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
|
||||||
return i == mySMDS2VTKNodes.end() ? -1 : i->second;
|
return i == mySMDS2VTKNodes.end() ? -1 : i->second;
|
||||||
}
|
}
|
||||||
return theObjID;
|
return this->GetMesh()->FindNode(theObjID)->getVtkId();
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
|
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
|
||||||
@ -256,7 +256,7 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
|
|||||||
myVTK2SMDSElems.clear();
|
myVTK2SMDSElems.clear();
|
||||||
|
|
||||||
myGrid->SetPoints( 0 );
|
myGrid->SetPoints( 0 );
|
||||||
myGrid->SetCells( 0, 0, 0 );
|
myGrid->SetCells( 0, 0, 0, 0, 0 );
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ void SMESH_VisualObjDef::buildNodePrs()
|
|||||||
myGrid->SetPoints( aPoints );
|
myGrid->SetPoints( aPoints );
|
||||||
aPoints->Delete();
|
aPoints->Delete();
|
||||||
|
|
||||||
myGrid->SetCells( 0, 0, 0 );
|
myGrid->SetCells( 0, 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -612,8 +612,9 @@ SMESH_MeshObj::~SMESH_MeshObj()
|
|||||||
bool SMESH_MeshObj::Update( int theIsClear )
|
bool SMESH_MeshObj::Update( int theIsClear )
|
||||||
{
|
{
|
||||||
// Update SMDS_Mesh on client part
|
// Update SMDS_Mesh on client part
|
||||||
//MESSAGE("SMESH_MeshObj::Update " << this);
|
MESSAGE("SMESH_MeshObj::Update " << this);
|
||||||
if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) {
|
if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) {
|
||||||
|
MESSAGE("buildPrs");
|
||||||
buildPrs(); // Fill unstructured grid
|
buildPrs(); // Fill unstructured grid
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ using namespace std;
|
|||||||
SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
|
SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
|
||||||
const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
|
const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("********************************* SMDS_EdgePosition "<< aEdgeId << " " << myUParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -57,11 +58,13 @@ const double *SMDS_EdgePosition::Coords() const
|
|||||||
*/
|
*/
|
||||||
SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const
|
SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const
|
||||||
{
|
{
|
||||||
|
//MESSAGE("###################################### SMDS_EdgePosition::GetTypeOfPosition");
|
||||||
return SMDS_TOP_EDGE;
|
return SMDS_TOP_EDGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMDS_EdgePosition::SetUParameter(double aUparam)
|
void SMDS_EdgePosition::SetUParameter(double aUparam)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("############################### SMDS_EdgePosition::SetUParameter " << aUparam);
|
||||||
myUParameter = aUparam;
|
myUParameter = aUparam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,5 +75,6 @@ void SMDS_EdgePosition::SetUParameter(double aUparam)
|
|||||||
|
|
||||||
double SMDS_EdgePosition::GetUParameter() const
|
double SMDS_EdgePosition::GetUParameter() const
|
||||||
{
|
{
|
||||||
|
//MESSAGE("########################## SMDS_EdgePosition::GetUParameter " << myUParameter);
|
||||||
return myUParameter;
|
return myUParameter;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "SMDS_FaceOfEdges.hxx"
|
#include "SMDS_FaceOfEdges.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -111,6 +112,7 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
|
|||||||
const SMDS_MeshEdge* edge2,
|
const SMDS_MeshEdge* edge2,
|
||||||
const SMDS_MeshEdge* edge3)
|
const SMDS_MeshEdge* edge3)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("****************************************************** SMDS_FaceOfEdges");
|
||||||
myNbEdges = 3;
|
myNbEdges = 3;
|
||||||
myEdges[0]=edge1;
|
myEdges[0]=edge1;
|
||||||
myEdges[1]=edge2;
|
myEdges[1]=edge2;
|
||||||
@ -123,6 +125,7 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
|
|||||||
const SMDS_MeshEdge* edge3,
|
const SMDS_MeshEdge* edge3,
|
||||||
const SMDS_MeshEdge* edge4)
|
const SMDS_MeshEdge* edge4)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("****************************************************** SMDS_FaceOfEdges");
|
||||||
myNbEdges = 4;
|
myNbEdges = 4;
|
||||||
myEdges[0]=edge1;
|
myEdges[0]=edge1;
|
||||||
myEdges[1]=edge2;
|
myEdges[1]=edge2;
|
||||||
|
@ -133,6 +133,7 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
|
|||||||
const SMDS_MeshNode* node2,
|
const SMDS_MeshNode* node2,
|
||||||
const SMDS_MeshNode* node3)
|
const SMDS_MeshNode* node3)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************************* SMDS_FaceOfNodes");
|
||||||
myNbNodes = 3;
|
myNbNodes = 3;
|
||||||
myNodes[0]=node1;
|
myNodes[0]=node1;
|
||||||
myNodes[1]=node2;
|
myNodes[1]=node2;
|
||||||
@ -145,6 +146,7 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
|
|||||||
const SMDS_MeshNode* node3,
|
const SMDS_MeshNode* node3,
|
||||||
const SMDS_MeshNode* node4)
|
const SMDS_MeshNode* node4)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************************* SMDS_FaceOfNodes");
|
||||||
myNbNodes = 4;
|
myNbNodes = 4;
|
||||||
myNodes[0]=node1;
|
myNodes[0]=node1;
|
||||||
myNodes[1]=node2;
|
myNodes[1]=node2;
|
||||||
|
@ -42,6 +42,7 @@ SMDS_FacePosition::SMDS_FacePosition(const int aEdgeId,
|
|||||||
:SMDS_Position(aEdgeId),
|
:SMDS_Position(aEdgeId),
|
||||||
myUParameter(aUParam),myVParameter(aVParam)
|
myUParameter(aUParam),myVParameter(aVParam)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************************** SMDS_FacePosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -112,10 +112,10 @@ SMDS_ElemIteratorPtr SMDS_LinearEdge::elementsIterator(SMDSAbs_ElementType type)
|
|||||||
|
|
||||||
bool operator<(const SMDS_LinearEdge & e1, const SMDS_LinearEdge & e2)
|
bool operator<(const SMDS_LinearEdge & e1, const SMDS_LinearEdge & e2)
|
||||||
{
|
{
|
||||||
int id11 = e1.myNodes[0]->GetID();
|
int id11 = e1.myNodes[0]->getVtkId();
|
||||||
int id21 = e2.myNodes[0]->GetID();
|
int id21 = e2.myNodes[0]->getVtkId();
|
||||||
int id12 = e1.myNodes[1]->GetID();
|
int id12 = e1.myNodes[1]->getVtkId();
|
||||||
int id22 = e2.myNodes[1]->GetID();
|
int id22 = e2.myNodes[1]->getVtkId();
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
if (id11 >= id12)
|
if (id11 >= id12)
|
||||||
|
@ -145,8 +145,8 @@ SMDS_Mesh::SMDS_Mesh()
|
|||||||
|
|
||||||
myNodes.clear();
|
myNodes.clear();
|
||||||
myCells.clear();
|
myCells.clear();
|
||||||
myIDElements.clear();
|
myCellIdSmdsToVtk.clear();
|
||||||
myVtkIndex.clear();
|
myCellIdVtkToSmds.clear();
|
||||||
myGrid = SMDS_UnstructuredGrid::New();
|
myGrid = SMDS_UnstructuredGrid::New();
|
||||||
myGrid->setSMDS_mesh(this);
|
myGrid->setSMDS_mesh(this);
|
||||||
myGrid->Initialize();
|
myGrid->Initialize();
|
||||||
@ -207,15 +207,19 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID)
|
|||||||
// find the MeshNode corresponding to ID
|
// find the MeshNode corresponding to 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();
|
// TODO ID < 1
|
||||||
//SMDS_MeshNode * node=new SMDS_MeshNode(ID, myMeshId, -1, x, y, z);
|
if (ID <= 0)
|
||||||
|
{
|
||||||
|
MESSAGE("=============> Bad Node Id: " << ID);
|
||||||
|
ID = myNodeIDFactory->GetFreeID();
|
||||||
|
}
|
||||||
myNodeIDFactory->adjustMaxId(ID);
|
myNodeIDFactory->adjustMaxId(ID);
|
||||||
SMDS_MeshNode * node = myNodePool->getNew();
|
SMDS_MeshNode * node = myNodePool->getNew();
|
||||||
node->init(ID, myMeshId, -1, x, y, z);
|
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);
|
||||||
//MESSAGE(" ------------------ myNodes resize " << ID << " --> " << ID+SMDS_Mesh::chunkSize);
|
MESSAGE(" ------------------ myNodes resize " << ID << " --> " << ID+SMDS_Mesh::chunkSize);
|
||||||
}
|
}
|
||||||
myNodes[ID] = node;
|
myNodes[ID] = node;
|
||||||
myNodeIDFactory->BindID(ID,node);
|
myNodeIDFactory->BindID(ID,node);
|
||||||
@ -315,8 +319,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retreive nodes ID
|
// --- retreive nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
||||||
edgevtk->init(nodeIds, this);
|
edgevtk->init(nodeIds, this);
|
||||||
@ -598,10 +602,10 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n3->getId()); // order SMDS-->VTK
|
nodeIds.push_back(n3->getVtkId()); // order SMDS-->VTK
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -705,11 +709,11 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -818,12 +822,12 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getVtkId());
|
||||||
nodeIds.push_back(n6->getId());
|
nodeIds.push_back(n6->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -944,14 +948,14 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getVtkId());
|
||||||
nodeIds.push_back(n8->getId());
|
nodeIds.push_back(n8->getVtkId());
|
||||||
nodeIds.push_back(n7->getId());
|
nodeIds.push_back(n7->getVtkId());
|
||||||
nodeIds.push_back(n6->getId());
|
nodeIds.push_back(n6->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -1158,7 +1162,7 @@ SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID
|
|||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
||||||
for ( ; it != nodes.end(); ++it)
|
for ( ; it != nodes.end(); ++it)
|
||||||
nodeIds.push_back((*it)->getId());
|
nodeIds.push_back((*it)->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
facevtk->initPoly(nodeIds, this);
|
facevtk->initPoly(nodeIds, this);
|
||||||
@ -1253,7 +1257,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID
|
|||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
||||||
for (; it != nodes.end(); ++it)
|
for (; it != nodes.end(); ++it)
|
||||||
nodeIds.push_back((*it)->getId());
|
nodeIds.push_back((*it)->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->initPoly(nodeIds, quantities, this);
|
volvtk->initPoly(nodeIds, quantities, this);
|
||||||
@ -1307,9 +1311,9 @@ 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 ((ID < myIDElements.size()) && myIDElements[ID] >= 0) // --- already bound
|
if ((ID < myCellIdSmdsToVtk.size()) && myCellIdSmdsToVtk[ID] >= 0) // --- already bound
|
||||||
{
|
{
|
||||||
MESSAGE(" --------------------------------- already bound "<< ID << " " << myIDElements[ID]);
|
MESSAGE(" --------------------------------- already bound "<< ID << " " << myCellIdSmdsToVtk[ID]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1322,32 +1326,32 @@ bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
|
|||||||
if (vtkId == -1)
|
if (vtkId == -1)
|
||||||
vtkId = myElementIDFactory->SetInVtkGrid(element);
|
vtkId = myElementIDFactory->SetInVtkGrid(element);
|
||||||
|
|
||||||
if (ID >= myIDElements.size()) // --- resize local vector
|
if (ID >= myCellIdSmdsToVtk.size()) // --- resize local vector
|
||||||
{
|
{
|
||||||
MESSAGE(" ------------------- resize myIDElements " << ID << " --> " << ID + SMDS_Mesh::chunkSize);
|
MESSAGE(" ------------------- resize myCellIdSmdsToVtk " << ID << " --> " << ID + SMDS_Mesh::chunkSize);
|
||||||
myIDElements.resize(ID + SMDS_Mesh::chunkSize, -1); // fill new elements with -1
|
myCellIdSmdsToVtk.resize(ID + SMDS_Mesh::chunkSize, -1); // fill new elements with -1
|
||||||
}
|
}
|
||||||
|
|
||||||
myIDElements[ID] = vtkId;
|
myCellIdSmdsToVtk[ID] = vtkId;
|
||||||
//MESSAGE("smds:" << ID << " vtk:" << vtkId );
|
//MESSAGE("smds:" << ID << " vtk:" << vtkId );
|
||||||
|
|
||||||
if (vtkId >= myVtkIndex.size()) // --- resize local vector
|
if (vtkId >= myCellIdVtkToSmds.size()) // --- resize local vector
|
||||||
{
|
{
|
||||||
MESSAGE(" --------------------- resize myVtkIndex " << vtkId << " --> " << vtkId + SMDS_Mesh::chunkSize);
|
MESSAGE(" --------------------- resize myCellIdVtkToSmds " << vtkId << " --> " << vtkId + SMDS_Mesh::chunkSize);
|
||||||
myVtkIndex.resize(vtkId + SMDS_Mesh::chunkSize, -1);
|
myCellIdVtkToSmds.resize(vtkId + SMDS_Mesh::chunkSize, -1);
|
||||||
}
|
}
|
||||||
myVtkIndex[vtkId] = ID;
|
myCellIdVtkToSmds[vtkId] = ID;
|
||||||
|
|
||||||
myElementIDFactory->updateMinMax(ID);
|
myElementIDFactory->updateMinMax(ID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Return the node whose ID is 'ID'.
|
/// Return the node whose SMDS ID is 'ID'.
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const
|
const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const
|
||||||
{
|
{
|
||||||
if (ID < 0 || ID >= myNodes.size())
|
if (ID < 1 || ID >= myNodes.size())
|
||||||
{
|
{
|
||||||
MESSAGE("------------------------------------------------------------------------- ");
|
MESSAGE("------------------------------------------------------------------------- ");
|
||||||
MESSAGE("----------------------------------- bad ID " << ID << " " << myNodes.size());
|
MESSAGE("----------------------------------- bad ID " << ID << " " << myNodes.size());
|
||||||
@ -1357,6 +1361,22 @@ const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const
|
|||||||
return (const SMDS_MeshNode *)myNodes[ID];
|
return (const SMDS_MeshNode *)myNodes[ID];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Return the node whose VTK ID is 'vtkId'.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
const SMDS_MeshNode * SMDS_Mesh::FindNodeVtk(int vtkId) const
|
||||||
|
{
|
||||||
|
// TODO if needed use mesh->nodeIdFromVtkToSmds
|
||||||
|
if (vtkId < 0 || vtkId >= (myNodes.size() -1))
|
||||||
|
{
|
||||||
|
MESSAGE("------------------------------------------------------------------------- ");
|
||||||
|
MESSAGE("---------------------------- bad VTK ID " << vtkId << " " << myNodes.size());
|
||||||
|
MESSAGE("------------------------------------------------------------------------- ");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (const SMDS_MeshNode *)myNodes[vtkId+1];
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///Create a triangle and add it to the current mesh. This method do not bind an
|
///Create a triangle and add it to the current mesh. This method do not bind an
|
||||||
///ID to the create triangle.
|
///ID to the create triangle.
|
||||||
@ -1387,9 +1407,9 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(node1->getId());
|
nodeIds.push_back(node1->getVtkId());
|
||||||
nodeIds.push_back(node2->getId());
|
nodeIds.push_back(node2->getVtkId());
|
||||||
nodeIds.push_back(node3->getId());
|
nodeIds.push_back(node3->getVtkId());
|
||||||
|
|
||||||
SMDS_MeshFace * face = 0;
|
SMDS_MeshFace * face = 0;
|
||||||
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
@ -1441,10 +1461,10 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(node1->getId());
|
nodeIds.push_back(node1->getVtkId());
|
||||||
nodeIds.push_back(node2->getId());
|
nodeIds.push_back(node2->getVtkId());
|
||||||
nodeIds.push_back(node3->getId());
|
nodeIds.push_back(node3->getVtkId());
|
||||||
nodeIds.push_back(node4->getId());
|
nodeIds.push_back(node4->getVtkId());
|
||||||
|
|
||||||
SMDS_MeshFace * face = 0;
|
SMDS_MeshFace * face = 0;
|
||||||
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
@ -1561,13 +1581,16 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element,
|
|||||||
set<const SMDS_MeshElement*> oldNodes;
|
set<const SMDS_MeshElement*> oldNodes;
|
||||||
SMDS_ElemIteratorPtr itn = element->nodesIterator();
|
SMDS_ElemIteratorPtr itn = element->nodesIterator();
|
||||||
while(itn->more())
|
while(itn->more())
|
||||||
oldNodes.insert( itn->next() );
|
oldNodes.insert(itn->next());
|
||||||
|
|
||||||
// change nodes
|
// change nodes
|
||||||
bool Ok = false;
|
bool Ok = false;
|
||||||
SMDS_MeshCell* cell = dynamic_cast<SMDS_MeshCell*>((SMDS_MeshElement*) element);
|
SMDS_MeshCell* cell = dynamic_cast<SMDS_MeshCell*>((SMDS_MeshElement*) element);
|
||||||
if (cell)
|
if (cell)
|
||||||
|
{
|
||||||
|
Ok = cell->vtkOrder(nodes, nbnodes);
|
||||||
Ok = cell->ChangeNodes(nodes, nbnodes);
|
Ok = cell->ChangeNodes(nodes, nbnodes);
|
||||||
|
}
|
||||||
|
|
||||||
if ( Ok ) { // update InverseElements
|
if ( Ok ) { // update InverseElements
|
||||||
|
|
||||||
@ -1752,8 +1775,8 @@ SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
|
|||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(node1->getId());
|
nodeIds.push_back(node1->getVtkId());
|
||||||
nodeIds.push_back(node2->getId());
|
nodeIds.push_back(node2->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
||||||
edgevtk->init(nodeIds, this);
|
edgevtk->init(nodeIds, this);
|
||||||
@ -2045,7 +2068,7 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace(const SMDS_MeshNode *node1,
|
|||||||
|
|
||||||
const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
|
const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
|
||||||
{
|
{
|
||||||
if ((IDelem < 0) || IDelem >= myCells.size())
|
if ((IDelem <= 0) || IDelem >= myCells.size())
|
||||||
{
|
{
|
||||||
MESSAGE("--------------------------------------------------------------------------------- ");
|
MESSAGE("--------------------------------------------------------------------------------- ");
|
||||||
MESSAGE("----------------------------------- bad IDelem " << IDelem << " " << myCells.size());
|
MESSAGE("----------------------------------- bad IDelem " << IDelem << " " << myCells.size());
|
||||||
@ -2348,6 +2371,7 @@ SMDS_Mesh::~SMDS_Mesh()
|
|||||||
|
|
||||||
void SMDS_Mesh::Clear()
|
void SMDS_Mesh::Clear()
|
||||||
{
|
{
|
||||||
|
MESSAGE("SMDS_Mesh::Clear");
|
||||||
if (myParent!=NULL)
|
if (myParent!=NULL)
|
||||||
{
|
{
|
||||||
SMDS_ElemIteratorPtr eIt = elementsIterator();
|
SMDS_ElemIteratorPtr eIt = elementsIterator();
|
||||||
@ -2387,6 +2411,8 @@ void SMDS_Mesh::Clear()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
myCells.clear();
|
myCells.clear();
|
||||||
|
myCellIdVtkToSmds.clear();
|
||||||
|
myCellIdSmdsToVtk.clear();
|
||||||
|
|
||||||
SMDS_NodeIteratorPtr itn = nodesIterator();
|
SMDS_NodeIteratorPtr itn = nodesIterator();
|
||||||
while (itn->more())
|
while (itn->more())
|
||||||
@ -2514,6 +2540,13 @@ struct MYElem_Map_Iterator: public FATHER
|
|||||||
{
|
{
|
||||||
_ctr = 0;
|
_ctr = 0;
|
||||||
_type = typ;
|
_type = typ;
|
||||||
|
while (_ctr < _map.size()) // go to the first valid element
|
||||||
|
{
|
||||||
|
if (_map[_ctr])
|
||||||
|
if ( (_type == SMDSAbs_All) || (_map[_ctr]->GetType() == _type))
|
||||||
|
break;
|
||||||
|
_ctr++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool more()
|
bool more()
|
||||||
@ -2831,7 +2864,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
list<const SMDS_MeshElement *>& removedNodes,
|
list<const SMDS_MeshElement *>& removedNodes,
|
||||||
bool removenodes)
|
bool removenodes)
|
||||||
{
|
{
|
||||||
//MESSAGE("SMDS_Mesh::RemoveElement " << elem->GetID() << " " << removenodes);
|
//MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
|
||||||
// get finite elements built on elem
|
// get finite elements built on elem
|
||||||
set<const SMDS_MeshElement*> * s1;
|
set<const SMDS_MeshElement*> * s1;
|
||||||
if (elem->GetType() == SMDSAbs_0DElement || elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges()
|
if (elem->GetType() == SMDSAbs_0DElement || elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges()
|
||||||
@ -2984,6 +3017,7 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
|||||||
SMDSAbs_ElementType aType = elem->GetType();
|
SMDSAbs_ElementType aType = elem->GetType();
|
||||||
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
|
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
|
||||||
if (aType == SMDSAbs_Node) {
|
if (aType == SMDSAbs_Node) {
|
||||||
|
//MESSAGE("Remove free node " << elemId);
|
||||||
// only free node can be removed by this method
|
// only free node can be removed by this method
|
||||||
const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
|
const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
|
||||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||||
@ -2998,6 +3032,7 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
|||||||
// this methods is only for meshes without descendants
|
// this methods is only for meshes without descendants
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//MESSAGE("Remove free element " << elemId);
|
||||||
int vtkid = this->fromSmdsToVtk(elemId);
|
int vtkid = this->fromSmdsToVtk(elemId);
|
||||||
|
|
||||||
// Remove element from <InverseElements> of its nodes
|
// Remove element from <InverseElements> of its nodes
|
||||||
@ -3221,9 +3256,9 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
|
|
||||||
SMDS_MeshEdge * edge = 0;
|
SMDS_MeshEdge * edge = 0;
|
||||||
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
||||||
@ -3302,12 +3337,12 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
nodeIds.push_back(n23->getId());
|
nodeIds.push_back(n23->getVtkId());
|
||||||
nodeIds.push_back(n31->getId());
|
nodeIds.push_back(n31->getVtkId());
|
||||||
|
|
||||||
SMDS_MeshFace * face = 0;
|
SMDS_MeshFace * face = 0;
|
||||||
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
@ -3392,14 +3427,14 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
nodeIds.push_back(n23->getId());
|
nodeIds.push_back(n23->getVtkId());
|
||||||
nodeIds.push_back(n34->getId());
|
nodeIds.push_back(n34->getVtkId());
|
||||||
nodeIds.push_back(n41->getId());
|
nodeIds.push_back(n41->getVtkId());
|
||||||
|
|
||||||
SMDS_MeshFace * face = 0;
|
SMDS_MeshFace * face = 0;
|
||||||
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
@ -3493,18 +3528,18 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n31->getId());
|
nodeIds.push_back(n31->getVtkId());
|
||||||
nodeIds.push_back(n23->getId());
|
nodeIds.push_back(n23->getVtkId());
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n14->getId());
|
nodeIds.push_back(n14->getVtkId());
|
||||||
nodeIds.push_back(n34->getId());
|
nodeIds.push_back(n34->getVtkId());
|
||||||
nodeIds.push_back(n24->getId());
|
nodeIds.push_back(n24->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -3606,21 +3641,21 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n41->getId());
|
nodeIds.push_back(n41->getVtkId());
|
||||||
nodeIds.push_back(n34->getId());
|
nodeIds.push_back(n34->getVtkId());
|
||||||
nodeIds.push_back(n23->getId());
|
nodeIds.push_back(n23->getVtkId());
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n15->getId());
|
nodeIds.push_back(n15->getVtkId());
|
||||||
nodeIds.push_back(n45->getId());
|
nodeIds.push_back(n45->getVtkId());
|
||||||
nodeIds.push_back(n35->getId());
|
nodeIds.push_back(n35->getVtkId());
|
||||||
nodeIds.push_back(n25->getId());
|
nodeIds.push_back(n25->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -3730,25 +3765,25 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getVtkId());
|
||||||
nodeIds.push_back(n6->getId());
|
nodeIds.push_back(n6->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
nodeIds.push_back(n23->getId());
|
nodeIds.push_back(n23->getVtkId());
|
||||||
nodeIds.push_back(n31->getId());
|
nodeIds.push_back(n31->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n45->getId());
|
nodeIds.push_back(n45->getVtkId());
|
||||||
nodeIds.push_back(n56->getId());
|
nodeIds.push_back(n56->getVtkId());
|
||||||
nodeIds.push_back(n64->getId());
|
nodeIds.push_back(n64->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n14->getId());
|
nodeIds.push_back(n14->getVtkId());
|
||||||
nodeIds.push_back(n25->getId());
|
nodeIds.push_back(n25->getVtkId());
|
||||||
nodeIds.push_back(n36->getId());
|
nodeIds.push_back(n36->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -3873,30 +3908,30 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getVtkId());
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getVtkId());
|
||||||
nodeIds.push_back(n3->getId());
|
nodeIds.push_back(n3->getVtkId());
|
||||||
nodeIds.push_back(n2->getId());
|
nodeIds.push_back(n2->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getVtkId());
|
||||||
nodeIds.push_back(n8->getId());
|
nodeIds.push_back(n8->getVtkId());
|
||||||
nodeIds.push_back(n7->getId());
|
nodeIds.push_back(n7->getVtkId());
|
||||||
nodeIds.push_back(n6->getId());
|
nodeIds.push_back(n6->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n41->getId());
|
nodeIds.push_back(n41->getVtkId());
|
||||||
nodeIds.push_back(n34->getId());
|
nodeIds.push_back(n34->getVtkId());
|
||||||
nodeIds.push_back(n23->getId());
|
nodeIds.push_back(n23->getVtkId());
|
||||||
nodeIds.push_back(n12->getId());
|
nodeIds.push_back(n12->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n85->getId());
|
nodeIds.push_back(n85->getVtkId());
|
||||||
nodeIds.push_back(n78->getId());
|
nodeIds.push_back(n78->getVtkId());
|
||||||
nodeIds.push_back(n67->getId());
|
nodeIds.push_back(n67->getVtkId());
|
||||||
nodeIds.push_back(n56->getId());
|
nodeIds.push_back(n56->getVtkId());
|
||||||
|
|
||||||
nodeIds.push_back(n15->getId());
|
nodeIds.push_back(n15->getVtkId());
|
||||||
nodeIds.push_back(n48->getId());
|
nodeIds.push_back(n48->getVtkId());
|
||||||
nodeIds.push_back(n37->getId());
|
nodeIds.push_back(n37->getVtkId());
|
||||||
nodeIds.push_back(n26->getId());
|
nodeIds.push_back(n26->getVtkId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -3934,9 +3969,9 @@ void SMDS_Mesh::updateNodeMinMax()
|
|||||||
|
|
||||||
void SMDS_Mesh::incrementNodesCapacity(int nbNodes)
|
void SMDS_Mesh::incrementNodesCapacity(int nbNodes)
|
||||||
{
|
{
|
||||||
int val = myIDElements.size();
|
int val = myCellIdSmdsToVtk.size();
|
||||||
MESSAGE(" ------------------- resize myIDElements " << val << " --> " << val + nbNodes);
|
MESSAGE(" ------------------- resize myCellIdSmdsToVtk " << val << " --> " << val + nbNodes);
|
||||||
myIDElements.resize(val + nbNodes, -1); // fill new elements with -1
|
myCellIdSmdsToVtk.resize(val + nbNodes, -1); // fill new elements with -1
|
||||||
val = myNodes.size();
|
val = myNodes.size();
|
||||||
MESSAGE(" ------------------- resize myNodes " << val << " --> " << val + nbNodes);
|
MESSAGE(" ------------------- resize myNodes " << val << " --> " << val + nbNodes);
|
||||||
myNodes.resize(val +nbNodes, 0);
|
myNodes.resize(val +nbNodes, 0);
|
||||||
@ -3944,9 +3979,9 @@ void SMDS_Mesh::incrementNodesCapacity(int nbNodes)
|
|||||||
|
|
||||||
void SMDS_Mesh::incrementCellsCapacity(int nbCells)
|
void SMDS_Mesh::incrementCellsCapacity(int nbCells)
|
||||||
{
|
{
|
||||||
int val = myVtkIndex.size();
|
int val = myCellIdVtkToSmds.size();
|
||||||
MESSAGE(" ------------------- resize myVtkIndex " << val << " --> " << val + nbCells);
|
MESSAGE(" ------------------- resize myCellIdVtkToSmds " << val << " --> " << val + nbCells);
|
||||||
myVtkIndex.resize(val + nbCells, -1); // fill new elements with -1
|
myCellIdVtkToSmds.resize(val + nbCells, -1); // fill new elements with -1
|
||||||
val = myCells.size();
|
val = myCells.size();
|
||||||
MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
|
MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
|
||||||
myNodes.resize(val +nbCells, 0);
|
myNodes.resize(val +nbCells, 0);
|
||||||
@ -3954,7 +3989,7 @@ void SMDS_Mesh::incrementCellsCapacity(int nbCells)
|
|||||||
|
|
||||||
void SMDS_Mesh::adjustStructure()
|
void SMDS_Mesh::adjustStructure()
|
||||||
{
|
{
|
||||||
myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID()+1);
|
myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMDS_Mesh::dumpGrid(string ficdump)
|
void SMDS_Mesh::dumpGrid(string ficdump)
|
||||||
@ -4012,3 +4047,17 @@ void SMDS_Mesh::compactMesh()
|
|||||||
{
|
{
|
||||||
MESSAGE("SMDS_Mesh::compactMesh do nothing!");
|
MESSAGE("SMDS_Mesh::compactMesh do nothing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SMDS_Mesh::fromVtkToSmds(int vtkid)
|
||||||
|
{
|
||||||
|
if (vtkid >= 0 && vtkid < myCellIdVtkToSmds.size())
|
||||||
|
return myCellIdVtkToSmds[vtkid];
|
||||||
|
throw SALOME_Exception(LOCALIZED ("vtk id out of bounds"));
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_Mesh::fromSmdsToVtk(int smdsid)
|
||||||
|
{
|
||||||
|
if (smdsid >= 0 && smdsid < myCellIdSmdsToVtk.size())
|
||||||
|
return myCellIdSmdsToVtk[smdsid];
|
||||||
|
throw SALOME_Exception(LOCALIZED ("smds id out of bounds"));
|
||||||
|
}
|
||||||
|
@ -475,6 +475,7 @@ public:
|
|||||||
virtual void compactMesh();
|
virtual void compactMesh();
|
||||||
|
|
||||||
const SMDS_MeshNode *FindNode(int idnode) const;
|
const SMDS_MeshNode *FindNode(int idnode) const;
|
||||||
|
const SMDS_MeshNode *FindNodeVtk(int idnode) const;
|
||||||
const SMDS_Mesh0DElement* Find0DElement(int idnode) const;
|
const SMDS_Mesh0DElement* Find0DElement(int idnode) const;
|
||||||
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
|
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
|
||||||
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
|
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
|
||||||
@ -567,8 +568,8 @@ public:
|
|||||||
typedef std::vector<SMDS_MeshCell *> SetOfCells;
|
typedef std::vector<SMDS_MeshCell *> SetOfCells;
|
||||||
|
|
||||||
void updateNodeMinMax();
|
void updateNodeMinMax();
|
||||||
inline int fromVtkToSmds(int vtkid) { MYASSERT(vtkid>=0); return myVtkIndex[vtkid]; };
|
int fromVtkToSmds(int vtkid);
|
||||||
inline int fromSmdsToVtk(int smdsid) { MYASSERT(smdsid>=0); return myIDElements[smdsid]; };
|
int fromSmdsToVtk(int smdsid);
|
||||||
|
|
||||||
void incrementNodesCapacity(int nbNodes);
|
void incrementNodesCapacity(int nbNodes);
|
||||||
void incrementCellsCapacity(int nbCells);
|
void incrementCellsCapacity(int nbCells);
|
||||||
@ -636,10 +637,10 @@ protected:
|
|||||||
SetOfCells myCells;
|
SetOfCells myCells;
|
||||||
|
|
||||||
//! for cells only: index = ID for SMDS users, value = ID in vtkUnstructuredGrid
|
//! for cells only: index = ID for SMDS users, value = ID in vtkUnstructuredGrid
|
||||||
std::vector<int> myIDElements;
|
std::vector<int> myCellIdSmdsToVtk;
|
||||||
|
|
||||||
//! for cells only: index = ID in vtkUnstructuredGrid, value = ID for SMDS users
|
//! for cells only: index = ID in vtkUnstructuredGrid, value = ID for SMDS users
|
||||||
std::vector<int> myVtkIndex;
|
std::vector<int> myCellIdVtkToSmds;
|
||||||
|
|
||||||
SMDS_Mesh * myParent;
|
SMDS_Mesh * myParent;
|
||||||
std::list<SMDS_Mesh *> myChildren;
|
std::list<SMDS_Mesh *> myChildren;
|
||||||
|
@ -131,8 +131,8 @@ SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType t
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
|
bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
|
||||||
{
|
{
|
||||||
int id1 = e1.myNode->GetID();
|
int id1 = e1.myNode->getVtkId();
|
||||||
int id2 = e2.myNode->GetID();
|
int id2 = e2.myNode->getVtkId();
|
||||||
|
|
||||||
return (id1 < id2);
|
return (id1 < id2);
|
||||||
}
|
}
|
||||||
|
@ -14,20 +14,17 @@ public:
|
|||||||
virtual ~SMDS_MeshCell();
|
virtual ~SMDS_MeshCell();
|
||||||
|
|
||||||
virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)= 0;
|
virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)= 0;
|
||||||
|
virtual bool vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes) {return true; };
|
||||||
inline void setVtkId(int vtkId)
|
|
||||||
{
|
|
||||||
myVtkID = vtkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int getVtkId() const
|
|
||||||
{
|
|
||||||
return myVtkID;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int nbCells;
|
static int nbCells;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int myVtkID;
|
inline void exchange(const SMDS_MeshNode* nodes[],int a, int b)
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode* noda = nodes[a];
|
||||||
|
nodes[a] = nodes[b];
|
||||||
|
nodes[b] = noda;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,14 +182,6 @@ SMDS_ElemIteratorPtr SMDS_MeshElement::interlacedNodesElemIterator() const
|
|||||||
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
///Return the ID of the element
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
int SMDS_MeshElement::GetID() const
|
|
||||||
{
|
|
||||||
return myID;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator<(const SMDS_MeshElement& e1, const SMDS_MeshElement& e2)
|
bool operator<(const SMDS_MeshElement& e1, const SMDS_MeshElement& e2)
|
||||||
{
|
{
|
||||||
if(e1.GetType()!=e2.GetType()) return false;
|
if(e1.GetType()!=e2.GetType()) return false;
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
virtual int NbNodes() const;
|
virtual int NbNodes() const;
|
||||||
virtual int NbEdges() const;
|
virtual int NbEdges() const;
|
||||||
virtual int NbFaces() const;
|
virtual int NbFaces() const;
|
||||||
int GetID() const;
|
inline int GetID() const { return myID; };
|
||||||
|
|
||||||
///Return the type of the current element
|
///Return the type of the current element
|
||||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||||
@ -137,13 +137,23 @@ 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 ShortType getMeshId() const {return myMeshId; };
|
inline ShortType getMeshId() const {return myMeshId; };
|
||||||
inline ShortType getshapeId() const {return myShapeId; };
|
inline ShortType getshapeId() const {return myShapeId; };
|
||||||
inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
|
inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
|
||||||
inline int getIdInShape() const { return myIdInShape; };
|
inline int getIdInShape() const { return myIdInShape; };
|
||||||
inline void setIdInShape(int id) { myIdInShape = id; };
|
inline void setIdInShape(int id) { myIdInShape = id; };
|
||||||
|
|
||||||
|
inline void setVtkId(int vtkId)
|
||||||
|
{
|
||||||
|
myVtkID = vtkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int getVtkId() const
|
||||||
|
{
|
||||||
|
return myVtkID;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void setId(int id) {myID = id; };
|
inline void setId(int id) {myID = id; };
|
||||||
SMDS_MeshElement(int ID=-1);
|
SMDS_MeshElement(int ID=-1);
|
||||||
@ -153,6 +163,9 @@ protected:
|
|||||||
//! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
|
//! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
|
||||||
int myID;
|
int myID;
|
||||||
|
|
||||||
|
// index in vtkUnstructuredGrid
|
||||||
|
int myVtkID;
|
||||||
|
|
||||||
//! SMDS_Mesh identification in SMESH
|
//! SMDS_Mesh identification in SMESH
|
||||||
ShortType myMeshId;
|
ShortType myMeshId;
|
||||||
|
|
||||||
|
@ -81,12 +81,14 @@ int SMDS_MeshElementIDFactory::SetInVtkGrid(SMDS_MeshElement * elem)
|
|||||||
{
|
{
|
||||||
// --- retrieve nodes ID
|
// --- retrieve nodes ID
|
||||||
|
|
||||||
|
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
|
||||||
|
assert(cell);
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
SMDS_ElemIteratorPtr it = elem->nodesIterator();
|
SMDS_ElemIteratorPtr it = elem->nodesIterator();
|
||||||
while(it->more())
|
while(it->more())
|
||||||
{
|
{
|
||||||
int nodeId = it->next()->GetID();
|
int nodeId = (static_cast<const SMDS_MeshNode*>(it->next()))->getVtkId();
|
||||||
//MESSAGE(" node in cell " << ID << " : " <<nodeId)
|
MESSAGE(" node in cell " << cell->getVtkId() << " : " << nodeId)
|
||||||
nodeIds.push_back(nodeId);
|
nodeIds.push_back(nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +97,6 @@ int SMDS_MeshElementIDFactory::SetInVtkGrid(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]);
|
||||||
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
|
|
||||||
assert(cell);
|
|
||||||
cell->setVtkId(cellId);
|
cell->setVtkId(cellId);
|
||||||
//MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId);
|
//MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId);
|
||||||
return cellId;
|
return cellId;
|
||||||
@ -120,7 +120,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) || (myMesh->myIDElements[ID]<0))
|
if ((ID<1) || (ID>myMax) || (myMesh->myCellIdSmdsToVtk[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);
|
||||||
@ -132,17 +132,17 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
|
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
|
||||||
{
|
{
|
||||||
if (ID < 0)
|
if (ID < 1)
|
||||||
{
|
{
|
||||||
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID ID = " << ID);
|
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID ID = " << ID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int vtkId = myMesh->myIDElements[ID];
|
int vtkId = myMesh->myCellIdSmdsToVtk[ID];
|
||||||
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId);
|
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId);
|
||||||
if (ID >=0)
|
if (ID >=0)
|
||||||
{
|
{
|
||||||
myMesh->myIDElements[ID] = -1;
|
myMesh->myCellIdSmdsToVtk[ID] = -1;
|
||||||
myMesh->myVtkIndex[vtkId] = -1;
|
myMesh->myCellIdVtkToSmds[vtkId] = -1;
|
||||||
}
|
}
|
||||||
SMDS_MeshIDFactory::ReleaseID(ID);
|
SMDS_MeshIDFactory::ReleaseID(ID);
|
||||||
if (ID == myMax)
|
if (ID == myMax)
|
||||||
@ -160,8 +160,8 @@ void SMDS_MeshElementIDFactory::updateMinMax() const
|
|||||||
{
|
{
|
||||||
myMin = IntegerLast();
|
myMin = IntegerLast();
|
||||||
myMax = 0;
|
myMax = 0;
|
||||||
for (int i=0; i<myMesh->myIDElements.size(); i++)
|
for (int i=0; i<myMesh->myCellIdSmdsToVtk.size(); i++)
|
||||||
if (int id=myMesh->myIDElements[i] >=0)
|
if (int id=myMesh->myCellIdSmdsToVtk[i] >=0)
|
||||||
{
|
{
|
||||||
if (id > myMax) myMax = id;
|
if (id > myMax) myMax = id;
|
||||||
if (id < myMin) myMin = id;
|
if (id < myMin) myMin = id;
|
||||||
@ -182,7 +182,7 @@ SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
|
|||||||
|
|
||||||
void SMDS_MeshElementIDFactory::Clear()
|
void SMDS_MeshElementIDFactory::Clear()
|
||||||
{
|
{
|
||||||
myMesh->myIDElements.clear();
|
myMesh->myCellIdSmdsToVtk.clear();
|
||||||
myMin = myMax = 0;
|
myMin = myMax = 0;
|
||||||
SMDS_MeshIDFactory::Clear();
|
SMDS_MeshIDFactory::Clear();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ using namespace std;
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(-1), myMesh(0)
|
SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(0), myMesh(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ int SMDS_MeshIDFactory::GetFreeID()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMDS_MeshIDFactory::ReleaseID(const int ID)
|
void SMDS_MeshIDFactory::ReleaseID(const int ID)
|
||||||
{
|
{
|
||||||
if ( ID >= 0 )
|
if ( ID > 0 )
|
||||||
{
|
{
|
||||||
if ( ID < myMaxID )
|
if ( ID < myMaxID )
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ void SMDS_MeshIDFactory::ReleaseID(const int ID)
|
|||||||
|
|
||||||
void SMDS_MeshIDFactory::Clear()
|
void SMDS_MeshIDFactory::Clear()
|
||||||
{
|
{
|
||||||
myMaxID = -1;
|
myMaxID = 0;
|
||||||
myPoolOfID.clear();
|
myPoolOfID.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ SMDS_Mesh* SMDS_MeshIDFactory::GetMesh()
|
|||||||
|
|
||||||
void SMDS_MeshIDFactory::emptyPool(int maxId)
|
void SMDS_MeshIDFactory::emptyPool(int maxId)
|
||||||
{
|
{
|
||||||
MESSAGE("SMDS_MeshIDFactory::emptyPool " << myMaxID << " --> " << maxId-1);
|
MESSAGE("SMDS_MeshIDFactory::emptyPool " << myMaxID << " --> " << maxId);
|
||||||
myMaxID = maxId-1;
|
myMaxID = maxId;
|
||||||
myPoolOfID.clear();
|
myPoolOfID.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
void SetMesh(SMDS_Mesh *mesh);
|
void SetMesh(SMDS_Mesh *mesh);
|
||||||
SMDS_Mesh* GetMesh();
|
SMDS_Mesh* GetMesh();
|
||||||
inline bool isPoolIdEmpty() { return myPoolOfID.empty(); };
|
inline bool isPoolIdEmpty() { return myPoolOfID.empty(); };
|
||||||
void emptyPool(int maxId);
|
virtual void emptyPool(int maxId);
|
||||||
inline void adjustMaxId(int ID) { if (ID > myMaxID) myMaxID = ID;};
|
inline void adjustMaxId(int ID) { if (ID > myMaxID) myMaxID = ID;};
|
||||||
protected:
|
protected:
|
||||||
SMDS_MeshIDFactory();
|
SMDS_MeshIDFactory();
|
||||||
|
@ -65,18 +65,20 @@ SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y
|
|||||||
|
|
||||||
void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
|
void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
|
||||||
{
|
{
|
||||||
|
myVtkID = id -1;
|
||||||
|
assert(myVtkID >= 0);
|
||||||
myID = id;
|
myID = id;
|
||||||
myMeshId = meshId;
|
myMeshId = meshId;
|
||||||
myShapeId = shapeId;
|
myShapeId = shapeId;
|
||||||
myIdInShape = -1;
|
myIdInShape = -1;
|
||||||
//MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
|
//MESSAGE("Node " << myID << " " << myVtkID << " (" << 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();
|
||||||
vtkPoints *points = grid->GetPoints();
|
vtkPoints *points = grid->GetPoints();
|
||||||
points->InsertPoint(myID, x, y, z);
|
points->InsertPoint(myVtkID, x, y, z);
|
||||||
vtkCellLinks *cellLinks = grid->GetCellLinks();
|
vtkCellLinks *cellLinks = grid->GetCellLinks();
|
||||||
if (myID >=cellLinks->Size)
|
if (myVtkID >=cellLinks->Size)
|
||||||
cellLinks->Resize(myID+SMDS_Mesh::chunkSize);
|
cellLinks->Resize(myVtkID+SMDS_Mesh::chunkSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_MeshNode::~SMDS_MeshNode()
|
SMDS_MeshNode::~SMDS_MeshNode()
|
||||||
@ -94,7 +96,7 @@ void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
|
|||||||
//MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
|
//MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
|
||||||
const SMDS_MeshCell* cell = dynamic_cast<const SMDS_MeshCell*>(parent);
|
const SMDS_MeshCell* cell = dynamic_cast<const SMDS_MeshCell*>(parent);
|
||||||
MYASSERT(cell);
|
MYASSERT(cell);
|
||||||
SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myID, cell->getVtkId());
|
SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myVtkID, cell->getVtkId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -193,7 +195,7 @@ public:
|
|||||||
SMDS_ElemIteratorPtr SMDS_MeshNode::
|
SMDS_ElemIteratorPtr SMDS_MeshNode::
|
||||||
GetInverseElementIterator(SMDSAbs_ElementType type) const
|
GetInverseElementIterator(SMDSAbs_ElementType type) const
|
||||||
{
|
{
|
||||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
|
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
|
||||||
//MESSAGE("myID " << myID << " ncells " << l.ncells);
|
//MESSAGE("myID " << myID << " ncells " << l.ncells);
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
||||||
}
|
}
|
||||||
@ -253,7 +255,7 @@ SMDS_ElemIteratorPtr SMDS_MeshNode::
|
|||||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
|
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
|
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,7 +268,7 @@ int SMDS_MeshNode::NbNodes() const
|
|||||||
|
|
||||||
double* SMDS_MeshNode::getCoord() const
|
double* SMDS_MeshNode::getCoord() const
|
||||||
{
|
{
|
||||||
return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myID);
|
return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myVtkID);
|
||||||
}
|
}
|
||||||
|
|
||||||
double SMDS_MeshNode::X() const
|
double SMDS_MeshNode::X() const
|
||||||
@ -291,7 +293,7 @@ double SMDS_MeshNode::Z() const
|
|||||||
void SMDS_MeshNode::setXYZ(double x, double y, double z)
|
void SMDS_MeshNode::setXYZ(double x, double y, double z)
|
||||||
{
|
{
|
||||||
vtkPoints *points = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints();
|
vtkPoints *points = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints();
|
||||||
points->InsertPoint(myID, x, y, z);
|
points->InsertPoint(myVtkID, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDSAbs_ElementType SMDS_MeshNode::GetType() const
|
SMDSAbs_ElementType SMDS_MeshNode::GetType() const
|
||||||
@ -312,7 +314,7 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
|
|||||||
{
|
{
|
||||||
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*>(ME);
|
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*>(ME);
|
||||||
assert(cell);
|
assert(cell);
|
||||||
SMDS_Mesh::_meshList[myMeshId]->getGrid()->AddReferenceToCell(myID, cell->getVtkId());
|
SMDS_Mesh::_meshList[myMeshId]->getGrid()->AddReferenceToCell(myVtkID, cell->getVtkId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -321,12 +323,12 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMDS_MeshNode::ClearInverseElements()
|
void SMDS_MeshNode::ClearInverseElements()
|
||||||
{
|
{
|
||||||
SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myID, 0);
|
SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myVtkID, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_MeshNode::emptyInverseElements()
|
bool SMDS_MeshNode::emptyInverseElements()
|
||||||
{
|
{
|
||||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
|
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
|
||||||
return (l.ncells == 0);
|
return (l.ncells == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +340,7 @@ bool SMDS_MeshNode::emptyInverseElements()
|
|||||||
|
|
||||||
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
|
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
|
||||||
{
|
{
|
||||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
|
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
|
||||||
|
|
||||||
if ( type == SMDSAbs_All )
|
if ( type == SMDSAbs_All )
|
||||||
return l.ncells;
|
return l.ncells;
|
||||||
@ -347,7 +349,7 @@ int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
|
|||||||
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||||
for (int i=0; i<l.ncells; i++)
|
for (int i=0; i<l.ncells; i++)
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* elem = mesh->FindNode(l.cells[i]);
|
const SMDS_MeshElement* elem = mesh->FindElement(mesh->fromVtkToSmds(l.cells[i]));
|
||||||
if (elem->GetType() == type)
|
if (elem->GetType() == type)
|
||||||
nb++;
|
nb++;
|
||||||
}
|
}
|
||||||
@ -359,7 +361,7 @@ int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2)
|
bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2)
|
||||||
{
|
{
|
||||||
return e1.GetID()<e2.GetID();
|
return e1.getVtkId()<e2.getVtkId();
|
||||||
/*if(e1.myX<e2.myX) return true;
|
/*if(e1.myX<e2.myX) return true;
|
||||||
else if(e1.myX==e2.myX)
|
else if(e1.myX==e2.myX)
|
||||||
{
|
{
|
||||||
|
@ -31,47 +31,53 @@
|
|||||||
|
|
||||||
#include "SMDS_MeshElement.hxx"
|
#include "SMDS_MeshElement.hxx"
|
||||||
#include "SMDS_Position.hxx"
|
#include "SMDS_Position.hxx"
|
||||||
|
#include "ObjectPool.hxx"
|
||||||
#include <NCollection_List.hxx>
|
#include <NCollection_List.hxx>
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
|
class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMDS_MeshNode();
|
friend class SMESHDS_Mesh;
|
||||||
SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
|
friend class SMDS_Mesh;
|
||||||
virtual ~SMDS_MeshNode();
|
friend class ObjectPool<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;
|
||||||
|
|
||||||
void Print(std::ostream & OS) const;
|
void Print(std::ostream & OS) const;
|
||||||
double X() const;
|
double X() const;
|
||||||
double Y() const;
|
double Y() const;
|
||||||
double Z() const;
|
double Z() const;
|
||||||
void AddInverseElement(const SMDS_MeshElement * ME);
|
|
||||||
void RemoveInverseElement(const SMDS_MeshElement * parent);
|
|
||||||
void ClearInverseElements();
|
|
||||||
bool emptyInverseElements();
|
|
||||||
SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
|
SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
|
||||||
int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
|
int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
|
||||||
void SetPosition(const SMDS_PositionPtr& aPos);
|
|
||||||
const SMDS_PositionPtr& GetPosition() const;
|
const SMDS_PositionPtr& GetPosition() const;
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
virtual vtkIdType GetVtkType() const;
|
virtual vtkIdType GetVtkType() const;
|
||||||
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_Node;}
|
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_Node;}
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
void setXYZ(double x, double y, double z);
|
|
||||||
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
|
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
|
||||||
|
|
||||||
|
void SetPosition(const SMDS_PositionPtr& aPos);
|
||||||
|
void AddInverseElement(const SMDS_MeshElement * ME);
|
||||||
|
void RemoveInverseElement(const SMDS_MeshElement * parent);
|
||||||
|
void ClearInverseElements();
|
||||||
|
bool emptyInverseElements();
|
||||||
|
void setXYZ(double x, double y, double z);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Return node by its index
|
* \brief Return node by its index
|
||||||
* \param ind - node index
|
* \param ind - node index
|
||||||
* \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;
|
static int nbNodes;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
SMDS_MeshNode();
|
||||||
|
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);
|
||||||
|
inline void setVtkId(int vtkId) { myVtkID = vtkId; };
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr
|
SMDS_ElemIteratorPtr
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ bool SMDS_MeshNodeIDFactory::BindID(int ID, SMDS_MeshElement * elem)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
|
SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
|
||||||
{
|
{
|
||||||
if ((ID < 0) || (ID > myMax))
|
if ((ID < 1) || (ID > myMax))
|
||||||
return NULL;
|
return NULL;
|
||||||
const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
|
const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
|
||||||
return (SMDS_MeshElement*) (elem);
|
return (SMDS_MeshElement*) (elem);
|
||||||
@ -127,3 +127,9 @@ void SMDS_MeshNodeIDFactory::Clear()
|
|||||||
myMin = myMax = 0;
|
myMin = myMax = 0;
|
||||||
SMDS_MeshIDFactory::Clear();
|
SMDS_MeshIDFactory::Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMDS_MeshNodeIDFactory::emptyPool(int maxId)
|
||||||
|
{
|
||||||
|
SMDS_MeshIDFactory::emptyPool(maxId);
|
||||||
|
myMax = maxId;
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
int GetMinID() const;
|
int GetMinID() const;
|
||||||
SMDS_ElemIteratorPtr elementsIterator() const;
|
SMDS_ElemIteratorPtr elementsIterator() const;
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
virtual void emptyPool(int maxId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateMinMax() const;
|
void updateMinMax() const;
|
||||||
|
@ -43,6 +43,7 @@ using namespace std;
|
|||||||
SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
|
SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
|
||||||
(std::vector<const SMDS_MeshNode *> nodes)
|
(std::vector<const SMDS_MeshNode *> nodes)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************** SMDS_PolygonalFaceOfNodes");
|
||||||
myNodes = nodes;
|
myNodes = nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ SMDS_PolyhedralVolumeOfNodes::SMDS_PolyhedralVolumeOfNodes
|
|||||||
vector<int> quantities)
|
vector<int> quantities)
|
||||||
: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
|
: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("****************************************** SMDS_PolyhedralVolumeOfNodes");
|
||||||
ChangeNodes(nodes, quantities);
|
ChangeNodes(nodes, quantities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
//
|
//
|
||||||
#include "SMDS_Position.hxx"
|
#include "SMDS_Position.hxx"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SMDS_Position
|
//function : SMDS_Position
|
||||||
@ -34,6 +35,7 @@
|
|||||||
|
|
||||||
SMDS_Position::SMDS_Position(int aShapeId) :myShapeId(aShapeId)
|
SMDS_Position::SMDS_Position(int aShapeId) :myShapeId(aShapeId)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("########################## SMDS_Position " << myShapeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -43,6 +45,7 @@ SMDS_Position::SMDS_Position(int aShapeId) :myShapeId(aShapeId)
|
|||||||
|
|
||||||
void SMDS_Position::SetShapeId(int aShapeId)
|
void SMDS_Position::SetShapeId(int aShapeId)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("############################## SetShapeId "<< aShapeId);
|
||||||
myShapeId = aShapeId;
|
myShapeId = aShapeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +56,7 @@ void SMDS_Position::SetShapeId(int aShapeId)
|
|||||||
|
|
||||||
int SMDS_Position::GetShapeId() const
|
int SMDS_Position::GetShapeId() const
|
||||||
{
|
{
|
||||||
|
//MESSAGE("################################# GetShapeId " << myShapeId);
|
||||||
return myShapeId;
|
return myShapeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "SMDS_SetIterator.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ SMDS_QuadraticEdge::SMDS_QuadraticEdge(const SMDS_MeshNode * node1,
|
|||||||
const SMDS_MeshNode * node12)
|
const SMDS_MeshNode * node12)
|
||||||
:SMDS_LinearEdge(node1,node2)
|
:SMDS_LinearEdge(node1,node2)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************************* SMDS_QuadraticEdge");
|
||||||
myNodes[2]=node12;
|
myNodes[2]=node12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ SMDS_QuadraticFaceOfNodes::SMDS_QuadraticFaceOfNodes(const SMDS_MeshNode * n1,
|
|||||||
const SMDS_MeshNode * n23,
|
const SMDS_MeshNode * n23,
|
||||||
const SMDS_MeshNode * n31)
|
const SMDS_MeshNode * n31)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("********************************************** SMDS_QuadraticFaceOfNodes 1");
|
||||||
myNodes.resize( 6 );
|
myNodes.resize( 6 );
|
||||||
myNodes[ 0 ] = n1;
|
myNodes[ 0 ] = n1;
|
||||||
myNodes[ 1 ] = n2;
|
myNodes[ 1 ] = n2;
|
||||||
@ -73,6 +74,7 @@ SMDS_QuadraticFaceOfNodes::SMDS_QuadraticFaceOfNodes(const SMDS_MeshNode * n1,
|
|||||||
const SMDS_MeshNode * n34,
|
const SMDS_MeshNode * n34,
|
||||||
const SMDS_MeshNode * n41)
|
const SMDS_MeshNode * n41)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("********************************************* SMDS_QuadraticFaceOfNodes 2");
|
||||||
myNodes.resize( 8 );
|
myNodes.resize( 8 );
|
||||||
myNodes[ 0 ] = n1;
|
myNodes[ 0 ] = n1;
|
||||||
myNodes[ 1 ] = n2;
|
myNodes[ 1 ] = n2;
|
||||||
|
@ -54,6 +54,7 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n24,
|
const SMDS_MeshNode * n24,
|
||||||
const SMDS_MeshNode * n34)
|
const SMDS_MeshNode * n34)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
|
||||||
myNodes.resize( 10 );
|
myNodes.resize( 10 );
|
||||||
myNodes[ 0 ] = n1;
|
myNodes[ 0 ] = n1;
|
||||||
myNodes[ 1 ] = n2;
|
myNodes[ 1 ] = n2;
|
||||||
@ -88,6 +89,7 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n35,
|
const SMDS_MeshNode * n35,
|
||||||
const SMDS_MeshNode * n45)
|
const SMDS_MeshNode * n45)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
|
||||||
myNodes.resize( 13 );
|
myNodes.resize( 13 );
|
||||||
myNodes[ 0 ] = n1;
|
myNodes[ 0 ] = n1;
|
||||||
myNodes[ 1 ] = n2;
|
myNodes[ 1 ] = n2;
|
||||||
@ -127,6 +129,7 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n25,
|
const SMDS_MeshNode * n25,
|
||||||
const SMDS_MeshNode * n36)
|
const SMDS_MeshNode * n36)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
|
||||||
myNodes.resize( 15 );
|
myNodes.resize( 15 );
|
||||||
myNodes[ 0 ] = n1;
|
myNodes[ 0 ] = n1;
|
||||||
myNodes[ 1 ] = n2;
|
myNodes[ 1 ] = n2;
|
||||||
@ -173,6 +176,7 @@ SMDS_QuadraticVolumeOfNodes::SMDS_QuadraticVolumeOfNodes
|
|||||||
const SMDS_MeshNode * n37,
|
const SMDS_MeshNode * n37,
|
||||||
const SMDS_MeshNode * n48)
|
const SMDS_MeshNode * n48)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
|
||||||
myNodes.resize( 20 );
|
myNodes.resize( 20 );
|
||||||
myNodes[ 0 ] = n1;
|
myNodes[ 0 ] = n1;
|
||||||
myNodes[ 1 ] = n2;
|
myNodes[ 1 ] = n2;
|
||||||
|
@ -205,12 +205,10 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
|||||||
|
|
||||||
vtkUnsignedCharArray *newTypes = vtkUnsignedCharArray::New();
|
vtkUnsignedCharArray *newTypes = vtkUnsignedCharArray::New();
|
||||||
newTypes->Initialize();
|
newTypes->Initialize();
|
||||||
//newTypes->Allocate(oldCellSize);
|
|
||||||
newTypes->SetNumberOfValues(newCellSize);
|
newTypes->SetNumberOfValues(newCellSize);
|
||||||
|
|
||||||
vtkIdTypeArray *newLocations = vtkIdTypeArray::New();
|
vtkIdTypeArray *newLocations = vtkIdTypeArray::New();
|
||||||
newLocations->Initialize();
|
newLocations->Initialize();
|
||||||
//newLocations->Allocate(oldCellSize);
|
|
||||||
newLocations->SetNumberOfValues(newCellSize);
|
newLocations->SetNumberOfValues(newCellSize);
|
||||||
|
|
||||||
startHole = 0;
|
startHole = 0;
|
||||||
@ -251,7 +249,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
|||||||
startBloc = i;
|
startBloc = i;
|
||||||
compactState = lookBlocEnd;
|
compactState = lookBlocEnd;
|
||||||
holes += endHole - startHole;
|
holes += endHole - startHole;
|
||||||
//alreadyCopied = startBloc -holes;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case lookBlocEnd:
|
case lookBlocEnd:
|
||||||
@ -324,7 +321,8 @@ void SMDS_UnstructuredGrid::copyNodes(vtkPoints *newPoints, std::vector<int>& id
|
|||||||
{
|
{
|
||||||
memcpy(target, source, 3 * sizeof(float) * nbPoints);
|
memcpy(target, source, 3 * sizeof(float) * nbPoints);
|
||||||
for (int j = start; j < end; j++)
|
for (int j = start; j < end; j++)
|
||||||
idNodesOldToNew[j] = alreadyCopied++;
|
idNodesOldToNew[j] = alreadyCopied++; // old vtkId --> new vtkId
|
||||||
|
//idNodesOldToNew[alreadyCopied++] = idNodesOldToNew[j]; // new vtkId --> old SMDS id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +335,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, std::vector
|
|||||||
for (int j = start; j < end; j++)
|
for (int j = start; j < end; j++)
|
||||||
{
|
{
|
||||||
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
|
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
|
||||||
idCellsOldToNew[j] = alreadyCopied;
|
idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
|
||||||
vtkIdType oldLoc = this->Locations->GetValue(j);
|
vtkIdType oldLoc = this->Locations->GetValue(j);
|
||||||
vtkIdType nbpts;
|
vtkIdType nbpts;
|
||||||
vtkIdType *oldPtsCell = 0;
|
vtkIdType *oldPtsCell = 0;
|
||||||
|
@ -39,6 +39,7 @@ using namespace std;
|
|||||||
SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
|
SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
|
||||||
:SMDS_Position(aVertexId)
|
:SMDS_Position(aVertexId)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("*********************************************** SMDS_VertexPosition " << aVertexId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -49,12 +50,13 @@ SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
|
|||||||
const double *SMDS_VertexPosition::Coords() const
|
const double *SMDS_VertexPosition::Coords() const
|
||||||
{
|
{
|
||||||
const static double origin[]={0,0,0};
|
const static double origin[]={0,0,0};
|
||||||
MESSAGE("SMDS_VertexPosition::Coords not implemented");
|
//MESSAGE("######################### SMDS_VertexPosition::Coords not implemented");
|
||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SMDS_TypeOfPosition SMDS_VertexPosition::GetTypeOfPosition() const
|
SMDS_TypeOfPosition SMDS_VertexPosition::GetTypeOfPosition() const
|
||||||
{
|
{
|
||||||
|
//MESSAGE("################################################# GetTypeOfPosition");
|
||||||
return SMDS_TOP_VERTEX;
|
return SMDS_TOP_VERTEX;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "SMDS_VolumeOfFaces.hxx"
|
#include "SMDS_VolumeOfFaces.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
|
|||||||
const SMDS_MeshFace * face3,
|
const SMDS_MeshFace * face3,
|
||||||
const SMDS_MeshFace * face4)
|
const SMDS_MeshFace * face4)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("****************************************************** SMDS_VolumeOfFaces");
|
||||||
myNbFaces = 4;
|
myNbFaces = 4;
|
||||||
myFaces[0]=face1;
|
myFaces[0]=face1;
|
||||||
myFaces[1]=face2;
|
myFaces[1]=face2;
|
||||||
@ -111,6 +113,7 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
|
|||||||
const SMDS_MeshFace * face4,
|
const SMDS_MeshFace * face4,
|
||||||
const SMDS_MeshFace * face5)
|
const SMDS_MeshFace * face5)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("****************************************************** SMDS_VolumeOfFaces");
|
||||||
myNbFaces = 5;
|
myNbFaces = 5;
|
||||||
myFaces[0]=face1;
|
myFaces[0]=face1;
|
||||||
myFaces[1]=face2;
|
myFaces[1]=face2;
|
||||||
@ -127,6 +130,7 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
|
|||||||
const SMDS_MeshFace * face5,
|
const SMDS_MeshFace * face5,
|
||||||
const SMDS_MeshFace * face6)
|
const SMDS_MeshFace * face6)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("****************************************************** SMDS_VolumeOfFaces");
|
||||||
myNbFaces = 6;
|
myNbFaces = 6;
|
||||||
myFaces[0]=face1;
|
myFaces[0]=face1;
|
||||||
myFaces[1]=face2;
|
myFaces[1]=face2;
|
||||||
|
@ -49,6 +49,7 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
|
|||||||
const SMDS_MeshNode * node7,
|
const SMDS_MeshNode * node7,
|
||||||
const SMDS_MeshNode * node8)
|
const SMDS_MeshNode * node8)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("***************************************************** SMDS_VolumeOfNodes");
|
||||||
myNbNodes = 8;
|
myNbNodes = 8;
|
||||||
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
||||||
myNodes[0]=node1;
|
myNodes[0]=node1;
|
||||||
@ -67,6 +68,7 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
|
|||||||
const SMDS_MeshNode * node3,
|
const SMDS_MeshNode * node3,
|
||||||
const SMDS_MeshNode * node4)
|
const SMDS_MeshNode * node4)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("***************************************************** SMDS_VolumeOfNodes");
|
||||||
myNbNodes = 4;
|
myNbNodes = 4;
|
||||||
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
||||||
myNodes[0]=node1;
|
myNodes[0]=node1;
|
||||||
@ -82,6 +84,7 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
|
|||||||
const SMDS_MeshNode * node4,
|
const SMDS_MeshNode * node4,
|
||||||
const SMDS_MeshNode * node5)
|
const SMDS_MeshNode * node5)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("***************************************************** SMDS_VolumeOfNodes");
|
||||||
myNbNodes = 5;
|
myNbNodes = 5;
|
||||||
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
||||||
myNodes[0]=node1;
|
myNodes[0]=node1;
|
||||||
@ -99,6 +102,7 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
|
|||||||
const SMDS_MeshNode * node5,
|
const SMDS_MeshNode * node5,
|
||||||
const SMDS_MeshNode * node6)
|
const SMDS_MeshNode * node6)
|
||||||
{
|
{
|
||||||
|
//MESSAGE("***************************************************** SMDS_VolumeOfNodes");
|
||||||
myNbNodes = 6;
|
myNbNodes = 6;
|
||||||
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
||||||
myNodes[0]=node1;
|
myNodes[0]=node1;
|
||||||
|
@ -418,6 +418,7 @@ SMDS_VolumeTool::SMDS_VolumeTool ()
|
|||||||
myFaceNodeIndices( NULL ),
|
myFaceNodeIndices( NULL ),
|
||||||
myFaceNodes( NULL )
|
myFaceNodes( NULL )
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************************** SMDS_VolumeToo");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -438,6 +439,7 @@ SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
|
|||||||
myFaceNodeIndices( NULL ),
|
myFaceNodeIndices( NULL ),
|
||||||
myFaceNodes( NULL )
|
myFaceNodes( NULL )
|
||||||
{
|
{
|
||||||
|
//MESSAGE("******************************************************** SMDS_VolumeToo");
|
||||||
Set( theVolume );
|
Set( theVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,12 +694,13 @@ double SMDS_VolumeTool::GetSize() const
|
|||||||
if ( !myPolyedre )
|
if ( !myPolyedre )
|
||||||
return 0.;
|
return 0.;
|
||||||
|
|
||||||
|
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myPolyedre->getMeshId()];
|
||||||
// split a polyhedron into tetrahedrons
|
// split a polyhedron into tetrahedrons
|
||||||
|
|
||||||
SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
|
SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
|
||||||
XYZ baryCenter;
|
XYZ baryCenter;
|
||||||
me->GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
|
me->GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
|
||||||
SMDS_MeshNode bcNode ( baryCenter.x, baryCenter.y, baryCenter.z );
|
SMDS_MeshNode *bcNode = mesh->AddNode( baryCenter.x, baryCenter.y, baryCenter.z );
|
||||||
|
|
||||||
for ( int f = 0; f < NbFaces(); ++f )
|
for ( int f = 0; f < NbFaces(); ++f )
|
||||||
{
|
{
|
||||||
@ -707,11 +710,12 @@ double SMDS_VolumeTool::GetSize() const
|
|||||||
double Vn = getTetraVolume( myFaceNodes[ 0 ],
|
double Vn = getTetraVolume( myFaceNodes[ 0 ],
|
||||||
myFaceNodes[ n-1 ],
|
myFaceNodes[ n-1 ],
|
||||||
myFaceNodes[ n ],
|
myFaceNodes[ n ],
|
||||||
& bcNode );
|
bcNode );
|
||||||
/// cout <<"++++ " << Vn << " nodes " <<myFaceNodes[ 0 ]->GetID() << " " <<myFaceNodes[ n-1 ]->GetID() << " " <<myFaceNodes[ n ]->GetID() << " < " << V << endl;
|
/// cout <<"++++ " << Vn << " nodes " <<myFaceNodes[ 0 ]->GetID() << " " <<myFaceNodes[ n-1 ]->GetID() << " " <<myFaceNodes[ n ]->GetID() << " < " << V << endl;
|
||||||
V += externalFace ? -Vn : Vn;
|
V += externalFace ? -Vn : Vn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mesh->RemoveNode(bcNode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ bool SMDS_VtkCellIterator::more()
|
|||||||
const SMDS_MeshElement* SMDS_VtkCellIterator::next()
|
const SMDS_MeshElement* SMDS_VtkCellIterator::next()
|
||||||
{
|
{
|
||||||
vtkIdType id = _vtkIdList->GetId(_index++);
|
vtkIdType id = _vtkIdList->GetId(_index++);
|
||||||
return _mesh->FindNode(id);
|
return _mesh->FindNodeVtk(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
|
SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
|
||||||
|
@ -32,6 +32,7 @@ void SMDS_VtkEdge::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
|||||||
if (nodeIds.size() == 3)
|
if (nodeIds.size() == 3)
|
||||||
aType = VTK_QUADRATIC_EDGE;
|
aType = VTK_QUADRATIC_EDGE;
|
||||||
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
||||||
|
//MESSAGE("SMDS_VtkEdge::init myVtkID " << myVtkID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2)
|
bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2)
|
||||||
@ -53,7 +54,7 @@ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < nbNodes; i++)
|
for (int i = 0; i < nbNodes; i++)
|
||||||
{
|
{
|
||||||
pts[i] = nodes[i]->GetID();
|
pts[i] = nodes[i]->getVtkId();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ bool SMDS_VtkEdge::IsMediumNode(const SMDS_MeshNode* node) const
|
|||||||
vtkIdType npts = 0;
|
vtkIdType npts = 0;
|
||||||
vtkIdType* pts = 0;
|
vtkIdType* pts = 0;
|
||||||
grid->GetCellPoints(myVtkID, npts, pts);
|
grid->GetCellPoints(myVtkID, npts, pts);
|
||||||
return ((npts == 3) && (node->GetID() == pts[2]));
|
return ((npts == 3) && (node->getVtkId() == pts[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMDS_VtkEdge::Print(std::ostream & OS) const
|
void SMDS_VtkEdge::Print(std::ostream & OS) const
|
||||||
|
@ -47,6 +47,7 @@ void SMDS_VtkFace::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
||||||
|
//MESSAGE("SMDS_VtkFace::init myVtkID " << myVtkID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMDS_VtkFace::initPoly(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
void SMDS_VtkFace::initPoly(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
@ -70,7 +71,7 @@ bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < nbNodes; i++)
|
for (int i = 0; i < nbNodes; i++)
|
||||||
{
|
{
|
||||||
pts[i] = nodes[i]->GetID();
|
pts[i] = nodes[i]->getVtkId();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -150,6 +151,43 @@ bool SMDS_VtkFace::IsPoly() const
|
|||||||
return (aVtkType == VTK_POLYGON);
|
return (aVtkType == VTK_POLYGON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SMDS_VtkFace::IsMediumNode(const SMDS_MeshNode* node) const
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
int rankFirstMedium = 0;
|
||||||
|
switch (aVtkType)
|
||||||
|
{
|
||||||
|
case VTK_QUADRATIC_TRIANGLE:
|
||||||
|
rankFirstMedium = 3; // medium nodes are of rank 3,4,5
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_QUAD:
|
||||||
|
rankFirstMedium = 4; // medium nodes are of rank 4,5,6,7
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
vtkIdType npts = 0;
|
||||||
|
vtkIdType* pts = 0;
|
||||||
|
grid->GetCellPoints(myVtkID, npts, pts);
|
||||||
|
vtkIdType nodeId = node->getVtkId();
|
||||||
|
for (int rank = 0; rank < npts; rank++)
|
||||||
|
{
|
||||||
|
if (pts[rank] == nodeId)
|
||||||
|
{
|
||||||
|
if (rank < rankFirstMedium)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//throw SALOME_Exception(LOCALIZED("node does not belong to this element"));
|
||||||
|
MESSAGE("======================================================");
|
||||||
|
MESSAGE("= IsMediumNode: node does not belong to this element =");
|
||||||
|
MESSAGE("======================================================");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SMDSAbs_EntityType SMDS_VtkFace::GetEntityType() const
|
SMDSAbs_EntityType SMDS_VtkFace::GetEntityType() const
|
||||||
{
|
{
|
||||||
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
virtual bool IsQuadratic() const;
|
virtual bool IsQuadratic() const;
|
||||||
virtual bool IsPoly() const;
|
virtual bool IsPoly() const;
|
||||||
|
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
|
||||||
|
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
||||||
|
@ -56,6 +56,7 @@ void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
||||||
|
//MESSAGE("SMDS_VtkVolume::init myVtkID " << myVtkID);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VTK_HAVE_POLYHEDRON
|
#ifdef VTK_HAVE_POLYHEDRON
|
||||||
@ -108,11 +109,66 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < nbNodes; i++)
|
for (int i = 0; i < nbNodes; i++)
|
||||||
{
|
{
|
||||||
pts[i] = nodes[i]->GetID();
|
pts[i] = nodes[i]->getVtkId();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Reorder in VTK order a list of nodes given in SMDS order.
|
||||||
|
* To be used before ChangeNodes: lists are given or computed in SMDS order.
|
||||||
|
*/
|
||||||
|
bool SMDS_VtkVolume::vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes)
|
||||||
|
{
|
||||||
|
if (nbNodes != this->NbNodes())
|
||||||
|
{
|
||||||
|
MESSAGE("vtkOrder, wrong number of nodes " << nbNodes << " instead of "<< this->NbNodes());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
switch (aVtkType)
|
||||||
|
{
|
||||||
|
case VTK_TETRA:
|
||||||
|
this->exchange(nodes, 1, 2);
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_TETRA:
|
||||||
|
this->exchange(nodes, 1, 2);
|
||||||
|
this->exchange(nodes, 4, 6);
|
||||||
|
this->exchange(nodes, 8, 9);
|
||||||
|
break;
|
||||||
|
case VTK_PYRAMID:
|
||||||
|
this->exchange(nodes, 1, 3);
|
||||||
|
break;
|
||||||
|
case VTK_WEDGE:
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_PYRAMID:
|
||||||
|
this->exchange(nodes, 1, 3);
|
||||||
|
this->exchange(nodes, 5, 8);
|
||||||
|
this->exchange(nodes, 6, 7);
|
||||||
|
this->exchange(nodes, 10, 12);
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_WEDGE:
|
||||||
|
break;
|
||||||
|
case VTK_HEXAHEDRON:
|
||||||
|
this->exchange(nodes, 1, 3);
|
||||||
|
this->exchange(nodes, 5, 7);
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_HEXAHEDRON:
|
||||||
|
this->exchange(nodes, 1, 3);
|
||||||
|
this->exchange(nodes, 5, 7);
|
||||||
|
this->exchange(nodes, 8, 11);
|
||||||
|
this->exchange(nodes, 9, 10);
|
||||||
|
this->exchange(nodes, 12, 15);
|
||||||
|
this->exchange(nodes, 13, 14);
|
||||||
|
this->exchange(nodes, 17, 19);
|
||||||
|
break;
|
||||||
|
case VTK_POLYHEDRON:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SMDS_VtkVolume::~SMDS_VtkVolume()
|
SMDS_VtkVolume::~SMDS_VtkVolume()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -283,7 +339,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
|
|||||||
if (i == face_ind - 1) // first face is number 1
|
if (i == face_ind - 1) // first face is number 1
|
||||||
{
|
{
|
||||||
if ((node_ind > 0) && (node_ind <= nodesInFace))
|
if ((node_ind > 0) && (node_ind <= nodesInFace))
|
||||||
node = mesh->FindNode(ptIds[id + node_ind]); // ptIds[id+1] : first node
|
node = mesh->FindNodeVtk(ptIds[id + node_ind]); // ptIds[id+1] : first node
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
id += (nodesInFace + 1);
|
id += (nodesInFace + 1);
|
||||||
@ -387,6 +443,49 @@ bool SMDS_VtkVolume::IsPoly() const
|
|||||||
return (aVtkType == VTK_POLYHEDRON);
|
return (aVtkType == VTK_POLYHEDRON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SMDS_VtkVolume::IsMediumNode(const SMDS_MeshNode* node) const
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
int rankFirstMedium = 0;
|
||||||
|
switch (aVtkType)
|
||||||
|
{
|
||||||
|
case VTK_QUADRATIC_TETRA:
|
||||||
|
rankFirstMedium = 4; // medium nodes are of rank 4 to 9
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_PYRAMID:
|
||||||
|
rankFirstMedium = 5; // medium nodes are of rank 5 to 12
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_WEDGE:
|
||||||
|
rankFirstMedium = 6; // medium nodes are of rank 6 to 14
|
||||||
|
break;
|
||||||
|
case VTK_QUADRATIC_HEXAHEDRON:
|
||||||
|
rankFirstMedium = 8; // medium nodes are of rank 8 to 19
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
vtkIdType npts = 0;
|
||||||
|
vtkIdType* pts = 0;
|
||||||
|
grid->GetCellPoints(myVtkID, npts, pts);
|
||||||
|
vtkIdType nodeId = node->getVtkId();
|
||||||
|
for (int rank = 0; rank < npts; rank++)
|
||||||
|
{
|
||||||
|
if (pts[rank] == nodeId)
|
||||||
|
{
|
||||||
|
if (rank < rankFirstMedium)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//throw SALOME_Exception(LOCALIZED("node does not belong to this element"));
|
||||||
|
MESSAGE("======================================================");
|
||||||
|
MESSAGE("= IsMediumNode: node does not belong to this element =");
|
||||||
|
MESSAGE("======================================================");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
|
SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
|
||||||
{
|
{
|
||||||
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
@ -17,7 +17,8 @@ public:
|
|||||||
#ifdef VTK_HAVE_POLYHEDRON
|
#ifdef VTK_HAVE_POLYHEDRON
|
||||||
void initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> nbNodesPerFace, SMDS_Mesh* mesh);
|
void initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> nbNodesPerFace, SMDS_Mesh* mesh);
|
||||||
#endif
|
#endif
|
||||||
bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
|
virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
|
||||||
|
virtual bool vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes);
|
||||||
|
|
||||||
void Print(std::ostream & OS) const;
|
void Print(std::ostream & OS) const;
|
||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
@ -36,6 +37,7 @@ public:
|
|||||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
virtual bool IsQuadratic() const;
|
virtual bool IsQuadratic() const;
|
||||||
virtual bool IsPoly() const;
|
virtual bool IsPoly() const;
|
||||||
|
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
|
||||||
static void gravityCenter(SMDS_UnstructuredGrid* grid,
|
static void gravityCenter(SMDS_UnstructuredGrid* grid,
|
||||||
vtkIdType *nodeIds,
|
vtkIdType *nodeIds,
|
||||||
int nbNodes,
|
int nbNodes,
|
||||||
|
@ -435,6 +435,7 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM
|
|||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
|
||||||
theNodes.insert( make_pair( epos->GetUParameter(), node ));
|
theNodes.insert( make_pair( epos->GetUParameter(), node ));
|
||||||
|
//MESSAGE("U " << epos->GetUParameter() << " ID " << node->GetID());
|
||||||
++nbNodes;
|
++nbNodes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,6 +444,7 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM
|
|||||||
TopExp::Vertices(theEdge, v1, v2);
|
TopExp::Vertices(theEdge, v1, v2);
|
||||||
const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
|
const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
|
||||||
const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
|
const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
|
||||||
|
//MESSAGE("Vertices ID " << n1->GetID() << " " << n2->GetID());
|
||||||
Standard_Real f, l;
|
Standard_Real f, l;
|
||||||
BRep_Tool::Range(theEdge, f, l);
|
BRep_Tool::Range(theEdge, f, l);
|
||||||
if ( v1.Orientation() != TopAbs_FORWARD )
|
if ( v1.Orientation() != TopAbs_FORWARD )
|
||||||
|
@ -796,6 +796,11 @@ bool SMESH_MeshEditor::DeleteDiag (const SMDS_MeshNode * theNode1,
|
|||||||
newElem = aMesh->AddFace( aNodes[0], aNodes[1], aNodes[2], aNodes[3] );
|
newElem = aMesh->AddFace( aNodes[0], aNodes[1], aNodes[2], aNodes[3] );
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups( newElem, tr1, aMesh );
|
AddToSameGroups( newElem, tr1, aMesh );
|
||||||
|
int aShapeId = tr1->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
aMesh->RemoveElement( tr1 );
|
aMesh->RemoveElement( tr1 );
|
||||||
aMesh->RemoveElement( tr2 );
|
aMesh->RemoveElement( tr2 );
|
||||||
|
|
||||||
@ -841,6 +846,11 @@ bool SMESH_MeshEditor::DeleteDiag (const SMDS_MeshNode * theNode1,
|
|||||||
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
|
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups( newElem, tr1, aMesh );
|
AddToSameGroups( newElem, tr1, aMesh );
|
||||||
|
int aShapeId = tr1->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
aMesh->RemoveElement( tr1 );
|
aMesh->RemoveElement( tr1 );
|
||||||
aMesh->RemoveElement( tr2 );
|
aMesh->RemoveElement( tr2 );
|
||||||
|
|
||||||
@ -2148,6 +2158,11 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
|
|||||||
newElem = aMesh->AddFace(n12[0], n12[1], n12[2], n12[3] );
|
newElem = aMesh->AddFace(n12[0], n12[1], n12[2], n12[3] );
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups( newElem, tr1, aMesh );
|
AddToSameGroups( newElem, tr1, aMesh );
|
||||||
|
int aShapeId = tr1->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
aMesh->RemoveElement( tr1 );
|
aMesh->RemoveElement( tr1 );
|
||||||
aMesh->RemoveElement( tr2 );
|
aMesh->RemoveElement( tr2 );
|
||||||
}
|
}
|
||||||
@ -2172,6 +2187,11 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
|
|||||||
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
|
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups( newElem, tr1, aMesh );
|
AddToSameGroups( newElem, tr1, aMesh );
|
||||||
|
int aShapeId = tr1->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
aMesh->RemoveElement( tr1 );
|
aMesh->RemoveElement( tr1 );
|
||||||
aMesh->RemoveElement( tr2 );
|
aMesh->RemoveElement( tr2 );
|
||||||
// remove middle node (9)
|
// remove middle node (9)
|
||||||
@ -2186,6 +2206,11 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
|
|||||||
newElem = aMesh->AddFace(n13[0], n13[1], n13[2], n13[3] );
|
newElem = aMesh->AddFace(n13[0], n13[1], n13[2], n13[3] );
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups( newElem, tr1, aMesh );
|
AddToSameGroups( newElem, tr1, aMesh );
|
||||||
|
int aShapeId = tr1->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
aMesh->RemoveElement( tr1 );
|
aMesh->RemoveElement( tr1 );
|
||||||
aMesh->RemoveElement( tr3 );
|
aMesh->RemoveElement( tr3 );
|
||||||
}
|
}
|
||||||
@ -2210,6 +2235,11 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
|
|||||||
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
|
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups( newElem, tr1, aMesh );
|
AddToSameGroups( newElem, tr1, aMesh );
|
||||||
|
int aShapeId = tr1->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
aMesh->RemoveElement( tr1 );
|
aMesh->RemoveElement( tr1 );
|
||||||
aMesh->RemoveElement( tr3 );
|
aMesh->RemoveElement( tr3 );
|
||||||
// remove middle node (9)
|
// remove middle node (9)
|
||||||
@ -3299,7 +3329,7 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//cout<<" nbSame = "<<nbSame<<endl;
|
//cerr<<" nbSame = "<<nbSame<<endl;
|
||||||
if ( nbSame == nbNodes || nbSame > 2) {
|
if ( nbSame == nbNodes || nbSame > 2) {
|
||||||
MESSAGE( " Too many same nodes of element " << elem->GetID() );
|
MESSAGE( " Too many same nodes of element " << elem->GetID() );
|
||||||
//INFOS( " Too many same nodes of element " << elem->GetID() );
|
//INFOS( " Too many same nodes of element " << elem->GetID() );
|
||||||
@ -3336,6 +3366,7 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make new elements
|
// make new elements
|
||||||
|
const SMDS_MeshElement* lastElem = elem;
|
||||||
for (int iStep = 0; iStep < nbSteps; iStep++ ) {
|
for (int iStep = 0; iStep < nbSteps; iStep++ ) {
|
||||||
// get next nodes
|
// get next nodes
|
||||||
for ( iNode = 0; iNode < nbNodes; iNode++ ) {
|
for ( iNode = 0; iNode < nbNodes; iNode++ ) {
|
||||||
@ -3351,7 +3382,7 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
|
|||||||
nextNod[ iNode ] = *itNN[ iNode ];
|
nextNod[ iNode ] = *itNN[ iNode ];
|
||||||
itNN[ iNode ]++;
|
itNN[ iNode ]++;
|
||||||
}
|
}
|
||||||
else if(!elem->IsQuadratic() || elem->IsMediumNode(prevNod[iNode]) ) {
|
else if(!elem->IsQuadratic() || lastElem->IsMediumNode(prevNod[iNode]) ) {
|
||||||
// we have to use each second node
|
// we have to use each second node
|
||||||
//itNN[ iNode ]++;
|
//itNN[ iNode ]++;
|
||||||
nextNod[ iNode ] = *itNN[ iNode ];
|
nextNod[ iNode ] = *itNN[ iNode ];
|
||||||
@ -3656,6 +3687,7 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
|
|||||||
newElems.push_back( aNewElem );
|
newElems.push_back( aNewElem );
|
||||||
myLastCreatedElems.Append(aNewElem);
|
myLastCreatedElems.Append(aNewElem);
|
||||||
srcElements.Append( elem );
|
srcElements.Append( elem );
|
||||||
|
lastElem = aNewElem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set new prev nodes
|
// set new prev nodes
|
||||||
@ -4455,6 +4487,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
|||||||
const gp_Pnt& theRefPoint,
|
const gp_Pnt& theRefPoint,
|
||||||
const bool theMakeGroups)
|
const bool theMakeGroups)
|
||||||
{
|
{
|
||||||
|
MESSAGE("ExtrusionAlongTrack");
|
||||||
myLastCreatedElems.Clear();
|
myLastCreatedElems.Clear();
|
||||||
myLastCreatedNodes.Clear();
|
myLastCreatedNodes.Clear();
|
||||||
|
|
||||||
@ -4858,6 +4891,7 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
|||||||
const gp_Pnt& theRefPoint,
|
const gp_Pnt& theRefPoint,
|
||||||
const bool theMakeGroups)
|
const bool theMakeGroups)
|
||||||
{
|
{
|
||||||
|
MESSAGE("MakeExtrElements");
|
||||||
//cout<<"MakeExtrElements fullList.size() = "<<fullList.size()<<endl;
|
//cout<<"MakeExtrElements fullList.size() = "<<fullList.size()<<endl;
|
||||||
int aNbTP = fullList.size();
|
int aNbTP = fullList.size();
|
||||||
vector<SMESH_MeshEditor_PathPoint> aPPs(aNbTP);
|
vector<SMESH_MeshEditor_PathPoint> aPPs(aNbTP);
|
||||||
@ -5013,6 +5047,7 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make new node
|
// make new node
|
||||||
|
//MESSAGE("elem->IsQuadratic " << elem->IsQuadratic() << " " << elem->IsMediumNode(node));
|
||||||
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
|
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
|
||||||
// create additional node
|
// create additional node
|
||||||
double x = ( aPN1.X() + aPN0.X() )/2.;
|
double x = ( aPN1.X() + aPN0.X() )/2.;
|
||||||
@ -5982,9 +6017,8 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
|
|||||||
*/
|
*/
|
||||||
const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt )
|
const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt )
|
||||||
{
|
{
|
||||||
SMDS_MeshNode tgtNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
|
|
||||||
map<double, const SMDS_MeshNode*> dist2Nodes;
|
map<double, const SMDS_MeshNode*> dist2Nodes;
|
||||||
myOctreeNode->NodesAround( &tgtNode, dist2Nodes, myHalfLeafSize );
|
myOctreeNode->NodesAround( thePnt.Coord(), dist2Nodes, myHalfLeafSize );
|
||||||
if ( !dist2Nodes.empty() )
|
if ( !dist2Nodes.empty() )
|
||||||
return dist2Nodes.begin()->second;
|
return dist2Nodes.begin()->second;
|
||||||
list<const SMDS_MeshNode*> nodes;
|
list<const SMDS_MeshNode*> nodes;
|
||||||
@ -6000,13 +6034,12 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
|
|||||||
list< SMESH_OctreeNode* >::iterator trIt;
|
list< SMESH_OctreeNode* >::iterator trIt;
|
||||||
treeList.push_back( myOctreeNode );
|
treeList.push_back( myOctreeNode );
|
||||||
|
|
||||||
SMDS_MeshNode pointNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
|
|
||||||
for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt)
|
for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt)
|
||||||
{
|
{
|
||||||
SMESH_OctreeNode* tree = *trIt;
|
SMESH_OctreeNode* tree = *trIt;
|
||||||
if ( !tree->isLeaf() ) // put children to the queue
|
if ( !tree->isLeaf() ) // put children to the queue
|
||||||
{
|
{
|
||||||
if ( !tree->isInside( &pointNode, myHalfLeafSize )) continue;
|
if ( !tree->isInside( thePnt.Coord(), myHalfLeafSize )) continue;
|
||||||
SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
|
SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
|
||||||
while ( cIt->more() )
|
while ( cIt->more() )
|
||||||
treeList.push_back( cIt->next() );
|
treeList.push_back( cIt->next() );
|
||||||
@ -6359,7 +6392,6 @@ double SMESH_ElementSearcherImpl::getTolerance()
|
|||||||
meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 )
|
meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 )
|
||||||
--complexType;
|
--complexType;
|
||||||
if ( complexType == SMDSAbs_All ) return 0; // empty mesh
|
if ( complexType == SMDSAbs_All ) return 0; // empty mesh
|
||||||
|
|
||||||
double elemSize;
|
double elemSize;
|
||||||
if ( complexType == int( SMDSAbs_Node ))
|
if ( complexType == int( SMDSAbs_Node ))
|
||||||
{
|
{
|
||||||
@ -6370,8 +6402,9 @@ double SMESH_ElementSearcherImpl::getTolerance()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* elem =
|
SMDS_ElemIteratorPtr elemIt =
|
||||||
_mesh->elementsIterator( SMDSAbs_ElementType( complexType ))->next();
|
_mesh->elementsIterator( SMDSAbs_ElementType( complexType ));
|
||||||
|
const SMDS_MeshElement* elem = elemIt->next();
|
||||||
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
||||||
SMESH_MeshEditor::TNodeXYZ n1( cast2Node( nodeIt->next() ));
|
SMESH_MeshEditor::TNodeXYZ n1( cast2Node( nodeIt->next() ));
|
||||||
while ( nodeIt->more() )
|
while ( nodeIt->more() )
|
||||||
@ -6833,6 +6866,7 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
|
|||||||
// get ordered nodes
|
// get ordered nodes
|
||||||
|
|
||||||
vector< gp_XYZ > xyz;
|
vector< gp_XYZ > xyz;
|
||||||
|
vector<const SMDS_MeshNode*> nodeList;
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
|
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
|
||||||
if ( element->IsQuadratic() )
|
if ( element->IsQuadratic() )
|
||||||
@ -6842,7 +6876,11 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
|
|||||||
nodeIt = e->interlacedNodesElemIterator();
|
nodeIt = e->interlacedNodesElemIterator();
|
||||||
|
|
||||||
while ( nodeIt->more() )
|
while ( nodeIt->more() )
|
||||||
xyz.push_back( TNodeXYZ( cast2Node( nodeIt->next() )));
|
{
|
||||||
|
const SMDS_MeshNode* node = cast2Node( nodeIt->next() );
|
||||||
|
xyz.push_back( TNodeXYZ(node) );
|
||||||
|
nodeList.push_back(node);
|
||||||
|
}
|
||||||
|
|
||||||
int i, nbNodes = element->NbNodes();
|
int i, nbNodes = element->NbNodes();
|
||||||
|
|
||||||
@ -6851,6 +6889,7 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
|
|||||||
// compute face normal
|
// compute face normal
|
||||||
gp_Vec faceNorm(0,0,0);
|
gp_Vec faceNorm(0,0,0);
|
||||||
xyz.push_back( xyz.front() );
|
xyz.push_back( xyz.front() );
|
||||||
|
nodeList.push_back( nodeList.front() );
|
||||||
for ( i = 0; i < nbNodes; ++i )
|
for ( i = 0; i < nbNodes; ++i )
|
||||||
{
|
{
|
||||||
gp_Vec edge1( xyz[i+1], xyz[i]);
|
gp_Vec edge1( xyz[i+1], xyz[i]);
|
||||||
@ -6863,9 +6902,7 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
|
|||||||
// degenerated face: point is out if it is out of all face edges
|
// degenerated face: point is out if it is out of all face edges
|
||||||
for ( i = 0; i < nbNodes; ++i )
|
for ( i = 0; i < nbNodes; ++i )
|
||||||
{
|
{
|
||||||
SMDS_MeshNode n1( xyz[i].X(), xyz[i].Y(), xyz[i].Z() );
|
SMDS_LinearEdge edge( nodeList[i], nodeList[i+1] );
|
||||||
SMDS_MeshNode n2( xyz[i+1].X(), xyz[i+1].Y(), xyz[i+1].Z() );
|
|
||||||
SMDS_LinearEdge edge( &n1, &n2 );
|
|
||||||
if ( !isOut( &edge, point, tol ))
|
if ( !isOut( &edge, point, tol ))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -9271,7 +9308,8 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
// face does not exist
|
// face does not exist
|
||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
SMDS_Mesh aTmpFacesMesh;
|
// TODO algoritm not OK with vtkUnstructuredGrid: 2 meshes can't share nodes
|
||||||
|
//SMDS_Mesh aTmpFacesMesh; // try to use the same mesh
|
||||||
set<const SMDS_MeshElement*> faceSet1, faceSet2;
|
set<const SMDS_MeshElement*> faceSet1, faceSet2;
|
||||||
set<const SMDS_MeshElement*> volSet1, volSet2;
|
set<const SMDS_MeshElement*> volSet1, volSet2;
|
||||||
set<const SMDS_MeshNode*> nodeSet1, nodeSet2;
|
set<const SMDS_MeshNode*> nodeSet1, nodeSet2;
|
||||||
@ -9281,6 +9319,7 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
TIDSortedElemSet * elemSetPtr[] = { &theSide1, &theSide2 };
|
TIDSortedElemSet * elemSetPtr[] = { &theSide1, &theSide2 };
|
||||||
int iSide, iFace, iNode;
|
int iSide, iFace, iNode;
|
||||||
|
|
||||||
|
list<const SMDS_MeshElement* > tempFaceList;
|
||||||
for ( iSide = 0; iSide < 2; iSide++ ) {
|
for ( iSide = 0; iSide < 2; iSide++ ) {
|
||||||
set<const SMDS_MeshNode*> * nodeSet = nodeSetPtr[ iSide ];
|
set<const SMDS_MeshNode*> * nodeSet = nodeSetPtr[ iSide ];
|
||||||
TIDSortedElemSet * elemSet = elemSetPtr[ iSide ];
|
TIDSortedElemSet * elemSet = elemSetPtr[ iSide ];
|
||||||
@ -9400,18 +9439,23 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
if ( !aFreeFace ) {
|
if ( !aFreeFace ) {
|
||||||
// create a temporary face
|
// create a temporary face
|
||||||
if ( nbNodes == 3 ) {
|
if ( nbNodes == 3 ) {
|
||||||
aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2] );
|
//aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2] );
|
||||||
|
aFreeFace = aMesh->AddFace( fNodes[0],fNodes[1],fNodes[2] );
|
||||||
}
|
}
|
||||||
else if ( nbNodes == 4 ) {
|
else if ( nbNodes == 4 ) {
|
||||||
aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
//aFreeFace = aTmpFacesMesh.AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
||||||
|
aFreeFace = aMesh->AddFace( fNodes[0],fNodes[1],fNodes[2],fNodes[3] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vector<const SMDS_MeshNode *> poly_nodes ( fNodes, & fNodes[nbNodes]);
|
vector<const SMDS_MeshNode *> poly_nodes ( fNodes, & fNodes[nbNodes]);
|
||||||
aFreeFace = aTmpFacesMesh.AddPolygonalFace(poly_nodes);
|
//aFreeFace = aTmpFacesMesh.AddPolygonalFace(poly_nodes);
|
||||||
|
aFreeFace = aMesh->AddPolygonalFace(poly_nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( aFreeFace )
|
if ( aFreeFace ) {
|
||||||
freeFaceList.push_back( aFreeFace );
|
freeFaceList.push_back( aFreeFace );
|
||||||
|
tempFaceList.push_back( aFreeFace );
|
||||||
|
}
|
||||||
|
|
||||||
} // loop on faces of a volume
|
} // loop on faces of a volume
|
||||||
|
|
||||||
@ -9525,9 +9569,12 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
|
|
||||||
if ( faceSet1.size() != faceSet2.size() ) {
|
if ( faceSet1.size() != faceSet2.size() ) {
|
||||||
// delete temporary faces: they are in reverseElements of actual nodes
|
// delete temporary faces: they are in reverseElements of actual nodes
|
||||||
SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
|
// SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
|
||||||
while ( tmpFaceIt->more() )
|
// while ( tmpFaceIt->more() )
|
||||||
aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
|
// aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
|
||||||
|
// list<const SMDS_MeshElement* >::iterator tmpFaceIt = tempFaceList.begin();
|
||||||
|
// for (; tmpFaceIt !=tempFaceList.end(); ++tmpFaceIt)
|
||||||
|
// aMesh->RemoveElement(*tmpFaceIt);
|
||||||
MESSAGE("Diff nb of faces");
|
MESSAGE("Diff nb of faces");
|
||||||
return SEW_TOPO_DIFF_SETS_OF_ELEMENTS;
|
return SEW_TOPO_DIFF_SETS_OF_ELEMENTS;
|
||||||
}
|
}
|
||||||
@ -9783,9 +9830,12 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
// delete temporary faces: they are in reverseElements of actual nodes
|
// delete temporary faces: they are in reverseElements of actual nodes
|
||||||
SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
|
// SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
|
||||||
while ( tmpFaceIt->more() )
|
// while ( tmpFaceIt->more() )
|
||||||
aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
|
// aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
|
||||||
|
// list<const SMDS_MeshElement* >::iterator tmpFaceIt = tempFaceList.begin();
|
||||||
|
// for (; tmpFaceIt !=tempFaceList.end(); ++tmpFaceIt)
|
||||||
|
// aMesh->RemoveElement(*tmpFaceIt);
|
||||||
|
|
||||||
if ( aResult != SEW_OK)
|
if ( aResult != SEW_OK)
|
||||||
return aResult;
|
return aResult;
|
||||||
@ -9826,6 +9876,11 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
{
|
{
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
AddToSameGroups(newElem, e, aMesh);
|
AddToSameGroups(newElem, e, aMesh);
|
||||||
|
int aShapeId = e->getshapeId();
|
||||||
|
if ( aShapeId )
|
||||||
|
{
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
aMesh->RemoveElement(e);
|
aMesh->RemoveElement(e);
|
||||||
}
|
}
|
||||||
@ -10377,7 +10432,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
|
|||||||
SMDS_MeshElement* anElem = (SMDS_MeshElement*) *elemItr;
|
SMDS_MeshElement* anElem = (SMDS_MeshElement*) *elemItr;
|
||||||
if (!anElem)
|
if (!anElem)
|
||||||
continue;
|
continue;
|
||||||
int vtkId = meshDS->fromSmdsToVtk(anElem->getId());
|
int vtkId = meshDS->fromSmdsToVtk(anElem->GetID());
|
||||||
int neighborsVtkIds[NBMAXNEIGHBORS];
|
int neighborsVtkIds[NBMAXNEIGHBORS];
|
||||||
int downIds[NBMAXNEIGHBORS];
|
int downIds[NBMAXNEIGHBORS];
|
||||||
unsigned char downTypes[NBMAXNEIGHBORS];
|
unsigned char downTypes[NBMAXNEIGHBORS];
|
||||||
|
@ -651,6 +651,8 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
|
|||||||
{
|
{
|
||||||
if ( force || !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
|
if ( force || !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
|
||||||
{
|
{
|
||||||
|
double toldis = tol;
|
||||||
|
// TODO if (toldis < 5.e-5) toldis = 5.e-5; // nodes coordinates are stored in float format
|
||||||
// check that u is correct
|
// check that u is correct
|
||||||
TopLoc_Location loc; double f,l;
|
TopLoc_Location loc; double f,l;
|
||||||
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
|
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
|
||||||
@ -666,7 +668,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
|
|||||||
{
|
{
|
||||||
gp_Pnt nodePnt = SMESH_MeshEditor::TNodeXYZ( n );
|
gp_Pnt nodePnt = SMESH_MeshEditor::TNodeXYZ( n );
|
||||||
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
|
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
|
||||||
if ( nodePnt.Distance( curve->Value( u )) > tol )
|
if ( nodePnt.Distance( curve->Value( u )) > toldis )
|
||||||
{
|
{
|
||||||
// u incorrect, project the node to the curve
|
// u incorrect, project the node to the curve
|
||||||
GeomAPI_ProjectPointOnCurve projector( nodePnt, curve, f, l );
|
GeomAPI_ProjectPointOnCurve projector( nodePnt, curve, f, l );
|
||||||
@ -676,9 +678,10 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Quantity_Parameter U = projector.LowerDistanceParameter();
|
Quantity_Parameter U = projector.LowerDistanceParameter();
|
||||||
if ( nodePnt.Distance( curve->Value( U )) > tol )
|
if ( nodePnt.Distance( curve->Value( U )) > toldis )
|
||||||
{
|
{
|
||||||
MESSAGE( "SMESH_MesherHelper::CheckNodeU(), invalid projection" );
|
MESSAGE( "SMESH_MesherHelper::CheckNodeU(), invalid projection" );
|
||||||
|
MESSAGE("distance " << nodePnt.Distance(curve->Value( U )) << " " << toldis);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
u = double( U );
|
u = double( U );
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
// inherites global class SMESH_Octree
|
// inherites global class SMESH_Octree
|
||||||
// File : SMESH_OctreeNode.cxx
|
// File : SMESH_OctreeNode.cxx
|
||||||
// Created : Tue Jan 16 16:00:00 2007
|
// Created : Tue Jan 16 16:00:00 2007
|
||||||
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
// Author : Nicolas Geimer & Aurelien Motteux (OCC)
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
//
|
//
|
||||||
#include "SMESH_OctreeNode.hxx"
|
#include "SMESH_OctreeNode.hxx"
|
||||||
@ -107,9 +107,9 @@ Bnd_B3d* SMESH_OctreeNode::buildRootBox()
|
|||||||
*/
|
*/
|
||||||
//====================================================================================
|
//====================================================================================
|
||||||
|
|
||||||
const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double precision)
|
const bool SMESH_OctreeNode::isInside (const gp_XYZ& p, const double precision)
|
||||||
{
|
{
|
||||||
gp_XYZ p (Node->X(),Node->Y(),Node->Z());
|
//gp_XYZ p (Node->X(),Node->Y(),Node->Z());
|
||||||
if (precision <= 0.)
|
if (precision <= 0.)
|
||||||
return !(getBox().IsOut(p));
|
return !(getBox().IsOut(p));
|
||||||
Bnd_B3d BoxWithPrecision = getBox();
|
Bnd_B3d BoxWithPrecision = getBox();
|
||||||
@ -159,7 +159,8 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
|
|||||||
list<const SMDS_MeshNode*>* Result,
|
list<const SMDS_MeshNode*>* Result,
|
||||||
const double precision)
|
const double precision)
|
||||||
{
|
{
|
||||||
if (isInside(Node,precision))
|
gp_XYZ p(Node->X(), Node->Y(), Node->Z());
|
||||||
|
if (isInside(p, precision))
|
||||||
{
|
{
|
||||||
if (isLeaf())
|
if (isLeaf())
|
||||||
{
|
{
|
||||||
@ -186,7 +187,7 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
|
bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node,
|
||||||
map<double, const SMDS_MeshNode*>& dist2Nodes,
|
map<double, const SMDS_MeshNode*>& dist2Nodes,
|
||||||
double precision)
|
double precision)
|
||||||
{
|
{
|
||||||
@ -195,13 +196,14 @@ bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
|
|||||||
else if ( precision == 0. )
|
else if ( precision == 0. )
|
||||||
precision = maxSize() / 2;
|
precision = maxSize() / 2;
|
||||||
|
|
||||||
if (isInside(node,precision))
|
//gp_XYZ p(node->X(), node->Y(), node->Z());
|
||||||
|
if (isInside(node, precision))
|
||||||
{
|
{
|
||||||
if (!isLeaf())
|
if (!isLeaf())
|
||||||
{
|
{
|
||||||
// first check a child containing node
|
// first check a child containing node
|
||||||
gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
|
gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
|
||||||
int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid );
|
int nodeChild = getChildIndex( node.X(), node.Y(), node.Z(), mid );
|
||||||
if ( ((SMESH_OctreeNode*) myChildren[nodeChild])->NodesAround(node, dist2Nodes, precision))
|
if ( ((SMESH_OctreeNode*) myChildren[nodeChild])->NodesAround(node, dist2Nodes, precision))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -213,7 +215,7 @@ bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
|
|||||||
else if ( NbNodes() > 0 )
|
else if ( NbNodes() > 0 )
|
||||||
{
|
{
|
||||||
double minDist = precision * precision;
|
double minDist = precision * precision;
|
||||||
gp_Pnt p1 ( node->X(), node->Y(), node->Z() );
|
gp_Pnt p1 ( node.X(), node.Y(), node.Z() );
|
||||||
set<const SMDS_MeshNode*>::iterator nIt = myNodes.begin();
|
set<const SMDS_MeshNode*>::iterator nIt = myNodes.begin();
|
||||||
for ( ; nIt != myNodes.end(); ++nIt )
|
for ( ; nIt != myNodes.end(); ++nIt )
|
||||||
{
|
{
|
||||||
@ -320,7 +322,8 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
|||||||
list<const SMDS_MeshNode*>* Result,
|
list<const SMDS_MeshNode*>* Result,
|
||||||
const double precision)
|
const double precision)
|
||||||
{
|
{
|
||||||
bool isInsideBool = isInside(Node,precision);
|
gp_XYZ p(Node->X(), Node->Y(), Node->Z());
|
||||||
|
bool isInsideBool = isInside(p, precision);
|
||||||
|
|
||||||
if (isInsideBool)
|
if (isInsideBool)
|
||||||
{
|
{
|
||||||
@ -386,8 +389,7 @@ void SMESH_OctreeNode::UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt
|
|||||||
set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
|
set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
|
||||||
bool nodeInMe = ( pNode != myNodes.end() );
|
bool nodeInMe = ( pNode != myNodes.end() );
|
||||||
|
|
||||||
SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
|
bool pointInMe = isInside( toPnt.Coord(), 1e-10 );
|
||||||
bool pointInMe = isInside( &pointNode, 1e-10 );
|
|
||||||
|
|
||||||
if ( pointInMe != nodeInMe )
|
if ( pointInMe != nodeInMe )
|
||||||
{
|
{
|
||||||
|
@ -24,13 +24,14 @@
|
|||||||
// inherites global class SMESH_Octree
|
// inherites global class SMESH_Octree
|
||||||
// File : SMESH_OctreeNode.hxx
|
// File : SMESH_OctreeNode.hxx
|
||||||
// Created : Tue Jan 16 16:00:00 2007
|
// Created : Tue Jan 16 16:00:00 2007
|
||||||
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
// Author : Nicolas Geimer & Aurelien Motteux (OCC)
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
//
|
//
|
||||||
#ifndef _SMESH_OCTREENODE_HXX_
|
#ifndef _SMESH_OCTREENODE_HXX_
|
||||||
#define _SMESH_OCTREENODE_HXX_
|
#define _SMESH_OCTREENODE_HXX_
|
||||||
|
|
||||||
#include "SMESH_Octree.hxx"
|
#include "SMESH_Octree.hxx"
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -61,7 +62,7 @@ public:
|
|||||||
virtual ~SMESH_OctreeNode () {};
|
virtual ~SMESH_OctreeNode () {};
|
||||||
|
|
||||||
// Tells us if Node is inside the current box with the precision "precision"
|
// Tells us if Node is inside the current box with the precision "precision"
|
||||||
virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0.);
|
virtual const bool isInside(const gp_XYZ& p, const double precision = 0.);
|
||||||
|
|
||||||
// Return in Result a list of Nodes potentials to be near Node
|
// Return in Result a list of Nodes potentials to be near Node
|
||||||
void NodesAround(const SMDS_MeshNode * Node,
|
void NodesAround(const SMDS_MeshNode * Node,
|
||||||
@ -69,7 +70,7 @@ public:
|
|||||||
const double precision = 0.);
|
const double precision = 0.);
|
||||||
|
|
||||||
// Return in dist2Nodes nodes mapped to their square distance from Node
|
// Return in dist2Nodes nodes mapped to their square distance from Node
|
||||||
bool NodesAround(const SMDS_MeshNode * Node,
|
bool NodesAround(const gp_XYZ& node,
|
||||||
std::map<double, const SMDS_MeshNode*>& dist2Nodes,
|
std::map<double, const SMDS_MeshNode*>& dist2Nodes,
|
||||||
double precision);
|
double precision);
|
||||||
|
|
||||||
|
@ -1808,33 +1808,14 @@ void SMESHDS_Mesh::compactMesh()
|
|||||||
{
|
{
|
||||||
if (myNodes[i])
|
if (myNodes[i])
|
||||||
{
|
{
|
||||||
idNodesOldToNew[i] = i; // all valid id are >= 0
|
int vtkid = myNodes[i]->getVtkId();
|
||||||
|
idNodesOldToNew[vtkid] = i; // old vtkId --> old smdsId (valid smdsId are >= 0)
|
||||||
newNodeSize++;
|
newNodeSize++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool areNodesModified = (newNodeSize < nbVtkNodes);
|
bool areNodesModified = (newNodeSize < nbVtkNodes);
|
||||||
MESSAGE("------------------------------------------------- SMESHDS_Mesh::compactMesh " << areNodesModified);
|
MESSAGE("------------------------- compactMesh Nodes Modified: " << areNodesModified);
|
||||||
|
areNodesModified = true;
|
||||||
// bool areNodesModified = !myNodeIDFactory->isPoolIdEmpty();
|
|
||||||
// MESSAGE("------------------------------------------------- SMESHDS_Mesh::compactMesh " << areNodesModified);
|
|
||||||
// if (areNodesModified)
|
|
||||||
// {
|
|
||||||
// for (int i = 0; i < nbNodes; i++)
|
|
||||||
// {
|
|
||||||
// if (myNodes[i])
|
|
||||||
// {
|
|
||||||
// idNodesOldToNew[i] = i; // all valid id are >= 0
|
|
||||||
// newNodeSize++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// for (int i = 0; i < nbNodes; i++)
|
|
||||||
// idNodesOldToNew[i] = i;
|
|
||||||
// if (nbNodes > nbVtkNodes)
|
|
||||||
// newNodeSize = nbVtkNodes; // else 0 means nothing to change (no need to compact vtkPoints)
|
|
||||||
// }
|
|
||||||
|
|
||||||
int newCellSize = 0;
|
int newCellSize = 0;
|
||||||
int nbCells = myCells.size();
|
int nbCells = myCells.size();
|
||||||
@ -1851,11 +1832,29 @@ void SMESHDS_Mesh::compactMesh()
|
|||||||
{
|
{
|
||||||
if (myCells[i])
|
if (myCells[i])
|
||||||
{
|
{
|
||||||
idCellsOldToNew[i] = myVtkIndex[i]; // valid vtk indexes are > = 0
|
// //idCellsOldToNew[i] = myCellIdVtkToSmds[i]; // valid vtk indexes are > = 0
|
||||||
|
// int vtkid = myCells[i]->getVtkId();
|
||||||
|
// idCellsOldToNew[vtkid] = i; // old vtkId --> old smdsId (not used in input)
|
||||||
newCellSize++;
|
newCellSize++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (areNodesModified)
|
||||||
myGrid->compactGrid(idNodesOldToNew, newNodeSize, idCellsOldToNew, newCellSize);
|
myGrid->compactGrid(idNodesOldToNew, newNodeSize, idCellsOldToNew, newCellSize);
|
||||||
|
else
|
||||||
|
myGrid->compactGrid(idNodesOldToNew, 0, idCellsOldToNew, newCellSize);
|
||||||
|
|
||||||
|
int nbVtkPts = myGrid->GetNumberOfPoints();
|
||||||
|
nbVtkCells = myGrid->GetNumberOfCells();
|
||||||
|
if (nbVtkPts != newNodeSize)
|
||||||
|
{
|
||||||
|
MESSAGE("===> nbVtkPts != newNodeSize " << nbVtkPts << " " << newNodeSize);
|
||||||
|
if (nbVtkPts > newNodeSize) newNodeSize = nbVtkPts; // several points with same SMDS Id
|
||||||
|
}
|
||||||
|
if (nbVtkCells != newCellSize)
|
||||||
|
{
|
||||||
|
MESSAGE("===> nbVtkCells != newCellSize " << nbVtkCells << " " << newCellSize);
|
||||||
|
if (nbVtkCells > newCellSize) newCellSize = nbVtkCells; // several cells with same SMDS Id
|
||||||
|
}
|
||||||
|
|
||||||
// --- SMDS_MeshNode and myNodes (id in SMDS and in VTK are the same), myNodeIdFactory
|
// --- SMDS_MeshNode and myNodes (id in SMDS and in VTK are the same), myNodeIdFactory
|
||||||
|
|
||||||
@ -1863,51 +1862,55 @@ void SMESHDS_Mesh::compactMesh()
|
|||||||
{
|
{
|
||||||
MESSAGE("-------------- modify myNodes");
|
MESSAGE("-------------- modify myNodes");
|
||||||
SetOfNodes newNodes;
|
SetOfNodes newNodes;
|
||||||
newNodes.resize(newNodeSize);
|
newNodes.resize(newNodeSize+1,0); // 0 not used, SMDS numbers 1..n
|
||||||
|
int newSmdsId = 0;
|
||||||
for (int i = 0; i < nbNodes; i++)
|
for (int i = 0; i < nbNodes; i++)
|
||||||
{
|
{
|
||||||
if (myNodes[i])
|
if (myNodes[i])
|
||||||
{
|
{
|
||||||
int newid = idNodesOldToNew[i];
|
newSmdsId++; // SMDS id start to 1
|
||||||
//MESSAGE(i << " --> " << newid);;
|
int oldVtkId = myNodes[i]->getVtkId();
|
||||||
myNodes[i]->setId(newid);
|
int newVtkId = idNodesOldToNew[oldVtkId];
|
||||||
newNodes[newid] = myNodes[i];
|
//MESSAGE("myNodes["<< i << "] vtkId " << oldVtkId << " --> " << newVtkId);
|
||||||
|
myNodes[i]->setVtkId(newVtkId);
|
||||||
|
myNodes[i]->setId(newSmdsId);
|
||||||
|
newNodes[newSmdsId] = myNodes[i];
|
||||||
|
//MESSAGE("myNodes["<< i << "] --> newNodes[" << newSmdsId << "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myNodes.swap(newNodes);
|
myNodes.swap(newNodes);
|
||||||
this->myNodeIDFactory->emptyPool(newNodeSize);
|
this->myNodeIDFactory->emptyPool(newSmdsId); // newSmdsId = number of nodes
|
||||||
|
MESSAGE("myNodes.size " << myNodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- SMDS_MeshCell, myIDElements and myVtkIndex (myCells and myElementIdFactory are not compacted)
|
// --- SMDS_MeshCell, myCellIdVtkToSmds, myCellIdSmdsToVtk, myCells
|
||||||
|
|
||||||
int vtkIndexSize = myVtkIndex.size();
|
int vtkIndexSize = myCellIdVtkToSmds.size();
|
||||||
int maxVtkId = 0;
|
int maxVtkId = -1;
|
||||||
for (int oldVtkId = 0; oldVtkId < vtkIndexSize; oldVtkId++)
|
for (int oldVtkId = 0; oldVtkId < vtkIndexSize; oldVtkId++)
|
||||||
{
|
{
|
||||||
int smdsId = this->myVtkIndex[oldVtkId];
|
int oldSmdsId = this->myCellIdVtkToSmds[oldVtkId];
|
||||||
if (smdsId >= 0)
|
if (oldSmdsId > 0)
|
||||||
{
|
{
|
||||||
int newVtkId = idCellsOldToNew[oldVtkId];
|
int newVtkId = idCellsOldToNew[oldVtkId];
|
||||||
if (newVtkId > maxVtkId)
|
if (newVtkId > maxVtkId)
|
||||||
maxVtkId = newVtkId;
|
maxVtkId = newVtkId;
|
||||||
//MESSAGE("===========> smdsId newVtkId " << smdsId << " " << newVtkId);
|
//MESSAGE("myCells["<< oldSmdsId << "] vtkId " << oldVtkId << " --> " << newVtkId);
|
||||||
myCells[smdsId]->setVtkId(newVtkId);
|
myCells[oldSmdsId]->setVtkId(newVtkId);
|
||||||
myIDElements[smdsId] = newVtkId;
|
|
||||||
myVtkIndex[newVtkId] = smdsId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maxVtkId++;
|
// MESSAGE("myCells.size()=" << myCells.size()
|
||||||
MESSAGE("myCells.size()=" << myCells.size() << " myIDElements.size()=" << myIDElements.size() << " myVtkIndex.size()=" << myVtkIndex.size() );
|
// << " myCellIdSmdsToVtk.size()=" << myCellIdSmdsToVtk.size()
|
||||||
MESSAGE("maxVtkId=" << maxVtkId);
|
// << " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
|
||||||
|
|
||||||
SetOfCells newCells;
|
SetOfCells newCells;
|
||||||
vector<int> newSmdsToVtk;
|
vector<int> newSmdsToVtk;
|
||||||
vector<int> newVtkToSmds;
|
vector<int> newVtkToSmds;
|
||||||
|
|
||||||
newCells.resize(maxVtkId, 0);
|
assert(maxVtkId < newCellSize);
|
||||||
newSmdsToVtk.resize(maxVtkId, -1);
|
newCells.resize(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n
|
||||||
newVtkToSmds.resize(maxVtkId, -1);
|
newSmdsToVtk.resize(newCellSize+1, -1);
|
||||||
|
newVtkToSmds.resize(newCellSize+1, -1);
|
||||||
|
|
||||||
int myCellsSize = myCells.size();
|
int myCellsSize = myCells.size();
|
||||||
int newSmdsId = 0;
|
int newSmdsId = 0;
|
||||||
@ -1915,24 +1918,28 @@ void SMESHDS_Mesh::compactMesh()
|
|||||||
{
|
{
|
||||||
if (myCells[i])
|
if (myCells[i])
|
||||||
{
|
{
|
||||||
//MESSAGE(newSmdsId << " " << i);
|
newSmdsId++; // SMDS id start to 1
|
||||||
|
assert(newSmdsId <= newCellSize);
|
||||||
newCells[newSmdsId] = myCells[i];
|
newCells[newSmdsId] = myCells[i];
|
||||||
|
newCells[newSmdsId]->setId(newSmdsId);
|
||||||
|
//MESSAGE("myCells["<< i << "] --> newCells[" << newSmdsId << "]");
|
||||||
int idvtk = myCells[i]->getVtkId();
|
int idvtk = myCells[i]->getVtkId();
|
||||||
newSmdsToVtk[newSmdsId] = idvtk;
|
newSmdsToVtk[newSmdsId] = idvtk;
|
||||||
assert(idvtk < maxVtkId);
|
assert(idvtk < newCellSize);
|
||||||
newVtkToSmds[idvtk] = newSmdsId;
|
newVtkToSmds[idvtk] = newSmdsId;
|
||||||
myCells[i]->setId(newSmdsId);
|
|
||||||
newSmdsId++;
|
|
||||||
assert(newSmdsId <= maxVtkId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myCells.swap(newCells);
|
myCells.swap(newCells);
|
||||||
myIDElements.swap(newSmdsToVtk);
|
myCellIdSmdsToVtk.swap(newSmdsToVtk);
|
||||||
myVtkIndex.swap(newVtkToSmds);
|
myCellIdVtkToSmds.swap(newVtkToSmds);
|
||||||
MESSAGE("myCells.size()=" << myCells.size() << " myIDElements.size()=" << myIDElements.size() << " myVtkIndex.size()=" << myVtkIndex.size() );
|
MESSAGE("myCells.size()=" << myCells.size()
|
||||||
|
<< " myCellIdSmdsToVtk.size()=" << myCellIdSmdsToVtk.size()
|
||||||
|
<< " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
|
||||||
this->myElementIDFactory->emptyPool(newSmdsId);
|
this->myElementIDFactory->emptyPool(newSmdsId);
|
||||||
|
|
||||||
|
this->myScript->SetModified(true); // notify GUI client for buildPrs when update
|
||||||
|
|
||||||
// ---TODO: myNodes, myElements in submeshes
|
// ---TODO: myNodes, myElements in submeshes
|
||||||
|
|
||||||
// map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
|
// map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
|
||||||
|
@ -121,7 +121,7 @@ namespace SMESH
|
|||||||
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
|
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
|
||||||
if(anIter != VISUAL_OBJ_CONT.end()) {
|
if(anIter != VISUAL_OBJ_CONT.end()) {
|
||||||
// for unknown reason, object destructor is not called, so clear object manually
|
// for unknown reason, object destructor is not called, so clear object manually
|
||||||
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
|
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
|
||||||
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
||||||
}
|
}
|
||||||
VISUAL_OBJ_CONT.erase(aKey);
|
VISUAL_OBJ_CONT.erase(aKey);
|
||||||
@ -163,7 +163,7 @@ namespace SMESH
|
|||||||
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
|
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
|
||||||
for ( ; anIter != VISUAL_OBJ_CONT.end(); ++anIter ) {
|
for ( ; anIter != VISUAL_OBJ_CONT.end(); ++anIter ) {
|
||||||
// for unknown reason, object destructor is not called, so clear object manually
|
// for unknown reason, object destructor is not called, so clear object manually
|
||||||
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
|
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
|
||||||
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
||||||
}
|
}
|
||||||
VISUAL_OBJ_CONT.clear();
|
VISUAL_OBJ_CONT.clear();
|
||||||
@ -208,7 +208,7 @@ namespace SMESH
|
|||||||
int curId = anIter->first.first;
|
int curId = anIter->first.first;
|
||||||
if ( curId == studyID ) {
|
if ( curId == studyID ) {
|
||||||
// for unknown reason, object destructor is not called, so clear object manually
|
// for unknown reason, object destructor is not called, so clear object manually
|
||||||
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
|
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0,0,0);
|
||||||
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
anIter->second->GetUnstructuredGrid()->SetPoints(0);
|
||||||
VISUAL_OBJ_CONT.erase( anIter-- ); // dercement occures before erase()
|
VISUAL_OBJ_CONT.erase( anIter-- ); // dercement occures before erase()
|
||||||
}
|
}
|
||||||
|
@ -1984,6 +1984,7 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme
|
|||||||
SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
|
SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
|
||||||
const SMDSAbs_ElementType theElementType)
|
const SMDSAbs_ElementType theElementType)
|
||||||
{
|
{
|
||||||
|
MESSAGE("extrusionAlongPath");
|
||||||
initData();
|
initData();
|
||||||
|
|
||||||
if ( thePathMesh->_is_nil() || thePathShape->_is_nil() ) {
|
if ( thePathMesh->_is_nil() || thePathShape->_is_nil() ) {
|
||||||
@ -2150,6 +2151,7 @@ SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfEleme
|
|||||||
CORBA::Boolean theHasRefPoint,
|
CORBA::Boolean theHasRefPoint,
|
||||||
const SMESH::PointStruct & theRefPoint)
|
const SMESH::PointStruct & theRefPoint)
|
||||||
{
|
{
|
||||||
|
MESSAGE("ExtrusionAlongPath");
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
|
TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
|
||||||
<< theIDsOfElements << ", "
|
<< theIDsOfElements << ", "
|
||||||
|
@ -1004,8 +1004,8 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh )
|
|||||||
|
|
||||||
// store the rest nodes row by row
|
// store the rest nodes row by row
|
||||||
|
|
||||||
SMDS_MeshNode dummy(0,0,0);
|
const SMDS_MeshNode* dummy = mesh.GetMeshDS()->AddNode(0,0,0);
|
||||||
const SMDS_MeshElement* firstQuad = &dummy;// most left face above the last row of found nodes
|
const SMDS_MeshElement* firstQuad = dummy; // most left face above the last row of found nodes
|
||||||
|
|
||||||
int nbFoundNodes = myIndexer._xSize;
|
int nbFoundNodes = myIndexer._xSize;
|
||||||
while ( nbFoundNodes != myGrid.size() )
|
while ( nbFoundNodes != myGrid.size() )
|
||||||
@ -1072,7 +1072,7 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh )
|
|||||||
n1up = n2up;
|
n1up = n2up;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mesh.GetMeshDS()->RemoveNode(dummy);
|
||||||
DumpGrid(); // debug
|
DumpGrid(); // debug
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -374,6 +374,7 @@ namespace {
|
|||||||
SMESH_Mesh * srcMesh,
|
SMESH_Mesh * srcMesh,
|
||||||
const TAssocTool::TShapeShapeMap& shape2ShapeMap)
|
const TAssocTool::TShapeShapeMap& shape2ShapeMap)
|
||||||
{
|
{
|
||||||
|
MESSAGE("projectPartner");
|
||||||
const double tol = 1e-6;
|
const double tol = 1e-6;
|
||||||
|
|
||||||
gp_Trsf trsf; // transformation to get location of target nodes from source ones
|
gp_Trsf trsf; // transformation to get location of target nodes from source ones
|
||||||
@ -412,6 +413,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
gp_Vec p0p1( srcPP[0], srcPP[1] ), p0p( srcPP[0], p );
|
gp_Vec p0p1( srcPP[0], srcPP[1] ), p0p( srcPP[0], p );
|
||||||
pOK = !p0p1.IsParallel( p0p, tol );
|
pOK = !p0p1.IsParallel( p0p, tol );
|
||||||
|
// TODO angle pOK = !p0p1.IsParallel( p0p, 3.14/6 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,6 +546,7 @@ namespace {
|
|||||||
// create a new node
|
// create a new node
|
||||||
gp_Pnt tgtP = gp_Pnt(srcNode->X(),srcNode->Y(),srcNode->Z()).Transformed( trsf );
|
gp_Pnt tgtP = gp_Pnt(srcNode->X(),srcNode->Y(),srcNode->Z()).Transformed( trsf );
|
||||||
srcN_tgtN->second = helper.AddNode( tgtP.X(), tgtP.Y(), tgtP.Z() );
|
srcN_tgtN->second = helper.AddNode( tgtP.X(), tgtP.Y(), tgtP.Z() );
|
||||||
|
//MESSAGE(tgtP.X() << " " << tgtP.Y() << " " << tgtP.Z());
|
||||||
}
|
}
|
||||||
tgtFaceNodes.push_back( srcN_tgtN->second );
|
tgtFaceNodes.push_back( srcN_tgtN->second );
|
||||||
}
|
}
|
||||||
@ -566,6 +569,7 @@ namespace {
|
|||||||
|
|
||||||
bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape)
|
bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape)
|
||||||
{
|
{
|
||||||
|
MESSAGE("Projection_2D Compute");
|
||||||
if ( !_sourceHypo )
|
if ( !_sourceHypo )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user