PAL9022. Use improved SMESHDS_Mesh API methods, comment unused variables

This commit is contained in:
eap 2005-09-07 04:45:51 +00:00
parent 2ac338d578
commit 58187d6f68
3 changed files with 37 additions and 54 deletions

View File

@ -129,7 +129,7 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis
theHyp = (*itl); // use only the first hypothesis theHyp = (*itl); // use only the first hypothesis
string hypName = theHyp->GetName(); string hypName = theHyp->GetName();
int hypId = theHyp->GetID(); //int hypId = theHyp->GetID();
//SCRUTE(hypName); //SCRUTE(hypName);
bool isOk = false; bool isOk = false;
@ -190,8 +190,8 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
_edgeLength = ComputeEdgeElementLength(aMesh, aShape); _edgeLength = ComputeEdgeElementLength(aMesh, aShape);
bool isOk = false; bool isOk = false;
const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); //const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape); //SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
const TopoDS_Face & FF = TopoDS::Face(aShape); const TopoDS_Face & FF = TopoDS::Face(aShape);
bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
@ -477,7 +477,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
{ {
// MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints"); // MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints");
SMDS_Mesh * meshDS = aMesh.GetMeshDS(); //SMDS_Mesh * meshDS = aMesh.GetMeshDS();
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); 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(); SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
bool isForward = (E.Orientation() == TopAbs_FORWARD); //bool isForward = (E.Orientation() == TopAbs_FORWARD);
map<double, const SMDS_MeshNode*> params; map<double, const SMDS_MeshNode*> params;
while(ite->more()) while(ite->more())
@ -713,6 +713,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
double scalex, double scaley) double scalex, double scaley)
{ {
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
int faceID = meshDS->ShapeToIndex( F );
Z n, m; Z n, m;
Handle(Geom_Surface) S = BRep_Tool::Surface(F); 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); gp_Pnt P = S->Value(u, v);
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(node, F); meshDS->SetNodeOnFace(node, faceID, u, v);
//MESSAGE(P.X()<<" "<<P.Y()<<" "<<P.Z()); //MESSAGE(P.X()<<" "<<P.Y()<<" "<<P.Z());
mefistoToDS[n + 1] = node; mefistoToDS[n + 1] = node;
//MESSAGE("NEW: "<<n<<" "<<mefistoToDS[n+1]); //MESSAGE("NEW: "<<n<<" "<<mefistoToDS[n+1]);
SMDS_FacePosition* fpos =
static_cast<SMDS_FacePosition*>(node->GetPosition().get());
fpos->SetUParameter(u);
fpos->SetVParameter(v);
} }
} }
m = 0; m = 0;
int mt = 0; //int mt = 0;
//SCRUTE(faceIsForward); //SCRUTE(faceIsForward);
for (n = 1; n <= nbt; n++) for (n = 1; n <= nbt; n++)
@ -765,7 +762,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
else else
elt = meshDS->AddFace(n1, n3, n2); elt = meshDS->AddFace(n1, n3, n2);
meshDS->SetMeshElementOnShape(elt, F); meshDS->SetMeshElementOnShape(elt, faceID);
m++; m++;
} }
@ -806,7 +803,7 @@ double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
// **** a mettre dans SMESH_2D_Algo ? // **** a mettre dans SMESH_2D_Algo ?
const TopoDS_Face & FF = TopoDS::Face(aShape); 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)); TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
double meanElementLength = 100; double meanElementLength = 100;

View File

@ -136,8 +136,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
int nbhoriz = Min(nbdown, nbup); int nbhoriz = Min(nbdown, nbup);
int nbvertic = Min(nbright, nbleft); int nbvertic = Min(nbright, nbleft);
int nbVertices = nbhoriz * nbvertic; //int nbVertices = nbhoriz * nbvertic;
int nbQuad = (nbhoriz - 1) * (nbvertic - 1); //int nbQuad = (nbhoriz - 1) * (nbvertic - 1);
//SCRUTE(nbVertices); //SCRUTE(nbVertices);
//SCRUTE(nbQuad); //SCRUTE(nbQuad);
@ -145,11 +145,11 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
// bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
// TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
const TopoDS_Face& F = TopoDS::Face(aShape); 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); Handle(Geom_Surface) S = BRep_Tool::Surface(F);
// internal mesh nodes // internal mesh nodes
int i, j; int i, j, faceID = meshDS->ShapeToIndex( F );
for (i = 1; i < nbhoriz - 1; i++) { for (i = 1; i < nbhoriz - 1; i++) {
for (j = 1; j < nbvertic - 1; j++) { for (j = 1; j < nbvertic - 1; j++) {
int ij = j * nbhoriz + i; int ij = j * nbhoriz + i;
@ -157,12 +157,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
double v = quad->uv_grid[ij].v; double v = quad->uv_grid[ij].v;
gp_Pnt P = S->Value(u, v); gp_Pnt P = S->Value(u, v);
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); 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; quad->uv_grid[ij].node = node;
SMDS_FacePosition* fpos =
dynamic_cast<SMDS_FacePosition*>(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; b = quad->uv_grid[j * nbhoriz + i + 1].node;
c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node; c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
d = quad->uv_grid[(j + 1) * nbhoriz + i].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); 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 else
d = quad->uv_grid[nbhoriz + near - 1].node; d = quad->uv_grid[nbhoriz + near - 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); 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 node d is not at position g - make additional triangles
if (near - 1 > g) { if (near - 1 > g) {
@ -290,7 +284,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
else else
d = quad->uv_grid[nbhoriz + k - 1].node; d = quad->uv_grid[nbhoriz + k - 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} }
} }
g = near; g = near;
@ -352,14 +346,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} else { // make quadrangle } else { // make quadrangle
if (near + 1 > iup) if (near + 1 > iup)
d = uv_e1[nbright - 2].node; d = uv_e1[nbright - 2].node;
else else
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node; d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); 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 if (near + 1 < g) { // if d not is at g - make additional triangles
for (int k = near + 1; k < g; k++) { for (int k = near + 1; k < g; k++) {
@ -369,7 +363,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
else else
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node; d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} }
} }
g = near; g = near;
@ -417,14 +411,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} else { // make quadrangle } else { // make quadrangle
if (near - 1 < jlow) if (near - 1 < jlow)
d = uv_e0[nbdown - 2].node; d = uv_e0[nbdown - 2].node;
else else
d = quad->uv_grid[nbhoriz*near - 2].node; d = quad->uv_grid[nbhoriz*near - 2].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); 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 if (near - 1 > g) { // if d not is at g - make additional triangles
for (int k = near - 1; k > g; k--) { for (int k = near - 1; k > g; k--) {
@ -434,7 +428,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
else else
d = quad->uv_grid[nbhoriz*k - 2].node; d = quad->uv_grid[nbhoriz*k - 2].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} }
} }
g = near; g = near;
@ -479,14 +473,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} else { // make quadrangle } else { // make quadrangle
if (near + 1 > jup) if (near + 1 > jup)
d = uv_e2[1].node; d = uv_e2[1].node;
else else
d = quad->uv_grid[nbhoriz*(near + 1) + 1].node; d = quad->uv_grid[nbhoriz*(near + 1) + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); 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 if (near + 1 < g) { // if d not is at g - make additional triangles
for (int k = near + 1; k < g; k++) { for (int k = near + 1; k < g; k++) {
@ -496,7 +490,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
else else
d = quad->uv_grid[nbhoriz*(k + 1) + 1].node; d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, F); meshDS->SetMeshElementOnShape(face, faceID);
} }
} }
g = near; g = near;
@ -522,13 +516,13 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
Unexpect aCatch(SalomeException); Unexpect aCatch(SalomeException);
// MESSAGE("StdMeshers_Quadrangle_2D::CheckAnd2Dcompute"); // MESSAGE("StdMeshers_Quadrangle_2D::CheckAnd2Dcompute");
SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape); //SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
// const TopoDS_Face& FF = TopoDS::Face(aShape); // 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)); // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
const TopoDS_Face & F = TopoDS::Face(aShape); 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 // verify 1 wire only, with 4 edges
@ -865,7 +859,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
{ {
//MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints"); //MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints");
SMDS_Mesh* meshDS = aMesh.GetMeshDS(); //SMDS_Mesh* meshDS = aMesh.GetMeshDS();
// --- IDNodes of first and last Vertex // --- IDNodes of first and last Vertex

View File

@ -699,6 +699,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
const TopoDS_Edge & EE = TopoDS::Edge(aShape); const TopoDS_Edge & EE = TopoDS::Edge(aShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
int shapeID = meshDS->ShapeToIndex( E );
double f, l; double f, l;
Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, 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 //Add the Node in the DataStructure
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnEdge(node, E); meshDS->SetNodeOnEdge(node, shapeID, param);
// **** edgePosition associe au point = param.
SMDS_EdgePosition* epos =
dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
epos->SetUParameter(param);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node); SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
meshDS->SetMeshElementOnShape(edge, E); meshDS->SetMeshElementOnShape(edge, shapeID);
idPrev = node; idPrev = node;
} }
SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast); SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
meshDS->SetMeshElementOnShape(edge, E); meshDS->SetMeshElementOnShape(edge, shapeID);
} }
else else
{ {
@ -781,18 +777,14 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
{ {
double param = f + (i - 1) * du; double param = f + (i - 1) * du;
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnEdge(node, E); meshDS->SetNodeOnEdge(node, shapeID, param);
SMDS_EdgePosition* epos =
dynamic_cast<SMDS_EdgePosition*>(node->GetPosition().get());
epos->SetUParameter(param);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node); SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
meshDS->SetMeshElementOnShape(edge, E); meshDS->SetMeshElementOnShape(edge, shapeID);
idPrev = node; idPrev = node;
} }
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast); SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
meshDS->SetMeshElementOnShape(edge, E); meshDS->SetMeshElementOnShape(edge, shapeID);
} }
return true; return true;
} }