0021893: EDF 2133 SMESH : Improvement of 3D extrusion algorithm

struct faceQuadStruct
 {
+  void shift( size_t nb, bool keepUnitOri );
+  typedef boost::shared_ptr<faceQuadStruct> Ptr;
 }

-  FaceQuadStruct* CheckNbEdges();
+  FaceQuadStruct::Ptr CheckNbEdges();

+  FaceQuadStruct::Ptr  myQuadStruct;
This commit is contained in:
eap 2013-01-28 08:35:01 +00:00
parent 9f2f0a0c1a
commit 212d7fc62e
2 changed files with 161 additions and 148 deletions

View File

@ -78,6 +78,11 @@ 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),
myQuadranglePreference(false),
myTrianglePreference(false),
myTriaVertexID(-1),
myNeedSmooth(false),
myQuadType(QUAD_STANDARD),
myHelper( 0 ) myHelper( 0 )
{ {
MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D"); MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
@ -122,6 +127,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
myQuadType = QUAD_STANDARD; myQuadType = QUAD_STANDARD;
myQuadranglePreference = false; myQuadranglePreference = false;
myTrianglePreference = false; myTrianglePreference = false;
myQuadStruct.reset();
bool isFirstParams = true; bool isFirstParams = true;
@ -211,10 +217,10 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
_quadraticMesh = myHelper->IsQuadraticSubMesh(aShape); _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape);
myNeedSmooth = false; myNeedSmooth = false;
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape); FaceQuadStruct::Ptr quad = CheckNbEdges(aMesh, aShape);
std::auto_ptr<FaceQuadStruct> quadDeleter (quad); // to delete quad at exit from Compute()
if (!quad) if (!quad)
return false; return false;
myQuadStruct = quad;
if (myQuadranglePreference) { if (myQuadranglePreference) {
int n1 = quad->side[0]->NbPoints(); int n1 = quad->side[0]->NbPoints();
@ -781,24 +787,25 @@ static bool twoEdgesMeatAtVertex(const TopoDS_Edge& e1,
*/ */
//============================================================================= //=============================================================================
FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh, FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape) const TopoDS_Shape & aShape)
//throw(SALOME_Exception)
{ {
if ( myQuadStruct && myQuadStruct->face.IsSame( aShape ))
return myQuadStruct;
TopoDS_Face F = TopoDS::Face(aShape); TopoDS_Face F = TopoDS::Face(aShape);
if ( F.Orientation() >= TopAbs_INTERNAL ) F.Orientation( TopAbs_FORWARD ); if ( F.Orientation() >= TopAbs_INTERNAL ) F.Orientation( TopAbs_FORWARD );
const bool ignoreMediumNodes = _quadraticMesh; const bool ignoreMediumNodes = _quadraticMesh;
// verify 1 wire only, with 4 edges // verify 1 wire only, with 4 edges
TopoDS_Vertex V;
list< TopoDS_Edge > edges; list< TopoDS_Edge > edges;
list< int > nbEdgesInWire; list< int > nbEdgesInWire;
int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire); int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
if (nbWire != 1) { if (nbWire != 1) {
error(COMPERR_BAD_SHAPE, TComm("Wrong number of wires: ") << nbWire); error(COMPERR_BAD_SHAPE, TComm("Wrong number of wires: ") << nbWire);
return 0; return FaceQuadStruct::Ptr();
} }
FaceQuadStruct* quad = new FaceQuadStruct; FaceQuadStruct::Ptr quad( new FaceQuadStruct );
quad->uv_grid = 0; quad->uv_grid = 0;
quad->side.reserve(nbEdgesInWire.front()); quad->side.reserve(nbEdgesInWire.front());
quad->face = F; quad->face = F;
@ -809,7 +816,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
{ {
SMESH_Comment comment; SMESH_Comment comment;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
if (myTriaVertexID == -1) if (myTriaVertexID < 1)
{ {
comment << "No Base vertex parameter provided for a trilateral geometrical face"; comment << "No Base vertex parameter provided for a trilateral geometrical face";
} }
@ -853,13 +860,13 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
comment << meshDS->ShapeToIndex(v.Current()) << (vMap.Extent()==3 ? "]" : ", "); comment << meshDS->ShapeToIndex(v.Current()) << (vMap.Extent()==3 ? "]" : ", ");
} }
error(comment); error(comment);
delete quad; quad.reset();
return quad = 0; return quad;
} }
else if (nbEdgesInWire.front() == 4) // exactly 4 edges else if (nbEdgesInWire.front() == 4) // exactly 4 edges
{ {
for (; edgeIt != edges.end(); ++edgeIt, nbSides++) for (; edgeIt != edges.end(); ++edgeIt, nbSides++)
quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt, &aMesh, nbSides < TOP_SIDE, quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt, &aMesh, nbSides < QUAD_TOP_SIDE,
ignoreMediumNodes, myProxyMesh)); ignoreMediumNodes, myProxyMesh));
} }
else if (nbEdgesInWire.front() > 4) // more than 4 edges - try to unite some else if (nbEdgesInWire.front() > 4) // more than 4 edges - try to unite some
@ -886,14 +893,14 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
if ( sideEdges.size() == 1 && BRep_Tool::Degenerated( sideEdges.front() )) if ( sideEdges.size() == 1 && BRep_Tool::Degenerated( sideEdges.front() ))
degenSides.push_back( nbSides ); degenSides.push_back( nbSides );
quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, nbSides < TOP_SIDE, quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, nbSides < QUAD_TOP_SIDE,
ignoreMediumNodes, myProxyMesh)); ignoreMediumNodes, myProxyMesh));
++nbSides; ++nbSides;
} }
if ( !degenSides.empty() && nbSides - degenSides.size() == 4 ) if ( !degenSides.empty() && nbSides - degenSides.size() == 4 )
{ {
myNeedSmooth = true; myNeedSmooth = true;
for ( unsigned i = TOP_SIDE; i < quad->side.size(); ++i ) for ( unsigned i = QUAD_TOP_SIDE; i < quad->side.size(); ++i )
quad->side[i]->Reverse(); quad->side[i]->Reverse();
for ( int i = degenSides.size()-1; i > -1; --i ) for ( int i = degenSides.size()-1; i > -1; --i )
@ -902,20 +909,19 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
delete degenSide; delete degenSide;
quad->side.erase( quad->side.begin() + degenSides[ i ] ); quad->side.erase( quad->side.begin() + degenSides[ i ] );
} }
for ( unsigned i = TOP_SIDE; i < quad->side.size(); ++i ) for ( unsigned i = QUAD_TOP_SIDE; i < quad->side.size(); ++i )
quad->side[i]->Reverse(); quad->side[i]->Reverse();
nbSides -= degenSides.size(); nbSides -= degenSides.size();
} }
// issue 20222. Try to unite only edges shared by two same faces // issue 20222. Try to unite only edges shared by two same faces
if (nbSides < 4) { if (nbSides < 4)
// delete found sides {
{ FaceQuadStruct cleaner(*quad); } quad.reset( new FaceQuadStruct );
quad->side.clear();
quad->side.reserve(nbEdgesInWire.front()); quad->side.reserve(nbEdgesInWire.front());
nbSides = 0; nbSides = 0;
SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire); SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
while (!edges.empty()) { while (!edges.empty()) {
sideEdges.clear(); sideEdges.clear();
sideEdges.splice(sideEdges.end(), edges, edges.begin()); sideEdges.splice(sideEdges.end(), edges, edges.begin());
@ -938,7 +944,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
} }
} }
quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh,
nbSides < TOP_SIDE, nbSides < QUAD_TOP_SIDE,
ignoreMediumNodes, myProxyMesh)); ignoreMediumNodes, myProxyMesh));
++nbSides; ++nbSides;
} }
@ -958,8 +964,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
if (!nbSides) if (!nbSides)
nbSides = nbEdgesInWire.front(); nbSides = nbEdgesInWire.front();
error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides); error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides);
delete quad; quad.reset();
quad = 0;
} }
return quad; return quad;
@ -982,10 +987,9 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
const TopoDS_Face & F = TopoDS::Face(aShape); const TopoDS_Face & F = TopoDS::Face(aShape);
// verify 1 wire only, with 4 edges // verify 1 wire only, with 4 edges
TopoDS_Vertex V;
list< TopoDS_Edge > edges; list< TopoDS_Edge > edges;
list< int > nbEdgesInWire; list< int > nbEdgesInWire;
int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire); int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
if (nbWire != 1) { if (nbWire != 1) {
return false; return false;
} }
@ -1101,7 +1105,7 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
// issue 20222. Try to unite only edges shared by two same faces // issue 20222. Try to unite only edges shared by two same faces
if (nbSides < 4) { if (nbSides < 4) {
nbSides = 0; nbSides = 0;
SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire); SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
while (!edges.empty()) { while (!edges.empty()) {
sideEdges.clear(); sideEdges.clear();
sideEdges.splice(sideEdges.end(), edges, edges.begin()); sideEdges.splice(sideEdges.end(), edges, edges.begin());
@ -1158,30 +1162,26 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
*/ */
//============================================================================= //=============================================================================
FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute FaceQuadStruct::Ptr
(SMESH_Mesh & aMesh, StdMeshers_Quadrangle_2D::CheckAnd2Dcompute (SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
const bool CreateQuadratic) //throw(SALOME_Exception) const bool CreateQuadratic)
{ {
_quadraticMesh = CreateQuadratic; _quadraticMesh = CreateQuadratic;
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape); FaceQuadStruct::Ptr quad = CheckNbEdges(aMesh, aShape);
if ( quad )
if (!quad) return 0; {
// set normalized grid on unit square in parametric domain
// set normalized grid on unit square in parametric domain if (!SetNormalizedGrid(aMesh, aShape, quad))
bool stat = SetNormalizedGrid(aMesh, aShape, quad); quad.reset();
if (!stat) {
if (quad) delete quad;
quad = 0;
} }
return quad; return quad;
} }
//============================================================================= //=============================================================================
/*! /*!
* *
*/ */
//============================================================================= //=============================================================================
@ -1193,17 +1193,18 @@ faceQuadStruct::~faceQuadStruct()
if (uv_grid) delete [] uv_grid; if (uv_grid) delete [] uv_grid;
} }
namespace { namespace
inline const vector<UVPtStruct>& GetUVPtStructIn(FaceQuadStruct* quad, int i, int nbSeg) {
inline const vector<UVPtStruct>& getUVPtStructIn(FaceQuadStruct::Ptr& quad, int i, int nbSeg)
{ {
bool isXConst = (i == BOTTOM_SIDE || i == TOP_SIDE); bool isXConst = (i == QUAD_BOTTOM_SIDE || i == QUAD_TOP_SIDE);
double constValue = (i == BOTTOM_SIDE || i == LEFT_SIDE) ? 0 : 1; double constValue = (i == QUAD_BOTTOM_SIDE || i == QUAD_LEFT_SIDE) ? 0 : 1;
return return
quad->isEdgeOut[i] ? quad->isEdgeOut[i] ?
quad->side[i]->SimulateUVPtStruct(nbSeg,isXConst,constValue) : quad->side[i]->SimulateUVPtStruct(nbSeg,isXConst,constValue) :
quad->side[i]->GetUVPtStruct(isXConst,constValue); quad->side[i]->GetUVPtStruct(isXConst,constValue);
} }
inline gp_UV CalcUV(double x, double y, inline gp_UV calcUV(double x, double y,
const gp_UV& a0,const gp_UV& a1,const gp_UV& a2,const gp_UV& a3, const gp_UV& a0,const gp_UV& a1,const gp_UV& a2,const gp_UV& a3,
const gp_UV& p0,const gp_UV& p1,const gp_UV& p2,const gp_UV& p3) const gp_UV& p0,const gp_UV& p1,const gp_UV& p2,const gp_UV& p3)
{ {
@ -1219,9 +1220,9 @@ namespace {
*/ */
//============================================================================= //=============================================================================
bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh, bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
FaceQuadStruct* & quad) //throw (SALOME_Exception) FaceQuadStruct::Ptr & quad)
{ {
// Algorithme décrit dans "Génération automatique de maillages" // Algorithme décrit dans "Génération automatique de maillages"
// P.L. GEORGE, MASSON, § 6.4.1 p. 84-85 // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
@ -1257,10 +1258,10 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
UVPtStruct *uv_grid = quad->uv_grid = new UVPtStruct[nbvertic * nbhoriz]; UVPtStruct *uv_grid = quad->uv_grid = new UVPtStruct[nbvertic * nbhoriz];
const vector<UVPtStruct>& uv_e0 = GetUVPtStructIn(quad, 0, nbhoriz - 1); const vector<UVPtStruct>& uv_e0 = getUVPtStructIn(quad, 0, nbhoriz - 1);
const vector<UVPtStruct>& uv_e1 = GetUVPtStructIn(quad, 1, nbvertic - 1); const vector<UVPtStruct>& uv_e1 = getUVPtStructIn(quad, 1, nbvertic - 1);
const vector<UVPtStruct>& uv_e2 = GetUVPtStructIn(quad, 2, nbhoriz - 1); const vector<UVPtStruct>& uv_e2 = getUVPtStructIn(quad, 2, nbhoriz - 1);
const vector<UVPtStruct>& uv_e3 = GetUVPtStructIn(quad, 3, nbvertic - 1); const vector<UVPtStruct>& uv_e3 = getUVPtStructIn(quad, 3, nbvertic - 1);
if (uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty()) if (uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty())
//return error("Can't find nodes on sides"); //return error("Can't find nodes on sides");
@ -1330,7 +1331,7 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
double x = uv_grid[ij].x; double x = uv_grid[ij].x;
double y = uv_grid[ij].y; double y = uv_grid[ij].y;
gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3); gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
uv_grid[ij].u = uv.X(); uv_grid[ij].u = uv.X();
uv_grid[ij].v = uv.Y(); uv_grid[ij].v = uv.Y();
@ -1344,64 +1345,72 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
//purpose : auxilary function for ComputeQuadPref //purpose : auxilary function for ComputeQuadPref
//======================================================================= //=======================================================================
static void ShiftQuad(FaceQuadStruct* quad, const int num, bool) static void shiftQuad(FaceQuadStruct::Ptr& quad, const int num, bool)
{ {
StdMeshers_FaceSide* side[4] = { quad->side[0], quad->side[1], quad->shift( num, /*ori=*/true );
quad->side[2], quad->side[3] }; }
for (int i = BOTTOM_SIDE; i < NB_SIDES; ++i) {
int id = (i + num) % NB_SIDES; //================================================================================
bool wasForward = (i < TOP_SIDE); /*!
bool newForward = (id < TOP_SIDE); * \brief Rotate sides of a quad by nb
if (wasForward != newForward) * \param nb - number of rotation quartes
side[ i ]->Reverse(); * \param ori - to keep orientation of sides as in an unit quad or not
quad->side[ id ] = side[ i ]; */
//================================================================================
void FaceQuadStruct::shift( size_t nb, bool ori )
{
if ( nb == 0 ) return;
StdMeshers_FaceSide* sideArr[4] = { side[0], side[1], side[2], side[3] };
for (int i = QUAD_BOTTOM_SIDE; i < NB_QUAD_SIDES; ++i) {
int id = (i + nb) % NB_QUAD_SIDES;
bool wasForward = (i < QUAD_TOP_SIDE);
bool newForward = (id < QUAD_TOP_SIDE);
if (ori && wasForward != newForward)
sideArr[ i ]->Reverse();
side[ id ] = sideArr[ i ];
} }
} }
//======================================================================= //=======================================================================
//function : CalcUV //function : calcUV
//purpose : auxilary function for ComputeQuadPref //purpose : auxilary function for ComputeQuadPref
//======================================================================= //=======================================================================
static gp_UV CalcUV(double x0, double x1, double y0, double y1, static gp_UV calcUV(double x0, double x1, double y0, double y1,
FaceQuadStruct* quad, FaceQuadStruct::Ptr& quad,
const gp_UV& a0, const gp_UV& a1, const gp_UV& a0, const gp_UV& a1,
const gp_UV& a2, const gp_UV& a3) const gp_UV& a2, const gp_UV& a3)
{ {
// const vector<UVPtStruct>& uv_eb = quad->side[0]->GetUVPtStruct(true,0);
// const vector<UVPtStruct>& uv_er = quad->side[1]->GetUVPtStruct(false,1);
// const vector<UVPtStruct>& uv_et = quad->side[2]->GetUVPtStruct(true,1);
// const vector<UVPtStruct>& uv_el = quad->side[3]->GetUVPtStruct(false,0);
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);
gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY(); gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY();
gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY(); gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY();
gp_UV p2 = quad->side[TOP_SIDE ]->Value2d(x).XY(); gp_UV p2 = quad->side[QUAD_TOP_SIDE ]->Value2d(x).XY();
gp_UV p3 = quad->side[LEFT_SIDE ]->Value2d(y).XY(); gp_UV p3 = quad->side[QUAD_LEFT_SIDE ]->Value2d(y).XY();
gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3); gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
return uv; return uv;
} }
//======================================================================= //=======================================================================
//function : CalcUV2 //function : calcUV2
//purpose : auxilary function for ComputeQuadPref //purpose : auxilary function for ComputeQuadPref
//======================================================================= //=======================================================================
static gp_UV CalcUV2(double x, double y, static gp_UV calcUV2(double x, double y,
FaceQuadStruct* quad, FaceQuadStruct::Ptr& quad,
const gp_UV& a0, const gp_UV& a1, const gp_UV& a0, const gp_UV& a1,
const gp_UV& a2, const gp_UV& a3) const gp_UV& a2, const gp_UV& a3)
{ {
gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY(); gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY();
gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY(); gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY();
gp_UV p2 = quad->side[TOP_SIDE ]->Value2d(x).XY(); gp_UV p2 = quad->side[QUAD_TOP_SIDE ]->Value2d(x).XY();
gp_UV p3 = quad->side[LEFT_SIDE ]->Value2d(y).XY(); gp_UV p3 = quad->side[QUAD_LEFT_SIDE ]->Value2d(y).XY();
gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3); gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
return uv; return uv;
} }
@ -1415,7 +1424,7 @@ static gp_UV CalcUV2(double x, double y,
bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
FaceQuadStruct* quad) FaceQuadStruct::Ptr quad)
{ {
// 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
@ -1440,21 +1449,21 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
if (dh>=dv) { if (dh>=dv) {
if (nt>nb) { if (nt>nb) {
// it is a base case => not shift quad but me be replacement is need // it is a base case => not shift quad but me be replacement is need
ShiftQuad(quad,0,WisF); shiftQuad(quad,0,WisF);
} }
else { else {
// we have to shift quad on 2 // we have to shift quad on 2
ShiftQuad(quad,2,WisF); shiftQuad(quad,2,WisF);
} }
} }
else { else {
if (nr>nl) { if (nr>nl) {
// we have to shift quad on 1 // we have to shift quad on 1
ShiftQuad(quad,1,WisF); shiftQuad(quad,1,WisF);
} }
else { else {
// we have to shift quad on 3 // we have to shift quad on 3
ShiftQuad(quad,3,WisF); shiftQuad(quad,3,WisF);
} }
} }
@ -1589,7 +1598,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
// diagonal node // diagonal node
double y0 = npl.Value(i+1); double y0 = npl.Value(i+1);
double y1 = npr.Value(i+1); double y1 = npr.Value(i+1);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1599,7 +1608,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
for (j=2; j<nl; j++) { for (j=2; j<nl; j++) {
double y0 = npl.Value(dl+j); double y0 = npl.Value(dl+j);
double y1 = npr.Value(dl+j); double y1 = npr.Value(dl+j);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1660,7 +1669,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
// diagonal node // diagonal node
double y0 = npl.Value(i+1); double y0 = npl.Value(i+1);
double y1 = npr.Value(i+1); double y1 = npr.Value(i+1);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1670,7 +1679,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
for (j=2; j<nr; j++) { for (j=2; j<nr; j++) {
double y0 = npl.Value(nbv-j+1); double y0 = npl.Value(nbv-j+1);
double y1 = npr.Value(nbv-j+1); double y1 = npr.Value(nbv-j+1);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1733,7 +1742,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
for (j=1; j<nnn; j++) { for (j=1; j<nnn; j++) {
double y0 = npl.Value(nbv-nnn+j); double y0 = npl.Value(nbv-nnn+j);
double y1 = npr.Value(nbv-nnn+j); double y1 = npr.Value(nbv-nnn+j);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1759,7 +1768,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
double x = npb.Value(j); double x = npb.Value(j);
gp_UV p0( uv_eb[j-1].u, uv_eb[j-1].v ); gp_UV p0( uv_eb[j-1].u, uv_eb[j-1].v );
gp_UV p2 = UVT.Value( j-1 ); gp_UV p2 = UVT.Value( j-1 );
gp_UV UV = CalcUV(x, y, a0, a1, A2, A3, p0,p1,p2,p3 ); gp_UV UV = calcUV(x, y, a0, a1, A2, A3, p0,p1,p2,p3 );
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y());
@ -1798,7 +1807,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
for (j=2; j<nb; j++) { for (j=2; j<nb; j++) {
double x = npb.Value(j); double x = npb.Value(j);
double y = (1-x) * npl.Value(i+1) + x * npr.Value(i+1); double y = (1-x) * npl.Value(i+1) + x * npr.Value(i+1);
gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3); gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y());
@ -1848,7 +1857,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
for (j=1; j<nb; j++) { for (j=1; j<nb; j++) {
double x = npt.Value(i+1) + npb.Value(j)*(1-npt.Value(i+1)); double x = npt.Value(i+1) + npb.Value(j)*(1-npt.Value(i+1));
double y = y0 + dy*x; double y = y0 + dy*x;
gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3); gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1865,7 +1874,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
double x = npt.Value(i+1+drl) + double x = npt.Value(i+1+drl) +
npb.Value(j) * (npt.Value(nt-i) - npt.Value(i+1+drl)); npb.Value(j) * (npt.Value(nt-i) - npt.Value(i+1+drl));
double y = yy0 + dyy*x; double y = yy0 + dyy*x;
gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3); gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1891,7 +1900,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
for (j=2; j<=nb; j++) { for (j=2; j<=nb; j++) {
double x = npb.Value(j)*npt.Value(nt-i); double x = npb.Value(j)*npt.Value(nt-i);
double y = y0 + dy*x; double y = y0 + dy*x;
gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3); gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -1908,7 +1917,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
double x = npt.Value(i+1) + double x = npt.Value(i+1) +
npb.Value(j) * (npt.Value(nt-i-drl) - npt.Value(i+1)); npb.Value(j) * (npt.Value(nt-i-drl) - npt.Value(i+1));
double y = yy0 + dyy*x; double y = yy0 + dyy*x;
gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3); gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -2147,13 +2156,13 @@ namespace
inline SMDS_MeshNode* makeNode( UVPtStruct & uvPt, inline SMDS_MeshNode* makeNode( UVPtStruct & uvPt,
const double y, const double y,
FaceQuadStruct* quad, FaceQuadStruct::Ptr& quad,
const gp_UV* UVs, const gp_UV* UVs,
SMESH_MesherHelper* helper, SMESH_MesherHelper* helper,
Handle(Geom_Surface) S) Handle(Geom_Surface) S)
{ {
const vector<UVPtStruct>& uv_eb = quad->side[BOTTOM_SIDE]->GetUVPtStruct(); const vector<UVPtStruct>& uv_eb = quad->side[QUAD_BOTTOM_SIDE]->GetUVPtStruct();
const vector<UVPtStruct>& uv_et = quad->side[TOP_SIDE ]->GetUVPtStruct(); const vector<UVPtStruct>& uv_et = quad->side[QUAD_TOP_SIDE ]->GetUVPtStruct();
double rBot = ( uv_eb.size() - 1 ) * uvPt.normParam; double rBot = ( uv_eb.size() - 1 ) * uvPt.normParam;
double rTop = ( uv_et.size() - 1 ) * uvPt.normParam; double rTop = ( uv_et.size() - 1 ) * uvPt.normParam;
int iBot = int( rBot ); int iBot = int( rBot );
@ -2162,11 +2171,11 @@ namespace
double xTop = uv_et[ iTop ].normParam + ( rTop - iTop ) * ( uv_et[ iTop+1 ].normParam - uv_et[ iTop ].normParam ); double xTop = uv_et[ iTop ].normParam + ( rTop - iTop ) * ( uv_et[ iTop+1 ].normParam - uv_et[ iTop ].normParam );
double x = xBot + y * ( xTop - xBot ); double x = xBot + y * ( xTop - xBot );
gp_UV uv = CalcUV(/*x,y=*/x, y, gp_UV uv = calcUV(/*x,y=*/x, y,
/*a0,...=*/UVs[UV_A0], UVs[UV_A1], UVs[UV_A2], UVs[UV_A3], /*a0,...=*/UVs[UV_A0], UVs[UV_A1], UVs[UV_A2], UVs[UV_A3],
/*p0=*/quad->side[BOTTOM_SIDE]->Value2d( x ).XY(), /*p0=*/quad->side[QUAD_BOTTOM_SIDE]->Value2d( x ).XY(),
/*p1=*/UVs[ UV_R ], /*p1=*/UVs[ UV_R ],
/*p2=*/quad->side[TOP_SIDE ]->Value2d( x ).XY(), /*p2=*/quad->side[QUAD_TOP_SIDE ]->Value2d( x ).XY(),
/*p3=*/UVs[ UV_L ]); /*p3=*/UVs[ UV_L ]);
gp_Pnt P = S->Value( uv.X(), uv.Y() ); gp_Pnt P = S->Value( uv.X(), uv.Y() );
uvPt.u = uv.X(); uvPt.u = uv.X();
@ -2178,7 +2187,7 @@ namespace
vector<UVPtStruct>& next_base, vector<UVPtStruct>& next_base,
const int j, const int j,
int & next_base_len, int & next_base_len,
FaceQuadStruct* quad, FaceQuadStruct::Ptr& quad,
gp_UV* UVs, gp_UV* UVs,
const double y, const double y,
SMESH_MesherHelper* helper, SMESH_MesherHelper* helper,
@ -2247,7 +2256,7 @@ namespace
vector<UVPtStruct>& next_base, vector<UVPtStruct>& next_base,
const int j, const int j,
int & next_base_len, int & next_base_len,
FaceQuadStruct* quad, FaceQuadStruct::Ptr& quad,
gp_UV* UVs, gp_UV* UVs,
const double y, const double y,
SMESH_MesherHelper* helper, SMESH_MesherHelper* helper,
@ -2310,7 +2319,7 @@ namespace
vector<UVPtStruct>& next_base, vector<UVPtStruct>& next_base,
const int j, const int j,
int & next_base_len, int & next_base_len,
FaceQuadStruct* quad, FaceQuadStruct::Ptr & quad,
gp_UV* UVs, gp_UV* UVs,
const double y, const double y,
SMESH_MesherHelper* helper, SMESH_MesherHelper* helper,
@ -2325,7 +2334,7 @@ namespace
//======================================================================= //=======================================================================
bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh, bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
FaceQuadStruct* quad) FaceQuadStruct::Ptr quad)
{ {
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
const TopoDS_Face& F = TopoDS::Face(aShape); const TopoDS_Face& F = TopoDS::Face(aShape);
@ -2398,21 +2407,21 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
if (dh >= dv) { if (dh >= dv) {
if (nt > nb) { if (nt > nb) {
// it is a base case => not shift quad but may be replacement is need // it is a base case => not shift quad but may be replacement is need
ShiftQuad(quad,0,true); shiftQuad(quad,0,true);
} }
else { else {
// we have to shift quad on 2 // we have to shift quad on 2
ShiftQuad(quad,2,true); shiftQuad(quad,2,true);
} }
} }
else { else {
if (nr > nl) { if (nr > nl) {
// we have to shift quad on 1 // we have to shift quad on 1
ShiftQuad(quad,1,true); shiftQuad(quad,1,true);
} }
else { else {
// we have to shift quad on 3 // we have to shift quad on 3
ShiftQuad(quad,3,true); shiftQuad(quad,3,true);
} }
} }
@ -2520,7 +2529,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
// diagonal node // diagonal node
double y0 = npl.Value(i+1); double y0 = npl.Value(i+1);
double y1 = npr.Value(i+1); double y1 = npr.Value(i+1);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -2530,7 +2539,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
for (j=2; j<nl; j++) { for (j=2; j<nl; j++) {
double y0 = npl.Value(dl+j); double y0 = npl.Value(dl+j);
double y1 = npr.Value(dl+j); double y1 = npr.Value(dl+j);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -2575,7 +2584,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
// diagonal node // diagonal node
double y0 = npl.Value(i+1); double y0 = npl.Value(i+1);
double y1 = npr.Value(i+1); double y1 = npr.Value(i+1);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -2585,7 +2594,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
for (j=2; j<nr; j++) { for (j=2; j<nr; j++) {
double y0 = npl.Value(nbv-j+1); double y0 = npl.Value(nbv-j+1);
double y1 = npr.Value(nbv-j+1); double y1 = npr.Value(nbv-j+1);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -2640,7 +2649,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
for (j=1; j<nnn; j++) { for (j=1; j<nnn; j++) {
double y0 = npl.Value(nbv-nnn+j); double y0 = npl.Value(nbv-nnn+j);
double y1 = npr.Value(nbv-nnn+j); double y1 = npr.Value(nbv-nnn+j);
gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3); gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
gp_Pnt P = S->Value(UV.X(),UV.Y()); gp_Pnt P = S->Value(UV.X(),UV.Y());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y()); meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@ -2676,21 +2685,21 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
if (nr == nl) { if (nr == nl) {
if (nt < nb) { if (nt < nb) {
// it is a base case => not shift quad // it is a base case => not shift quad
//ShiftQuad(quad,0,true); //shiftQuad(quad,0,true);
} }
else { else {
// we have to shift quad on 2 // we have to shift quad on 2
ShiftQuad(quad,2,true); shiftQuad(quad,2,true);
} }
} }
else { else {
if (nl > nr) { if (nl > nr) {
// we have to shift quad on 1 // we have to shift quad on 1
ShiftQuad(quad,1,true); shiftQuad(quad,1,true);
} }
else { else {
// we have to shift quad on 3 // we have to shift quad on 3
ShiftQuad(quad,3,true); shiftQuad(quad,3,true);
} }
} }
@ -3273,7 +3282,7 @@ namespace // data for smoothing
*/ */
//================================================================================ //================================================================================
void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad) void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct::Ptr quad)
{ {
for ( unsigned i = 0; i < quad->side.size(); ++i ) for ( unsigned i = 0; i < quad->side.size(); ++i )
{ {
@ -3291,7 +3300,7 @@ void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad)
// find another side sharing the degenerated shape // find another side sharing the degenerated shape
bool isPrev = ( degenInd == 0 ); bool isPrev = ( degenInd == 0 );
if ( i >= TOP_SIDE ) if ( i >= QUAD_TOP_SIDE )
isPrev = !isPrev; isPrev = !isPrev;
int i2 = ( isPrev ? ( i + 3 ) : ( i + 1 )) % 4; int i2 = ( isPrev ? ( i + 3 ) : ( i + 1 )) % 4;
StdMeshers_FaceSide* side2 = quad->side[ i2 ]; StdMeshers_FaceSide* side2 = quad->side[ i2 ];
@ -3318,7 +3327,7 @@ void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad)
*/ */
//================================================================================ //================================================================================
void StdMeshers_Quadrangle_2D::Smooth (FaceQuadStruct* quad) void StdMeshers_Quadrangle_2D::Smooth (FaceQuadStruct::Ptr quad)
{ {
if ( !myNeedSmooth ) return; if ( !myNeedSmooth ) return;

View File

@ -42,16 +42,18 @@ class StdMeshers_FaceSide;
struct uvPtStruct; struct uvPtStruct;
enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES }; enum TSideID { QUAD_BOTTOM_SIDE=0, QUAD_RIGHT_SIDE, QUAD_TOP_SIDE, QUAD_LEFT_SIDE, NB_QUAD_SIDES };
typedef uvPtStruct UVPtStruct; typedef uvPtStruct UVPtStruct;
typedef struct faceQuadStruct typedef struct faceQuadStruct
{ {
std::vector< StdMeshers_FaceSide*> side; std::vector< StdMeshers_FaceSide*> side;
bool isEdgeOut[4]; // true, if an edge has more nodes, than the opposite bool isEdgeOut[4]; // true, if an EDGE has more nodes, than an opposite one
UVPtStruct* uv_grid; UVPtStruct* uv_grid;
TopoDS_Face face; TopoDS_Face face;
~faceQuadStruct(); ~faceQuadStruct();
void shift( size_t nb, bool keepUnitOri );
typedef boost::shared_ptr<faceQuadStruct> Ptr;
} FaceQuadStruct; } FaceQuadStruct;
class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
@ -70,12 +72,12 @@ public:
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap); MapShapeNbElems& aResMap);
FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh, FaceQuadStruct::Ptr CheckAnd2Dcompute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
const bool CreateQuadratic); const bool CreateQuadratic);
FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh, FaceQuadStruct::Ptr CheckNbEdges(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape); const TopoDS_Shape& aShape);
protected: protected:
@ -85,9 +87,9 @@ protected:
std::vector<int>& aNbNodes, std::vector<int>& aNbNodes,
bool& IsQuadratic); bool& IsQuadratic);
bool SetNormalizedGrid(SMESH_Mesh& aMesh, bool SetNormalizedGrid(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
FaceQuadStruct*& quad); FaceQuadStruct::Ptr& quad);
void SplitQuad(SMESHDS_Mesh *theMeshDS, void SplitQuad(SMESHDS_Mesh *theMeshDS,
const int theFaceID, const int theFaceID,
@ -96,23 +98,23 @@ protected:
const SMDS_MeshNode* theNode3, const SMDS_MeshNode* theNode3,
const SMDS_MeshNode* theNode4); const SMDS_MeshNode* theNode4);
bool ComputeQuadPref(SMESH_Mesh& aMesh, bool ComputeQuadPref(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
FaceQuadStruct* quad); FaceQuadStruct::Ptr quad);
bool EvaluateQuadPref(SMESH_Mesh& aMesh, bool 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);
bool ComputeReduced (SMESH_Mesh& aMesh, bool ComputeReduced (SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
FaceQuadStruct* quad); FaceQuadStruct::Ptr quad);
void UpdateDegenUV(FaceQuadStruct* quad); void UpdateDegenUV(FaceQuadStruct::Ptr quad);
void Smooth (FaceQuadStruct* quad); void Smooth (FaceQuadStruct::Ptr quad);
// true if QuadranglePreference hypothesis is assigned that forces // true if QuadranglePreference hypothesis is assigned that forces
@ -132,6 +134,8 @@ protected:
SMESH_MesherHelper* myHelper; // tool for working with quadratic elements SMESH_MesherHelper* myHelper; // tool for working with quadratic elements
SMESH_ProxyMesh::Ptr myProxyMesh; SMESH_ProxyMesh::Ptr myProxyMesh;
FaceQuadStruct::Ptr myQuadStruct;
}; };
#endif #endif