mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-29 03:50:33 +05:00
PAL13615 (EDF PAL 315/31 GEOM SMESH : meshing of a "5 edges quadrangle")
fix for degenerated edges
This commit is contained in:
parent
e10dbaa38e
commit
73dc14d280
@ -95,11 +95,13 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
|
||||
SMESHDS_Mesh* meshDS = theMesh->GetMeshDS();
|
||||
vector<double> len( nbEdges );
|
||||
|
||||
int nbDegen = 0;
|
||||
list<TopoDS_Edge>::iterator edge = theEdges.begin();
|
||||
for ( int index = 0; edge != theEdges.end(); ++index, ++edge )
|
||||
{
|
||||
int i = theIsForward ? index : nbEdges - index - 1;
|
||||
len[i] = SMESH_Algo::EdgeLength( *edge );
|
||||
if ( len[i] < DBL_MIN ) nbDegen++;
|
||||
myLength += len[i];
|
||||
myEdge[i] = *edge;
|
||||
if ( !theIsForward ) myEdge[i].Reverse();
|
||||
@ -130,49 +132,21 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
|
||||
myMissingVertexNodes = true;
|
||||
|
||||
if ( nbEdges > 1 && myLength > DBL_MIN ) {
|
||||
const double degenNormLen = 1.e-5;
|
||||
double totLength = myLength;
|
||||
if ( nbDegen )
|
||||
totLength += myLength * degenNormLen * nbDegen;
|
||||
double prevNormPar = 0;
|
||||
for ( int i = 0; i < nbEdges; ++i ) {
|
||||
myNormPar[ i ] = len[i]/myLength;
|
||||
if ( i > 0 )
|
||||
myNormPar[ i ] += myNormPar[ i-1 ];
|
||||
if ( len[ i ] < DBL_MIN )
|
||||
len[ i ] = myLength * degenNormLen;
|
||||
myNormPar[ i ] = prevNormPar + len[i]/totLength;
|
||||
prevNormPar = myNormPar[ i ];
|
||||
}
|
||||
}
|
||||
myNormPar[nbEdges-1] = 1.;
|
||||
//dump();
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief First curve parameter
|
||||
* \retval double - parameter value
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
// double StdMeshers_FaceSide::First() const
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
// //================================================================================
|
||||
// /*!
|
||||
// * \brief Last curve parameter
|
||||
// * \retval double - parameter value
|
||||
// */
|
||||
// //================================================================================
|
||||
|
||||
// double StdMeshers_FaceSide::Last() const
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
// //================================================================================
|
||||
// /*!
|
||||
// * \brief
|
||||
// * \retval bool -
|
||||
// */
|
||||
// //================================================================================
|
||||
|
||||
// bool StdMeshers_FaceSide::IsForward() const
|
||||
// {
|
||||
// return myIsForward;
|
||||
// }
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
@ -193,6 +167,7 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
|
||||
// sort nodes of all edges putting them into a map
|
||||
|
||||
map< double, const SMDS_MeshNode*> u2node;
|
||||
//int nbOnDegen = 0;
|
||||
for ( int i = 0; i < myEdge.size(); ++i )
|
||||
{
|
||||
// put 1st vertex node
|
||||
@ -243,7 +218,8 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
|
||||
}
|
||||
}
|
||||
if ( u2node.size() != myNbPonits ) {
|
||||
MESSAGE("Wrong node parameters on edges");
|
||||
MESSAGE("Wrong node parameters on edges, u2node.size():"
|
||||
<<u2node.size()<<" != myNbPonits:"<<myNbPonits);
|
||||
return myPoints;
|
||||
}
|
||||
|
||||
@ -275,8 +251,15 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
|
||||
#endif
|
||||
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
|
||||
}
|
||||
double r = ( uvPt.normParam - prevNormPar )/ paramSize;
|
||||
uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
|
||||
const SMDS_EdgePosition* epos =
|
||||
dynamic_cast<const SMDS_EdgePosition*>(uvPt.node->GetPosition().get());
|
||||
if ( epos ) {
|
||||
uvPt.param = epos->GetUParameter();
|
||||
}
|
||||
else {
|
||||
double r = ( uvPt.normParam - prevNormPar )/ paramSize;
|
||||
uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
|
||||
}
|
||||
if ( !myC2d[ EdgeIndex ].IsNull() ) {
|
||||
gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
|
||||
uvPt.u = p.X();
|
||||
|
@ -263,24 +263,26 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
// correspondence mefisto index --> Nodes
|
||||
vector< const SMDS_MeshNode*> mefistoToDS(nbpnt, (const SMDS_MeshNode*)0);
|
||||
|
||||
// fill input points UV
|
||||
LoadPoints(wires, uvslf, mefistoToDS, scalex, scaley);
|
||||
|
||||
// Compute
|
||||
aptrte(nutysu, aretmx,
|
||||
nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
|
||||
|
||||
bool isOk = false;
|
||||
if (ierr == 0)
|
||||
|
||||
// fill input points UV
|
||||
if ( LoadPoints(wires, uvslf, mefistoToDS, scalex, scaley) )
|
||||
{
|
||||
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
|
||||
MESSAGE(" Node Number " << nbst);
|
||||
StoreResult(nbst, uvst, nbt, nust, mefistoToDS, scalex, scaley);
|
||||
isOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MESSAGE("Error in Triangulation");
|
||||
// Compute
|
||||
aptrte(nutysu, aretmx,
|
||||
nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
|
||||
|
||||
if (ierr == 0)
|
||||
{
|
||||
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
|
||||
MESSAGE(" Node Number " << nbst);
|
||||
StoreResult(nbst, uvst, nbt, nust, mefistoToDS, scalex, scaley);
|
||||
isOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MESSAGE("Error in Triangulation");
|
||||
}
|
||||
}
|
||||
if (nudslf != NULL) delete[]nudslf;
|
||||
if (uvslf != NULL) delete[]uvslf;
|
||||
@ -507,6 +509,10 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector & wires,
|
||||
for ( int iW = 0; iW < wires.size(); ++iW )
|
||||
{
|
||||
const vector<UVPtStruct>& uvPtVec = wires[ iW ]->GetUVPtStruct(isXConst,constValue);
|
||||
if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) {
|
||||
MESSAGE("Wrong nb UVPtStruct: "<<uvPtVec.size()<<" != "<<wires[ iW ]->NbPoints());
|
||||
return false;
|
||||
}
|
||||
|
||||
vector<UVPtStruct>::const_iterator uvPt = uvPtVec.begin();
|
||||
for ( ++uvPt; uvPt != uvPtVec.end(); ++uvPt )
|
||||
|
@ -577,14 +577,16 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
|
||||
}
|
||||
FaceQuadStruct* quad = new FaceQuadStruct;
|
||||
quad->uv_grid = 0;
|
||||
for ( int i = 0; i < NB_SIDES; ++i )
|
||||
quad->side[i] = 0;
|
||||
|
||||
int nbSides = 0;
|
||||
list< TopoDS_Edge >::iterator edgeIt = edges.begin();
|
||||
if ( nbEdgesInWire.front() == 4 ) {
|
||||
if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges
|
||||
for ( ; edgeIt != edges.end(); ++edgeIt, nbSides++ )
|
||||
quad->side[nbSides] = new StdMeshers_FaceSide(F,*edgeIt,&aMesh,nbSides<TOP_SIDE);
|
||||
}
|
||||
else {
|
||||
else if ( nbEdgesInWire.front() > 4 ) { // more than 4 edges - try to unite
|
||||
list< TopoDS_Edge > sideEdges;
|
||||
while ( edgeIt != edges.end()) {
|
||||
sideEdges.clear();
|
||||
@ -601,7 +603,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
|
||||
}
|
||||
}
|
||||
if (nbSides != 4) {
|
||||
INFOS("face must have 4 edges /quadrangles");
|
||||
INFOS("face must have 4 edges / quadrangle");
|
||||
delete quad;
|
||||
quad = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user