From f7fbf1c62246f439c35746c731f64dab57391c1b Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 5 Sep 2003 10:31:32 +0000 Subject: [PATCH 01/16] Use nodes and elements pointer instead on IDs --- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 10 +- src/SMESH/SMESH_Hexa_3D.cxx | 107 ++++++++-------- src/SMESH/SMESH_Hexa_3D.hxx | 2 +- src/SMESH/SMESH_MEFISTO_2D.cxx | 61 +++++----- src/SMESH/SMESH_MEFISTO_2D.hxx | 6 +- src/SMESH/SMESH_Quadrangle_2D.cxx | 78 ++++++------ src/SMESH/SMESH_Quadrangle_2D.hxx | 2 +- src/SMESH/SMESH_Regular_1D.cxx | 29 ++--- src/SMESH/SMESH_subMesh.cxx | 26 ++-- src/SMESHDS/SMESHDS_Mesh.cxx | 134 ++++++++++++--------- src/SMESHDS/SMESHDS_Mesh.hxx | 56 +++++++-- src/SMESHDS/SMESHDS_SubMesh.cxx | 92 +++++--------- src/SMESHDS/SMESHDS_SubMesh.hxx | 14 +-- src/SMESH_I/SMESH_MEDSupport_i.cxx | 10 +- src/SMESH_I/SMESH_MeshEditor_i.cxx | 67 +++-------- 15 files changed, 329 insertions(+), 365 deletions(-) diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 145125304..5665790ad 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -530,14 +530,11 @@ void DriverMED_W_SMESHDS_Mesh::Add() //MESSAGE ("********* Traitement de la Famille "<<-t); SMESHDS_SubMesh * SM = mySMESHDSMesh->MeshElements(S); - const vector& indElt = SM->GetIDElements(); - vector::const_iterator ite=indElt.begin(); - + SMDS_Iterator * ite=SM->GetElements(); bool plein = false; - for (; ite!=indElt.end(); ite++) + while(ite->more()) { - int eltId = *ite; - mapFamille[eltId] = -t; + mapFamille[ite->next()->GetID()] = -t; plein = true; } if (plein) @@ -640,6 +637,7 @@ void DriverMED_W_SMESHDS_Mesh::Add() /* liberation memoire */ free(connectivite); free(numele); + free(nomele); free(nufael); MESSAGE(" End " << typmai[i]); } diff --git a/src/SMESH/SMESH_Hexa_3D.cxx b/src/SMESH/SMESH_Hexa_3D.cxx index 65d2d2a4b..69f036fc1 100644 --- a/src/SMESH/SMESH_Hexa_3D.cxx +++ b/src/SMESH/SMESH_Hexa_3D.cxx @@ -341,18 +341,19 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, { const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX0]->GetSubShape()); - const vector & indElt - = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); faceQuadStruct *quad = _cube.quad_X0; int i = 0; // j = x/face , k = y/face int nbdown = quad->nbPts[0]; int nbright = quad->nbPts[1]; - for (int itf=0; itf * itf= + aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); + + while(itf->more()) { - int nodeId = indElt[itf]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itf->next(); const SMDS_FacePosition* fpos = static_cast(node->GetPosition()); double ri = fpos->GetUParameter(); @@ -360,8 +361,9 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int i1 = int (ri); int j1 = int (rj); int ij1 = j1 * nbdown + i1; - quad->uv_grid[ij1].nodeId = nodeId; + quad->uv_grid[ij1].node = node; } + delete itf; for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) @@ -371,25 +373,25 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].nodeId; + np[ijk].node = quad->uv_grid[ij1].node; //SCRUTE(np[ijk].nodeId); } } { const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX1]->GetSubShape()); - const vector & indElt - = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + + SMDS_Iterator * itf= + aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = _cube.quad_X1; int i = nbx - 1; // j = x/face , k = y/face int nbdown = quad->nbPts[0]; int nbright = quad->nbPts[1]; - for (int itf=0; itfmore()) { - int nodeId = indElt[itf]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itf->next(); const SMDS_FacePosition* fpos = static_cast(node->GetPosition()); double ri = fpos->GetUParameter(); @@ -397,8 +399,9 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int i1 = int (ri); int j1 = int (rj); int ij1 = j1 * nbdown + i1; - quad->uv_grid[ij1].nodeId = nodeId; + quad->uv_grid[ij1].node = node; } + delete itf; for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) @@ -408,25 +411,25 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].nodeId; + np[ijk].node = quad->uv_grid[ij1].node; //SCRUTE(np[ijk].nodeId); } } { const TopoDS_Face & F = TopoDS::Face(meshFaces[_indY0]->GetSubShape()); - const vector & indElt - = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + + SMDS_Iterator * itf= + aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = _cube.quad_Y0; int j = 0; // i = x/face , k = y/face int nbdown = quad->nbPts[0]; int nbright = quad->nbPts[1]; - for (int itf=0; itfmore()) { - int nodeId = indElt[itf]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itf->next(); const SMDS_FacePosition * fpos = static_cast(node->GetPosition()); double ri = fpos->GetUParameter(); @@ -434,7 +437,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int i1 = int (ri); int j1 = int (rj); int ij1 = j1 * nbdown + i1; - quad->uv_grid[ij1].nodeId = nodeId; + quad->uv_grid[ij1].node = node; } for (int i1 = 0; i1 < nbdown; i1++) @@ -445,25 +448,25 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].nodeId; + np[ijk].node = quad->uv_grid[ij1].node; //SCRUTE(np[ijk].nodeId); } } { const TopoDS_Face & F = TopoDS::Face(meshFaces[_indY1]->GetSubShape()); - const vector & indElt - = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + + SMDS_Iterator * itf= + aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = _cube.quad_Y1; int j = nby - 1; // i = x/face , k = y/face int nbdown = quad->nbPts[0]; int nbright = quad->nbPts[1]; - for (int itf=0; itfmore()) { - int nodeId = indElt[itf]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itf->next(); const SMDS_FacePosition* fpos = static_cast(node->GetPosition()); double ri = fpos->GetUParameter(); @@ -471,7 +474,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int i1 = int (ri); int j1 = int (rj); int ij1 = j1 * nbdown + i1; - quad->uv_grid[ij1].nodeId = nodeId; + quad->uv_grid[ij1].node = node; } for (int i1 = 0; i1 < nbdown; i1++) @@ -482,25 +485,25 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].nodeId; + np[ijk].node = quad->uv_grid[ij1].node; //SCRUTE(np[ijk].nodeId); } } { const TopoDS_Face & F = TopoDS::Face(meshFaces[_indZ0]->GetSubShape()); - const vector & indElt - = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + + SMDS_Iterator * itf= + aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = _cube.quad_Z0; int k = 0; // i = x/face , j = y/face int nbdown = quad->nbPts[0]; int nbright = quad->nbPts[1]; - for (int itf=0; itfmore()) { - int nodeId = indElt[itf]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itf->next(); const SMDS_FacePosition * fpos = static_cast(node->GetPosition()); double ri = fpos->GetUParameter(); @@ -508,7 +511,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int i1 = int (ri); int j1 = int (rj); int ij1 = j1 * nbdown + i1; - quad->uv_grid[ij1].nodeId = nodeId; + quad->uv_grid[ij1].node = node; } for (int i1 = 0; i1 < nbdown; i1++) @@ -519,25 +522,25 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].nodeId; + np[ijk].node = quad->uv_grid[ij1].node; //SCRUTE(np[ijk].nodeId); } } { const TopoDS_Face & F = TopoDS::Face(meshFaces[_indZ1]->GetSubShape()); - const vector & indElt - = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + + SMDS_Iterator * itf= + aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = _cube.quad_Z1; int k = nbz - 1; // i = x/face , j = y/face int nbdown = quad->nbPts[0]; int nbright = quad->nbPts[1]; - for(int itf=0; itfmore()) { - int nodeId = indElt[itf]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itf->next(); const SMDS_FacePosition* fpos = static_cast(node->GetPosition()); double ri = fpos->GetUParameter(); @@ -545,7 +548,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int i1 = int (ri); int j1 = int (rj); int ij1 = j1 * nbdown + i1; - quad->uv_grid[ij1].nodeId = nodeId; + quad->uv_grid[ij1].node = node; } for (int i1 = 0; i1 < nbdown; i1++) @@ -556,7 +559,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].nodeId; + np[ijk].node = quad->uv_grid[ij1].node; //SCRUTE(np[ijk].nodeId); } } @@ -651,7 +654,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, } SMDS_MeshNode * node = meshDS->AddNode(X[0], X[1], X[2]); - np[ijk].nodeId = node->GetID(); + np[ijk].node = node; //meshDS->SetNodeInVolume(node, TopoDS::Solid(aShape)); meshDS->SetNodeInVolume(node, aShell); } @@ -677,14 +680,14 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, // MESSAGE(" "<AddVolume(np[n1].nodeId, - np[n2].nodeId, - np[n3].nodeId, - np[n4].nodeId, - np[n5].nodeId, - np[n6].nodeId, - np[n7].nodeId, - np[n8].nodeId); + SMDS_MeshVolume * elt = meshDS->AddVolume(np[n1].node, + np[n2].node, + np[n3].node, + np[n4].node, + np[n5].node, + np[n6].node, + np[n7].node, + np[n8].node); ; meshDS->SetMeshElementOnShape(elt, aShell); @@ -728,7 +731,7 @@ void SMESH_Hexa_3D::GetPoint(Pt3 p, int i, int j, int k, int nbx, int nby, int nbz, Point3DStruct * np, const SMESHDS_Mesh * meshDS) { int ijk = k * nbx * nby + j * nbx + i; - const SMDS_MeshNode * node = meshDS->FindNode(np[ijk].nodeId); + const SMDS_MeshNode * node = np[ijk].node; p[0] = node->X(); p[1] = node->Y(); p[2] = node->Z(); diff --git a/src/SMESH/SMESH_Hexa_3D.hxx b/src/SMESH/SMESH_Hexa_3D.hxx index 0a6a98093..0aa874c7a 100644 --- a/src/SMESH/SMESH_Hexa_3D.hxx +++ b/src/SMESH/SMESH_Hexa_3D.hxx @@ -36,7 +36,7 @@ typedef struct point3Dstruct { - int nodeId; + const SMDS_MeshNode * node; } Point3DStruct; typedef double Pt3[3]; diff --git a/src/SMESH/SMESH_MEFISTO_2D.cxx b/src/SMESH/SMESH_MEFISTO_2D.cxx index 3a69f84d5..ffd212d06 100644 --- a/src/SMESH/SMESH_MEFISTO_2D.cxx +++ b/src/SMESH/SMESH_MEFISTO_2D.cxx @@ -225,7 +225,7 @@ bool SMESH_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) //SCRUTE(nudslf[nblf]); int m = 0; - map < int, int >mefistoToDS; // correspondence mefisto index--> points IDNodes + map mefistoToDS; // correspondence mefisto index--> points IDNodes TopoDS_Wire OW = BRepTools::OuterWire(F); LoadPoints(aMesh, F, OW, uvslf, m, mefistoToDS); //SCRUTE(m); @@ -291,7 +291,8 @@ bool SMESH_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) void SMESH_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, const TopoDS_Face & FF, - const TopoDS_Wire & WW, R2 * uvslf, int &m, map < int, int >&mefistoToDS) + const TopoDS_Wire & WW, R2 * uvslf, int &m, + map&mefistoToDS) { MESSAGE("SMESH_MEFISTO_2D::LoadPoints"); @@ -313,19 +314,16 @@ void SMESH_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, TopoDS_Vertex VFirst, VLast; TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l - ASSERT(!VFirst.IsNull()); - SMESH_subMesh *firstSubMesh = aMesh.GetSubMesh(VFirst); - const vector & lidf - = firstSubMesh->GetSubMeshDS()->GetIDNodes(); - int idFirst = lidf[0]; -// SCRUTE(idFirst); + ASSERT(!VFirst.IsNull()); + SMDS_Iterator * lid= + aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* idFirst = lid->next(); + delete lid; ASSERT(!VLast.IsNull()); - SMESH_subMesh *lastSubMesh = aMesh.GetSubMesh(VLast); - const vector & lidl - = lastSubMesh->GetSubMeshDS()->GetIDNodes(); - int idLast = lidl[0]; -// SCRUTE(idLast); + lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* idLast = lid->next(); + delete lid; // --- edge internal IDNodes (relies on good order storage, not checked) @@ -335,22 +333,21 @@ void SMESH_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, double f, l; Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); - const vector & indElt - = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes(); + SMDS_Iterator * ite= + aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes(); - ASSERT(nbPoints == indElt.size()); bool isForward = (E.Orientation() == TopAbs_FORWARD); - map < double, int >params; - for (int ite=0; ite params; + + while(ite->more()) { - int nodeId = indElt[ite]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = ite->next(); const SMDS_EdgePosition* epos = static_cast(node->GetPosition()); double param = epos->GetUParameter(); - params[param] = nodeId; + params[param] = node; } - + delete ite; // --- load 2D values into MEFISTO structure, // add IDNodes in mefistoToDS map @@ -363,7 +360,7 @@ void SMESH_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, //MESSAGE(" "<::iterator itp = params.begin(); + map::iterator itp = params.begin(); for (int i = 1; i <= nbPoints; i++) // nbPoints internal { double param = (*itp).first; @@ -386,7 +383,7 @@ void SMESH_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, // MESSAGE(" "<::reverse_iterator itp = params.rbegin(); + map::reverse_iterator itp = params.rbegin(); for (int i = nbPoints; i >= 1; i--) { double param = (*itp).first; @@ -489,7 +486,8 @@ void SMESH_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh, void SMESH_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh, Z nbst, R2 * uvst, Z nbt, Z * nust, - const TopoDS_Face & F, bool faceIsForward, map < int, int >&mefistoToDS) + const TopoDS_Face & F, bool faceIsForward, + map&mefistoToDS) { double scalex; double scaley; @@ -512,7 +510,7 @@ void SMESH_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh, meshDS->SetNodeOnFace(node, F); //MESSAGE(nodeId<<" "<GetID(); + mefistoToDS[n + 1] = node; //MESSAGE(" "<(node->GetPosition()); @@ -531,9 +529,10 @@ void SMESH_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh, int inode2 = nust[m++]; int inode3 = nust[m++]; - int nodeId1 = mefistoToDS[inode1]; - int nodeId2 = mefistoToDS[inode2]; - int nodeId3 = mefistoToDS[inode3]; + const SMDS_MeshNode *n1, *n2, *n3; + n1 = mefistoToDS[inode1]; + n2 = mefistoToDS[inode2]; + n3 = mefistoToDS[inode3]; //MESSAGE("-- "<AddFace(nodeId1, nodeId2, nodeId3); + elt = meshDS->AddFace(n1, n2, n3); else - elt = meshDS->AddFace(nodeId1, nodeId3, nodeId2); + elt = meshDS->AddFace(n1, n3, n2); meshDS->SetMeshElementOnShape(elt, F); m++; diff --git a/src/SMESH/SMESH_MEFISTO_2D.hxx b/src/SMESH/SMESH_MEFISTO_2D.hxx index 870e8d87d..7727a86e0 100644 --- a/src/SMESH/SMESH_MEFISTO_2D.hxx +++ b/src/SMESH/SMESH_MEFISTO_2D.hxx @@ -34,8 +34,8 @@ #include "SMESH_LengthFromEdges.hxx" #include "Rn.h" +class SMDS_MeshNode; #include - #include class SMESH_MEFISTO_2D: @@ -59,7 +59,7 @@ public: const TopoDS_Wire& W, R2* uvslf, int& m, - map& mefistoToDS); + map& mefistoToDS); void ComputeScaleOnFace(SMESH_Mesh& aMesh, const TopoDS_Face& aFace, @@ -69,7 +69,7 @@ public: void StoreResult (SMESH_Mesh& aMesh, Z nbst, R2* uvst, Z nbt, Z* nust, const TopoDS_Face& F, bool faceIsForward, - map& mefistoToDS); + map& mefistoToDS); ostream & SaveTo(ostream & save); istream & LoadFrom(istream & load); diff --git a/src/SMESH/SMESH_Quadrangle_2D.cxx b/src/SMESH/SMESH_Quadrangle_2D.cxx index 3b8a61bbe..eab7b2838 100644 --- a/src/SMESH/SMESH_Quadrangle_2D.cxx +++ b/src/SMESH/SMESH_Quadrangle_2D.cxx @@ -134,9 +134,8 @@ bool SMESH_Quadrangle_2D::Compute(SMESH_Mesh & aMesh, double v = quad->uv_grid[ij].v; gp_Pnt P = S->Value(u, v); SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - int nodeId = node->GetID(); meshDS->SetNodeOnFace(node, F); - quad->uv_grid[ij].nodeId = nodeId; + quad->uv_grid[ij].node = node; // Handle (SMDS_FacePosition) fpos // = new SMDS_FacePosition(theSubMesh->GetId(),i,j); // easier than u,v // node->SetPosition(fpos); @@ -150,11 +149,11 @@ bool SMESH_Quadrangle_2D::Compute(SMESH_Mesh & aMesh, for (int i = 0; i < nbdown - 1; i++) for (int j = 0; j < nbright - 1; j++) // faces { - int a = quad->uv_grid[j * nbdown + i].nodeId; - int b = quad->uv_grid[j * nbdown + i + 1].nodeId; - int c = quad->uv_grid[(j + 1) * nbdown + i + 1].nodeId; - int d = quad->uv_grid[(j + 1) * nbdown + i].nodeId; - int faceId; + const SMDS_MeshNode *a, *b, *c, *d; + a = quad->uv_grid[j * nbdown + i].node; + b = quad->uv_grid[j * nbdown + i + 1].node; + c = quad->uv_grid[(j + 1) * nbdown + i + 1].node; + d = quad->uv_grid[(j + 1) * nbdown + i].node; // if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d); // else faceId = meshDS->AddFace(a,d,c,b); SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d); @@ -392,25 +391,25 @@ void SMESH_Quadrangle_2D::SetNormalizedGrid(SMESH_Mesh & aMesh, for (int i = 0; i < nbdown; i++) { int ij = j * nbdown + i; - uv_grid[ij].nodeId = uv_e0[i].nodeId; + uv_grid[ij].node = uv_e0[i].node; } i = nbdown - 1; for (int j = 0; j < nbright; j++) { int ij = j * nbdown + i; - uv_grid[ij].nodeId = uv_e1[j].nodeId; + uv_grid[ij].node = uv_e1[j].node; } j = nbright - 1; for (int i = 0; i < nbdown; i++) { int ij = j * nbdown + i; - uv_grid[ij].nodeId = uv_e2[i].nodeId; + uv_grid[ij].node = uv_e2[i].node; } i = 0; for (int j = 0; j < nbright; j++) { int ij = j * nbdown + i; - uv_grid[ij].nodeId = uv_e3[j].nodeId; + uv_grid[ij].node = uv_e3[j].node; } // normalized 2d values on grid @@ -489,19 +488,16 @@ UVPtStruct *SMESH_Quadrangle_2D::LoadEdgePoints(SMESH_Mesh & aMesh, TopoDS_Vertex VFirst, VLast; TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l - ASSERT(!VFirst.IsNull()); - SMESH_subMesh *firstSubMesh = aMesh.GetSubMesh(VFirst); - const vector& lidf - = firstSubMesh->GetSubMeshDS()->GetIDNodes(); - int idFirst = lidf[0]; - //SCRUTE(idFirst); + ASSERT(!VFirst.IsNull()); + SMDS_Iterator * lid= + aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode * idFirst = lid->next(); + delete lid; - ASSERT(!VLast.IsNull()); - SMESH_subMesh *lastSubMesh = aMesh.GetSubMesh(VLast); - const vector & lidl - = lastSubMesh->GetSubMeshDS()->GetIDNodes(); - int idLast = lidl[0]; - //SCRUTE(idLast); + ASSERT(!VLast.IsNull()); + lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode * idLast = lid->next(); + delete lid; // --- edge internal IDNodes (relies on good order storage, not checked) @@ -512,23 +508,19 @@ UVPtStruct *SMESH_Quadrangle_2D::LoadEdgePoints(SMESH_Mesh & aMesh, double f, l; Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); - const vector & indElt - = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes(); + map params; + SMDS_Iterator * ite= + aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes(); - //SCRUTE(nbPoints); - //SCRUTE(indElt.Extent()); - ASSERT(nbPoints == indElt.size()); - - map params; - for (int ite=0; itemore()) { - int nodeId = indElt[ite]; - const SMDS_MeshNode * node = meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = ite->next(); const SMDS_EdgePosition* epos = static_cast(node->GetPosition()); double param = epos->GetUParameter(); - params[param] = nodeId; + params[param] = node; } + delete ite; bool isForward = (((l - f) * (last - first)) > 0); double paramin = 0; @@ -541,18 +533,17 @@ UVPtStruct *SMESH_Quadrangle_2D::LoadEdgePoints(SMESH_Mesh & aMesh, uvslf[0].x = p.X(); uvslf[0].y = p.Y(); uvslf[0].param = f; - uvslf[0].nodeId = idFirst; + uvslf[0].node = idFirst; //MESSAGE("__ f "<::iterator itp = params.begin(); + map < double, const SMDS_MeshNode* >::iterator itp = params.begin(); for (int i = 1; i <= nbPoints; i++) // nbPoints internal { double param = (*itp).first; - int nodeId = (*itp).second; gp_Pnt2d p = C2d->Value(param); uvslf[i].x = p.X(); uvslf[i].y = p.Y(); uvslf[i].param = param; - uvslf[i].nodeId = nodeId; + uvslf[i].node = (*itp).second; //MESSAGE("__ "<::reverse_iterator itp = params.rbegin(); + map < double, const SMDS_MeshNode* >::reverse_iterator itp = params.rbegin(); for (int j = nbPoints; j >= 1; j--) // nbPoints internal { double param = (*itp).first; - int nodeId = (*itp).second; int i = nbPoints + 1 - j; gp_Pnt2d p = C2d->Value(param); uvslf[i].x = p.X(); uvslf[i].y = p.Y(); uvslf[i].param = param; - uvslf[i].nodeId = nodeId; + uvslf[i].node = (*itp).second; //MESSAGE("__ "< & lidf - = firstSubMesh->GetSubMeshDS()->GetIDNodes(); - int idFirst = lidf[0]; - //SCRUTE(idFirst); + SMDS_Iterator * lid= + aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode * idFirst = lid->next(); + delete lid; ASSERT(!VLast.IsNull()); - SMESH_subMesh *lastSubMesh = aMesh.GetSubMesh(VLast); - const vector & lidl - = lastSubMesh->GetSubMeshDS()->GetIDNodes(); - int idLast = lidl[0]; - //SCRUTE(idLast); + lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode * idLast = lid->next(); + delete lid; if (!Curve.IsNull()) { @@ -244,7 +241,7 @@ bool SMESH_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex) // only internal nodes receive an edge position with param on curve - int idPrev = idFirst; + const SMDS_MeshNode * idPrev = idFirst; for (int i = 2; i < NbPoints; i++) { double param = Discret.Parameter(i); @@ -274,9 +271,9 @@ bool SMESH_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) SMDS_EdgePosition* epos=dynamic_cast(node->GetPosition()); epos->SetUParameter(param); - SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node->GetID()); + SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node); meshDS->SetMeshElementOnShape(edge, E); - idPrev = node->GetID(); + idPrev = node; } SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast); meshDS->SetMeshElementOnShape(edge, E); @@ -297,7 +294,7 @@ bool SMESH_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) TopExp::Vertices(E, V1, V2); gp_Pnt P = BRep_Tool::Pnt(V1); - int idPrev = idFirst; + const SMDS_MeshNode * idPrev = idFirst; for (int i = 2; i < NbPoints; i++) { double param = f + (i - 1) * du; @@ -311,9 +308,9 @@ bool SMESH_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) = dynamic_cast(node->GetPosition()); epos->SetUParameter(param); - SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node->GetID()); + SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node); meshDS->SetMeshElementOnShape(edge, E); - idPrev = node->GetID(); + idPrev = node; } SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast); meshDS->SetMeshElementOnShape(edge, E); diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 711baf691..9fae1d7ab 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1321,27 +1321,23 @@ void SMESH_subMesh::RemoveSubMeshElementsAndNodes() _subMeshDS = _meshDS->MeshElements(_subShape); if (_subMeshDS!=NULL) { - const vector & indElt = _subMeshDS->GetIDElements(); - vector::const_iterator ite=indElt.begin(); - for (; ite!=indElt.end(); ite++) + SMDS_Iterator * ite=_subMeshDS->GetElements(); + while(ite->more()) { - int eltId = *ite; - SCRUTE(eltId); - const SMDS_MeshElement * elt = _meshDS->FindElement(eltId); + const SMDS_MeshElement * elt = ite->next(); _subMeshDS->RemoveElement(elt); - _meshDS->RemoveElement(eltId); + _meshDS->RemoveElement(elt); } - - const vector & indNodes = _subMeshDS->GetIDNodes(); - vector::const_iterator itn=indNodes.begin(); - for (; itn!=indNodes.end(); itn++) + delete ite; + + SMDS_Iterator * itn=_subMeshDS->GetNodes(); + while(itn->more()) { - int nodeId = *itn; - SCRUTE(nodeId); - const SMDS_MeshNode * node = _meshDS->FindNode(nodeId); + const SMDS_MeshNode * node = itn->next(); _subMeshDS->RemoveNode(node); - _meshDS->RemoveNode(nodeId); + _meshDS->RemoveNode(node); } + delete itn; } } diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index b9023b3e6..0396c6ba7 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -111,21 +111,22 @@ SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z) //function : MoveNode //purpose : //======================================================================= -void SMESHDS_Mesh::MoveNode(int ID, double x, double y, double z) +void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z) { - SMDS_MeshNode * node=const_cast(FindNode(ID)); + SMDS_MeshNode * node=const_cast(n); node->setXYZ(x,y,z); - myScript->MoveNode(ID, x, y, z); + myScript->MoveNode(n->GetID(), x, y, z); } //======================================================================= //function : AddEdge //purpose : //======================================================================= -SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(int idnode1, int idnode2) +SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2) { - SMDS_MeshEdge* e = SMDS_Mesh::AddEdge(idnode1, idnode2); - if(e!=NULL) myScript->AddEdge(e->GetID(), idnode1, idnode2); + SMDS_MeshEdge* e = SMDS_Mesh::AddEdge(n1,n2); + if(e!=NULL) myScript->AddEdge(e->GetID(), n1->GetID(), n2->GetID()); return e; } @@ -133,10 +134,13 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(int idnode1, int idnode2) //function :AddFace //purpose : //======================================================================= -SMDS_MeshFace* SMESHDS_Mesh::AddFace(int idnode1, int idnode2, int idnode3) +SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3) { - SMDS_MeshFace *f = SMDS_Mesh::AddFace(idnode1, idnode2, idnode3); - if(f!=NULL) myScript->AddFace(f->GetID(), idnode1, idnode2, idnode3); + SMDS_MeshFace *f = SMDS_Mesh::AddFace(n1, n2, n3); + if(f!=NULL) myScript->AddFace(f->GetID(), n1->GetID(), n2->GetID(), + n3->GetID()); return f; } @@ -144,12 +148,15 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFace(int idnode1, int idnode2, int idnode3) //function :AddFace //purpose : //======================================================================= -SMDS_MeshFace* SMESHDS_Mesh::AddFace(int idnode1, int idnode2, int idnode3, - int idnode4) +SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4) { - SMDS_MeshFace *f = SMDS_Mesh::AddFace(idnode1, idnode2, idnode3, idnode4); + SMDS_MeshFace *f = SMDS_Mesh::AddFace(n1, n2, n3, n4); if(f!=NULL) - myScript->AddFace(f->GetID(), idnode1, idnode2, idnode3, idnode4); + myScript->AddFace(f->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), + n4->GetID()); return f; } @@ -157,13 +164,16 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFace(int idnode1, int idnode2, int idnode3, //function :AddVolume //purpose : //======================================================================= -SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, - int idnode4) +SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4) { - SMDS_MeshVolume *f = SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3, - idnode4); + SMDS_MeshVolume *f = SMDS_Mesh::AddVolume(n1, n2, n3, n4); if(f!=NULL) - myScript->AddVolume(f->GetID(), idnode1, idnode2, idnode3, idnode4); + myScript->AddVolume(f->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), + n4->GetID()); return f; } @@ -171,14 +181,17 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, //function :AddVolume //purpose : //======================================================================= -SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, - int idnode4, int idnode5) +SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5) { - SMDS_MeshVolume *v = SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3, - idnode4, idnode5); + SMDS_MeshVolume *v = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5); if(v!=NULL) - myScript->AddVolume(v->GetID(), idnode1, idnode2, idnode3, idnode4, - idnode5); + myScript->AddVolume(v->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), + n4->GetID(), n5->GetID()); return v; } @@ -186,15 +199,18 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, //function :AddVolume //purpose : //======================================================================= -SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, - int idnode4, int idnode5, int idnode6) +SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6) { - SMDS_MeshVolume *v= - SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3, idnode4, idnode5, - idnode6); + SMDS_MeshVolume *v= SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6); if(v!=NULL) - myScript->AddVolume(v->GetID(), idnode1, idnode2, idnode3, idnode4, - idnode5, idnode6); + myScript->AddVolume(v->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), + n4->GetID(), n5->GetID(), n6->GetID()); return v; } @@ -202,15 +218,21 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, //function :AddVolume //purpose : //======================================================================= -SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, - int idnode4, int idnode5, int idnode6, int idnode7, int idnode8) +SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8) { SMDS_MeshVolume *v= - SMDS_Mesh::AddVolume(idnode1, idnode2, idnode3, idnode4, idnode5, - idnode6, idnode7, idnode8); + SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8); if(v!=NULL) - myScript->AddVolume(v->GetID(), idnode1, idnode2, idnode3, idnode4, - idnode5, idnode6, idnode7, idnode8); + myScript->AddVolume(v->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), + n4->GetID(), n5->GetID(), n6->GetID(), n7->GetID(), n8->GetID()); return v; } @@ -218,20 +240,20 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(int idnode1, int idnode2, int idnode3, //function : RemoveNode //purpose : //======================================================================= -void SMESHDS_Mesh::RemoveNode(int ID) +void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n) { - SMDS_Mesh::RemoveNode(ID); - myScript->RemoveNode(ID); + SMDS_Mesh::RemoveNode(n); + myScript->RemoveNode(n->GetID()); } //======================================================================= //function : RemoveElement //purpose : //======================================================================== -void SMESHDS_Mesh::RemoveElement(int ID) +void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt) { - SMDS_Mesh::RemoveElement(ID); - myScript->RemoveElement(ID); + SMDS_Mesh::RemoveElement(elt); + myScript->RemoveElement(elt->GetID()); } //======================================================================= @@ -252,7 +274,7 @@ void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode, //Update or build submesh map::iterator it=myShapeIndexToSubMesh.find(Index); if (it==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -274,7 +296,7 @@ void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode * aNode, //Update or build submesh map::iterator it=myShapeIndexToSubMesh.find(Index); if (it==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -296,7 +318,7 @@ void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode * aNode, //Update or build submesh map::iterator it=myShapeIndexToSubMesh.find(Index); if (it==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -318,7 +340,7 @@ void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode * aNode, //Update or build submesh map::iterator it=myShapeIndexToSubMesh.find(Index); if (it==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -344,7 +366,7 @@ void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement * anElement, int Index = myIndexToShape.FindIndex(S); if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddElement(anElement); } @@ -450,7 +472,7 @@ void SMESHDS_Mesh::NewSubMesh(int Index) { if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) { - SMESHDS_SubMesh* SM = new SMESHDS_SubMesh(this); + SMESHDS_SubMesh* SM = new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]=SM; } } @@ -486,7 +508,7 @@ void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index) //Update or build submesh if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -502,7 +524,7 @@ void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode* aNode, int Index) //Update or build submesh if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -518,7 +540,7 @@ void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode* aNode, int Index) //Update or build submesh if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -534,7 +556,7 @@ void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode* aNode, int Index) //Update or build submesh if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddNode(aNode); } @@ -547,7 +569,11 @@ void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement, int Index) { if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) - myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(this); + myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh(); myShapeIndexToSubMesh[Index]->AddElement(anElement); } + +SMESHDS_Mesh::~SMESHDS_Mesh() +{ +} diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index ef18cb416..ce7d49a87 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -58,19 +58,49 @@ class SMESHDS_Mesh:public SMDS_Mesh bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H); bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H); SMDS_MeshNode * AddNode(double x, double y, double z); - virtual void RemoveNode(int ID); - void MoveNode(int ID, double x, double y, double z); - SMDS_MeshEdge* AddEdge(int idnode1, int idnode2); - SMDS_MeshFace* AddFace(int idnode1, int idnode2, int idnode3); - SMDS_MeshFace* AddFace(int idnode1, int idnode2, int idnode3, int idnode4); - SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4); - SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4, - int idnode5); - SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4, - int idnode5, int idnode6); - SMDS_MeshVolume* AddVolume(int idnode1, int idnode2, int idnode3, int idnode4, - int idnode5, int idnode6, int idnode7, int idnode8); - virtual void RemoveElement(int IDelem); + void RemoveNode(const SMDS_MeshNode *); + void MoveNode(const SMDS_MeshNode *, double x, double y, double z); + SMDS_MeshEdge* AddEdge( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2); + SMDS_MeshFace* AddFace( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3); + SMDS_MeshFace* AddFace( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4); + SMDS_MeshVolume* AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4); + SMDS_MeshVolume* AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5); + SMDS_MeshVolume* AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6); + SMDS_MeshVolume* AddVolume( + const SMDS_MeshNode * n1, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8); + + void RemoveElement(const SMDS_MeshElement *); void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S); void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S); void SetNodeOnEdge(SMDS_MeshNode * aNode, const TopoDS_Edge & S); diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx index e2e1494ad..31710630d 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.cxx +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -29,16 +29,6 @@ using namespace std; #include "SMESHDS_SubMesh.hxx" -//======================================================================= -//function : SMESHDS_SubMesh -//purpose : -//======================================================================= -SMESHDS_SubMesh::SMESHDS_SubMesh(const SMDS_Mesh * M):myMesh(M) -{ - myListOfEltIDIsUpdate = false; - myListOfNodeIDIsUpdate = false; -} - //======================================================================= //function : AddElement //purpose : @@ -46,7 +36,6 @@ SMESHDS_SubMesh::SMESHDS_SubMesh(const SMDS_Mesh * M):myMesh(M) void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME) { myElements.insert(ME); - myListOfEltIDIsUpdate = false; } //======================================================================= @@ -56,7 +45,6 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME) void SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME) { myElements.erase(ME); - myListOfEltIDIsUpdate = false; } //======================================================================= @@ -66,7 +54,6 @@ void SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME) void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N) { myNodes.insert(N); - myListOfNodeIDIsUpdate = false; } //======================================================================= @@ -76,7 +63,6 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N) void SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N) { myNodes.erase(N); - myListOfNodeIDIsUpdate = false; } //======================================================================= @@ -88,15 +74,6 @@ int SMESHDS_SubMesh::NbElements() const return myElements.size(); } -//======================================================================= -//function : GetElements -//purpose : -//======================================================================= -const set & SMESHDS_SubMesh::GetElements() -{ - return myElements; -} - //======================================================================= //function : NbNodes //purpose : @@ -106,49 +83,42 @@ int SMESHDS_SubMesh::NbNodes() const return myNodes.size(); } -//======================================================================= -//function : GetNodes -//purpose : -//======================================================================= -const set & SMESHDS_SubMesh::GetNodes() const +template class MySetIterator:public SMDS_Iterator { - return myNodes; -} + const set& mySet; + set::const_iterator myIt; -//======================================================================= -//function : GetIDElements -//purpose : -//======================================================================= -const vector & SMESHDS_SubMesh::GetIDElements() -{ - if (!myListOfEltIDIsUpdate) + public: + MySetIterator(const set& s):mySet(s), myIt(s.begin()) { - myListOfEltID.clear(); - set::iterator it=myElements.begin(); - for (; it!=myElements.end(); it++) - { - myListOfEltID.push_back((*it)->GetID()); - } - myListOfEltIDIsUpdate = true; } - return myListOfEltID; -} -//======================================================================= -//function : GetIDNodes -//purpose : -//======================================================================= -const vector & SMESHDS_SubMesh::GetIDNodes() -{ - if (!myListOfNodeIDIsUpdate) + bool more() + { + return myIt!=mySet.end(); + } + const T* next() { - myListOfNodeID.clear(); - set::iterator it=myNodes.begin(); - for (; it!=myNodes.end(); it++) - { - myListOfNodeID.push_back((*it)->GetID()); - } - myListOfNodeIDIsUpdate = true; + const T* t=*myIt; + myIt++; + return t; } - return myListOfNodeID; +}; +/////////////////////////////////////////////////////////////////////////////// +///Return an iterator on the elements of submesh +///The created iterator must be free by the caller +/////////////////////////////////////////////////////////////////////////////// +SMDS_Iterator * SMESHDS_SubMesh::GetElements() const +{ + return new MySetIterator(myElements); } + +/////////////////////////////////////////////////////////////////////////////// +///Return an iterator on the nodes of submesh +///The created iterator must be free by the caller +/////////////////////////////////////////////////////////////////////////////// +SMDS_Iterator * SMESHDS_SubMesh::GetNodes() const +{ + return new MySetIterator(myNodes); +} + diff --git a/src/SMESHDS/SMESHDS_SubMesh.hxx b/src/SMESHDS/SMESHDS_SubMesh.hxx index 53802ecb4..bda8f04bb 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.hxx +++ b/src/SMESHDS/SMESHDS_SubMesh.hxx @@ -28,7 +28,6 @@ #define _SMESHDS_SubMesh_HeaderFile #include "SMDS_Mesh.hxx" -#include #include using namespace std; @@ -36,25 +35,18 @@ using namespace std; class SMESHDS_SubMesh { public: - SMESHDS_SubMesh(const SMDS_Mesh * M); void AddElement(const SMDS_MeshElement * ME); void RemoveElement(const SMDS_MeshElement * ME); void AddNode(const SMDS_MeshNode * ME); void RemoveNode(const SMDS_MeshNode * ME); int NbElements() const; - const set & GetElements(); - const vector & GetIDElements(); + SMDS_Iterator * GetElements() const; int NbNodes() const; - const set & GetNodes() const; - const vector & GetIDNodes(); - ~SMESHDS_SubMesh(); + SMDS_Iterator * GetNodes() const; + private: const SMDS_Mesh * myMesh; set myElements; set myNodes; - bool myListOfEltIDIsUpdate; - vector myListOfEltID; - bool myListOfNodeIDIsUpdate; - vector myListOfNodeID; }; #endif diff --git a/src/SMESH_I/SMESH_MEDSupport_i.cxx b/src/SMESH_I/SMESH_MEDSupport_i.cxx index 7b9b8f255..931bb835b 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.cxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.cxx @@ -308,16 +308,14 @@ Engines::long_array * SMESH_MEDSupport_i::getNumber( int i = 0; myseq->length(_subMeshDS->NbNodes()); - const set & myNodesMap = _subMeshDS->GetNodes(); - set::const_iterator it=myNodesMap.begin(); - for (; it!=myNodesMap.end(); it++) + SMDS_Iterator * it = _subMeshDS->GetNodes(); + while(it->more()) { - myseq[i] = (*it)->GetID(); - SCRUTE((*it)->GetID()); - SCRUTE(myseq[i]); + myseq[i] = it->next()->GetID(); i++; }; + delete it; SCRUTE(myseq->length()); MESSAGE("End of SMESH_MEDSupport_i::getNumber"); diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 5c7909428..89088d3f6 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -61,7 +61,7 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH:: for (int i = 0; i < IDsOfElements.length(); i++) { CORBA::Long index = IDsOfElements[i]; - _myMeshDS->RemoveElement(index); + _myMeshDS->RemoveElement(_myMeshDS->FindElement(index)); MESSAGE("Element " << index << " was removed") } return true; @@ -86,8 +86,8 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH:: <<" not found"); continue; } - _myMeshDS->RemoveNode(IDsOfNodes[i]); - MESSAGE("Node " << index << " was removed") + _myMeshDS->RemoveNode(node); + MESSAGE("Node " << IDsOfNodes[i] << " was removed") } return true; }; @@ -105,7 +105,7 @@ CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes) { CORBA::Long index1 = IDsOfNodes[0]; CORBA::Long index2 = IDsOfNodes[1]; - _myMeshDS->AddEdge(index1, index2); + _myMeshDS->AddEdge(_myMeshDS->FindNode(index1), _myMeshDS->FindNode(index2)); } return true; } @@ -133,20 +133,15 @@ CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x, CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes) { int NbNodes = IDsOfNodes.length(); + const SMDS_MeshNode* nodes[4]; + for(int i=0;iFindNode(IDsOfNodes[i]); if (NbNodes == 3) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - _myMeshDS->AddFace(index1, index2, index3); + _myMeshDS->AddFace(nodes[0], nodes[1], nodes[2]); } else if (NbNodes == 4) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - _myMeshDS->AddFace(index1, index2, index3, index4); + _myMeshDS->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]); } return true; }; @@ -161,45 +156,15 @@ CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH:: long_array & IDsOfNodes) { int NbNodes = IDsOfNodes.length(); - if (NbNodes == 4) - { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - _myMeshDS->AddVolume(index1, index2, index3, index4); - } - else if (NbNodes == 5) - { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - CORBA::Long index5 = IDsOfNodes[4]; - _myMeshDS->AddVolume(index1, index2, index3, index4, index5); - } - else if (NbNodes == 6) - { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - CORBA::Long index5 = IDsOfNodes[4]; - CORBA::Long index6 = IDsOfNodes[5]; - _myMeshDS->AddVolume(index1, index2, index3, index4, index5, index6); - } - else if (NbNodes == 8) + const SMDS_MeshNode* n[8]; + for(int i=0;iFindNode(IDsOfNodes[i]); + + switch(NbNodes) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - CORBA::Long index5 = IDsOfNodes[4]; - CORBA::Long index6 = IDsOfNodes[5]; - CORBA::Long index7 = IDsOfNodes[6]; - CORBA::Long index8 = IDsOfNodes[7]; - _myMeshDS->AddVolume(index1, index2, index3, index4, index5, index6, - index7, index8); + case 4:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3]); break; + case 5:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3],n[4]); break; + case 6:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break; + case 8:_myMeshDS->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break; } return true; }; -- 2.30.2 From ef932e4d05a45b9a3034423e30519d15e664f2bc Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 5 Sep 2003 11:45:54 +0000 Subject: [PATCH 02/16] Correct some memory leaks --- src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx | 4 +++- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 7 +++---- src/SMESH/SMESH_Hexa_3D.cxx | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx index adcbd218d..0c988c3d8 100644 --- a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx @@ -196,6 +196,7 @@ void DriverDAT_W_SMESHDS_Mesh::Add() SMDS_Iterator * itNodes=elem->nodesIterator(); while(itNodes->more()) fprintf(myFileId, "%d ", itNodes->next()->GetID()); + delete itNodes; fprintf(myFileId, "\n"); } @@ -218,7 +219,8 @@ void DriverDAT_W_SMESHDS_Mesh::Add() SMDS_Iterator * itNodes=elem->nodesIterator(); while(itNodes->more()) fprintf(myFileId, "%d ", itNodes->next()->GetID()); - + delete itNodes; + fprintf(myFileId, "\n"); } delete itVolumes; diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 5665790ad..1c602e378 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -573,12 +573,12 @@ void DriverMED_W_SMESHDS_Mesh::Add() /* allocation memoire */ connectivite = (med_int *) malloc(sizeof(med_int) * taille * nmailles[i]); - nomele = + /* nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM * - nmailles[i] + 1); + nmailles[i] + 1);*/ + nomele = ""; numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]); nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]); - nomele = ""; nbNodes = typmai[i] % 100; for (j = 0; j < nmailles[i]; j++) @@ -637,7 +637,6 @@ void DriverMED_W_SMESHDS_Mesh::Add() /* liberation memoire */ free(connectivite); free(numele); - free(nomele); free(nufael); MESSAGE(" End " << typmai[i]); } diff --git a/src/SMESH/SMESH_Hexa_3D.cxx b/src/SMESH/SMESH_Hexa_3D.cxx index 69f036fc1..ef661bc83 100644 --- a/src/SMESH/SMESH_Hexa_3D.cxx +++ b/src/SMESH/SMESH_Hexa_3D.cxx @@ -439,6 +439,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int ij1 = j1 * nbdown + i1; quad->uv_grid[ij1].node = node; } + delete itf; for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) -- 2.30.2 From 888669652e8ebdff0161e485913c1d3b93e4b5dc Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 5 Sep 2003 12:19:11 +0000 Subject: [PATCH 03/16] Some forgotten return statments --- src/SMDS/SMDS_MeshNode.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx index 271d53fe0..20bce6369 100644 --- a/src/SMDS/SMDS_MeshNode.cxx +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -97,7 +97,7 @@ SMDS_Iterator * SMDS_MeshNode:: bool more() { - myIterator!=mySet.end(); + return myIterator!=mySet.end(); } const SMDS_MeshElement* next() @@ -143,7 +143,7 @@ SMDS_Iterator * SMDS_MeshNode:: bool more() { - myIterator!=mySet.end(); + return myIterator!=mySet.end(); } const SMDS_MeshElement* next() -- 2.30.2 From 00c069f8d414099a12268c42d58c6cfae9d1bff9 Mon Sep 17 00:00:00 2001 From: jrt Date: Mon, 8 Sep 2003 13:41:48 +0000 Subject: [PATCH 04/16] Add some comments --- src/SMDS/SMDS_Mesh.cxx | 147 ++++++++++++++++++++++------------ src/SMDS/SMDS_MeshElement.cxx | 3 + 2 files changed, 100 insertions(+), 50 deletions(-) diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index c25456840..f031b974c 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -38,6 +38,9 @@ SMDS_Mesh::SMDS_Mesh() } /////////////////////////////////////////////////////////////////////////////// +/// Create a new child mesh +/// Note that the tree structure of SMDS_Mesh seems to be unused in this version +/// (2003-09-08) of SMESH /////////////////////////////////////////////////////////////////////////////// SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent) :myParent(parent), myNodeIDFactory(parent->myNodeIDFactory), @@ -60,6 +63,7 @@ SMDS_Mesh *SMDS_Mesh::AddSubMesh() /////////////////////////////////////////////////////////////////////////////// ///create a MeshNode and add it to the current Mesh +///An ID is automatically assigned to the node. ///@return : The created node /////////////////////////////////////////////////////////////////////////////// @@ -90,8 +94,8 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID) } /////////////////////////////////////////////////////////////////////////////// -///create a MeshEdge and add it to the current Mesh -///@return : The created MeshEdge +/// create a MeshEdge and add it to the current Mesh +/// @return : The created MeshEdge /////////////////////////////////////////////////////////////////////////////// SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID) @@ -102,18 +106,24 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID) return AddEdgeWithID(node1, node2, ID); } +/////////////////////////////////////////////////////////////////////////////// +/// create a MeshEdge and add it to the current Mesh +/// @return : The created MeshEdge +/////////////////////////////////////////////////////////////////////////////// + SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2) { return AddEdgeWithID(node1, node2, myElementIDFactory->GetFreeID()); } + /////////////////////////////////////////////////////////////////////////////// -///Create a new edge and at it to the mesh -///@param idnode1 ID of the first node -///@param idnode2 ID of the second node -///@param ID ID of the edge to create -///@return The created edge or NULL if an edge with this ID already exists or -///if input nodes are not found. +/// Create a new edge and at it to the mesh +/// @param idnode1 ID of the first node +/// @param idnode2 ID of the second node +/// @param ID ID of the edge to create +/// @return The created edge or NULL if an edge with this ID already exists or +/// if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, @@ -253,8 +263,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, /////////////////////////////////////////////////////////////////////////////// ///Create a new tetrahedron and add it to the mesh. -///@return The created tetrahedron or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created tetrahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, @@ -289,8 +298,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, int idnode2, /////////////////////////////////////////////////////////////////////////////// ///Create a new tetrahedron and add it to the mesh. ///@param ID The ID of the new volume -///@return The created tetrahedron or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created tetrahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( @@ -343,8 +351,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( /////////////////////////////////////////////////////////////////////////////// ///Create a new pyramid and add it to the mesh. ///Nodes 1,2,3 and 4 define the base of the pyramid -///@return The created pyramid or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created pyramid /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, @@ -361,7 +368,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, ///Create a new pyramid and add it to the mesh. ///Nodes 1,2,3 and 4 define the base of the pyramid ///@param ID The ID of the new volume -///@return The created pyramid or NULL if an edge with this ID already exists +///@return The created pyramid or NULL if a pyramid with this ID already exists ///or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// @@ -384,8 +391,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, int idnode2, ///Create a new pyramid and add it to the mesh. ///Nodes 1,2,3 and 4 define the base of the pyramid ///@param ID The ID of the new volume -///@return The created pyramid or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created pyramid /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( @@ -441,8 +447,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( /////////////////////////////////////////////////////////////////////////////// ///Create a new prism and add it to the mesh. ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle. -///@return The created prism or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created prism /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, @@ -460,7 +465,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, ///Create a new prism and add it to the mesh. ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle. ///@param ID The ID of the new volume -///@return The created prism or NULL if an edge with this ID already exists +///@return The created prism or NULL if a prism with this ID already exists ///or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// @@ -484,8 +489,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, int idnode2, ///Create a new prism and add it to the mesh. ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle. ///@param ID The ID of the new volume -///@return The created prism or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created prism /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( @@ -545,8 +549,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( /////////////////////////////////////////////////////////////////////////////// ///Create a new hexahedron and add it to the mesh. ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges. -///@return The created hexahedron or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created hexahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, @@ -565,8 +568,8 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, ///Create a new hexahedron and add it to the mesh. ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges. ///@param ID The ID of the new volume -///@return The created hexahedron or NULL if an edge with this ID already exists -///or if input nodes are not found. +///@return The created hexahedron or NULL if an hexahedron with this ID already +///exists or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, int idnode2, @@ -659,11 +662,9 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( } } -//======================================================================= -//function : FindNode -//purpose : -//======================================================================= - +/////////////////////////////////////////////////////////////////////////////// +/// Return the node whose ID is 'ID'. +/////////////////////////////////////////////////////////////////////////////// const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const { return (const SMDS_MeshNode *)myNodeIDFactory->MeshElement(ID); @@ -722,11 +723,9 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(SMDS_MeshNode * node1, } } - -//======================================================================= -//function : RemoveNode -//purpose : -//======================================================================= +/////////////////////////////////////////////////////////////////////////////// +/// Remove a node and all the elements which own this node +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node) { @@ -737,10 +736,9 @@ void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node) myNodes.erase(const_cast(node)); } -//======================================================================= -//function : RemoveEdge -//purpose : -//======================================================================= +/////////////////////////////////////////////////////////////////////////////// +/// Remove an edge and all the elements which own this edge +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge) { @@ -750,10 +748,9 @@ void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge) delete edge; } -//======================================================================= -//function : RemoveFace -//purpose : -//======================================================================= +/////////////////////////////////////////////////////////////////////////////// +/// Remove an face and all the elements which own this face +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face) { @@ -763,10 +760,9 @@ void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face) delete face; } -//======================================================================= -//function : RemoveVolume -//purpose : -//======================================================================= +/////////////////////////////////////////////////////////////////////////////// +/// Remove a volume +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume) { @@ -775,9 +771,11 @@ void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume) //removeElementDependencies(volume); delete volume; } + /////////////////////////////////////////////////////////////////////////////// /// Remove no longer used sub element of an element. Unbind the element ID /////////////////////////////////////////////////////////////////////////////// + void SMDS_Mesh::removeElementDependencies(SMDS_MeshElement * element) { /** @todo to be fix */ @@ -1153,31 +1151,52 @@ void SMDS_Mesh::DebugStats() const } +/////////////////////////////////////////////////////////////////////////////// +/// Return the number of nodes +/////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbNodes() const { return myNodes.size(); } +/////////////////////////////////////////////////////////////////////////////// +/// Return the number of edges (including construction edges) +/////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbEdges() const { return myEdges.size(); } +/////////////////////////////////////////////////////////////////////////////// +/// Return the number of faces (including construction faces) +/////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbFaces() const { return myFaces.size(); } +/////////////////////////////////////////////////////////////////////////////// +/// Return the number of volumes +/////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbVolumes() const { return myVolumes.size(); } +/////////////////////////////////////////////////////////////////////////////// +/// Return the number of child mesh of this mesh. +/// Note that the tree structure of SMDS_Mesh seems to be unused in this version +/// (2003-09-08) of SMESH +/////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbSubMesh() const { return myChildren.size(); } +/////////////////////////////////////////////////////////////////////////////// +/// Destroy the mesh and all its elements +/// All pointer on elements owned by this mesh become illegals. +/////////////////////////////////////////////////////////////////////////////// SMDS_Mesh::~SMDS_Mesh() { if(myParent==NULL) @@ -1223,31 +1242,59 @@ SMDS_Mesh::~SMDS_Mesh() } +/////////////////////////////////////////////////////////////////////////////// +/// Return true if this mesh create faces with edges. +/// A false returned value mean that faces are created with nodes. A concequence +/// is, iteration on edges (SMDS_Element::edgesIterator) will be unavailable. +/////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasConstructionEdges() { return myHasConstructionEdges; } +/////////////////////////////////////////////////////////////////////////////// +/// Return true if this mesh create volumes with faces +/// A false returned value mean that volumes are created with nodes or edges. +/// (see hasConstructionEdges) +/// A concequence is, iteration on faces (SMDS_Element::facesIterator) will be +/// unavailable. +/////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasConstructionFaces() { return myHasConstructionFaces; } +/////////////////////////////////////////////////////////////////////////////// +/// Return true if nodes are linked to the finit elements, they are belonging to. +/// Currently, It always return true. +/////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasInverseElements() { return myHasInverseElements; } +/////////////////////////////////////////////////////////////////////////////// +/// Make this mesh creating construction edges (see hasConstructionEdges) +/// @param b true to have construction edges, else false. +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setConstructionEdges(bool b) { myHasConstructionEdges=b; } +/////////////////////////////////////////////////////////////////////////////// +/// Make this mesh creating construction faces (see hasConstructionFaces) +/// @param b true to have construction faces, else false. +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setConstructionFaces(bool b) { myHasConstructionFaces=b; } +/////////////////////////////////////////////////////////////////////////////// +/// Make this mesh creating link from nodes to elements (see hasInverseElements) +/// @param b true to link nodes to elements, else false. +/////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setInverseElements(bool b) { if(!b) MESSAGE("Error : inverseElement=false not implemented"); @@ -1255,8 +1302,8 @@ void SMDS_Mesh::setInverseElements(bool b) } /////////////////////////////////////////////////////////////////////////////// -///Return an iterator on nodes of the current mesh. Once used this iterator -///must be free by the caller +/// Return an iterator on nodes of the current mesh. Once used this iterator +/// must be free by the caller /////////////////////////////////////////////////////////////////////////////// SMDS_Iterator * SMDS_Mesh::nodesIterator() const { diff --git a/src/SMDS/SMDS_MeshElement.cxx b/src/SMDS/SMDS_MeshElement.cxx index 827737228..701e6fe97 100644 --- a/src/SMDS/SMDS_MeshElement.cxx +++ b/src/SMDS/SMDS_MeshElement.cxx @@ -125,6 +125,9 @@ int SMDS_MeshElement::NbFaces() const SMDS_Iterator * SMDS_MeshElement:: elementsIterator(SMDSAbs_ElementType type) const { + /** @todo Check that iterator in the child classes return elements + in the same order for each different implementation (i.e: SMDS_VolumeOfNodes + and SMDS_VolumeOfFaces */ class MyIterator:public SMDS_Iterator { const SMDS_MeshElement * myElement; -- 2.30.2 From 4ea4ccf36f3c18ecde6f63d51d3e8876a2a27344 Mon Sep 17 00:00:00 2001 From: jrt Date: Mon, 8 Sep 2003 15:04:54 +0000 Subject: [PATCH 05/16] Add support for tetra, pyramid and prism --- src/SMDS/SMDS_Mesh.cxx | 12 +++--- src/SMDS/SMDS_VolumeOfNodes.cxx | 72 +++++++++++++++++++++++++++++---- src/SMDS/SMDS_VolumeOfNodes.hxx | 22 +++++++++- 3 files changed, 92 insertions(+), 14 deletions(-) diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index f031b974c..6623b37ef 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -329,8 +329,8 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( } else { - MESSAGE("Error : Not implemented"); - return NULL; + volume=new SMDS_VolumeOfNodes(node1,node2,node3,node4); + myVolumes.insert(volume); } if(myElementIDFactory->BindID(ID, volume)) @@ -424,8 +424,8 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( } else { - MESSAGE("Error : Not implemented"); - return NULL; + volume=new SMDS_VolumeOfNodes(node1,node2,node3,node4,node5); + myVolumes.insert(volume); } if(myElementIDFactory->BindID(ID, volume)) @@ -525,8 +525,8 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( } else { - MESSAGE("Error : Not implemented"); - return NULL; + volume=new SMDS_VolumeOfNodes(node1,node2,node3,node4,node5,node6); + myVolumes.insert(volume); } if(myElementIDFactory->BindID(ID, volume)) diff --git a/src/SMDS/SMDS_VolumeOfNodes.cxx b/src/SMDS/SMDS_VolumeOfNodes.cxx index f09fa620a..c7b308e91 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.cxx +++ b/src/SMDS/SMDS_VolumeOfNodes.cxx @@ -37,6 +37,7 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( SMDS_MeshNode * node7, SMDS_MeshNode * node8) { + myNodes.resize(8); myNodes[0]=node1; myNodes[1]=node2; myNodes[2]=node3; @@ -47,6 +48,50 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( myNodes[7]=node8; } +SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4) +{ + myNodes.resize(4); + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; +} + +SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4, + SMDS_MeshNode * node5) +{ + myNodes.resize(5); + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; + myNodes[4]=node5; +} + +SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4, + SMDS_MeshNode * node5, + SMDS_MeshNode * node6) +{ + myNodes.resize(6); + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; + myNodes[4]=node5; + myNodes[5]=node6; +} //======================================================================= //function : Print //purpose : @@ -62,17 +107,31 @@ void SMDS_VolumeOfNodes::Print(ostream & OS) const int SMDS_VolumeOfNodes::NbFaces() const { - return 6; + switch(NbNodes()) + { + case 4: return 4; + case 5: return 5; + case 6: return 5; + case 8: return 6; + default: MESSAGE("invalid number of nodes"); + } } int SMDS_VolumeOfNodes::NbNodes() const { - return 8; + return myNodes.size(); } int SMDS_VolumeOfNodes::NbEdges() const { - return 12; + switch(NbNodes()) + { + case 4: return 6; + case 5: return 8; + case 6: return 9; + case 8: return 12; + default: MESSAGE("invalid number of nodes"); + } } SMDS_Iterator * SMDS_VolumeOfNodes:: @@ -80,15 +139,15 @@ SMDS_Iterator * SMDS_VolumeOfNodes:: { class MyIterator:public SMDS_Iterator { - const SMDS_MeshNode * const* mySet; + const vector& mySet; int index; public: - MyIterator(const SMDS_MeshNode * const* s):mySet(s),index(0) + MyIterator(const vector& s):mySet(s),index(0) {} bool more() { - return index<8; + return index * SMDS_VolumeOfNodes:: return mySet[index-1]; } }; - switch(type) { case SMDSAbs_Volume:return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume); diff --git a/src/SMDS/SMDS_VolumeOfNodes.hxx b/src/SMDS/SMDS_VolumeOfNodes.hxx index 224067341..c7c3529c3 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.hxx +++ b/src/SMDS/SMDS_VolumeOfNodes.hxx @@ -28,11 +28,31 @@ #define _SMDS_VolumeOfNodes_HeaderFile #include "SMDS_MeshVolume.hxx" +#include +using namespace std; class SMDS_VolumeOfNodes:public SMDS_MeshVolume { public: + SMDS_VolumeOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4); + SMDS_VolumeOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4, + SMDS_MeshNode * node5); + SMDS_VolumeOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4, + SMDS_MeshNode * node5, + SMDS_MeshNode * node6); SMDS_VolumeOfNodes( SMDS_MeshNode * node1, SMDS_MeshNode * node2, @@ -51,6 +71,6 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume protected: SMDS_Iterator * elementsIterator(SMDSAbs_ElementType type) const; - SMDS_MeshNode * myNodes[8]; + vector myNodes; }; #endif -- 2.30.2 From 7124ef481ed43fc1c6b34417a1c0837dd8806da8 Mon Sep 17 00:00:00 2001 From: jrt Date: Mon, 8 Sep 2003 15:11:15 +0000 Subject: [PATCH 06/16] update --- ChangeLog | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) diff --git a/ChangeLog b/ChangeLog index a16bd74d7..60e9176bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,244 @@ +2003-09-08 17:04 Jerome Robert + + * src/SMDS/: SMDS_Mesh.cxx, SMDS_VolumeOfNodes.cxx, + SMDS_VolumeOfNodes.hxx: Add support for tetra, pyramid and prism + * src/SMDS/: SMDS_Mesh.cxx, SMDS_MeshElement.cxx: Add some comments + +2003-09-05 14:19 Jerome Robert + + * src/SMDS/SMDS_MeshNode.cxx: Some forgotten return statments + +2003-09-05 13:45 Jerome Robert + + * src/: DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx, + DriverMED/DriverMED_W_SMESHDS_Mesh.cxx, SMESH/SMESH_Hexa_3D.cxx: + Correct some memory leaks + +2003-09-05 12:31 Jerome Robert + + * src/: DriverMED/DriverMED_W_SMESHDS_Mesh.cxx, + SMESH/SMESH_Hexa_3D.cxx, SMESH/SMESH_Hexa_3D.hxx, + SMESH/SMESH_MEFISTO_2D.cxx, SMESH/SMESH_MEFISTO_2D.hxx, + SMESH/SMESH_Quadrangle_2D.cxx, SMESH/SMESH_Quadrangle_2D.hxx, + SMESH/SMESH_Regular_1D.cxx, SMESH/SMESH_subMesh.cxx, + SMESHDS/SMESHDS_Mesh.cxx, SMESHDS/SMESHDS_Mesh.hxx, + SMESHDS/SMESHDS_SubMesh.cxx, SMESHDS/SMESHDS_SubMesh.hxx, + SMESH_I/SMESH_MEDSupport_i.cxx, SMESH_I/SMESH_MeshEditor_i.cxx: Use + nodes and elements pointer instead on IDs + * src/SMDS/: SMDS_Mesh.cxx, SMDS_Mesh.hxx: Change API to use + pointer on elements and no longer ID of elements + +2003-09-04 17:04 Jerome Robert + + * src/SMESHDS/: Handle_SMESHDS_Command.hxx, + Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx, + Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx, + Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx, + Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx, + Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx, + Handle_SMESHDS_Document.hxx, + Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx, + Handle_SMESHDS_ListNodeOfListOfCommand.hxx, + Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx, + Handle_SMESHDS_Mesh.hxx, Handle_SMESHDS_Script.hxx, + Handle_SMESHDS_SubMesh.hxx, SMESHDS.cdl, SMESHDS_Command.cdl, + SMESHDS_Command.ixx, SMESHDS_Command.jxx, + SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx, + SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx, + SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx, + SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx, + SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx, + SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx, + SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx, + SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx, + SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx, + SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx, + SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx, + SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx, + SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx, + SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx, + SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx, + SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx, + SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx, + SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx, + SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx, + SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx, + SMESHDS_DataMapOfIntegerMesh.hxx, + SMESHDS_DataMapOfIntegerMesh_0.cxx, + SMESHDS_DataMapOfIntegerPtrHypothesis.hxx, + SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx, + SMESHDS_DataMapOfIntegerSubMesh.hxx, + SMESHDS_DataMapOfIntegerSubMesh_0.cxx, + SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx, + SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx, + SMESHDS_DataMapOfShapeSubMesh.hxx, + SMESHDS_DataMapOfShapeSubMesh_0.cxx, SMESHDS_Document.cdl, + SMESHDS_Document.ixx, SMESHDS_Document.jxx, + SMESHDS_ListIteratorOfListOfAsciiString.hxx, + SMESHDS_ListIteratorOfListOfAsciiString_0.cxx, + SMESHDS_ListIteratorOfListOfCommand.hxx, + SMESHDS_ListIteratorOfListOfCommand_0.cxx, + SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx, + SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx, + SMESHDS_ListNodeOfListOfAsciiString.hxx, + SMESHDS_ListNodeOfListOfAsciiString_0.cxx, + SMESHDS_ListNodeOfListOfCommand.hxx, + SMESHDS_ListNodeOfListOfCommand_0.cxx, + SMESHDS_ListNodeOfListOfPtrHypothesis.hxx, + SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx, + SMESHDS_ListOfAsciiString.hxx, SMESHDS_ListOfAsciiString_0.cxx, + SMESHDS_ListOfCommand.hxx, SMESHDS_ListOfCommand_0.cxx, + SMESHDS_ListOfPtrHypothesis.hxx, SMESHDS_ListOfPtrHypothesis_0.cxx, + SMESHDS_Mesh.cdl, SMESHDS_Mesh.ixx, SMESHDS_Mesh.jxx, + SMESHDS_PtrHypothesis.hxx, SMESHDS_Script.cdl, SMESHDS_Script.ixx, + SMESHDS_Script.jxx, SMESHDS_SubMesh.cdl, SMESHDS_SubMesh.ixx, + SMESHDS_SubMesh.jxx: Remove no longer needed files + +2003-09-04 16:50 Jerome Robert + + * src/SMDS/: Handle_SMDSControl_BoundaryEdges.hxx, + Handle_SMDSControl_BoundaryFaces.hxx, + Handle_SMDSControl_MeshBoundary.hxx, + Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx, + Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx, + Handle_SMDS_EdgePosition.hxx, Handle_SMDS_FacePosition.hxx, + Handle_SMDS_HSequenceOfMesh.hxx, + Handle_SMDS_ListNodeOfListOfMesh.hxx, + Handle_SMDS_ListNodeOfListOfMeshElement.hxx, + Handle_SMDS_ListNodeOfListOfMeshGroup.hxx, Handle_SMDS_Mesh.hxx, + Handle_SMDS_MeshEdge.hxx, Handle_SMDS_MeshElement.hxx, + Handle_SMDS_MeshElementIDFactory.hxx, Handle_SMDS_MeshFace.hxx, + Handle_SMDS_MeshGroup.hxx, Handle_SMDS_MeshHexahedron.hxx, + Handle_SMDS_MeshIDFactory.hxx, Handle_SMDS_MeshNode.hxx, + Handle_SMDS_MeshNodeIDFactory.hxx, Handle_SMDS_MeshObject.hxx, + Handle_SMDS_MeshPrism.hxx, Handle_SMDS_MeshPyramid.hxx, + Handle_SMDS_MeshQuadrangle.hxx, Handle_SMDS_MeshTetrahedron.hxx, + Handle_SMDS_MeshTriangle.hxx, Handle_SMDS_MeshVolume.hxx, + Handle_SMDS_Position.hxx, + Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx, + Handle_SMDS_SpacePosition.hxx, + Handle_SMDS_StdMapNodeOfExtendedMap.hxx, + Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx, + Handle_SMDS_VertexPosition.hxx, SMDS.cdl, SMDSAbs.cdl, + SMDSControl.cdl, SMDSControl.ixx, SMDSControl.jxx, + SMDSControl_BoundaryEdges.cdl, SMDSControl_BoundaryEdges.ixx, + SMDSControl_BoundaryEdges.jxx, SMDSControl_BoundaryFaces.cdl, + SMDSControl_BoundaryFaces.ixx, SMDSControl_BoundaryFaces.jxx, + SMDSControl_MeshBoundary.cdl, SMDSControl_MeshBoundary.ixx, + SMDSControl_MeshBoundary.jxx, SMDSEdit.cdl, SMDSEdit_Transform.cdl, + SMDSEdit_Transform.ixx, SMDSEdit_Transform.jxx, SMDS_BasicMap.lxx, + SMDS_BasicMapIterator.lxx, + SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx, + SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx, + SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx, + SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx, + SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx, + SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx, + SMDS_DataMapNodeOfDataMapOfPntInteger.hxx, + SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx, + SMDS_DataMapOfIntegerMeshElement.hxx, + SMDS_DataMapOfIntegerMeshElement_0.cxx, + SMDS_DataMapOfPntInteger.hxx, SMDS_DataMapOfPntInteger_0.cxx, + SMDS_EdgePosition.cdl, SMDS_EdgePosition.ixx, + SMDS_EdgePosition.jxx, SMDS_EdgePosition.lxx, SMDS_ExtendedMap.hxx, + SMDS_ExtendedMap_0.cxx, SMDS_ExtendedOrientedMap.hxx, + SMDS_ExtendedOrientedMap_0.cxx, SMDS_FacePosition.cdl, + SMDS_FacePosition.ixx, SMDS_FacePosition.jxx, + SMDS_FacePosition.lxx, SMDS_HSequenceOfMesh.hxx, + SMDS_HSequenceOfMesh_0.cxx, SMDS_ListIteratorOfListOfMesh.hxx, + SMDS_ListIteratorOfListOfMeshElement.hxx, + SMDS_ListIteratorOfListOfMeshElement_0.cxx, + SMDS_ListIteratorOfListOfMeshGroup.hxx, + SMDS_ListIteratorOfListOfMeshGroup_0.cxx, + SMDS_ListIteratorOfListOfMesh_0.cxx, SMDS_ListNodeOfListOfMesh.hxx, + SMDS_ListNodeOfListOfMeshElement.hxx, + SMDS_ListNodeOfListOfMeshElement_0.cxx, + SMDS_ListNodeOfListOfMeshGroup.hxx, + SMDS_ListNodeOfListOfMeshGroup_0.cxx, + SMDS_ListNodeOfListOfMesh_0.cxx, SMDS_ListOfMesh.hxx, + SMDS_ListOfMeshElement.hxx, SMDS_ListOfMeshElement_0.cxx, + SMDS_ListOfMeshGroup.hxx, SMDS_ListOfMeshGroup_0.cxx, + SMDS_ListOfMesh_0.cxx, SMDS_Map.gxx, SMDS_MapHasher.gxx, + SMDS_MapIterator.gxx, SMDS_MapIteratorOfExtendedMap.hxx, + SMDS_MapIteratorOfExtendedMap_0.cxx, + SMDS_MapIteratorOfExtendedOrientedMap.hxx, + SMDS_MapIteratorOfExtendedOrientedMap_0.cxx, SMDS_MapNode.lxx, + SMDS_MapOfMeshElement.cdl, SMDS_MapOfMeshElement.cxx, + SMDS_MapOfMeshElement.hxx, SMDS_MapOfMeshElement.ixx, + SMDS_MapOfMeshElement.jxx, SMDS_MapOfMeshElement.lxx, + SMDS_MapOfMeshOrientedElement.cdl, + SMDS_MapOfMeshOrientedElement.cxx, + SMDS_MapOfMeshOrientedElement.hxx, + SMDS_MapOfMeshOrientedElement.ixx, + SMDS_MapOfMeshOrientedElement.jxx, + SMDS_MapOfMeshOrientedElement.lxx, SMDS_Mesh.cdl, SMDS_Mesh.ixx, + SMDS_Mesh.jxx, SMDS_Mesh.lxx, SMDS_MeshEdge.cdl, SMDS_MeshEdge.ixx, + SMDS_MeshEdge.jxx, SMDS_MeshEdge.lxx, SMDS_MeshEdgesIterator.cdl, + SMDS_MeshEdgesIterator.cxx, SMDS_MeshEdgesIterator.hxx, + SMDS_MeshEdgesIterator.ixx, SMDS_MeshEdgesIterator.jxx, + SMDS_MeshElement.cdl, SMDS_MeshElement.ixx, SMDS_MeshElement.jxx, + SMDS_MeshElement.lxx, SMDS_MeshElementIDFactory.cdl, + SMDS_MeshElementIDFactory.ixx, SMDS_MeshElementIDFactory.jxx, + SMDS_MeshElementIDFactory.lxx, SMDS_MeshElementMapHasher.cdl, + SMDS_MeshElementMapHasher.cxx, SMDS_MeshElementMapHasher.hxx, + SMDS_MeshElementMapHasher.ixx, SMDS_MeshElementMapHasher.jxx, + SMDS_MeshElementMapHasher.lxx, SMDS_MeshElementsIterator.cdl, + SMDS_MeshElementsIterator.cxx, SMDS_MeshElementsIterator.hxx, + SMDS_MeshElementsIterator.ixx, SMDS_MeshElementsIterator.jxx, + SMDS_MeshElementsIterator.lxx, SMDS_MeshFace.cdl, + SMDS_MeshFace.ixx, SMDS_MeshFace.jxx, SMDS_MeshFace.lxx, + SMDS_MeshFacesIterator.cdl, SMDS_MeshFacesIterator.cxx, + SMDS_MeshFacesIterator.hxx, SMDS_MeshFacesIterator.ixx, + SMDS_MeshFacesIterator.jxx, SMDS_MeshGroup.cdl, SMDS_MeshGroup.ixx, + SMDS_MeshGroup.jxx, SMDS_MeshGroup.lxx, SMDS_MeshHexahedron.cdl, + SMDS_MeshHexahedron.ixx, SMDS_MeshHexahedron.jxx, + SMDS_MeshHexahedron.lxx, SMDS_MeshIDFactory.cdl, + SMDS_MeshIDFactory.ixx, SMDS_MeshIDFactory.jxx, + SMDS_MeshIDFactory.lxx, SMDS_MeshNode.cdl, SMDS_MeshNode.ixx, + SMDS_MeshNode.jxx, SMDS_MeshNode.lxx, SMDS_MeshNodeIDFactory.cdl, + SMDS_MeshNodeIDFactory.ixx, SMDS_MeshNodeIDFactory.jxx, + SMDS_MeshNodeIDFactory.lxx, SMDS_MeshNodesIterator.cdl, + SMDS_MeshNodesIterator.cxx, SMDS_MeshNodesIterator.hxx, + SMDS_MeshNodesIterator.ixx, SMDS_MeshNodesIterator.jxx, + SMDS_MeshObject.cdl, SMDS_MeshObject.ixx, SMDS_MeshObject.jxx, + SMDS_MeshOrientedElementMapHasher.cdl, + SMDS_MeshOrientedElementMapHasher.cxx, + SMDS_MeshOrientedElementMapHasher.hxx, + SMDS_MeshOrientedElementMapHasher.ixx, + SMDS_MeshOrientedElementMapHasher.jxx, + SMDS_MeshOrientedElementMapHasher.lxx, SMDS_MeshPrism.cdl, + SMDS_MeshPrism.ixx, SMDS_MeshPrism.jxx, SMDS_MeshPrism.lxx, + SMDS_MeshPyramid.cdl, SMDS_MeshPyramid.ixx, SMDS_MeshPyramid.jxx, + SMDS_MeshPyramid.lxx, SMDS_MeshQuadrangle.cdl, + SMDS_MeshQuadrangle.ixx, SMDS_MeshQuadrangle.jxx, + SMDS_MeshQuadrangle.lxx, SMDS_MeshTetrahedron.cdl, + SMDS_MeshTetrahedron.ixx, SMDS_MeshTetrahedron.jxx, + SMDS_MeshTetrahedron.lxx, SMDS_MeshTriangle.cdl, + SMDS_MeshTriangle.ixx, SMDS_MeshTriangle.jxx, + SMDS_MeshTriangle.lxx, SMDS_MeshVolume.cdl, SMDS_MeshVolume.ixx, + SMDS_MeshVolume.jxx, SMDS_MeshVolume.lxx, + SMDS_MeshVolumesIterator.cdl, SMDS_MeshVolumesIterator.cxx, + SMDS_MeshVolumesIterator.hxx, SMDS_MeshVolumesIterator.ixx, + SMDS_MeshVolumesIterator.jxx, SMDS_PntHasher.cdl, + SMDS_PntHasher.cxx, SMDS_PntHasher.hxx, SMDS_PntHasher.ixx, + SMDS_PntHasher.jxx, SMDS_PntHasher.lxx, SMDS_Position.cdl, + SMDS_Position.ixx, SMDS_Position.jxx, SMDS_Position.lxx, + SMDS_SequenceNodeOfSequenceOfMesh.hxx, + SMDS_SequenceNodeOfSequenceOfMesh_0.cxx, SMDS_SequenceOfMesh.hxx, + SMDS_SequenceOfMesh_0.cxx, SMDS_SpacePosition.cdl, + SMDS_SpacePosition.ixx, SMDS_SpacePosition.jxx, + SMDS_SpacePosition.lxx, SMDS_StdMapNode.gxx, SMDS_StdMapNode.lxx, + SMDS_StdMapNodeOfExtendedMap.hxx, + SMDS_StdMapNodeOfExtendedMap_0.cxx, + SMDS_StdMapNodeOfExtendedOrientedMap.hxx, + SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx, + SMDS_VertexPosition.cdl, SMDS_VertexPosition.ixx, + SMDS_VertexPosition.jxx: Remove no longer needed files + +2003-09-04 16:09 Jerome Robert + + * ChangeLog: Add a ChangeLog file + 2003-09-04 15:28 Jerome Robert * build_configure: It seems "make_omniorb" and "make_commence" need -- 2.30.2 From aa64a62c439d80eb0f306350bf50e5c97f49c383 Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 12 Sep 2003 15:11:29 +0000 Subject: [PATCH 07/16] Fix bug. Was always printing 8 nodes --- src/SMDS/SMDS_VolumeOfNodes.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SMDS/SMDS_VolumeOfNodes.cxx b/src/SMDS/SMDS_VolumeOfNodes.cxx index c7b308e91..b2a7a547d 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.cxx +++ b/src/SMDS/SMDS_VolumeOfNodes.cxx @@ -101,8 +101,8 @@ void SMDS_VolumeOfNodes::Print(ostream & OS) const { OS << "volume <" << GetID() << "> : "; int i; - for (i = 0; i < 7; ++i) OS << myNodes[i] << ","; - OS << myNodes[7]<< ") " << endl; + for (i = 0; i < NbNodes(); ++i) OS << myNodes[i] << ","; + OS << myNodes[NbNodes()-1]<< ") " << endl; } int SMDS_VolumeOfNodes::NbFaces() const -- 2.30.2 From e0b529896b95749166851a7fc9bb83d7f52b43cf Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 12 Sep 2003 15:12:19 +0000 Subject: [PATCH 08/16] Add HexahedronOfNodes and Tria3OfNodes to improve performance --- src/SMDS/Makefile.in | 8 ++- src/SMDS/SMDS_HexahedronOfNodes.cxx | 95 ++++++++++++++++++++++++++ src/SMDS/SMDS_HexahedronOfNodes.hxx | 58 ++++++++++++++++ src/SMDS/SMDS_Mesh.cxx | 10 +-- src/SMDS/SMDS_Tria3OfNodes.cxx | 101 ++++++++++++++++++++++++++++ src/SMDS/SMDS_Tria3OfNodes.hxx | 49 ++++++++++++++ 6 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 src/SMDS/SMDS_HexahedronOfNodes.cxx create mode 100644 src/SMDS/SMDS_HexahedronOfNodes.hxx create mode 100644 src/SMDS/SMDS_Tria3OfNodes.cxx create mode 100644 src/SMDS/SMDS_Tria3OfNodes.hxx diff --git a/src/SMDS/Makefile.in b/src/SMDS/Makefile.in index 963d204f2..5c3e9abd9 100644 --- a/src/SMDS/Makefile.in +++ b/src/SMDS/Makefile.in @@ -56,7 +56,9 @@ LIB_SRC = \ SMDS_VolumeOfFaces.cxx \ SMDS_VolumeOfNodes.cxx \ SMDS_FaceOfEdges.cxx \ - SMDS_FaceOfNodes.cxx + SMDS_FaceOfNodes.cxx \ + SMDS_Tria3OfNodes.cxx \ + SMDS_HexahedronOfNodes.cxx #SMDSControl_BoundaryEdges.cxx \ #SMDSControl_BoundaryFaces.cxx \ @@ -104,7 +106,9 @@ EXPORT_HEADERS= \ SMDS_VolumeOfFaces.hxx \ SMDS_VolumeOfNodes.hxx \ SMDS_FaceOfEdges.hxx \ - SMDS_FaceOfNodes.hxx + SMDS_FaceOfNodes.hxx \ + SMDS_Tria3OfNodes.hxx \ + SMDS_HexahedronOfNodes.hxx #SMDSControl_BoundaryEdges.hxx \ #SMDSControl_BoundaryFaces.hxx \ diff --git a/src/SMDS/SMDS_HexahedronOfNodes.cxx b/src/SMDS/SMDS_HexahedronOfNodes.cxx new file mode 100644 index 000000000..cebd29a11 --- /dev/null +++ b/src/SMDS/SMDS_HexahedronOfNodes.cxx @@ -0,0 +1,95 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#include "utilities.h" +#include "SMDS_HexahedronOfNodes.hxx" +#include "SMDS_IteratorOfArray.hxx" +#include "SMDS_MeshNode.hxx" + +/////////////////////////////////////////////////////////////////////////////// +/// Create an hexahedron. node 1,2,3,4 and 5,6,7,8 are quadrangle and +/// 5,1 and 7,3 are an edges. +/////////////////////////////////////////////////////////////////////////////// +SMDS_HexahedronOfNodes::SMDS_HexahedronOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4, + SMDS_MeshNode * node5, + SMDS_MeshNode * node6, + SMDS_MeshNode * node7, + SMDS_MeshNode * node8) +{ + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; + myNodes[4]=node5; + myNodes[5]=node6; + myNodes[6]=node7; + myNodes[7]=node8; +} +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_HexahedronOfNodes::Print(ostream & OS) const +{ + OS << "volume <" << GetID() << "> : "; + int i; + for (i = 0; i < 7; ++i) OS << myNodes[i] << ","; + OS << myNodes[7]<< ") " << endl; +} + +int SMDS_HexahedronOfNodes::NbFaces() const +{ + return 6; +} + +int SMDS_HexahedronOfNodes::NbNodes() const +{ + return 8; +} + +int SMDS_HexahedronOfNodes::NbEdges() const +{ + return 12; +} + +SMDS_Iterator * SMDS_HexahedronOfNodes:: + elementsIterator(SMDSAbs_ElementType type) const +{ + switch(type) + { + case SMDSAbs_Volume: + return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume); + case SMDSAbs_Node: + return new SMDS_IteratorOfArray(myNodes); + default: MESSAGE("ERROR : Iterator not implemented"); + } +} + +SMDSAbs_ElementType SMDS_HexahedronOfNodes::GetType() const +{ + return SMDSAbs_Volume; +} diff --git a/src/SMDS/SMDS_HexahedronOfNodes.hxx b/src/SMDS/SMDS_HexahedronOfNodes.hxx new file mode 100644 index 000000000..2e3f22f4a --- /dev/null +++ b/src/SMDS/SMDS_HexahedronOfNodes.hxx @@ -0,0 +1,58 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SMDS_MeshVolume.hxx +// Module : SMESH + +#ifndef _SMDS_HexahedronOfNodes_HeaderFile +#define _SMDS_HexahedronOfNodes_HeaderFile + +#include "SMDS_MeshVolume.hxx" +#include +using namespace std; + +class SMDS_HexahedronOfNodes:public SMDS_MeshVolume +{ + + public: + SMDS_HexahedronOfNodes( + SMDS_MeshNode * node1, + SMDS_MeshNode * node2, + SMDS_MeshNode * node3, + SMDS_MeshNode * node4, + SMDS_MeshNode * node5, + SMDS_MeshNode * node6, + SMDS_MeshNode * node7, + SMDS_MeshNode * node8); + + void Print(ostream & OS) const; + int NbFaces() const; + int NbNodes() const; + int NbEdges() const; + SMDSAbs_ElementType GetType() const; + protected: + SMDS_Iterator * + elementsIterator(SMDSAbs_ElementType type) const; + const SMDS_MeshNode * myNodes[8]; +}; +#endif diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 6623b37ef..daabeb0f8 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -24,6 +24,8 @@ #include "SMDS_VolumeOfNodes.hxx" #include "SMDS_VolumeOfFaces.hxx" #include "SMDS_FaceOfNodes.hxx" +#include "SMDS_Tria3OfNodes.hxx" +#include "SMDS_HexahedronOfNodes.hxx" #include "SMDS_FaceOfEdges.hxx" /////////////////////////////////////////////////////////////////////////////// @@ -593,10 +595,10 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, int idnode2, } /////////////////////////////////////////////////////////////////////////////// -///Create a new prism and add it to the mesh. +///Create a new hexahedron and add it to the mesh. ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges. ///@param ID The ID of the new volume -///@return The created prism or NULL if an edge with this ID already exists +///@return The created prism or NULL if an hexadron with this ID already exists ///or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// @@ -638,7 +640,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID( } else { - volume=new SMDS_VolumeOfNodes(node1,node2,node3,node4,node5,node6, + volume=new SMDS_HexahedronOfNodes(node1,node2,node3,node4,node5,node6, node7,node8); myVolumes.insert(volume); } @@ -690,7 +692,7 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(SMDS_MeshNode * node1, } else { - SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3); + SMDS_MeshFace * face = new SMDS_Tria3OfNodes(node1,node2,node3); myFaces.insert(face); return face; } diff --git a/src/SMDS/SMDS_Tria3OfNodes.cxx b/src/SMDS/SMDS_Tria3OfNodes.cxx new file mode 100644 index 000000000..c3a96337d --- /dev/null +++ b/src/SMDS/SMDS_Tria3OfNodes.cxx @@ -0,0 +1,101 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#include "SMDS_Tria3OfNodes.hxx" +#include "SMDS_IteratorOfElements.hxx" +#include "SMDS_MeshNode.hxx" +#include "utilities.h" + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +int SMDS_Tria3OfNodes::NbEdges() const +{ + return 3; +} + +int SMDS_Tria3OfNodes::NbFaces() const +{ + return 3; +} + +int SMDS_Tria3OfNodes::NbNodes() const +{ + return 3; +} +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_Tria3OfNodes::Print(ostream & OS) const +{ + OS << "face <" << GetID() << " > : "; + int i; + for (i = 0; i < NbNodes() - 1; i++) OS << myNodes[i] << ","; + OS << myNodes[i] << ") " << endl; +} + +SMDS_Iterator * SMDS_Tria3OfNodes:: + elementsIterator(SMDSAbs_ElementType type) const +{ + class MyIterator:public SMDS_Iterator + { + const SMDS_MeshNode * const* mySet; + int index; + public: + MyIterator(const SMDS_MeshNode * const* s):mySet(s),index(0) + {} + + bool more() + { + return index<3; + } + + const SMDS_MeshElement* next() + { + index++; + return mySet[index-1]; + } + }; + + switch(type) + { + case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face); + case SMDSAbs_Node:return new MyIterator(myNodes); + case SMDSAbs_Edge: + MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented"); + break; + default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myNodes)); + } +} + +SMDS_Tria3OfNodes::SMDS_Tria3OfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, + SMDS_MeshNode* node3) +{ + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; +} + + diff --git a/src/SMDS/SMDS_Tria3OfNodes.hxx b/src/SMDS/SMDS_Tria3OfNodes.hxx new file mode 100644 index 000000000..a52dd7a1f --- /dev/null +++ b/src/SMDS/SMDS_Tria3OfNodes.hxx @@ -0,0 +1,49 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifndef _SMDS_Tria3OfNodes_HeaderFile +#define _SMDS_Tria3OfNodes_HeaderFile + +#include +#include "SMDS_MeshFace.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_Iterator.hxx" + +class SMDS_Tria3OfNodes:public SMDS_MeshFace +{ + public: + void Print(ostream & OS) const; + SMDS_Tria3OfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, + SMDS_MeshNode* node3); + + int NbEdges() const; + int NbFaces() const; + int NbNodes() const; + protected: + SMDS_Iterator * + elementsIterator(SMDSAbs_ElementType type) const; + + private: + const SMDS_MeshNode* myNodes[3]; + +}; + +#endif -- 2.30.2 From 5eead45cedf2e8ee9d3d376ee977dcdb293558b0 Mon Sep 17 00:00:00 2001 From: jrt Date: Mon, 22 Sep 2003 12:23:34 +0000 Subject: [PATCH 09/16] Freshly added file --- src/SMDS/SMDS_IteratorOfArray.hxx | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/SMDS/SMDS_IteratorOfArray.hxx diff --git a/src/SMDS/SMDS_IteratorOfArray.hxx b/src/SMDS/SMDS_IteratorOfArray.hxx new file mode 100644 index 000000000..a73fddbf5 --- /dev/null +++ b/src/SMDS/SMDS_IteratorOfArray.hxx @@ -0,0 +1,42 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#include "SMDS_Iterator.hxx" + +template class SMDS_IteratorOfArray:public SMDS_Iterator +{ + T2 const* myArray; + int index; + public: + SMDS_IteratorOfArray(T2 const* a):myArray(a),index(0) + {} + + bool more() + { + return index(myArray[index-1]); + } +}; -- 2.30.2 From 32975956715299318962bd208a2c1d04d25061b3 Mon Sep 17 00:00:00 2001 From: nri Date: Tue, 23 Sep 2003 11:52:55 +0000 Subject: [PATCH 10/16] NRI : Display Component UserName and Icon. --- src/SMESHGUI/SMESHGUI_StudyAPI.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_StudyAPI.cxx b/src/SMESHGUI/SMESHGUI_StudyAPI.cxx index 0e5a424fc..6c5fdc5d6 100644 --- a/src/SMESHGUI/SMESHGUI_StudyAPI.cxx +++ b/src/SMESHGUI/SMESHGUI_StudyAPI.cxx @@ -105,14 +105,15 @@ SMESHGUI_StudyAPI::SMESHGUI_StudyAPI ( SALOMEDS::Study_ptr aStudy, if (father->_is_nil()) { father = myStudyBuilder->NewComponent("MESH"); - anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - //NRI aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT")); - aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SMESH" ) ); - anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); } + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + //NRI aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT")); + aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SMESH" ) ); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); + myStudyBuilder->DefineComponentInstance(father, CompMesh ); mySComponentMesh = SALOMEDS::SComponent::_narrow( father ); } -- 2.30.2 From bef85377644b6a909a8f798c46362b898d43be3b Mon Sep 17 00:00:00 2001 From: jrt Date: Tue, 23 Sep 2003 14:33:41 +0000 Subject: [PATCH 11/16] Keep compatible with gcc 2 --- src/SMDS/SMDS_FaceOfEdges.hxx | 2 +- src/SMDS/SMDS_FaceOfNodes.hxx | 2 +- src/SMDS/SMDS_MeshEdge.hxx | 2 +- src/SMDS/SMDS_MeshElement.hxx | 2 +- src/SMDS/SMDS_Tria3OfNodes.hxx | 2 +- src/SMDS/SMDS_VolumeOfFaces.hxx | 2 +- src/SMESHDS/SMESHDS_Mesh.hxx | 11 +++++++++-- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/SMDS/SMDS_FaceOfEdges.hxx b/src/SMDS/SMDS_FaceOfEdges.hxx index 6f4d56c77..978ad5df6 100644 --- a/src/SMDS/SMDS_FaceOfEdges.hxx +++ b/src/SMDS/SMDS_FaceOfEdges.hxx @@ -22,7 +22,7 @@ #ifndef _SMDS_FaceOfEdges_HeaderFile #define _SMDS_FaceOfEdges_HeaderFile -#include +#include #include "SMDS_MeshFace.hxx" #include "SMDS_MeshEdge.hxx" #include "SMDS_Iterator.hxx" diff --git a/src/SMDS/SMDS_FaceOfNodes.hxx b/src/SMDS/SMDS_FaceOfNodes.hxx index e368a96af..809ee5f1c 100644 --- a/src/SMDS/SMDS_FaceOfNodes.hxx +++ b/src/SMDS/SMDS_FaceOfNodes.hxx @@ -22,7 +22,7 @@ #ifndef _SMDS_FaceOfNodes_HeaderFile #define _SMDS_FaceOfNodes_HeaderFile -#include +#include #include "SMDS_MeshFace.hxx" #include "SMDS_MeshNode.hxx" #include "SMDS_Iterator.hxx" diff --git a/src/SMDS/SMDS_MeshEdge.hxx b/src/SMDS/SMDS_MeshEdge.hxx index 0ed6e5548..cfef08ed7 100644 --- a/src/SMDS/SMDS_MeshEdge.hxx +++ b/src/SMDS/SMDS_MeshEdge.hxx @@ -28,7 +28,7 @@ #define _SMDS_MeshEdge_HeaderFile #include "SMDS_MeshElement.hxx" -#include +#include class SMDS_MeshEdge:public SMDS_MeshElement { diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index d35e151bd..86bc6ddb5 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -33,7 +33,7 @@ #include "SMDS_MeshElementIDFactory.hxx" #include -#include +#include using namespace std; class SMDS_MeshNode; diff --git a/src/SMDS/SMDS_Tria3OfNodes.hxx b/src/SMDS/SMDS_Tria3OfNodes.hxx index a52dd7a1f..ee4c330da 100644 --- a/src/SMDS/SMDS_Tria3OfNodes.hxx +++ b/src/SMDS/SMDS_Tria3OfNodes.hxx @@ -22,7 +22,7 @@ #ifndef _SMDS_Tria3OfNodes_HeaderFile #define _SMDS_Tria3OfNodes_HeaderFile -#include +#include #include "SMDS_MeshFace.hxx" #include "SMDS_MeshNode.hxx" #include "SMDS_Iterator.hxx" diff --git a/src/SMDS/SMDS_VolumeOfFaces.hxx b/src/SMDS/SMDS_VolumeOfFaces.hxx index ed5efc9c9..05480f3df 100644 --- a/src/SMDS/SMDS_VolumeOfFaces.hxx +++ b/src/SMDS/SMDS_VolumeOfFaces.hxx @@ -31,7 +31,7 @@ #include "SMDS_MeshFace.hxx" #include "SMDS_Iterator.hxx" #include -#include +#include using namespace std; class SMDS_VolumeOfFaces:public SMDS_MeshVolume diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index ce7d49a87..6159a4fca 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -42,9 +42,16 @@ #include #include #include + //Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more. -#include -using namespace __gnu_cxx; +#ifdef __GNUC__ +#if __GNUC__ < 3 + #include +#else + #include + using namespace __gnu_cxx; +#endif +#endif using namespace std; -- 2.30.2 From ece587c702cc990caf3ae14c39657dba15bc2e7f Mon Sep 17 00:00:00 2001 From: nri Date: Fri, 26 Sep 2003 14:21:29 +0000 Subject: [PATCH 12/16] NRI : INSTALL file defined into SALOME2_PRODUCTION_CYCLE document. --- INSTALL | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 INSTALL diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..3db409283 --- /dev/null +++ b/INSTALL @@ -0,0 +1,5 @@ +This is the version 1.2.1 of SMESH +Compatible with : + - KERNEL 1.2.1 + - GEOM 1.2.1 + - MED 1.2.1 -- 2.30.2 From 58b87f7d06960d72efe60075c4ed5ef1e11aaaa0 Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 26 Sep 2003 15:14:40 +0000 Subject: [PATCH 13/16] Add a tag file to track branch and tag. Update INSTALL to prepare V1_2_2 tag. --- INSTALL | 2 +- cvs-tags | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 cvs-tags diff --git a/INSTALL b/INSTALL index 3db409283..03a1d4890 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -This is the version 1.2.1 of SMESH +This is the version 1.2.2 of SMESH Compatible with : - KERNEL 1.2.1 - GEOM 1.2.1 diff --git a/cvs-tags b/cvs-tags new file mode 100644 index 000000000..a26df3679 --- /dev/null +++ b/cvs-tags @@ -0,0 +1,9 @@ +Start-v1_1a: ? + ? + +V1_2_1: ? + ? + +V1_2_2: 2003-09-26 17:00 + New data structure in SMDS. + -- 2.30.2 From 342d400770d89071b5b32c079a6000f7c2ccad5d Mon Sep 17 00:00:00 2001 From: nri Date: Thu, 2 Oct 2003 16:16:28 +0000 Subject: [PATCH 14/16] NRI : RedHat 9 compatibility (M. Tajchman). --- build_configure | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build_configure b/build_configure index 5e384ce51..163b46353 100755 --- a/build_configure +++ b/build_configure @@ -134,9 +134,14 @@ echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 \rm -f configure.in_tmp2 configure.in_tmp3 touch configure.in_tmp2 find_in . configure.in_tmp2 -sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3 -sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 -sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 +sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 configure.in_tmp2 +sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 +#sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +#sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +#sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 echo "])" >> configure.in_tmp1 -- 2.30.2 From 9bf5caace2276ae97a45c8a7ccea5678c3265dd3 Mon Sep 17 00:00:00 2001 From: jrt Date: Mon, 6 Oct 2003 10:50:04 +0000 Subject: [PATCH 15/16] Update. Created a new branch for user nadir. --- cvs-tags | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cvs-tags b/cvs-tags index a26df3679..c2261a7b3 100644 --- a/cvs-tags +++ b/cvs-tags @@ -7,3 +7,6 @@ V1_2_1: ? V1_2_2: 2003-09-26 17:00 New data structure in SMDS. +nadir_1_2_2: 2003-10-06 12:50 + Branch after V1_2_2. Developpement branch for user nadir + -- 2.30.2 From 212b8d174e2992f15dc7e302c57f371f5c628bee Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 17 Oct 2003 12:35:44 +0000 Subject: [PATCH 16/16] Create branch merge_1_2_c__1_2_2 --- cvs-tags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cvs-tags b/cvs-tags index c2261a7b3..c484bdbd6 100644 --- a/cvs-tags +++ b/cvs-tags @@ -10,3 +10,5 @@ V1_2_2: 2003-09-26 17:00 nadir_1_2_2: 2003-10-06 12:50 Branch after V1_2_2. Developpement branch for user nadir +merge_1_2_c__1_2_2: 2003-10-17 14:35 + Branch after V1_2_2. Branch to merge Salome 1.2c. Initiated by Paul Rascle. -- 2.30.2