for(MED::TInt iDim=0;iDim<aMeshDim;iDim++)
aCoords[(int)iDim] = aMEDNodeCoord[(int)iDim];
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){
TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
default:
break;
}
-
+ if (!anElement) {
+ EXCEPTION(runtime_error,"buildMeshGrille Error. Element not created! "<<iCell);
+ }
if((aGrilleInfo->myFamNum).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
if ( checkFamilyID ( aFamily, aFamNum )){
TElementLab aLabel = anElem->GetID();
int aNbNodes = anElem->NbNodes();
- MESSAGE("aNbNodes="<<aNbNodes);
+ //MESSAGE("aNbNodes="<<aNbNodes);
SMDS_ElemIteratorPtr aNodesIter;
aNodesIter = anElem->nodesIteratorToUNV();
if ( anElem->IsPoly() ) {
TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
return i == myVTK2SMDSNodes.end() ? -1 : i->second;
}
- return theVTKID;
+ return this->GetMesh()->FindNodeVtk(theVTKID)->GetID();
}
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
return i == mySMDS2VTKNodes.end() ? -1 : i->second;
}
- return theObjID;
+ return this->GetMesh()->FindNode(theObjID)->getVtkId();
}
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
myVTK2SMDSElems.clear();
myGrid->SetPoints( 0 );
- myGrid->SetCells( 0, 0, 0 );
+ myGrid->SetCells( 0, 0, 0, 0, 0 );
throw;
}
}
myGrid->SetPoints( aPoints );
aPoints->Delete();
- myGrid->SetCells( 0, 0, 0 );
+ myGrid->SetCells( 0, 0, 0, 0, 0 );
}
//=================================================================================
bool SMESH_MeshObj::Update( int theIsClear )
{
// Update SMDS_Mesh on client part
- //MESSAGE("SMESH_MeshObj::Update " << this);
+ MESSAGE("SMESH_MeshObj::Update " << this);
if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) {
+ MESSAGE("buildPrs");
buildPrs(); // Fill unstructured grid
return true;
}
SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
{
+ //MESSAGE("********************************* SMDS_EdgePosition "<< aEdgeId << " " << myUParameter);
}
//=======================================================================
*/
SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const
{
+ //MESSAGE("###################################### SMDS_EdgePosition::GetTypeOfPosition");
return SMDS_TOP_EDGE;
}
void SMDS_EdgePosition::SetUParameter(double aUparam)
{
+ //MESSAGE("############################### SMDS_EdgePosition::SetUParameter " << aUparam);
myUParameter = aUparam;
}
double SMDS_EdgePosition::GetUParameter() const
{
+ //MESSAGE("########################## SMDS_EdgePosition::GetUParameter " << myUParameter);
return myUParameter;
}
#include "SMDS_FaceOfEdges.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
using namespace std;
const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3)
{
+ //MESSAGE("****************************************************** SMDS_FaceOfEdges");
myNbEdges = 3;
myEdges[0]=edge1;
myEdges[1]=edge2;
const SMDS_MeshEdge* edge3,
const SMDS_MeshEdge* edge4)
{
+ //MESSAGE("****************************************************** SMDS_FaceOfEdges");
myNbEdges = 4;
myEdges[0]=edge1;
myEdges[1]=edge2;
const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3)
{
+ //MESSAGE("******************************************************* SMDS_FaceOfNodes");
myNbNodes = 3;
myNodes[0]=node1;
myNodes[1]=node2;
const SMDS_MeshNode* node3,
const SMDS_MeshNode* node4)
{
+ //MESSAGE("******************************************************* SMDS_FaceOfNodes");
myNbNodes = 4;
myNodes[0]=node1;
myNodes[1]=node2;
:SMDS_Position(aEdgeId),
myUParameter(aUParam),myVParameter(aVParam)
{
+ //MESSAGE("******************************************************** SMDS_FacePosition");
}
//=======================================================================
bool operator<(const SMDS_LinearEdge & e1, const SMDS_LinearEdge & e2)
{
- int id11 = e1.myNodes[0]->GetID();
- int id21 = e2.myNodes[0]->GetID();
- int id12 = e1.myNodes[1]->GetID();
- int id22 = e2.myNodes[1]->GetID();
+ int id11 = e1.myNodes[0]->getVtkId();
+ int id21 = e2.myNodes[0]->getVtkId();
+ int id12 = e1.myNodes[1]->getVtkId();
+ int id22 = e2.myNodes[1]->getVtkId();
int tmp;
if (id11 >= id12)
myNodes.clear();
myCells.clear();
- myIDElements.clear();
- myVtkIndex.clear();
+ myCellIdSmdsToVtk.clear();
+ myCellIdVtkToSmds.clear();
myGrid = SMDS_UnstructuredGrid::New();
myGrid->setSMDS_mesh(this);
myGrid->Initialize();
// find the MeshNode corresponding to ID
const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
if(!node){
- //if ( myNodes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
- //SMDS_MeshNode * node=new SMDS_MeshNode(ID, myMeshId, -1, x, y, z);
+ // TODO ID < 1
+ if (ID <= 0)
+ {
+ MESSAGE("=============> Bad Node Id: " << ID);
+ ID = myNodeIDFactory->GetFreeID();
+ }
myNodeIDFactory->adjustMaxId(ID);
SMDS_MeshNode * node = myNodePool->getNew();
node->init(ID, myMeshId, -1, x, y, z);
if (ID >= myNodes.size())
{
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;
myNodeIDFactory->BindID(ID,node);
// --- retreive nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n2->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
edgevtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n3->getId()); // order SMDS-->VTK
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n4->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n3->getVtkId()); // order SMDS-->VTK
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n5->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n5->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n5->getId());
- nodeIds.push_back(n6->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n5->getVtkId());
+ nodeIds.push_back(n6->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n5->getId());
- nodeIds.push_back(n8->getId());
- nodeIds.push_back(n7->getId());
- nodeIds.push_back(n6->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n5->getVtkId());
+ nodeIds.push_back(n8->getVtkId());
+ nodeIds.push_back(n7->getVtkId());
+ nodeIds.push_back(n6->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
nodeIds.clear();
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
for ( ; it != nodes.end(); ++it)
- nodeIds.push_back((*it)->getId());
+ nodeIds.push_back((*it)->getVtkId());
SMDS_VtkFace *facevtk = myFacePool->getNew();
facevtk->initPoly(nodeIds, this);
nodeIds.clear();
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
for (; it != nodes.end(); ++it)
- nodeIds.push_back((*it)->getId());
+ nodeIds.push_back((*it)->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->initPoly(nodeIds, quantities, this);
bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
{
//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;
}
if (vtkId == -1)
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);
- myIDElements.resize(ID + SMDS_Mesh::chunkSize, -1); // fill new elements with -1
+ MESSAGE(" ------------------- resize myCellIdSmdsToVtk " << ID << " --> " << ID + SMDS_Mesh::chunkSize);
+ myCellIdSmdsToVtk.resize(ID + SMDS_Mesh::chunkSize, -1); // fill new elements with -1
}
- myIDElements[ID] = vtkId;
+ myCellIdSmdsToVtk[ID] = 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);
- myVtkIndex.resize(vtkId + SMDS_Mesh::chunkSize, -1);
+ MESSAGE(" --------------------- resize myCellIdVtkToSmds " << vtkId << " --> " << vtkId + SMDS_Mesh::chunkSize);
+ myCellIdVtkToSmds.resize(vtkId + SMDS_Mesh::chunkSize, -1);
}
- myVtkIndex[vtkId] = ID;
+ myCellIdVtkToSmds[vtkId] = ID;
myElementIDFactory->updateMinMax(ID);
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
{
- if (ID < 0 || ID >= myNodes.size())
+ if (ID < 1 || ID >= myNodes.size())
{
MESSAGE("------------------------------------------------------------------------- ");
MESSAGE("----------------------------------- bad ID " << ID << " " << myNodes.size());
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
///ID to the create triangle.
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(node1->getId());
- nodeIds.push_back(node2->getId());
- nodeIds.push_back(node3->getId());
+ nodeIds.push_back(node1->getVtkId());
+ nodeIds.push_back(node2->getVtkId());
+ nodeIds.push_back(node3->getVtkId());
SMDS_MeshFace * face = 0;
SMDS_VtkFace *facevtk = myFacePool->getNew();
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(node1->getId());
- nodeIds.push_back(node2->getId());
- nodeIds.push_back(node3->getId());
- nodeIds.push_back(node4->getId());
+ nodeIds.push_back(node1->getVtkId());
+ nodeIds.push_back(node2->getVtkId());
+ nodeIds.push_back(node3->getVtkId());
+ nodeIds.push_back(node4->getVtkId());
SMDS_MeshFace * face = 0;
SMDS_VtkFace *facevtk = myFacePool->getNew();
set<const SMDS_MeshElement*> oldNodes;
SMDS_ElemIteratorPtr itn = element->nodesIterator();
while(itn->more())
- oldNodes.insert( itn->next() );
+ oldNodes.insert(itn->next());
// change nodes
bool Ok = false;
SMDS_MeshCell* cell = dynamic_cast<SMDS_MeshCell*>((SMDS_MeshElement*) element);
if (cell)
- Ok = cell->ChangeNodes(nodes, nbnodes);
+ {
+ Ok = cell->vtkOrder(nodes, nbnodes);
+ Ok = cell->ChangeNodes(nodes, nbnodes);
+ }
if ( Ok ) { // update InverseElements
adjustmyCellsCapacity(ID);
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(node1->getId());
- nodeIds.push_back(node2->getId());
+ nodeIds.push_back(node1->getVtkId());
+ nodeIds.push_back(node2->getVtkId());
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
edgevtk->init(nodeIds, this);
const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
{
- if ((IDelem < 0) || IDelem >= myCells.size())
+ if ((IDelem <= 0) || IDelem >= myCells.size())
{
MESSAGE("--------------------------------------------------------------------------------- ");
MESSAGE("----------------------------------- bad IDelem " << IDelem << " " << myCells.size());
void SMDS_Mesh::Clear()
{
+ MESSAGE("SMDS_Mesh::Clear");
if (myParent!=NULL)
{
SMDS_ElemIteratorPtr eIt = elementsIterator();
}
}
myCells.clear();
+ myCellIdVtkToSmds.clear();
+ myCellIdSmdsToVtk.clear();
SMDS_NodeIteratorPtr itn = nodesIterator();
while (itn->more())
{
_ctr = 0;
_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()
list<const SMDS_MeshElement *>& removedNodes,
bool removenodes)
{
- //MESSAGE("SMDS_Mesh::RemoveElement " << elem->GetID() << " " << removenodes);
+ //MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
if (elem->GetType() == SMDSAbs_0DElement || elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges()
SMDSAbs_ElementType aType = elem->GetType();
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
if (aType == SMDSAbs_Node) {
+ //MESSAGE("Remove free node " << elemId);
// only free node can be removed by this method
const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
// this methods is only for meshes without descendants
return;
+ //MESSAGE("Remove free element " << elemId);
int vtkid = this->fromSmdsToVtk(elemId);
// Remove element from <InverseElements> of its nodes
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n12->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n12->getVtkId());
SMDS_MeshEdge * edge = 0;
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n12->getId());
- nodeIds.push_back(n23->getId());
- nodeIds.push_back(n31->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n12->getVtkId());
+ nodeIds.push_back(n23->getVtkId());
+ nodeIds.push_back(n31->getVtkId());
SMDS_MeshFace * face = 0;
SMDS_VtkFace *facevtk = myFacePool->getNew();
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n12->getId());
- nodeIds.push_back(n23->getId());
- nodeIds.push_back(n34->getId());
- nodeIds.push_back(n41->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n12->getVtkId());
+ nodeIds.push_back(n23->getVtkId());
+ nodeIds.push_back(n34->getVtkId());
+ nodeIds.push_back(n41->getVtkId());
SMDS_MeshFace * face = 0;
SMDS_VtkFace *facevtk = myFacePool->getNew();
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n4->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
- nodeIds.push_back(n31->getId());
- nodeIds.push_back(n23->getId());
- nodeIds.push_back(n12->getId());
+ nodeIds.push_back(n31->getVtkId());
+ nodeIds.push_back(n23->getVtkId());
+ nodeIds.push_back(n12->getVtkId());
- nodeIds.push_back(n14->getId());
- nodeIds.push_back(n34->getId());
- nodeIds.push_back(n24->getId());
+ nodeIds.push_back(n14->getVtkId());
+ nodeIds.push_back(n34->getVtkId());
+ nodeIds.push_back(n24->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n5->getId());
-
- nodeIds.push_back(n41->getId());
- nodeIds.push_back(n34->getId());
- nodeIds.push_back(n23->getId());
- nodeIds.push_back(n12->getId());
-
- nodeIds.push_back(n15->getId());
- nodeIds.push_back(n45->getId());
- nodeIds.push_back(n35->getId());
- nodeIds.push_back(n25->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n5->getVtkId());
+
+ nodeIds.push_back(n41->getVtkId());
+ nodeIds.push_back(n34->getVtkId());
+ nodeIds.push_back(n23->getVtkId());
+ nodeIds.push_back(n12->getVtkId());
+
+ nodeIds.push_back(n15->getVtkId());
+ nodeIds.push_back(n45->getVtkId());
+ nodeIds.push_back(n35->getVtkId());
+ nodeIds.push_back(n25->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n2->getId());
- nodeIds.push_back(n3->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n5->getId());
- nodeIds.push_back(n6->getId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n5->getVtkId());
+ nodeIds.push_back(n6->getVtkId());
- nodeIds.push_back(n12->getId());
- nodeIds.push_back(n23->getId());
- nodeIds.push_back(n31->getId());
+ nodeIds.push_back(n12->getVtkId());
+ nodeIds.push_back(n23->getVtkId());
+ nodeIds.push_back(n31->getVtkId());
- nodeIds.push_back(n45->getId());
- nodeIds.push_back(n56->getId());
- nodeIds.push_back(n64->getId());
+ nodeIds.push_back(n45->getVtkId());
+ nodeIds.push_back(n56->getVtkId());
+ nodeIds.push_back(n64->getVtkId());
- nodeIds.push_back(n14->getId());
- nodeIds.push_back(n25->getId());
- nodeIds.push_back(n36->getId());
+ nodeIds.push_back(n14->getVtkId());
+ nodeIds.push_back(n25->getVtkId());
+ nodeIds.push_back(n36->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
// --- retrieve nodes ID
vector<vtkIdType> nodeIds;
nodeIds.clear();
- nodeIds.push_back(n1->getId());
- nodeIds.push_back(n4->getId());
- nodeIds.push_back(n3->getId());
- nodeIds.push_back(n2->getId());
-
- nodeIds.push_back(n5->getId());
- nodeIds.push_back(n8->getId());
- nodeIds.push_back(n7->getId());
- nodeIds.push_back(n6->getId());
-
- nodeIds.push_back(n41->getId());
- nodeIds.push_back(n34->getId());
- nodeIds.push_back(n23->getId());
- nodeIds.push_back(n12->getId());
-
- nodeIds.push_back(n85->getId());
- nodeIds.push_back(n78->getId());
- nodeIds.push_back(n67->getId());
- nodeIds.push_back(n56->getId());
-
- nodeIds.push_back(n15->getId());
- nodeIds.push_back(n48->getId());
- nodeIds.push_back(n37->getId());
- nodeIds.push_back(n26->getId());
+ nodeIds.push_back(n1->getVtkId());
+ nodeIds.push_back(n4->getVtkId());
+ nodeIds.push_back(n3->getVtkId());
+ nodeIds.push_back(n2->getVtkId());
+
+ nodeIds.push_back(n5->getVtkId());
+ nodeIds.push_back(n8->getVtkId());
+ nodeIds.push_back(n7->getVtkId());
+ nodeIds.push_back(n6->getVtkId());
+
+ nodeIds.push_back(n41->getVtkId());
+ nodeIds.push_back(n34->getVtkId());
+ nodeIds.push_back(n23->getVtkId());
+ nodeIds.push_back(n12->getVtkId());
+
+ nodeIds.push_back(n85->getVtkId());
+ nodeIds.push_back(n78->getVtkId());
+ nodeIds.push_back(n67->getVtkId());
+ nodeIds.push_back(n56->getVtkId());
+
+ nodeIds.push_back(n15->getVtkId());
+ nodeIds.push_back(n48->getVtkId());
+ nodeIds.push_back(n37->getVtkId());
+ nodeIds.push_back(n26->getVtkId());
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(nodeIds, this);
void SMDS_Mesh::incrementNodesCapacity(int nbNodes)
{
- int val = myIDElements.size();
- MESSAGE(" ------------------- resize myIDElements " << val << " --> " << val + nbNodes);
- myIDElements.resize(val + nbNodes, -1); // fill new elements with -1
+ int val = myCellIdSmdsToVtk.size();
+ MESSAGE(" ------------------- resize myCellIdSmdsToVtk " << val << " --> " << val + nbNodes);
+ myCellIdSmdsToVtk.resize(val + nbNodes, -1); // fill new elements with -1
val = myNodes.size();
MESSAGE(" ------------------- resize myNodes " << val << " --> " << val + nbNodes);
myNodes.resize(val +nbNodes, 0);
void SMDS_Mesh::incrementCellsCapacity(int nbCells)
{
- int val = myVtkIndex.size();
- MESSAGE(" ------------------- resize myVtkIndex " << val << " --> " << val + nbCells);
- myVtkIndex.resize(val + nbCells, -1); // fill new elements with -1
+ int val = myCellIdVtkToSmds.size();
+ MESSAGE(" ------------------- resize myCellIdVtkToSmds " << val << " --> " << val + nbCells);
+ myCellIdVtkToSmds.resize(val + nbCells, -1); // fill new elements with -1
val = myCells.size();
MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
myNodes.resize(val +nbCells, 0);
void SMDS_Mesh::adjustStructure()
{
- myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID()+1);
+ myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID());
}
void SMDS_Mesh::dumpGrid(string ficdump)
{
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"));
+}
virtual void compactMesh();
const SMDS_MeshNode *FindNode(int idnode) const;
+ const SMDS_MeshNode *FindNodeVtk(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, int idnode3) const;
typedef std::vector<SMDS_MeshCell *> SetOfCells;
void updateNodeMinMax();
- inline int fromVtkToSmds(int vtkid) { MYASSERT(vtkid>=0); return myVtkIndex[vtkid]; };
- inline int fromSmdsToVtk(int smdsid) { MYASSERT(smdsid>=0); return myIDElements[smdsid]; };
+ int fromVtkToSmds(int vtkid);
+ int fromSmdsToVtk(int smdsid);
void incrementNodesCapacity(int nbNodes);
void incrementCellsCapacity(int nbCells);
SetOfCells myCells;
//! 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
- std::vector<int> myVtkIndex;
+ std::vector<int> myCellIdVtkToSmds;
SMDS_Mesh * myParent;
std::list<SMDS_Mesh *> myChildren;
//=======================================================================
bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
{
- int id1 = e1.myNode->GetID();
- int id2 = e2.myNode->GetID();
+ int id1 = e1.myNode->getVtkId();
+ int id2 = e2.myNode->getVtkId();
return (id1 < id2);
}
virtual ~SMDS_MeshCell();
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;
- }
+ static int nbCells;
- inline int getVtkId() const
+protected:
+ inline void exchange(const SMDS_MeshNode* nodes[],int a, int b)
{
- return myVtkID;
+ const SMDS_MeshNode* noda = nodes[a];
+ nodes[a] = nodes[b];
+ nodes[b] = noda;
}
-
- static int nbCells;
-protected:
- int myVtkID;
};
#endif
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)
{
if(e1.GetType()!=e2.GetType()) return false;
virtual int NbNodes() const;
virtual int NbEdges() const;
virtual int NbFaces() const;
- int GetID() const;
+ inline int GetID() const { return myID; };
///Return the type of the current element
virtual SMDSAbs_ElementType GetType() const = 0;
*/
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 getshapeId() const {return myShapeId; };
inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
inline int getIdInShape() const { return myIdInShape; };
inline void setIdInShape(int id) { myIdInShape = id; };
+ inline void setVtkId(int vtkId)
+ {
+ myVtkID = vtkId;
+ }
+
+ inline int getVtkId() const
+ {
+ return myVtkID;
+ }
+
protected:
inline void setId(int id) {myID = id; };
SMDS_MeshElement(int ID=-1);
//! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
int myID;
+ // index in vtkUnstructuredGrid
+ int myVtkID;
+
//! SMDS_Mesh identification in SMESH
ShortType myMeshId;
{
// --- retrieve nodes ID
+ SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
+ assert(cell);
vector<vtkIdType> nodeIds;
SMDS_ElemIteratorPtr it = elem->nodesIterator();
while(it->more())
{
- int nodeId = it->next()->GetID();
- //MESSAGE(" node in cell " << ID << " : " <<nodeId)
+ int nodeId = (static_cast<const SMDS_MeshNode*>(it->next()))->getVtkId();
+ MESSAGE(" node in cell " << cell->getVtkId() << " : " << nodeId)
nodeIds.push_back(nodeId);
}
vtkUnstructuredGrid * grid = myMesh->getGrid();
int typ = GetVtkCellType(elem->GetType());
int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
- SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
- assert(cell);
cell->setVtkId(cellId);
//MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId);
return cellId;
//=======================================================================
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;
const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
return (SMDS_MeshElement*)(elem);
//=======================================================================
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
{
- if (ID < 0)
+ if (ID < 1)
{
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID ID = " << ID);
return;
}
- int vtkId = myMesh->myIDElements[ID];
+ int vtkId = myMesh->myCellIdSmdsToVtk[ID];
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId);
if (ID >=0)
{
- myMesh->myIDElements[ID] = -1;
- myMesh->myVtkIndex[vtkId] = -1;
+ myMesh->myCellIdSmdsToVtk[ID] = -1;
+ myMesh->myCellIdVtkToSmds[vtkId] = -1;
}
SMDS_MeshIDFactory::ReleaseID(ID);
if (ID == myMax)
{
myMin = IntegerLast();
myMax = 0;
- for (int i=0; i<myMesh->myIDElements.size(); i++)
- if (int id=myMesh->myIDElements[i] >=0)
+ for (int i=0; i<myMesh->myCellIdSmdsToVtk.size(); i++)
+ if (int id=myMesh->myCellIdSmdsToVtk[i] >=0)
{
if (id > myMax) myMax = id;
if (id < myMin) myMin = id;
void SMDS_MeshElementIDFactory::Clear()
{
- myMesh->myIDElements.clear();
+ myMesh->myCellIdSmdsToVtk.clear();
myMin = myMax = 0;
SMDS_MeshIDFactory::Clear();
}
//purpose :
//=======================================================================
-SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(-1), myMesh(0)
+SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(0), myMesh(0)
{
}
//=======================================================================
void SMDS_MeshIDFactory::ReleaseID(const int ID)
{
- if ( ID >= 0 )
+ if ( ID > 0 )
{
if ( ID < myMaxID )
{
void SMDS_MeshIDFactory::Clear()
{
- myMaxID = -1;
+ myMaxID = 0;
myPoolOfID.clear();
}
void SMDS_MeshIDFactory::emptyPool(int maxId)
{
- MESSAGE("SMDS_MeshIDFactory::emptyPool " << myMaxID << " --> " << maxId-1);
- myMaxID = maxId-1;
+ MESSAGE("SMDS_MeshIDFactory::emptyPool " << myMaxID << " --> " << maxId);
+ myMaxID = maxId;
myPoolOfID.clear();
}
void SetMesh(SMDS_Mesh *mesh);
SMDS_Mesh* GetMesh();
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;};
protected:
SMDS_MeshIDFactory();
void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
{
+ myVtkID = id -1;
+ assert(myVtkID >= 0);
myID = id;
myMeshId = meshId;
myShapeId = shapeId;
myIdInShape = -1;
- //MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
+ //MESSAGE("Node " << myID << " " << myVtkID << " (" << x << ", " << y << ", " << z << ")");
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
vtkUnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints();
- points->InsertPoint(myID, x, y, z);
+ points->InsertPoint(myVtkID, x, y, z);
vtkCellLinks *cellLinks = grid->GetCellLinks();
- if (myID >=cellLinks->Size)
- cellLinks->Resize(myID+SMDS_Mesh::chunkSize);
+ if (myVtkID >=cellLinks->Size)
+ cellLinks->Resize(myVtkID+SMDS_Mesh::chunkSize);
}
SMDS_MeshNode::~SMDS_MeshNode()
//MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
const SMDS_MeshCell* cell = dynamic_cast<const SMDS_MeshCell*>(parent);
MYASSERT(cell);
- SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myID, cell->getVtkId());
+ SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myVtkID, cell->getVtkId());
}
//=======================================================================
SMDS_ElemIteratorPtr SMDS_MeshNode::
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);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
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));
}
}
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
void SMDS_MeshNode::setXYZ(double x, double y, double z)
{
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
{
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*>(ME);
assert(cell);
- SMDS_Mesh::_meshList[myMeshId]->getGrid()->AddReferenceToCell(myID, cell->getVtkId());
+ SMDS_Mesh::_meshList[myMeshId]->getGrid()->AddReferenceToCell(myVtkID, cell->getVtkId());
}
//=======================================================================
//=======================================================================
void SMDS_MeshNode::ClearInverseElements()
{
- SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myID, 0);
+ SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myVtkID, 0);
}
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);
}
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 )
return l.ncells;
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
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)
nb++;
}
///////////////////////////////////////////////////////////////////////////////
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;
else if(e1.myX==e2.myX)
{
#include "SMDS_MeshElement.hxx"
#include "SMDS_Position.hxx"
+#include "ObjectPool.hxx"
#include <NCollection_List.hxx>
class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
{
-
public:
- SMDS_MeshNode();
- SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
- virtual ~SMDS_MeshNode();
+ friend class SMESHDS_Mesh;
+ friend class SMDS_Mesh;
+ 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;
-
void Print(std::ostream & OS) const;
double X() const;
double Y() 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;
int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
- void SetPosition(const SMDS_PositionPtr& aPos);
const SMDS_PositionPtr& GetPosition() const;
SMDSAbs_ElementType GetType() const;
virtual vtkIdType GetVtkType() const;
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_Node;}
int NbNodes() const;
- void setXYZ(double x, double y, double z);
+
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
* \param ind - node index
* \retval const SMDS_MeshNode* - the node
*/
- virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
+ //virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
static int nbNodes;
+
protected:
+ 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
elementsIterator(SMDSAbs_ElementType type) const;
//=======================================================================
SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
{
- if ((ID < 0) || (ID > myMax))
+ if ((ID < 1) || (ID > myMax))
return NULL;
const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
return (SMDS_MeshElement*) (elem);
myMin = myMax = 0;
SMDS_MeshIDFactory::Clear();
}
+
+void SMDS_MeshNodeIDFactory::emptyPool(int maxId)
+{
+ SMDS_MeshIDFactory::emptyPool(maxId);
+ myMax = maxId;
+}
int GetMinID() const;
SMDS_ElemIteratorPtr elementsIterator() const;
virtual void Clear();
+ virtual void emptyPool(int maxId);
protected:
void updateMinMax() const;
SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
(std::vector<const SMDS_MeshNode *> nodes)
{
+ //MESSAGE("******************************************** SMDS_PolygonalFaceOfNodes");
myNodes = nodes;
}
vector<int> quantities)
: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
{
+ //MESSAGE("****************************************** SMDS_PolyhedralVolumeOfNodes");
ChangeNodes(nodes, quantities);
}
// Module : SMESH
//
#include "SMDS_Position.hxx"
+#include "utilities.h"
//=======================================================================
//function : SMDS_Position
SMDS_Position::SMDS_Position(int aShapeId) :myShapeId(aShapeId)
{
+ //MESSAGE("########################## SMDS_Position " << myShapeId);
}
//=======================================================================
void SMDS_Position::SetShapeId(int aShapeId)
{
+ //MESSAGE("############################## SetShapeId "<< aShapeId);
myShapeId = aShapeId;
}
int SMDS_Position::GetShapeId() const
{
+ //MESSAGE("################################# GetShapeId " << myShapeId);
return myShapeId;
}
#include "SMDS_SetIterator.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
using namespace std;
const SMDS_MeshNode * node12)
:SMDS_LinearEdge(node1,node2)
{
+ //MESSAGE("******************************************************* SMDS_QuadraticEdge");
myNodes[2]=node12;
}
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31)
{
+ //MESSAGE("********************************************** SMDS_QuadraticFaceOfNodes 1");
myNodes.resize( 6 );
myNodes[ 0 ] = n1;
myNodes[ 1 ] = n2;
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41)
{
+ //MESSAGE("********************************************* SMDS_QuadraticFaceOfNodes 2");
myNodes.resize( 8 );
myNodes[ 0 ] = n1;
myNodes[ 1 ] = n2;
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34)
{
+ //MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
myNodes.resize( 10 );
myNodes[ 0 ] = n1;
myNodes[ 1 ] = n2;
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45)
{
+ //MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
myNodes.resize( 13 );
myNodes[ 0 ] = n1;
myNodes[ 1 ] = n2;
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36)
{
+ //MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
myNodes.resize( 15 );
myNodes[ 0 ] = n1;
myNodes[ 1 ] = n2;
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48)
{
+ //MESSAGE("*********************************************** SMDS_QuadraticVolumeOfNodes");
myNodes.resize( 20 );
myNodes[ 0 ] = n1;
myNodes[ 1 ] = n2;
vtkUnsignedCharArray *newTypes = vtkUnsignedCharArray::New();
newTypes->Initialize();
- //newTypes->Allocate(oldCellSize);
newTypes->SetNumberOfValues(newCellSize);
vtkIdTypeArray *newLocations = vtkIdTypeArray::New();
newLocations->Initialize();
- //newLocations->Allocate(oldCellSize);
newLocations->SetNumberOfValues(newCellSize);
startHole = 0;
startBloc = i;
compactState = lookBlocEnd;
holes += endHole - startHole;
- //alreadyCopied = startBloc -holes;
}
break;
case lookBlocEnd:
{
memcpy(target, source, 3 * sizeof(float) * nbPoints);
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
}
}
for (int j = start; j < end; 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 nbpts;
vtkIdType *oldPtsCell = 0;
SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
:SMDS_Position(aVertexId)
{
+ //MESSAGE("*********************************************** SMDS_VertexPosition " << aVertexId);
}
//=======================================================================
const double *SMDS_VertexPosition::Coords() const
{
const static double origin[]={0,0,0};
- MESSAGE("SMDS_VertexPosition::Coords not implemented");
+ //MESSAGE("######################### SMDS_VertexPosition::Coords not implemented");
return origin;
}
SMDS_TypeOfPosition SMDS_VertexPosition::GetTypeOfPosition() const
{
+ //MESSAGE("################################################# GetTypeOfPosition");
return SMDS_TOP_VERTEX;
}
#include "SMDS_VolumeOfFaces.hxx"
#include "SMDS_IteratorOfElements.hxx"
+#include "utilities.h"
using namespace std;
const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4)
{
+ //MESSAGE("****************************************************** SMDS_VolumeOfFaces");
myNbFaces = 4;
myFaces[0]=face1;
myFaces[1]=face2;
const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5)
{
+ //MESSAGE("****************************************************** SMDS_VolumeOfFaces");
myNbFaces = 5;
myFaces[0]=face1;
myFaces[1]=face2;
const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6)
{
+ //MESSAGE("****************************************************** SMDS_VolumeOfFaces");
myNbFaces = 6;
myFaces[0]=face1;
myFaces[1]=face2;
const SMDS_MeshNode * node7,
const SMDS_MeshNode * node8)
{
+ //MESSAGE("***************************************************** SMDS_VolumeOfNodes");
myNbNodes = 8;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4)
{
+ //MESSAGE("***************************************************** SMDS_VolumeOfNodes");
myNbNodes = 4;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5)
{
+ //MESSAGE("***************************************************** SMDS_VolumeOfNodes");
myNbNodes = 5;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6)
{
+ //MESSAGE("***************************************************** SMDS_VolumeOfNodes");
myNbNodes = 6;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1;
myFaceNodeIndices( NULL ),
myFaceNodes( NULL )
{
+ //MESSAGE("******************************************************** SMDS_VolumeToo");
}
//=======================================================================
myFaceNodeIndices( NULL ),
myFaceNodes( NULL )
{
+ //MESSAGE("******************************************************** SMDS_VolumeToo");
Set( theVolume );
}
if ( !myPolyedre )
return 0.;
+ SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myPolyedre->getMeshId()];
// split a polyhedron into tetrahedrons
SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
XYZ baryCenter;
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 )
{
double Vn = getTetraVolume( myFaceNodes[ 0 ],
myFaceNodes[ n-1 ],
myFaceNodes[ n ],
- & bcNode );
+ bcNode );
/// cout <<"++++ " << Vn << " nodes " <<myFaceNodes[ 0 ]->GetID() << " " <<myFaceNodes[ n-1 ]->GetID() << " " <<myFaceNodes[ n ]->GetID() << " < " << V << endl;
V += externalFace ? -Vn : Vn;
}
}
+ mesh->RemoveNode(bcNode);
}
else
{
const SMDS_MeshElement* SMDS_VtkCellIterator::next()
{
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) :
if (nodeIds.size() == 3)
aType = VTK_QUADRATIC_EDGE;
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)
}
for (int i = 0; i < nbNodes; i++)
{
- pts[i] = nodes[i]->GetID();
+ pts[i] = nodes[i]->getVtkId();
}
return true;
}
vtkIdType npts = 0;
vtkIdType* pts = 0;
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
break;
}
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)
}
for (int i = 0; i < nbNodes; i++)
{
- pts[i] = nodes[i]->GetID();
+ pts[i] = nodes[i]->getVtkId();
}
return true;
}
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
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
virtual const SMDS_MeshNode* GetNode(const int ind) const;
virtual bool IsQuadratic() const;
virtual bool IsPoly() const;
+ virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
break;
}
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
+ //MESSAGE("SMDS_VtkVolume::init myVtkID " << myVtkID);
}
#ifdef VTK_HAVE_POLYHEDRON
}
for (int i = 0; i < nbNodes; i++)
{
- pts[i] = nodes[i]->GetID();
+ pts[i] = nodes[i]->getVtkId();
}
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()
{
}
if (i == face_ind - 1) // first face is number 1
{
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;
}
id += (nodesInFace + 1);
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
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
#ifdef VTK_HAVE_POLYHEDRON
void initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> nbNodesPerFace, SMDS_Mesh* mesh);
#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;
int NbFaces() const;
virtual const SMDS_MeshNode* GetNode(const int ind) const;
virtual bool IsQuadratic() const;
virtual bool IsPoly() const;
+ virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
static void gravityCenter(SMDS_UnstructuredGrid* grid,
vtkIdType *nodeIds,
int nbNodes,
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
theNodes.insert( make_pair( epos->GetUParameter(), node ));
+ //MESSAGE("U " << epos->GetUParameter() << " ID " << node->GetID());
++nbNodes;
}
}
TopExp::Vertices(theEdge, v1, v2);
const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
+ //MESSAGE("Vertices ID " << n1->GetID() << " " << n2->GetID());
Standard_Real f, l;
BRep_Tool::Range(theEdge, f, l);
if ( v1.Orientation() != TopAbs_FORWARD )
newElem = aMesh->AddFace( aNodes[0], aNodes[1], aNodes[2], aNodes[3] );
myLastCreatedElems.Append(newElem);
AddToSameGroups( newElem, tr1, aMesh );
+ int aShapeId = tr1->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
aMesh->RemoveElement( tr1 );
aMesh->RemoveElement( tr2 );
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
myLastCreatedElems.Append(newElem);
AddToSameGroups( newElem, tr1, aMesh );
+ int aShapeId = tr1->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
aMesh->RemoveElement( tr1 );
aMesh->RemoveElement( tr2 );
newElem = aMesh->AddFace(n12[0], n12[1], n12[2], n12[3] );
myLastCreatedElems.Append(newElem);
AddToSameGroups( newElem, tr1, aMesh );
+ int aShapeId = tr1->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
aMesh->RemoveElement( tr1 );
aMesh->RemoveElement( tr2 );
}
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
myLastCreatedElems.Append(newElem);
AddToSameGroups( newElem, tr1, aMesh );
+ int aShapeId = tr1->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
aMesh->RemoveElement( tr1 );
aMesh->RemoveElement( tr2 );
// remove middle node (9)
newElem = aMesh->AddFace(n13[0], n13[1], n13[2], n13[3] );
myLastCreatedElems.Append(newElem);
AddToSameGroups( newElem, tr1, aMesh );
+ int aShapeId = tr1->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
aMesh->RemoveElement( tr1 );
aMesh->RemoveElement( tr3 );
}
aNodes[4], aNodes[5], aNodes[6], aNodes[7]);
myLastCreatedElems.Append(newElem);
AddToSameGroups( newElem, tr1, aMesh );
+ int aShapeId = tr1->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
aMesh->RemoveElement( tr1 );
aMesh->RemoveElement( tr3 );
// remove middle node (9)
}
}
- //cout<<" nbSame = "<<nbSame<<endl;
+ //cerr<<" nbSame = "<<nbSame<<endl;
if ( nbSame == nbNodes || nbSame > 2) {
MESSAGE( " Too many same nodes of element " << elem->GetID() );
//INFOS( " Too many same nodes of element " << elem->GetID() );
}
// make new elements
+ const SMDS_MeshElement* lastElem = elem;
for (int iStep = 0; iStep < nbSteps; iStep++ ) {
// get next nodes
for ( iNode = 0; iNode < nbNodes; iNode++ ) {
nextNod[ 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
//itNN[ iNode ]++;
nextNod[ iNode ] = *itNN[ iNode ];
newElems.push_back( aNewElem );
myLastCreatedElems.Append(aNewElem);
srcElements.Append( elem );
+ lastElem = aNewElem;
}
// set new prev nodes
const gp_Pnt& theRefPoint,
const bool theMakeGroups)
{
+ MESSAGE("ExtrusionAlongTrack");
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
const gp_Pnt& theRefPoint,
const bool theMakeGroups)
{
+ MESSAGE("MakeExtrElements");
//cout<<"MakeExtrElements fullList.size() = "<<fullList.size()<<endl;
int aNbTP = fullList.size();
vector<SMESH_MeshEditor_PathPoint> aPPs(aNbTP);
}
// make new node
+ //MESSAGE("elem->IsQuadratic " << elem->IsQuadratic() << " " << elem->IsMediumNode(node));
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
// create additional node
double x = ( aPN1.X() + aPN0.X() )/2.;
*/
const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt )
{
- SMDS_MeshNode tgtNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
map<double, const SMDS_MeshNode*> dist2Nodes;
- myOctreeNode->NodesAround( &tgtNode, dist2Nodes, myHalfLeafSize );
+ myOctreeNode->NodesAround( thePnt.Coord(), dist2Nodes, myHalfLeafSize );
if ( !dist2Nodes.empty() )
return dist2Nodes.begin()->second;
list<const SMDS_MeshNode*> nodes;
list< SMESH_OctreeNode* >::iterator trIt;
treeList.push_back( myOctreeNode );
- SMDS_MeshNode pointNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt)
{
SMESH_OctreeNode* tree = *trIt;
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();
while ( cIt->more() )
treeList.push_back( cIt->next() );
meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 )
--complexType;
if ( complexType == SMDSAbs_All ) return 0; // empty mesh
-
double elemSize;
if ( complexType == int( SMDSAbs_Node ))
{
}
else
{
- const SMDS_MeshElement* elem =
- _mesh->elementsIterator( SMDSAbs_ElementType( complexType ))->next();
+ SMDS_ElemIteratorPtr elemIt =
+ _mesh->elementsIterator( SMDSAbs_ElementType( complexType ));
+ const SMDS_MeshElement* elem = elemIt->next();
SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
SMESH_MeshEditor::TNodeXYZ n1( cast2Node( nodeIt->next() ));
while ( nodeIt->more() )
// get ordered nodes
vector< gp_XYZ > xyz;
+ vector<const SMDS_MeshNode*> nodeList;
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
if ( element->IsQuadratic() )
nodeIt = e->interlacedNodesElemIterator();
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();
// compute face normal
gp_Vec faceNorm(0,0,0);
xyz.push_back( xyz.front() );
+ nodeList.push_back( nodeList.front() );
for ( i = 0; i < nbNodes; ++i )
{
gp_Vec edge1( xyz[i+1], xyz[i]);
// degenerated face: point is out if it is out of all face edges
for ( i = 0; i < nbNodes; ++i )
{
- SMDS_MeshNode n1( xyz[i].X(), xyz[i].Y(), xyz[i].Z() );
- SMDS_MeshNode n2( xyz[i+1].X(), xyz[i+1].Y(), xyz[i+1].Z() );
- SMDS_LinearEdge edge( &n1, &n2 );
+ SMDS_LinearEdge edge( nodeList[i], nodeList[i+1] );
if ( !isOut( &edge, point, tol ))
return false;
}
// face does not exist
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*> volSet1, volSet2;
set<const SMDS_MeshNode*> nodeSet1, nodeSet2;
TIDSortedElemSet * elemSetPtr[] = { &theSide1, &theSide2 };
int iSide, iFace, iNode;
+ list<const SMDS_MeshElement* > tempFaceList;
for ( iSide = 0; iSide < 2; iSide++ ) {
set<const SMDS_MeshNode*> * nodeSet = nodeSetPtr[ iSide ];
TIDSortedElemSet * elemSet = elemSetPtr[ iSide ];
if ( !aFreeFace ) {
// create a temporary face
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 ) {
- 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 {
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 );
+ tempFaceList.push_back( aFreeFace );
+ }
} // loop on faces of a volume
if ( faceSet1.size() != faceSet2.size() ) {
// delete temporary faces: they are in reverseElements of actual nodes
- SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
- while ( tmpFaceIt->more() )
- aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
+// SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
+// while ( tmpFaceIt->more() )
+// 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");
return SEW_TOPO_DIFF_SETS_OF_ELEMENTS;
}
// ====================================================================
// delete temporary faces: they are in reverseElements of actual nodes
- SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
- while ( tmpFaceIt->more() )
- aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
+// SMDS_FaceIteratorPtr tmpFaceIt = aTmpFacesMesh.facesIterator();
+// while ( tmpFaceIt->more() )
+// aTmpFacesMesh.RemoveElement( tmpFaceIt->next() );
+// list<const SMDS_MeshElement* >::iterator tmpFaceIt = tempFaceList.begin();
+// for (; tmpFaceIt !=tempFaceList.end(); ++tmpFaceIt)
+// aMesh->RemoveElement(*tmpFaceIt);
if ( aResult != SEW_OK)
return aResult;
{
myLastCreatedElems.Append(newElem);
AddToSameGroups(newElem, e, aMesh);
+ int aShapeId = e->getshapeId();
+ if ( aShapeId )
+ {
+ aMesh->SetMeshElementOnShape( newElem, aShapeId );
+ }
}
aMesh->RemoveElement(e);
}
SMDS_MeshElement* anElem = (SMDS_MeshElement*) *elemItr;
if (!anElem)
continue;
- int vtkId = meshDS->fromSmdsToVtk(anElem->getId());
+ int vtkId = meshDS->fromSmdsToVtk(anElem->GetID());
int neighborsVtkIds[NBMAXNEIGHBORS];
int downIds[NBMAXNEIGHBORS];
unsigned char downTypes[NBMAXNEIGHBORS];
{
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
TopLoc_Location loc; double f,l;
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
{
gp_Pnt nodePnt = SMESH_MeshEditor::TNodeXYZ( n );
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
GeomAPI_ProjectPointOnCurve projector( nodePnt, curve, f, l );
return false;
}
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("distance " << nodePnt.Distance(curve->Value( U )) << " " << toldis);
return false;
}
u = double( U );
// inherites global class SMESH_Octree
// File : SMESH_OctreeNode.cxx
// Created : Tue Jan 16 16:00:00 2007
-// Author : Nicolas Geimer & Aurélien Motteux (OCC)
+// Author : Nicolas Geimer & Aurelien Motteux (OCC)
// Module : SMESH
//
#include "SMESH_OctreeNode.hxx"
*/
//====================================================================================
-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.)
return !(getBox().IsOut(p));
Bnd_B3d BoxWithPrecision = getBox();
list<const SMDS_MeshNode*>* Result,
const double precision)
{
- if (isInside(Node,precision))
+ gp_XYZ p(Node->X(), Node->Y(), Node->Z());
+ if (isInside(p, precision))
{
if (isLeaf())
{
*/
//================================================================================
-bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
+bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node,
map<double, const SMDS_MeshNode*>& dist2Nodes,
double precision)
{
else if ( precision == 0. )
precision = maxSize() / 2;
- if (isInside(node,precision))
+ //gp_XYZ p(node->X(), node->Y(), node->Z());
+ if (isInside(node, precision))
{
if (!isLeaf())
{
// first check a child containing node
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))
return true;
else if ( NbNodes() > 0 )
{
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();
for ( ; nIt != myNodes.end(); ++nIt )
{
list<const SMDS_MeshNode*>* Result,
const double precision)
{
- bool isInsideBool = isInside(Node,precision);
+ gp_XYZ p(Node->X(), Node->Y(), Node->Z());
+ bool isInsideBool = isInside(p, precision);
if (isInsideBool)
{
set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
bool nodeInMe = ( pNode != myNodes.end() );
- SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
- bool pointInMe = isInside( &pointNode, 1e-10 );
+ bool pointInMe = isInside( toPnt.Coord(), 1e-10 );
if ( pointInMe != nodeInMe )
{
// inherites global class SMESH_Octree
// File : SMESH_OctreeNode.hxx
// Created : Tue Jan 16 16:00:00 2007
-// Author : Nicolas Geimer & Aurélien Motteux (OCC)
+// Author : Nicolas Geimer & Aurelien Motteux (OCC)
// Module : SMESH
//
#ifndef _SMESH_OCTREENODE_HXX_
#define _SMESH_OCTREENODE_HXX_
#include "SMESH_Octree.hxx"
+#include <gp_Pnt.hxx>
#include <list>
#include <set>
virtual ~SMESH_OctreeNode () {};
// 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
void NodesAround(const SMDS_MeshNode * Node,
const double precision = 0.);
// 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,
double precision);
{
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++;
}
}
bool areNodesModified = (newNodeSize < nbVtkNodes);
- MESSAGE("------------------------------------------------- SMESHDS_Mesh::compactMesh " << areNodesModified);
-
-// 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)
-// }
+ MESSAGE("------------------------- compactMesh Nodes Modified: " << areNodesModified);
+ areNodesModified = true;
int newCellSize = 0;
int nbCells = myCells.size();
{
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++;
}
}
- myGrid->compactGrid(idNodesOldToNew, newNodeSize, idCellsOldToNew, newCellSize);
+ if (areNodesModified)
+ 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
{
MESSAGE("-------------- modify myNodes");
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++)
{
if (myNodes[i])
{
- int newid = idNodesOldToNew[i];
- //MESSAGE(i << " --> " << newid);;
- myNodes[i]->setId(newid);
- newNodes[newid] = myNodes[i];
+ newSmdsId++; // SMDS id start to 1
+ int oldVtkId = myNodes[i]->getVtkId();
+ int newVtkId = idNodesOldToNew[oldVtkId];
+ //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);
- 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 maxVtkId = 0;
+ int vtkIndexSize = myCellIdVtkToSmds.size();
+ int maxVtkId = -1;
for (int oldVtkId = 0; oldVtkId < vtkIndexSize; oldVtkId++)
{
- int smdsId = this->myVtkIndex[oldVtkId];
- if (smdsId >= 0)
+ int oldSmdsId = this->myCellIdVtkToSmds[oldVtkId];
+ if (oldSmdsId > 0)
{
int newVtkId = idCellsOldToNew[oldVtkId];
if (newVtkId > maxVtkId)
maxVtkId = newVtkId;
- //MESSAGE("===========> smdsId newVtkId " << smdsId << " " << newVtkId);
- myCells[smdsId]->setVtkId(newVtkId);
- myIDElements[smdsId] = newVtkId;
- myVtkIndex[newVtkId] = smdsId;
+ //MESSAGE("myCells["<< oldSmdsId << "] vtkId " << oldVtkId << " --> " << newVtkId);
+ myCells[oldSmdsId]->setVtkId(newVtkId);
}
}
- maxVtkId++;
- MESSAGE("myCells.size()=" << myCells.size() << " myIDElements.size()=" << myIDElements.size() << " myVtkIndex.size()=" << myVtkIndex.size() );
- MESSAGE("maxVtkId=" << maxVtkId);
+// MESSAGE("myCells.size()=" << myCells.size()
+// << " myCellIdSmdsToVtk.size()=" << myCellIdSmdsToVtk.size()
+// << " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
SetOfCells newCells;
vector<int> newSmdsToVtk;
vector<int> newVtkToSmds;
- newCells.resize(maxVtkId, 0);
- newSmdsToVtk.resize(maxVtkId, -1);
- newVtkToSmds.resize(maxVtkId, -1);
+ assert(maxVtkId < newCellSize);
+ newCells.resize(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n
+ newSmdsToVtk.resize(newCellSize+1, -1);
+ newVtkToSmds.resize(newCellSize+1, -1);
int myCellsSize = myCells.size();
int newSmdsId = 0;
{
if (myCells[i])
{
- //MESSAGE(newSmdsId << " " << i);
+ newSmdsId++; // SMDS id start to 1
+ assert(newSmdsId <= newCellSize);
newCells[newSmdsId] = myCells[i];
+ newCells[newSmdsId]->setId(newSmdsId);
+ //MESSAGE("myCells["<< i << "] --> newCells[" << newSmdsId << "]");
int idvtk = myCells[i]->getVtkId();
newSmdsToVtk[newSmdsId] = idvtk;
- assert(idvtk < maxVtkId);
+ assert(idvtk < newCellSize);
newVtkToSmds[idvtk] = newSmdsId;
- myCells[i]->setId(newSmdsId);
- newSmdsId++;
- assert(newSmdsId <= maxVtkId);
}
}
myCells.swap(newCells);
- myIDElements.swap(newSmdsToVtk);
- myVtkIndex.swap(newVtkToSmds);
- MESSAGE("myCells.size()=" << myCells.size() << " myIDElements.size()=" << myIDElements.size() << " myVtkIndex.size()=" << myVtkIndex.size() );
+ myCellIdSmdsToVtk.swap(newSmdsToVtk);
+ myCellIdVtkToSmds.swap(newVtkToSmds);
+ MESSAGE("myCells.size()=" << myCells.size()
+ << " myCellIdSmdsToVtk.size()=" << myCellIdSmdsToVtk.size()
+ << " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
this->myElementIDFactory->emptyPool(newSmdsId);
+ this->myScript->SetModified(true); // notify GUI client for buildPrs when update
+
// ---TODO: myNodes, myElements in submeshes
// map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
if(anIter != VISUAL_OBJ_CONT.end()) {
// 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);
}
VISUAL_OBJ_CONT.erase(aKey);
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
for ( ; anIter != VISUAL_OBJ_CONT.end(); ++anIter ) {
// 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);
}
VISUAL_OBJ_CONT.clear();
int curId = anIter->first.first;
if ( curId == studyID ) {
// 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);
VISUAL_OBJ_CONT.erase( anIter-- ); // dercement occures before erase()
}
SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
const SMDSAbs_ElementType theElementType)
{
+ MESSAGE("extrusionAlongPath");
initData();
if ( thePathMesh->_is_nil() || thePathShape->_is_nil() ) {
CORBA::Boolean theHasRefPoint,
const SMESH::PointStruct & theRefPoint)
{
+ MESSAGE("ExtrusionAlongPath");
if ( !myPreviewMode ) {
TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
<< theIDsOfElements << ", "
// store the rest nodes row by row
- SMDS_MeshNode dummy(0,0,0);
- const SMDS_MeshElement* firstQuad = &dummy;// most left face above the last row of found nodes
+ 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
int nbFoundNodes = myIndexer._xSize;
while ( nbFoundNodes != myGrid.size() )
n1up = n2up;
}
}
-
+ mesh.GetMeshDS()->RemoveNode(dummy);
DumpGrid(); // debug
return true;
SMESH_Mesh * srcMesh,
const TAssocTool::TShapeShapeMap& shape2ShapeMap)
{
+ MESSAGE("projectPartner");
const double tol = 1e-6;
gp_Trsf trsf; // transformation to get location of target nodes from source ones
{
gp_Vec p0p1( srcPP[0], srcPP[1] ), p0p( srcPP[0], p );
pOK = !p0p1.IsParallel( p0p, tol );
+ // TODO angle pOK = !p0p1.IsParallel( p0p, 3.14/6 );
break;
}
}
// create a new node
gp_Pnt tgtP = gp_Pnt(srcNode->X(),srcNode->Y(),srcNode->Z()).Transformed( trsf );
srcN_tgtN->second = helper.AddNode( tgtP.X(), tgtP.Y(), tgtP.Z() );
+ //MESSAGE(tgtP.X() << " " << tgtP.Y() << " " << tgtP.Z());
}
tgtFaceNodes.push_back( srcN_tgtN->second );
}
bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape)
{
+ MESSAGE("Projection_2D Compute");
if ( !_sourceHypo )
return false;