#include "SMESH_subMesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_Block.hxx"
+#include "SMESH_Comment.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
using namespace std;
typedef gp_XY gp_UV;
+typedef SMESH_Comment TComm;
//=============================================================================
/*!
aStatus = SMESH_Hypothesis::HYP_OK;
// there is only one compatible Hypothesis so far
- const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+ const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape, false);
myQuadranglePreference = hyps.size() > 0;
return isOk;
//=============================================================================
bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape) throw (SALOME_Exception)
+ const TopoDS_Shape& aShape)// throw (SALOME_Exception)
{
- Unexpect aCatch(SalomeException);
+ // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
+ //Unexpect aCatchSalomeException);
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
aMesh.GetSubMesh(aShape);
FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape)
- throw(SALOME_Exception)
+ //throw(SALOME_Exception)
{
- Unexpect aCatch(SalomeException);
-
const TopoDS_Face & F = TopoDS::Face(aShape);
const bool ignoreMediumNodes = _quadraticMesh;
list< int > nbEdgesInWire;
int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
if (nbWire != 1) {
- INFOS("only 1 wire by face (quadrangles)");
+ error(COMPERR_BAD_SHAPE, TComm("Wrong number of wires: ") << nbWire);
return 0;
}
FaceQuadStruct* quad = new FaceQuadStruct;
sideEdges.splice( sideEdges.end(), edges, edges.begin()); // edges.front() -> sideEdges.end()
bool sameSide = true;
while ( !edges.empty() && sameSide ) {
- GeomAbs_Shape cont = SMESH_Algo::Continuity( sideEdges.back(), edges.front() );
- sameSide = ( cont >= GeomAbs_G1 );
+ sameSide = SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() );
if ( sameSide )
sideEdges.splice( sideEdges.end(), edges, edges.begin());
}
if ( nbSides == 0 ) { // go backward from the first edge
sameSide = true;
while ( !edges.empty() && sameSide ) {
- GeomAbs_Shape cont = SMESH_Algo::Continuity( sideEdges.front(), edges.back() );
- sameSide = ( cont >= GeomAbs_G1 );
+ sameSide = SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() );
if ( sameSide )
sideEdges.splice( sideEdges.begin(), edges, --edges.end());
}
cout << ")";
}
cout << endl;
-#else
- INFOS("face must have 4 edges / quadrangle");
#endif
+ if ( !nbSides )
+ nbSides = nbEdgesInWire.front();
+ error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides);
delete quad;
quad = 0;
}
FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
- const bool CreateQuadratic) throw(SALOME_Exception)
+ const bool CreateQuadratic) //throw(SALOME_Exception)
{
- Unexpect aCatch(SalomeException);
-
_quadraticMesh = CreateQuadratic;
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
{
for (int i = 0; i < side.size(); i++) {
if (side[i]) delete side[i];
- //if (uv_edges[i]) delete [] uv_edges[i];
}
if (uv_grid) delete [] uv_grid;
}
namespace {
inline const vector<UVPtStruct>& GetUVPtStructIn(FaceQuadStruct* quad, int i, int nbSeg)
{
- bool isXConst = ( i == BOTTOM_SIDE || i == TOP_SIDE );
+ bool isXConst = ( i == BOTTOM_SIDE || i == TOP_SIDE );
double constValue = ( i == BOTTOM_SIDE || i == LEFT_SIDE ) ? 0 : 1;
return
quad->isEdgeOut[i] ?
bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
const TopoDS_Shape& aShape,
- FaceQuadStruct* & quad) throw (SALOME_Exception)
+ FaceQuadStruct* & quad) //throw (SALOME_Exception)
{
- Unexpect aCatch(SalomeException);
// Algorithme décrit dans "Génération automatique de maillages"
// P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
// traitement dans le domaine paramétrique 2d u,v
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() ) {
- MESSAGE("Nodes from edges not loaded");
- return false;
- }
+ if ( uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty() )
+ return error( "Can't find nodes on sides");
// nodes Id on "in" edges
if (! quad->isEdgeOut[0]) {
uv -= (1 - x) * (1 - y) * a0 + x * (1 - y) * a1 + x * y * a2 + (1 - x) * y * a3;
- //cout<<"x0="<<x0<<" x1="<<x1<<" y0="<<y0<<" y1="<<y1<<endl;
- //cout<<"x="<<x<<" y="<<y<<endl;
- //cout<<"param_b="<<param_b<<" param_t="<<param_t<<" param_r="<<param_r<<" param_l="<<param_l<<endl;
- //cout<<"u="<<u<<" v="<<v<<endl;
-
return uv;
}
-//=======================================================================
-//function : ComputeQuadPref
-//purpose :
//=======================================================================
/*!
- * Special function for creation only quandrangle faces
+ * Create only quandrangle faces
*/
-bool StdMeshers_Quadrangle_2D::ComputeQuadPref
- (SMESH_Mesh & aMesh,
- const TopoDS_Shape& aShape,
- FaceQuadStruct* quad) throw (SALOME_Exception)
-{
- Unexpect aCatch(SalomeException);
+//=======================================================================
+bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh,
+ const TopoDS_Shape& aShape,
+ FaceQuadStruct* quad)
+{
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
const TopoDS_Face& F = TopoDS::Face(aShape);
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
- const TopoDS_Wire& W = BRepTools::OuterWire(F);
- bool WisF = false;
- if(W.Orientation()==TopAbs_FORWARD)
- WisF = true;
+// const TopoDS_Wire& W = BRepTools::OuterWire(F);
+ bool WisF = true;
+// if(W.Orientation()==TopAbs_FORWARD)
+// WisF = true;
//if(WisF) cout<<"W is FORWARD"<<endl;
//else cout<<"W is REVERSED"<<endl;
- bool FisF = (F.Orientation()==TopAbs_FORWARD);
- if(!FisF) WisF = !WisF;
+// bool FisF = (F.Orientation()==TopAbs_FORWARD);
+// if(!FisF) WisF = !WisF;
+// WisF = FisF;
int i,j,geomFaceID = meshDS->ShapeToIndex( F );
int nb = quad->side[0]->NbPoints();