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