mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 10:40:36 +05:00
valid IDs count from 1
This commit is contained in:
parent
b94b5d0b91
commit
80ac3613f8
@ -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();
|
||||
|
@ -135,27 +135,27 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & 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<const SMDS_MeshNode*> & 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<const SMDS_MeshNode*> & 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<const SMDS_MeshNode*> & 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<const SMDS_MeshNode*> & 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<const SMDS_MeshNode*> & 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user