myGrid->Initialize();
myGrid->Allocate();
vtkPoints* points = vtkPoints::New();
+ // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
+ // using double type for storing coordinates of nodes instead float.
+ points->SetDataType(VTK_DOUBLE);
points->SetNumberOfPoints(SMDS_Mesh::chunkSize);
myGrid->SetPoints( points );
points->Delete();
// find the MeshNode corresponding to ID
const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
if(!node){
- // TODO ID < 1
- if (ID <= 0)
+ if (ID < 1)
{
MESSAGE("=============> Bad Node Id: " << ID);
ID = myNodeIDFactory->GetFreeID();
myNodeIDFactory->adjustMaxId(ID);
SMDS_MeshNode * node = myNodePool->getNew();
node->init(ID, myMeshId, 0, x, y, z);
+
if (ID >= myNodes.size())
{
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
//MESSAGE("Add0DElementWithID" << ID)
SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
if (myElementIDFactory->BindID(ID, el0d)) {
- SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
+ //SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
//node->AddInverseElement(el0d);// --- fait avec BindID
adjustmyCellsCapacity(ID);
myCells[ID] = el0d;
else
{
//#ifdef VTK_HAVE_POLYHEDRON
- MESSAGE("AddPolygonalFaceWithID vtk " << ID);
+ //MESSAGE("AddPolygonalFaceWithID vtk " << ID);
vector<vtkIdType> nodeIds;
nodeIds.clear();
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
else
{
//#ifdef VTK_HAVE_POLYHEDRON
- MESSAGE("AddPolyhedralVolumeWithID vtk " << ID);
+ //MESSAGE("AddPolyhedralVolumeWithID vtk " << ID);
vector<vtkIdType> nodeIds;
nodeIds.clear();
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
return v;
}
-SMDS_MeshVolume* SMDS_Mesh::AddVolumeFromVtkIds(const std::vector<int>& vtkNodeIds)
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeFromVtkIds(const std::vector<vtkIdType>& vtkNodeIds)
{
int ID = myElementIDFactory->GetFreeID();
SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeFromVtkIdsWithID(vtkNodeIds, ID);
return v;
}
-SMDS_MeshVolume* SMDS_Mesh::AddVolumeFromVtkIdsWithID(const std::vector<int>& vtkNodeIds, const int ID)
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeFromVtkIdsWithID(const std::vector<vtkIdType>& vtkNodeIds, const int ID)
{
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
volvtk->init(vtkNodeIds, this);
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbNodes() const
{
- //MESSAGE(myGrid->GetNumberOfPoints());
- //MESSAGE(myInfo.NbNodes());
- //MESSAGE(myNodeMax);
+ //MESSAGE(myGrid->GetNumberOfPoints());
+ //MESSAGE(myInfo.NbNodes());
+ //MESSAGE(myNodeMax);
return myInfo.NbNodes();
}
while (itn->more())
{
const SMDS_MeshNode *node = itn->next();
+ ((SMDS_MeshNode*)node)->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
}
}
while (itn->more())
{
SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
+ node->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodePool->destroy(node);
}
myNodes.clear();
myGrid->Initialize();
myGrid->Allocate();
vtkPoints* points = vtkPoints::New();
- points->SetNumberOfPoints(SMDS_Mesh::chunkSize);
+ // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
+ // using double type for storing coordinates of nodes instead float.
+ points->SetDataType(VTK_DOUBLE);
+ points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/);
myGrid->SetPoints( points );
points->Delete();
myGrid->BuildLinks();
//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()
- || elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() || elem->GetType() == SMDSAbs_Volume)
+ if ( (elem->GetType() == SMDSAbs_0DElement)
+ || ((elem->GetType() == SMDSAbs_Edge) && !hasConstructionEdges())
+ || ((elem->GetType() == SMDSAbs_Face) && !hasConstructionFaces())
+ || (elem->GetType() == SMDSAbs_Volume) )
{
s1 = new set<const SMDS_MeshElement*> ();
s1->insert(elem);
myNodeIDFactory->ReleaseID((*it)->GetID(), (*it)->getVtkId());
removedNodes.push_back((*it));
if (const SMDS_MeshNode* vtkElem = dynamic_cast<const SMDS_MeshNode*>(*it))
+ {
+ ((SMDS_MeshNode*)vtkElem)->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodePool->destroy((SMDS_MeshNode*) vtkElem);
+ }
else
delete (*it);
it++;
if (!itFe->more()) { // free node
myNodes[elemId] = 0;
myInfo.myNbNodes--;
+ ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
myNodeIDFactory->ReleaseID(elemId, vtkId);
}
myInfo.myNbQuadEdges++;
// if (!registerElement(ID, edge)) {
-// RemoveElement(edge, false);
-// edge = NULL;
+// RemoveElement(edge, false);
+// edge = NULL;
// }
return edge;
if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41) return 0;
if(hasConstructionEdges()) {
// creation quadratic edges - not implemented
- return 0;
+ return 0;
}
else
{
myNodeMin = 0;
if (myNodes.size() == 0)
{
- myNodeMax=0;
- return;
+ myNodeMax=0;
+ return;
}
while (!myNodes[myNodeMin] && (myNodeMin<myNodes.size()))
myNodeMin++;
void SMDS_Mesh::dumpGrid(string ficdump)
{
- MESSAGE("SMDS_Mesh::dumpGrid " << ficdump);
+ MESSAGE("SMDS_Mesh::dumpGrid " << ficdump);
// vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
// aWriter->SetFileName(ficdump.c_str());
// aWriter->SetInput(myGrid);
ficcon << "-------------------------------- points " << nbPoints << endl;
for (int i=0; i<nbPoints; i++)
{
- ficcon << i << " " << *(myGrid->GetPoint(i)) << " " << *(myGrid->GetPoint(i)+1) << " " << " " << *(myGrid->GetPoint(i)+2) << endl;
+ ficcon << i << " " << *(myGrid->GetPoint(i)) << " " << *(myGrid->GetPoint(i)+1) << " " << " " << *(myGrid->GetPoint(i)+2) << endl;
}
int nbCells = myGrid->GetNumberOfCells();
ficcon << "-------------------------------- cells " << nbCells << endl;
for (int i=0; i<nbCells; i++)
{
-// MESSAGE(i << " " << myGrid->GetCell(i));
-// MESSAGE(" " << myGrid->GetCell(i)->GetCellType());
- ficcon << i << " - " << myGrid->GetCell(i)->GetCellType() << " -";
- int nbptcell = myGrid->GetCell(i)->GetNumberOfPoints();
- vtkIdList *listid = myGrid->GetCell(i)->GetPointIds();
- for (int j=0; j<nbptcell; j++)
- {
- ficcon << " " << listid->GetId(j);
- }
- ficcon << endl;
+// MESSAGE(i << " " << myGrid->GetCell(i));
+// MESSAGE(" " << myGrid->GetCell(i)->GetCellType());
+ ficcon << i << " - " << myGrid->GetCell(i)->GetCellType() << " -";
+ int nbptcell = myGrid->GetCell(i)->GetNumberOfPoints();
+ vtkIdList *listid = myGrid->GetCell(i)->GetPointIds();
+ for (int j=0; j<nbptcell; j++)
+ {
+ ficcon << " " << listid->GetId(j);
+ }
+ ficcon << endl;
}
ficcon << "-------------------------------- connectivity " << nbPoints << endl;
- vtkCellLinks *links = myGrid->GetCellLinks();
+ vtkCellLinks *links = myGrid->GetCellLinks();
for (int i=0; i<nbPoints; i++)
{
- int ncells = links->GetNcells(i);
- vtkIdType *cells = links->GetCells(i);
- ficcon << i << " - " << ncells << " -";
- for (int j=0; j<ncells; j++)
- {
- ficcon << " " << cells[j];
- }
- ficcon << endl;
+ int ncells = links->GetNcells(i);
+ vtkIdType *cells = links->GetCells(i);
+ ficcon << i << " - " << ncells << " -";
+ for (int j=0; j<ncells; j++)
+ {
+ ficcon << " " << cells[j];
+ }
+ ficcon << endl;
}
ficcon.close();