StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
SMESH_Gen* gen)
: SMESH_2D_Algo(hypId, studyId, gen),
+ myQuadranglePreference(false),
+ myTrianglePreference(false),
+ myTriaVertexID(-1),
+ myNeedSmooth(false),
+ myQuadType(QUAD_STANDARD),
myHelper( 0 )
{
MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
myQuadType = QUAD_STANDARD;
myQuadranglePreference = false;
myTrianglePreference = false;
+ myQuadStruct.reset();
bool isFirstParams = true;
_quadraticMesh = myHelper->IsQuadraticSubMesh(aShape);
myNeedSmooth = false;
- FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
- std::auto_ptr<FaceQuadStruct> quadDeleter (quad); // to delete quad at exit from Compute()
+ FaceQuadStruct::Ptr quad = CheckNbEdges(aMesh, aShape);
if (!quad)
return false;
+ myQuadStruct = quad;
if (myQuadranglePreference) {
int n1 = quad->side[0]->NbPoints();
*/
//=============================================================================
-FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape)
- //throw(SALOME_Exception)
+FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape)
{
+ if ( myQuadStruct && myQuadStruct->face.IsSame( aShape ))
+ return myQuadStruct;
+
TopoDS_Face F = TopoDS::Face(aShape);
if ( F.Orientation() >= TopAbs_INTERNAL ) F.Orientation( TopAbs_FORWARD );
const bool ignoreMediumNodes = _quadraticMesh;
// verify 1 wire only, with 4 edges
- TopoDS_Vertex V;
list< TopoDS_Edge > edges;
list< int > nbEdgesInWire;
- int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+ int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
if (nbWire != 1) {
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->side.reserve(nbEdgesInWire.front());
quad->face = F;
{
SMESH_Comment comment;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
- if (myTriaVertexID == -1)
+ if (myTriaVertexID < 1)
{
comment << "No Base vertex parameter provided for a trilateral geometrical face";
}
comment << meshDS->ShapeToIndex(v.Current()) << (vMap.Extent()==3 ? "]" : ", ");
}
error(comment);
- delete quad;
- return quad = 0;
+ quad.reset();
+ return quad;
}
else if (nbEdgesInWire.front() == 4) // exactly 4 edges
{
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));
}
else if (nbEdgesInWire.front() > 4) // more than 4 edges - try to unite some
if ( sideEdges.size() == 1 && BRep_Tool::Degenerated( sideEdges.front() ))
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));
++nbSides;
}
if ( !degenSides.empty() && nbSides - degenSides.size() == 4 )
{
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();
for ( int i = degenSides.size()-1; i > -1; --i )
delete degenSide;
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();
nbSides -= degenSides.size();
}
// issue 20222. Try to unite only edges shared by two same faces
- if (nbSides < 4) {
- // delete found sides
- { FaceQuadStruct cleaner(*quad); }
- quad->side.clear();
+ if (nbSides < 4)
+ {
+ quad.reset( new FaceQuadStruct );
quad->side.reserve(nbEdgesInWire.front());
nbSides = 0;
- SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+ SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
while (!edges.empty()) {
sideEdges.clear();
sideEdges.splice(sideEdges.end(), edges, edges.begin());
}
}
quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh,
- nbSides < TOP_SIDE,
+ nbSides < QUAD_TOP_SIDE,
ignoreMediumNodes, myProxyMesh));
++nbSides;
}
if (!nbSides)
nbSides = nbEdgesInWire.front();
error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides);
- delete quad;
- quad = 0;
+ quad.reset();
}
return quad;
const TopoDS_Face & F = TopoDS::Face(aShape);
// verify 1 wire only, with 4 edges
- TopoDS_Vertex V;
list< TopoDS_Edge > edges;
list< int > nbEdgesInWire;
- int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+ int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
if (nbWire != 1) {
return false;
}
// issue 20222. Try to unite only edges shared by two same faces
if (nbSides < 4) {
nbSides = 0;
- SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+ SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
while (!edges.empty()) {
sideEdges.clear();
sideEdges.splice(sideEdges.end(), edges, edges.begin());
*/
//=============================================================================
-FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
- (SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- const bool CreateQuadratic) //throw(SALOME_Exception)
+FaceQuadStruct::Ptr
+StdMeshers_Quadrangle_2D::CheckAnd2Dcompute (SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool CreateQuadratic)
{
_quadraticMesh = CreateQuadratic;
- FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
-
- if (!quad) return 0;
-
- // set normalized grid on unit square in parametric domain
- bool stat = SetNormalizedGrid(aMesh, aShape, quad);
- if (!stat) {
- if (quad) delete quad;
- quad = 0;
+ FaceQuadStruct::Ptr quad = CheckNbEdges(aMesh, aShape);
+ if ( quad )
+ {
+ // set normalized grid on unit square in parametric domain
+ if (!SetNormalizedGrid(aMesh, aShape, quad))
+ quad.reset();
}
-
return quad;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
if (uv_grid) delete [] uv_grid;
}
-namespace {
- inline const vector<UVPtStruct>& GetUVPtStructIn(FaceQuadStruct* quad, int i, int nbSeg)
+namespace
+{
+ inline const vector<UVPtStruct>& getUVPtStructIn(FaceQuadStruct::Ptr& quad, int i, int nbSeg)
{
- bool isXConst = (i == BOTTOM_SIDE || i == TOP_SIDE);
- double constValue = (i == BOTTOM_SIDE || i == LEFT_SIDE) ? 0 : 1;
+ bool isXConst = (i == QUAD_BOTTOM_SIDE || i == QUAD_TOP_SIDE);
+ double constValue = (i == QUAD_BOTTOM_SIDE || i == QUAD_LEFT_SIDE) ? 0 : 1;
return
quad->isEdgeOut[i] ?
quad->side[i]->SimulateUVPtStruct(nbSeg,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& p0,const gp_UV& p1,const gp_UV& p2,const gp_UV& p3)
{
*/
//=============================================================================
-bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
- const TopoDS_Shape& aShape,
- FaceQuadStruct* & quad) //throw (SALOME_Exception)
+bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
+ const TopoDS_Shape& aShape,
+ FaceQuadStruct::Ptr & quad)
{
// Algorithme décrit dans "Génération automatique de maillages"
// P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
UVPtStruct *uv_grid = quad->uv_grid = new UVPtStruct[nbvertic * nbhoriz];
- const vector<UVPtStruct>& uv_e0 = GetUVPtStructIn(quad, 0, nbhoriz - 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_e3 = GetUVPtStructIn(quad, 3, nbvertic - 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_e2 = getUVPtStructIn(quad, 2, nbhoriz - 1);
+ const vector<UVPtStruct>& uv_e3 = getUVPtStructIn(quad, 3, nbvertic - 1);
if (uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty())
//return error("Can't find nodes on sides");
double x = uv_grid[ij].x;
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].v = uv.Y();
//purpose : auxilary function for ComputeQuadPref
//=======================================================================
-static void ShiftQuad(FaceQuadStruct* quad, const int num, bool)
+static void shiftQuad(FaceQuadStruct::Ptr& quad, const int num, bool)
+{
+ quad->shift( num, /*ori=*/true );
+}
+
+//================================================================================
+/*!
+ * \brief Rotate sides of a quad by nb
+ * \param nb - number of rotation quartes
+ * \param ori - to keep orientation of sides as in an unit quad or not
+ */
+//================================================================================
+
+void FaceQuadStruct::shift( size_t nb, bool ori )
{
- StdMeshers_FaceSide* side[4] = { quad->side[0], quad->side[1],
- 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);
- if (wasForward != newForward)
- side[ i ]->Reverse();
- quad->side[ id ] = side[ i ];
+ 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
//=======================================================================
-static gp_UV CalcUV(double x0, double x1, double y0, double y1,
- FaceQuadStruct* quad,
+static gp_UV calcUV(double x0, double x1, double y0, double y1,
+ FaceQuadStruct::Ptr& quad,
const gp_UV& a0, const gp_UV& a1,
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 y = y0 + x * (y1 - y0);
- gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY();
- gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY();
- gp_UV p2 = quad->side[TOP_SIDE ]->Value2d(x).XY();
- gp_UV p3 = quad->side[LEFT_SIDE ]->Value2d(y).XY();
+ gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY();
+ gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY();
+ gp_UV p2 = quad->side[QUAD_TOP_SIDE ]->Value2d(x).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;
}
//=======================================================================
-//function : CalcUV2
+//function : calcUV2
//purpose : auxilary function for ComputeQuadPref
//=======================================================================
-static gp_UV CalcUV2(double x, double y,
- FaceQuadStruct* quad,
+static gp_UV calcUV2(double x, double y,
+ FaceQuadStruct::Ptr& quad,
const gp_UV& a0, const gp_UV& a1,
const gp_UV& a2, const gp_UV& a3)
{
- gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY();
- gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY();
- gp_UV p2 = quad->side[TOP_SIDE ]->Value2d(x).XY();
- gp_UV p3 = quad->side[LEFT_SIDE ]->Value2d(y).XY();
+ gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY();
+ gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY();
+ gp_UV p2 = quad->side[QUAD_TOP_SIDE ]->Value2d(x).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;
}
bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape,
- FaceQuadStruct* quad)
+ FaceQuadStruct::Ptr quad)
{
// Auxilary key in order to keep old variant
// of meshing after implementation new variant
if (dh>=dv) {
if (nt>nb) {
// it is a base case => not shift quad but me be replacement is need
- ShiftQuad(quad,0,WisF);
+ shiftQuad(quad,0,WisF);
}
else {
// we have to shift quad on 2
- ShiftQuad(quad,2,WisF);
+ shiftQuad(quad,2,WisF);
}
}
else {
if (nr>nl) {
// we have to shift quad on 1
- ShiftQuad(quad,1,WisF);
+ shiftQuad(quad,1,WisF);
}
else {
// we have to shift quad on 3
- ShiftQuad(quad,3,WisF);
+ shiftQuad(quad,3,WisF);
}
}
// diagonal node
double y0 = npl.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());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=2; j<nl; j++) {
double y0 = npl.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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
// diagonal node
double y0 = npl.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());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=2; j<nr; j++) {
double y0 = npl.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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=1; j<nnn; j++) {
double y0 = npl.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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
double x = npb.Value(j);
gp_UV p0( uv_eb[j-1].u, uv_eb[j-1].v );
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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y());
for (j=2; j<nb; j++) {
double x = npb.Value(j);
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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y());
for (j=1; j<nb; j++) {
double x = npt.Value(i+1) + npb.Value(j)*(1-npt.Value(i+1));
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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
double x = npt.Value(i+1+drl) +
npb.Value(j) * (npt.Value(nt-i) - npt.Value(i+1+drl));
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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=2; j<=nb; j++) {
double x = npb.Value(j)*npt.Value(nt-i);
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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
double x = npt.Value(i+1) +
npb.Value(j) * (npt.Value(nt-i-drl) - npt.Value(i+1));
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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
inline SMDS_MeshNode* makeNode( UVPtStruct & uvPt,
const double y,
- FaceQuadStruct* quad,
+ FaceQuadStruct::Ptr& quad,
const gp_UV* UVs,
SMESH_MesherHelper* helper,
Handle(Geom_Surface) S)
{
- const vector<UVPtStruct>& uv_eb = quad->side[BOTTOM_SIDE]->GetUVPtStruct();
- const vector<UVPtStruct>& uv_et = quad->side[TOP_SIDE ]->GetUVPtStruct();
+ const vector<UVPtStruct>& uv_eb = quad->side[QUAD_BOTTOM_SIDE]->GetUVPtStruct();
+ const vector<UVPtStruct>& uv_et = quad->side[QUAD_TOP_SIDE ]->GetUVPtStruct();
double rBot = ( uv_eb.size() - 1 ) * uvPt.normParam;
double rTop = ( uv_et.size() - 1 ) * uvPt.normParam;
int iBot = int( rBot );
double xTop = uv_et[ iTop ].normParam + ( rTop - iTop ) * ( uv_et[ iTop+1 ].normParam - uv_et[ iTop ].normParam );
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],
- /*p0=*/quad->side[BOTTOM_SIDE]->Value2d( x ).XY(),
+ /*p0=*/quad->side[QUAD_BOTTOM_SIDE]->Value2d( x ).XY(),
/*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 ]);
gp_Pnt P = S->Value( uv.X(), uv.Y() );
uvPt.u = uv.X();
vector<UVPtStruct>& next_base,
const int j,
int & next_base_len,
- FaceQuadStruct* quad,
+ FaceQuadStruct::Ptr& quad,
gp_UV* UVs,
const double y,
SMESH_MesherHelper* helper,
vector<UVPtStruct>& next_base,
const int j,
int & next_base_len,
- FaceQuadStruct* quad,
+ FaceQuadStruct::Ptr& quad,
gp_UV* UVs,
const double y,
SMESH_MesherHelper* helper,
vector<UVPtStruct>& next_base,
const int j,
int & next_base_len,
- FaceQuadStruct* quad,
+ FaceQuadStruct::Ptr & quad,
gp_UV* UVs,
const double y,
SMESH_MesherHelper* helper,
//=======================================================================
bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape,
- FaceQuadStruct* quad)
+ FaceQuadStruct::Ptr quad)
{
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
const TopoDS_Face& F = TopoDS::Face(aShape);
if (dh >= dv) {
if (nt > nb) {
// it is a base case => not shift quad but may be replacement is need
- ShiftQuad(quad,0,true);
+ shiftQuad(quad,0,true);
}
else {
// we have to shift quad on 2
- ShiftQuad(quad,2,true);
+ shiftQuad(quad,2,true);
}
}
else {
if (nr > nl) {
// we have to shift quad on 1
- ShiftQuad(quad,1,true);
+ shiftQuad(quad,1,true);
}
else {
// we have to shift quad on 3
- ShiftQuad(quad,3,true);
+ shiftQuad(quad,3,true);
}
}
// diagonal node
double y0 = npl.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());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=2; j<nl; j++) {
double y0 = npl.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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
// diagonal node
double y0 = npl.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());
SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=2; j<nr; j++) {
double y0 = npl.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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
for (j=1; j<nnn; j++) {
double y0 = npl.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());
SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
if (nr == nl) {
if (nt < nb) {
// it is a base case => not shift quad
- //ShiftQuad(quad,0,true);
+ //shiftQuad(quad,0,true);
}
else {
// we have to shift quad on 2
- ShiftQuad(quad,2,true);
+ shiftQuad(quad,2,true);
}
}
else {
if (nl > nr) {
// we have to shift quad on 1
- ShiftQuad(quad,1,true);
+ shiftQuad(quad,1,true);
}
else {
// we have to shift quad on 3
- ShiftQuad(quad,3,true);
+ shiftQuad(quad,3,true);
}
}
*/
//================================================================================
-void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad)
+void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct::Ptr quad)
{
for ( unsigned i = 0; i < quad->side.size(); ++i )
{
// find another side sharing the degenerated shape
bool isPrev = ( degenInd == 0 );
- if ( i >= TOP_SIDE )
+ if ( i >= QUAD_TOP_SIDE )
isPrev = !isPrev;
int i2 = ( isPrev ? ( i + 3 ) : ( i + 1 )) % 4;
StdMeshers_FaceSide* side2 = quad->side[ i2 ];
*/
//================================================================================
-void StdMeshers_Quadrangle_2D::Smooth (FaceQuadStruct* quad)
+void StdMeshers_Quadrangle_2D::Smooth (FaceQuadStruct::Ptr quad)
{
if ( !myNeedSmooth ) return;