This commit is contained in:
eap 2009-11-10 11:59:31 +00:00
parent bebf5671ea
commit c75712a62e

View File

@ -77,7 +77,7 @@ typedef SMESH_Comment TComm;
//============================================================================= //=============================================================================
StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
SMESH_Gen* gen) SMESH_Gen* gen)
: SMESH_2D_Algo(hypId, studyId, gen) : SMESH_2D_Algo(hypId, studyId, gen)
{ {
MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D"); MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
@ -123,7 +123,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
theHyp = hyps.front(); theHyp = hyps.front();
if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) { if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) {
const StdMeshers_QuadrangleParams* theHyp1 = const StdMeshers_QuadrangleParams* theHyp1 =
(const StdMeshers_QuadrangleParams*)theHyp; (const StdMeshers_QuadrangleParams*)theHyp;
myTriaVertexID = theHyp1->GetTriaVertex(); myTriaVertexID = theHyp1->GetTriaVertex();
myQuadranglePreference= false; myQuadranglePreference= false;
myTrianglePreference= false; myTrianglePreference= false;
@ -144,29 +144,29 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
theHyp = hyps.front(); theHyp = hyps.front();
if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) { if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) {
const StdMeshers_QuadrangleParams* theHyp1 = const StdMeshers_QuadrangleParams* theHyp1 =
(const StdMeshers_QuadrangleParams*)theHyp; (const StdMeshers_QuadrangleParams*)theHyp;
myTriaVertexID = theHyp1->GetTriaVertex(); myTriaVertexID = theHyp1->GetTriaVertex();
theHyp = hyps.back(); theHyp = hyps.back();
if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
myQuadranglePreference= true; myQuadranglePreference= true;
myTrianglePreference= false; myTrianglePreference= false;
} }
else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
myQuadranglePreference= false; myQuadranglePreference= false;
myTrianglePreference= true; myTrianglePreference= true;
} }
} }
else { else {
if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
myQuadranglePreference= true; myQuadranglePreference= true;
myTrianglePreference= false; myTrianglePreference= false;
} }
else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
myQuadranglePreference= false; myQuadranglePreference= false;
myTrianglePreference= true; myTrianglePreference= true;
} }
const StdMeshers_QuadrangleParams* theHyp2 = const StdMeshers_QuadrangleParams* theHyp2 =
(const StdMeshers_QuadrangleParams*)hyps.back(); (const StdMeshers_QuadrangleParams*)hyps.back();
myTriaVertexID = theHyp2->GetTriaVertex(); myTriaVertexID = theHyp2->GetTriaVertex();
} }
} }
@ -286,7 +286,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
d = quad->uv_grid[(j + 1) * nbhoriz + i].node; d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
if(face) { if(face) {
meshDS->SetMeshElementOnShape(face, geomFaceID); meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
} }
} }
@ -638,7 +638,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh, bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap) MapShapeNbElems& aResMap)
{ {
aMesh.GetSubMesh(aShape); aMesh.GetSubMesh(aShape);
@ -778,31 +778,31 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID));
if(!V.IsNull()) { if(!V.IsNull()) {
TopoDS_Edge E1,E2,E3; TopoDS_Edge E1,E2,E3;
for(; edgeIt != edges.end(); ++edgeIt) { for(; edgeIt != edges.end(); ++edgeIt) {
TopoDS_Edge E = TopoDS::Edge(*edgeIt); TopoDS_Edge E = TopoDS::Edge(*edgeIt);
TopoDS_Vertex VF, VL; TopoDS_Vertex VF, VL;
TopExp::Vertices(E, VF, VL, true); TopExp::Vertices(E, VF, VL, true);
if( VF.IsSame(V) ) if( VF.IsSame(V) )
E1 = E; E1 = E;
else if( VL.IsSame(V) ) else if( VL.IsSame(V) )
E3 = E; E3 = E;
else else
E2 = E; E2 = E;
} }
quad->side.reserve(4); quad->side.reserve(4);
quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes)); quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes));
quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes)); quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes));
quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes)); quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes));
std::vector<UVPtStruct> UVPSleft = quad->side[0]->GetUVPtStruct(true,0); std::vector<UVPtStruct> UVPSleft = quad->side[0]->GetUVPtStruct(true,0);
std::vector<UVPtStruct> UVPStop = quad->side[1]->GetUVPtStruct(false,1); std::vector<UVPtStruct> UVPStop = quad->side[1]->GetUVPtStruct(false,1);
std::vector<UVPtStruct> UVPSright = quad->side[2]->GetUVPtStruct(true,1); std::vector<UVPtStruct> UVPSright = quad->side[2]->GetUVPtStruct(true,1);
const SMDS_MeshNode* aNode = UVPSleft[0].node; const SMDS_MeshNode* aNode = UVPSleft[0].node;
gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v ); gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v );
StdMeshers_FaceSide* VertFS = StdMeshers_FaceSide* VertFS =
new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]); new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]);
quad->side.push_back(VertFS); quad->side.push_back(VertFS);
return quad; return quad;
} }
} }
return 0; return 0;
@ -900,10 +900,10 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
//============================================================================= //=============================================================================
bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap, MapShapeNbElems& aResMap,
std::vector<int>& aNbNodes, std::vector<int>& aNbNodes,
bool& IsQuadratic) bool& IsQuadratic)
{ {
const TopoDS_Face & F = TopoDS::Face(aShape); const TopoDS_Face & F = TopoDS::Face(aShape);
@ -933,45 +933,45 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID));
if(!V.IsNull()) { if(!V.IsNull()) {
TopoDS_Edge E1,E2,E3; TopoDS_Edge E1,E2,E3;
for(; edgeIt != edges.end(); ++edgeIt) { for(; edgeIt != edges.end(); ++edgeIt) {
TopoDS_Edge E = TopoDS::Edge(*edgeIt); TopoDS_Edge E = TopoDS::Edge(*edgeIt);
TopoDS_Vertex VF, VL; TopoDS_Vertex VF, VL;
TopExp::Vertices(E, VF, VL, true); TopExp::Vertices(E, VF, VL, true);
if( VF.IsSame(V) ) if( VF.IsSame(V) )
E1 = E; E1 = E;
else if( VL.IsSame(V) ) else if( VL.IsSame(V) )
E3 = E; E3 = E;
else else
E2 = E; E2 = E;
} }
SMESH_subMesh * sm = aMesh.GetSubMesh(E1); SMESH_subMesh * sm = aMesh.GetSubMesh(E1);
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
if(anIt==aResMap.end()) return false; if(anIt==aResMap.end()) return false;
std::vector<int> aVec = (*anIt).second; std::vector<int> aVec = (*anIt).second;
if(IsQuadratic) if(IsQuadratic)
aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2; aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2;
else else
aNbNodes[0] = aVec[SMDSEntity_Node] + 2; aNbNodes[0] = aVec[SMDSEntity_Node] + 2;
sm = aMesh.GetSubMesh(E2); sm = aMesh.GetSubMesh(E2);
anIt = aResMap.find(sm); anIt = aResMap.find(sm);
if(anIt==aResMap.end()) return false; if(anIt==aResMap.end()) return false;
aVec = (*anIt).second; aVec = (*anIt).second;
if(IsQuadratic) if(IsQuadratic)
aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2; aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2;
else else
aNbNodes[1] = aVec[SMDSEntity_Node] + 2; aNbNodes[1] = aVec[SMDSEntity_Node] + 2;
sm = aMesh.GetSubMesh(E3); sm = aMesh.GetSubMesh(E3);
anIt = aResMap.find(sm); anIt = aResMap.find(sm);
if(anIt==aResMap.end()) return false; if(anIt==aResMap.end()) return false;
aVec = (*anIt).second; aVec = (*anIt).second;
if(IsQuadratic) if(IsQuadratic)
aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2; aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2;
else else
aNbNodes[2] = aVec[SMDSEntity_Node] + 2; aNbNodes[2] = aVec[SMDSEntity_Node] + 2;
aNbNodes[3] = aNbNodes[1]; aNbNodes[3] = aNbNodes[1];
aNbNodes.resize(5); aNbNodes.resize(5);
nbSides = 4; nbSides = 4;
} }
} }
} }
@ -980,13 +980,13 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt ); SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt );
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
if(anIt==aResMap.end()) { if(anIt==aResMap.end()) {
return false; return false;
} }
std::vector<int> aVec = (*anIt).second; std::vector<int> aVec = (*anIt).second;
if(IsQuadratic) if(IsQuadratic)
aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2; aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2;
else else
aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2; aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2;
nbSides++; nbSides++;
} }
} }
@ -1012,16 +1012,16 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
list<TopoDS_Edge>::iterator ite = sideEdges.begin(); list<TopoDS_Edge>::iterator ite = sideEdges.begin();
aNbNodes[nbSides] = 1; aNbNodes[nbSides] = 1;
for(; ite!=sideEdges.end(); ite++) { for(; ite!=sideEdges.end(); ite++) {
SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
if(anIt==aResMap.end()) { if(anIt==aResMap.end()) {
return false; return false;
} }
std::vector<int> aVec = (*anIt).second; std::vector<int> aVec = (*anIt).second;
if(IsQuadratic) if(IsQuadratic)
aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
else else
aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
} }
++nbSides; ++nbSides;
} }
@ -1050,20 +1050,20 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
sideEdges.splice( sideEdges.begin(), edges, --edges.end()); sideEdges.splice( sideEdges.begin(), edges, --edges.end());
} }
} }
list<TopoDS_Edge>::iterator ite = sideEdges.begin(); list<TopoDS_Edge>::iterator ite = sideEdges.begin();
aNbNodes[nbSides] = 1; aNbNodes[nbSides] = 1;
for(; ite!=sideEdges.end(); ite++) { for(; ite!=sideEdges.end(); ite++) {
SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
MapShapeNbElemsItr anIt = aResMap.find(sm); MapShapeNbElemsItr anIt = aResMap.find(sm);
if(anIt==aResMap.end()) { if(anIt==aResMap.end()) {
return false; return false;
} }
std::vector<int> aVec = (*anIt).second; std::vector<int> aVec = (*anIt).second;
if(IsQuadratic) if(IsQuadratic)
aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
else else
aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
} }
++nbSides; ++nbSides;
} }
} }
@ -1221,11 +1221,11 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
for (int j = 0; j < nbvertic; j++) { for (int j = 0; j < nbvertic; j++) {
int ij = j * nbhoriz + i; int ij = j * nbhoriz + i;
// --- droite i cste : x = x0 + y(x1-x0) // --- droite i cste : x = x0 + y(x1-x0)
double x0 = uv_e0[i].normParam; // bas - sud double x0 = uv_e0[i].normParam; // bas - sud
double x1 = uv_e2[i].normParam; // haut - nord double x1 = uv_e2[i].normParam; // haut - nord
// --- droite j cste : y = y0 + x(y1-y0) // --- droite j cste : y = y0 + x(y1-y0)
double y0 = uv_e3[j].normParam; // gauche-ouest double y0 = uv_e3[j].normParam; // gauche-ouest
double y1 = uv_e1[j].normParam; // droite - est double y1 = uv_e1[j].normParam; // droite - est
// --- intersection : x=x0+(y0+x(y1-y0))(x1-x0) // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0)); double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
double y = y0 + x * (y1 - y0); double y = y0 + x * (y1 - y0);
@ -1754,7 +1754,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
int nbf=0; int nbf=0;
for(j=1; j<nnn-1; j++) { for(j=1; j<nnn-1; j++) {
for(i=1; i<nb; i++) { for(i=1; i<nb; i++) {
nbf++; nbf++;
if(WisF) { if(WisF) {
SMDS_MeshFace* F = SMDS_MeshFace* F =
myTool->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j), myTool->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j),
@ -1867,7 +1867,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
// create faces // create faces
for(j=1; j<=drl+addv; j++) { for(j=1; j<=drl+addv; j++) {
for(i=1; i<nb; i++) { for(i=1; i<nb; i++) {
nbf++; nbf++;
if(WisF) { if(WisF) {
SMDS_MeshFace* F = SMDS_MeshFace* F =
myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
@ -1901,7 +1901,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
NodesLast.SetValue(nnn,1,NodesC.Value(nb,i)); NodesLast.SetValue(nnn,1,NodesC.Value(nb,i));
} }
for(i=1; i<nt; i++) { for(i=1; i<nt; i++) {
nbf++; nbf++;
if(WisF) { if(WisF) {
SMDS_MeshFace* F = SMDS_MeshFace* F =
myTool->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1), myTool->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1),
@ -1933,8 +1933,8 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh & aMesh, bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
std::vector<int>& aNbNodes, std::vector<int>& aNbNodes,
MapShapeNbElems& aResMap, MapShapeNbElems& aResMap,
bool IsQuadratic) bool IsQuadratic)
{ {
// Auxilary key in order to keep old variant // Auxilary key in order to keep old variant
// of meshing after implementation new variant // of meshing after implementation new variant