From 80ac3613f8288a4146f0d9b4763607bc7a02363d Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 24 Jan 2011 09:15:52 +0000 Subject: [PATCH] valid IDs count from 1 --- src/SMDS/SMDS_Mesh.cxx | 3 +-- src/SMESH/SMESH_MeshEditor.cxx | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index c1d16d8c8..dac6d7851 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -213,8 +213,7 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID) // 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(); diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index ccb675a0a..a0434ebfc 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -135,27 +135,27 @@ SMESH_MeshEditor::AddElement(const vector & node, case SMDSAbs_Face: if ( !isPoly ) { if (nbnode == 3) { - if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], ID); + if ( ID >= 1 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], ID); else e = mesh->AddFace (node[0], node[1], node[2] ); } else if (nbnode == 4) { - if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], ID); + if ( ID >= 1 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], ID); else e = mesh->AddFace (node[0], node[1], node[2], node[3] ); } else if (nbnode == 6) { - if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], node[4], node[5], ID); else e = mesh->AddFace (node[0], node[1], node[2], node[3], node[4], node[5] ); } else if (nbnode == 8) { - if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7], ID); else e = mesh->AddFace (node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7] ); } } else { - if ( ID >= 0 ) e = mesh->AddPolygonalFaceWithID(node, ID); + if ( ID >= 1 ) e = mesh->AddPolygonalFaceWithID(node, ID); else e = mesh->AddPolygonalFace (node ); } break; @@ -163,29 +163,29 @@ SMESH_MeshEditor::AddElement(const vector & node, case SMDSAbs_Volume: if ( !isPoly ) { if (nbnode == 4) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], ID); + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], ID); else e = mesh->AddVolume (node[0], node[1], node[2], node[3] ); } else if (nbnode == 5) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], ID); else e = mesh->AddVolume (node[0], node[1], node[2], node[3], node[4] ); } else if (nbnode == 6) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], node[5], ID); else e = mesh->AddVolume (node[0], node[1], node[2], node[3], node[4], node[5] ); } else if (nbnode == 8) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7], ID); else e = mesh->AddVolume (node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7] ); } else if (nbnode == 10) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7], node[8], node[9], ID); else e = mesh->AddVolume (node[0], node[1], node[2], node[3], @@ -193,7 +193,7 @@ SMESH_MeshEditor::AddElement(const vector & node, node[8], node[9] ); } else if (nbnode == 13) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7], node[8], node[9], node[10],node[11], node[12],ID); @@ -203,7 +203,7 @@ SMESH_MeshEditor::AddElement(const vector & node, node[12] ); } else if (nbnode == 15) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7], node[8], node[9], node[10],node[11], node[12],node[13],node[14],ID); @@ -213,7 +213,7 @@ SMESH_MeshEditor::AddElement(const vector & node, node[12],node[13],node[14] ); } else if (nbnode == 20) { - if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], + if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7], node[8], node[9], node[10],node[11], node[12],node[13],node[14],node[15], @@ -229,24 +229,24 @@ SMESH_MeshEditor::AddElement(const vector & node, case SMDSAbs_Edge: if ( nbnode == 2 ) { - if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], ID); + if ( ID >= 1 ) e = mesh->AddEdgeWithID(node[0], node[1], ID); else e = mesh->AddEdge (node[0], node[1] ); } else if ( nbnode == 3 ) { - if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], node[2], ID); + if ( ID >= 1 ) e = mesh->AddEdgeWithID(node[0], node[1], node[2], ID); else e = mesh->AddEdge (node[0], node[1], node[2] ); } break; case SMDSAbs_0DElement: if ( nbnode == 1 ) { - if ( ID >= 0 ) e = mesh->Add0DElementWithID(node[0], ID); + if ( ID >= 1 ) e = mesh->Add0DElementWithID(node[0], ID); else e = mesh->Add0DElement (node[0] ); } break; case SMDSAbs_Node: - if ( ID >= 0 ) e = mesh->AddNodeWithID(node[0]->X(), node[0]->Y(), node[0]->Z(), ID); + if ( ID >= 1 ) e = mesh->AddNodeWithID(node[0]->X(), node[0]->Y(), node[0]->Z(), ID); else e = mesh->AddNode (node[0]->X(), node[0]->Y(), node[0]->Z()); break; -- 2.39.2