From: eap Date: Wed, 7 Sep 2005 04:45:51 +0000 (+0000) Subject: PAL9022. Use improved SMESHDS_Mesh API methods, comment unused variables X-Git-Tag: V3_1_0a1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=58187d6f689f07303e5a147e853155e8c5f058d8;p=modules%2Fsmesh.git PAL9022. Use improved SMESHDS_Mesh API methods, comment unused variables --- diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index b7da7cbe6..ed166fc03 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -129,7 +129,7 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis theHyp = (*itl); // use only the first hypothesis string hypName = theHyp->GetName(); - int hypId = theHyp->GetID(); + //int hypId = theHyp->GetID(); //SCRUTE(hypName); bool isOk = false; @@ -190,8 +190,8 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh _edgeLength = ComputeEdgeElementLength(aMesh, aShape); bool isOk = false; - const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); - SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape); + //const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); + //SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape); const TopoDS_Face & FF = TopoDS::Face(aShape); bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); @@ -477,7 +477,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, { // MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints"); - SMDS_Mesh * meshDS = aMesh.GetMeshDS(); + //SMDS_Mesh * meshDS = aMesh.GetMeshDS(); TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); @@ -521,7 +521,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes(); - bool isForward = (E.Orientation() == TopAbs_FORWARD); + //bool isForward = (E.Orientation() == TopAbs_FORWARD); map params; while(ite->more()) @@ -713,6 +713,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh, double scalex, double scaley) { SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); + int faceID = meshDS->ShapeToIndex( F ); Z n, m; Handle(Geom_Surface) S = BRep_Tool::Surface(F); @@ -726,20 +727,16 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh, gp_Pnt P = S->Value(u, v); SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnFace(node, F); + meshDS->SetNodeOnFace(node, faceID, u, v); //MESSAGE(P.X()<<" "<(node->GetPosition().get()); - fpos->SetUParameter(u); - fpos->SetVParameter(v); } } m = 0; - int mt = 0; + //int mt = 0; //SCRUTE(faceIsForward); for (n = 1; n <= nbt; n++) @@ -765,7 +762,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh, else elt = meshDS->AddFace(n1, n3, n2); - meshDS->SetMeshElementOnShape(elt, F); + meshDS->SetMeshElementOnShape(elt, faceID); m++; } @@ -806,7 +803,7 @@ double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh, // **** a mettre dans SMESH_2D_Algo ? const TopoDS_Face & FF = TopoDS::Face(aShape); - bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + //bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); double meanElementLength = 100; diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index da6b6a2e4..d806c8778 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -136,8 +136,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, int nbhoriz = Min(nbdown, nbup); int nbvertic = Min(nbright, nbleft); - int nbVertices = nbhoriz * nbvertic; - int nbQuad = (nbhoriz - 1) * (nbvertic - 1); + //int nbVertices = nbhoriz * nbvertic; + //int nbQuad = (nbhoriz - 1) * (nbvertic - 1); //SCRUTE(nbVertices); //SCRUTE(nbQuad); @@ -145,11 +145,11 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); const TopoDS_Face& F = TopoDS::Face(aShape); - bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); + //bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); Handle(Geom_Surface) S = BRep_Tool::Surface(F); // internal mesh nodes - int i, j; + int i, j, faceID = meshDS->ShapeToIndex( F ); for (i = 1; i < nbhoriz - 1; i++) { for (j = 1; j < nbvertic - 1; j++) { int ij = j * nbhoriz + i; @@ -157,12 +157,8 @@ bool StdMeshers_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()); - meshDS->SetNodeOnFace(node, F); + meshDS->SetNodeOnFace(node, faceID, u, v); quad->uv_grid[ij].node = node; - SMDS_FacePosition* fpos = - dynamic_cast(node->GetPosition().get()); - fpos->SetUParameter(u); - fpos->SetVParameter(v); } } @@ -198,10 +194,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, b = quad->uv_grid[j * nbhoriz + i + 1].node; c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node; d = quad->uv_grid[(j + 1) * nbhoriz + 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); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } } @@ -279,7 +273,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, else d = quad->uv_grid[nbhoriz + near - 1].node; SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); // if node d is not at position g - make additional triangles if (near - 1 > g) { @@ -290,7 +284,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, else d = quad->uv_grid[nbhoriz + k - 1].node; SMDS_MeshFace* face = meshDS->AddFace(a, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } } g = near; @@ -352,14 +346,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, if (near == g) { // make triangle SMDS_MeshFace* face = meshDS->AddFace(a, b, c); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } else { // make quadrangle if (near + 1 > iup) d = uv_e1[nbright - 2].node; else d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node; SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); if (near + 1 < g) { // if d not is at g - make additional triangles for (int k = near + 1; k < g; k++) { @@ -369,7 +363,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, else d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node; SMDS_MeshFace* face = meshDS->AddFace(a, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } } g = near; @@ -417,14 +411,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, if (near == g) { // make triangle SMDS_MeshFace* face = meshDS->AddFace(a, b, c); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } else { // make quadrangle if (near - 1 < jlow) d = uv_e0[nbdown - 2].node; else d = quad->uv_grid[nbhoriz*near - 2].node; SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); if (near - 1 > g) { // if d not is at g - make additional triangles for (int k = near - 1; k > g; k--) { @@ -434,7 +428,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, else d = quad->uv_grid[nbhoriz*k - 2].node; SMDS_MeshFace* face = meshDS->AddFace(a, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } } g = near; @@ -479,14 +473,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, if (near == g) { // make triangle SMDS_MeshFace* face = meshDS->AddFace(a, b, c); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } else { // make quadrangle if (near + 1 > jup) d = uv_e2[1].node; else d = quad->uv_grid[nbhoriz*(near + 1) + 1].node; SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); if (near + 1 < g) { // if d not is at g - make additional triangles for (int k = near + 1; k < g; k++) { @@ -496,7 +490,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, else d = quad->uv_grid[nbhoriz*(k + 1) + 1].node; SMDS_MeshFace* face = meshDS->AddFace(a, c, d); - meshDS->SetMeshElementOnShape(face, F); + meshDS->SetMeshElementOnShape(face, faceID); } } g = near; @@ -522,13 +516,13 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute Unexpect aCatch(SalomeException); // MESSAGE("StdMeshers_Quadrangle_2D::CheckAnd2Dcompute"); - SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape); + //SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape); // const TopoDS_Face& FF = TopoDS::Face(aShape); // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); const TopoDS_Face & F = TopoDS::Face(aShape); - bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); + //bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); // verify 1 wire only, with 4 edges @@ -865,7 +859,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh, { //MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints"); - SMDS_Mesh* meshDS = aMesh.GetMeshDS(); + //SMDS_Mesh* meshDS = aMesh.GetMeshDS(); // --- IDNodes of first and last Vertex diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index be3e69f1d..a24abbb98 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -699,6 +699,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh const TopoDS_Edge & EE = TopoDS::Edge(aShape); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); + int shapeID = meshDS->ShapeToIndex( E ); double f, l; Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l); @@ -750,19 +751,14 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh //Add the Node in the DataStructure SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnEdge(node, E); - - // **** edgePosition associe au point = param. - SMDS_EdgePosition* epos = - dynamic_cast(node->GetPosition().get()); - epos->SetUParameter(param); + meshDS->SetNodeOnEdge(node, shapeID, param); SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node); - meshDS->SetMeshElementOnShape(edge, E); + meshDS->SetMeshElementOnShape(edge, shapeID); idPrev = node; } SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast); - meshDS->SetMeshElementOnShape(edge, E); + meshDS->SetMeshElementOnShape(edge, shapeID); } else { @@ -781,18 +777,14 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh { double param = f + (i - 1) * du; SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnEdge(node, E); - - SMDS_EdgePosition* epos = - dynamic_cast(node->GetPosition().get()); - epos->SetUParameter(param); + meshDS->SetNodeOnEdge(node, shapeID, param); SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node); - meshDS->SetMeshElementOnShape(edge, E); + meshDS->SetMeshElementOnShape(edge, shapeID); idPrev = node; } SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast); - meshDS->SetMeshElementOnShape(edge, E); + meshDS->SetMeshElementOnShape(edge, shapeID); } return true; }