Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
IPAL054122: Bad quality prismatic mesh
[modules/smesh.git]
/
src
/
SMESH
/
SMESH_Gen.cxx
diff --git
a/src/SMESH/SMESH_Gen.cxx
b/src/SMESH/SMESH_Gen.cxx
index ce860fc5eac101ae570d6d3d9e857b0be3b54326..bd5654c89588eb1bd05ddde3ae963e978e7cd8eb 100644
(file)
--- a/
src/SMESH/SMESH_Gen.cxx
+++ b/
src/SMESH/SMESH_Gen.cxx
@@
-73,6
+73,19
@@
SMESH_Gen::SMESH_Gen()
//vtkDebugLeaks::SetExitError(0);
}
//vtkDebugLeaks::SetExitError(0);
}
+namespace
+{
+ // a structure used to nullify SMESH_Gen field of SMESH_Hypothesis,
+ // which is needed for SMESH_Hypothesis not deleted before ~SMESH_Gen()
+ struct _Hyp : public SMESH_Hypothesis
+ {
+ void NullifyGen()
+ {
+ _gen = 0;
+ }
+ };
+}
+
//=============================================================================
/*!
* Destructor
//=============================================================================
/*!
* Destructor
@@
-84,9
+97,16
@@
SMESH_Gen::~SMESH_Gen()
std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
{
std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
{
- delete i_sc->second->myDocument;
- delete i_sc->second;
- }
+ StudyContextStruct* context = i_sc->second;
+ std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin();
+ for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp )
+ {
+ if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
+ h->NullifyGen();
+ }
+ delete context->myDocument;
+ delete context;
+ }
}
//=============================================================================
}
//=============================================================================
@@
-123,13
+143,16
@@
SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
- const bool aShapeOnly /*=false*/,
- const bool anUpward /*=false*/,
+ const int aFlags /*= COMPACT_MESH*/,
const ::MeshDimension aDim /*=::MeshDim_3D*/,
TSetOfInt* aShapesId /*=0*/)
{
MEMOSTAT;
const ::MeshDimension aDim /*=::MeshDim_3D*/,
TSetOfInt* aShapesId /*=0*/)
{
MEMOSTAT;
+ const bool aShapeOnly = aFlags & SHAPE_ONLY;
+ const bool anUpward = aFlags & UPWARD;
+ const bool aCompactMesh = aFlags & COMPACT_MESH;
+
bool ret = true;
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
bool ret = true;
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
@@
-141,10
+164,12
@@
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_subMeshIteratorPtr smIt;
// Fix of Issue 22150. Due to !BLSURF->OnlyUnaryInput(), BLSURF computes edges
SMESH_subMeshIteratorPtr smIt;
// Fix of Issue 22150. Due to !BLSURF->OnlyUnaryInput(), BLSURF computes edges
- // that must be computed by Projection 1D-2D wh
en
Projection asks to compute
+ // that must be computed by Projection 1D-2D wh
ile the
Projection asks to compute
// one face only.
SMESH_subMesh::compute_event computeEvent =
aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
// one face only.
SMESH_subMesh::compute_event computeEvent =
aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
+ if ( !aMesh.HasShapeToMesh() )
+ computeEvent = SMESH_subMesh::COMPUTE_NOGEOM; // if several algos and no geometry
if ( anUpward ) // is called from the below code in this method
{
if ( anUpward ) // is called from the below code in this method
{
@@
-331,7
+356,8
@@
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_Hypothesis::Hypothesis_Status status;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
// mesh a lower smToCompute starting from vertices
SMESH_Hypothesis::Hypothesis_Status status;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
// mesh a lower smToCompute starting from vertices
- Compute( aMesh, aSubShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId );
+ Compute( aMesh, aSubShape, aFlags | SHAPE_ONLY_UPWARD, aDim, aShapesId );
+ // Compute( aMesh, aSubShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId );
}
}
}
}
}
}
@@
-362,17
+388,14
@@
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// -----------------------------------------------
// mesh the rest sub-shapes starting from vertices
// -----------------------------------------------
// -----------------------------------------------
// mesh the rest sub-shapes starting from vertices
// -----------------------------------------------
- ret = Compute( aMesh, aShape, a
ShapeOnly, /*anUpward=*/true
, aDim, aShapesId );
+ ret = Compute( aMesh, aShape, a
Flags | UPWARD
, aDim, aShapesId );
}
MEMOSTAT;
}
MEMOSTAT;
- SMESHDS_Mesh *myMesh = aMesh.GetMeshDS();
- //MESSAGE("*** compactMesh after compute");
- myMesh->compactMesh();
-
// fix quadratic mesh by bending iternal links near concave boundary
// fix quadratic mesh by bending iternal links near concave boundary
- if ( aShape.IsSame( aMesh.GetShapeToMesh() ) &&
+ if ( aCompactMesh && // a final compute
+ aShape.IsSame( aMesh.GetShapeToMesh() ) &&
!aShapesId && // not preview
ret ) // everything is OK
{
!aShapesId && // not preview
ret ) // everything is OK
{
@@
-382,6
+405,10
@@
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
aHelper.FixQuadraticElements( sm->GetComputeError() );
}
}
aHelper.FixQuadraticElements( sm->GetComputeError() );
}
}
+
+ if ( aCompactMesh )
+ aMesh.GetMeshDS()->compactMesh();
+
return ret;
}
return ret;
}
@@
-579,7
+606,6
@@
bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
ret = Evaluate( aMesh, aShape, aResMap, /*anUpward=*/true, aShapesId );
}
ret = Evaluate( aMesh, aShape, aResMap, /*anUpward=*/true, aShapesId );
}
- MESSAGE( "VSR - SMESH_Gen::Evaluate() finished, OK = " << ret);
return ret;
}
return ret;
}
@@
-1053,7
+1079,8
@@
SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_subMesh * aSubMesh,
SMESH_Mesh& aMesh = *aSubMesh->GetFather();
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
SMESH_Mesh& aMesh = *aSubMesh->GetFather();
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
- filter.And( filter.IsApplicableTo( aShape ));
+ if ( aMesh.HasShapeToMesh() )
+ filter.And( filter.IsApplicableTo( aShape ));
typedef SMESH_Algo::Features AlgoData;
typedef SMESH_Algo::Features AlgoData;
@@
-1161,7
+1188,7
@@
int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
//=============================================================================
/*!
//=============================================================================
/*!
- * Genarate a new id unique within
g
this Gen
+ * Genarate a new id unique within this Gen
*/
//=============================================================================
*/
//=============================================================================