Fix 17 regressions

This commit is contained in:
eap 2015-08-14 13:31:06 +03:00
parent 76deac4f04
commit 21ea791049
16 changed files with 700 additions and 276 deletions

View File

@ -314,6 +314,7 @@
<algorithm type ="QuadFromMedialAxis_1D2D"
label-id ="Quadrangle (Medial Axis Projection)"
icon-id ="mesh_algo_quad.png"
hypos ="NumberOfLayers2D, LayerDistribution2D"
opt-hypos="ViscousLayers2D"
input ="EDGE"
output ="QUAD"
@ -321,6 +322,7 @@
<python-wrap>
<algo>QuadFromMedialAxis_1D2D=Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ)</algo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
<hypo>NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers())</hypo>
</python-wrap>
</algorithm>

View File

@ -752,7 +752,7 @@ SMESH_Hypothesis::Hypothesis_Status
// shape
bool isAlgo = ( !anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO );
int event = isAlgo ? SMESH_subMesh::REMOVE_ALGO : SMESH_subMesh::REMOVE_HYP;
int event = isAlgo ? SMESH_subMesh::REMOVE_ALGO : SMESH_subMesh::REMOVE_HYP;
SMESH_subMesh *subMesh = GetSubMesh(aSubShape);

View File

@ -890,7 +890,7 @@ SMESH_Hypothesis::Hypothesis_Status
f.AndNot( SMESH_HypoFilter::Is( algo ));
const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( this, f, true );
if (prevAlgo &&
string(algo->GetName()) != string(prevAlgo->GetName()) )
string( algo->GetName()) != prevAlgo->GetName())
modifiedHyp = true;
}
else
@ -1216,7 +1216,7 @@ void SMESH_subMesh::cleanDependsOn( SMESH_Algo* algoRequiringCleaning/*=0*/ )
if ( !sm->IsEmpty() )
{
const bool sameShapeType = ( prevShapeType == sm->GetSubShape().ShapeType() );
bool keepSubMeshes = ( sameShapeType && toKeepPrevShapeType );
bool keepSubMeshes = ( sameShapeType && toKeepPrevShapeType );
if ( !sameShapeType )
{
// check if the algo allows presence of global algos of dimension the algo
@ -1239,7 +1239,7 @@ void SMESH_subMesh::cleanDependsOn( SMESH_Algo* algoRequiringCleaning/*=0*/ )
// remember all sub-meshes of sm
if ( keepSubMeshes )
{
SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false,true);
SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false);
while ( smIt2->more() )
smToKeep.insert( smIt2->next() );
}

View File

@ -1571,7 +1571,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
myObjHyps[ dim ][ type ].count() > 0 &&
curHypType == SMESH::toQStr( myObjHyps[ dim ][ type ].first().first->GetName()) )
{
HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
HypothesisData* hypData = SMESH::GetHypothesisData( SMESH::toQStr( curHyp->GetName() ));
for (int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i) {
curAlgo = myAvailableHypData[ dim ][ Algo ][ i ];
if (curAlgo && hypData && isCompatible(curAlgo, hypData, type))
@ -1587,7 +1587,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
{
// check if a selected hyp is compatible with the curAlgo
if ( !curHyp->_is_nil() ) {
HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
HypothesisData* hypData = SMESH::GetHypothesisData( SMESH::toQStr( curHyp->GetName() ));
if ( !isCompatible( curAlgo, hypData, type ))
curHyp = SMESH::SMESH_Hypothesis::_nil();
}
@ -2180,7 +2180,7 @@ void SMESHGUI_MeshOp::readMesh()
if ( myObjHyps[ dim ][ Algo ].count() > 0 )
{
SMESH::SMESH_Hypothesis_var aVar = myObjHyps[ dim ][ Algo ].first().first;
HypothesisData* algoData = SMESH::GetHypothesisData( aVar->GetName() );
HypothesisData* algoData = SMESH::GetHypothesisData( SMESH::toQStr( aVar->GetName() ));
aHypIndex = myAvailableHypData[ dim ][ Algo ].indexOf ( algoData );
// if ( aHypIndex < 0 && algoData ) {
// // assigned algo is incompatible with other algorithms
@ -2323,7 +2323,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first().first;
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
if ( anAlgoVar->_is_nil() || // no new algo selected or
strcmp(anOldAlgo->GetName(), anAlgoVar->GetName()) ) // algo change
SMESH::toQStr(anOldAlgo->GetName()) != SMESH::toQStr(anAlgoVar->GetName())) // algo change
{
// remove old algorithm
SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first().first );

View File

@ -305,6 +305,9 @@ namespace SMESH
for ( ; anIter1->More(); anIter1->Next())
{
_PTR(SObject) aSObj1 = anIter1->Value();
_PTR(SObject) aSObjectRef;
if (aSObj1->ReferencedObject(aSObjectRef))
continue; // reference to an object
anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap");
aPixmap = anAttr;
@ -322,7 +325,7 @@ namespace SMESH
const bool isGroupOnFilter = !gof->_is_nil();
bool isEmpty = false;
if ( !isGroupOnFilter ) // GetTypes() can be very long on isGroupOnFilter!
if ( !isGroupOnFilter ) // GetTypes() can be very long on GroupOnFilter!
{
SMESH::array_of_ElementType_var elemTypes = idSrc->GetTypes();
isEmpty = ( elemTypes->length() == 0 );

View File

@ -1799,8 +1799,11 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell& theShell,
for ( ; eIt.More(); eIt.Next() ) {
const TopoDS_Edge& e = TopoDS::Edge( eIt.Value() );
TopoDS_Vertex v = TopExp::FirstVertex( e );
if ( v.IsSame( V000 ))
if ( v.IsSame( V000 )) {
v = TopExp::LastVertex( e );
if ( v.IsSame( V000 ))
return false;
}
val = dir001 * gp_Vec( p000, BRep_Tool::Pnt( v )).Normalized();
if ( val > maxVal ) {
V001 = v;

View File

@ -298,7 +298,7 @@ namespace
if ( _edge ) // pass branch to an opposite BndSeg
{
size_t oppSegIndex = SMESH_MAT2d::Branch::getBndSegment( _edge->twin() );
if ( oppSegIndex < bndSegs.size() /*&& bndSegs[ oppSegIndex ]._branchID == theNoBrachID*/ )
if ( oppSegIndex < bndSegs.size() && bndSegs[ oppSegIndex ]._branchID == theNoBrachID )
bndSegs[ oppSegIndex ]._branchID = -branchID;
}
}
@ -773,7 +773,7 @@ namespace
inPoints[0]._edges.clear();
}
// Divide InSegment's into BndSeg's (each BndSeg corresponds to one MA edge)
// Divide InSegment's into BndSeg's (so that each BndSeg corresponds to one MA edge)
vector< BndSeg > bndSegs;
bndSegs.reserve( inSegments.size() * 3 );
@ -1054,15 +1054,10 @@ namespace
{
// no MA edge, bndSeg corresponds to an end point of a branch
if ( bndPoints._maEdges.empty() )
{
// should not get here according to algo design???
edgeInd = 0;
}
else
{
edgeInd = branchEdges[ brID ].size();
dInd = bndSegs[ i ]._branchID > 0 ? +1 : -1;
}
dInd = bndSegs[ i ]._branchID > 0 ? +1 : -1;
}
bndPoints._maEdges.push_back( make_pair( br, ( 1 + edgeInd ) * dInd ));
@ -1188,7 +1183,7 @@ void SMESH_MAT2d::MedialAxis::getPoints( const Branch* branch,
//================================================================================
/*!
* \brief Returns a BranchPoint corresponding to a given point on a geom EDGE
* \param [in] iGeomEdge - index of geom EDGE within a vector passed at MA construction
* \param [in] iEdge - index of geom EDGE within a vector passed at MA construction
* \param [in] u - parameter of the point on EDGE curve
* \param [out] p - the found BranchPoint
* \return bool - is OK
@ -1243,9 +1238,9 @@ bool SMESH_MAT2d::Boundary::getBranchPoint( const std::size_t iEdge,
const std::pair< const Branch*, int >& maE = points._maEdges[ i ];
bool maReverse = ( maE.second < 0 );
p._branch = maE.first;
p._iEdge = ( maReverse ? -maE.second : maE.second ) - 1; // countered from 1 to store sign
p._edgeParam = maReverse ? ( 1. - edgeParam ) : edgeParam;
p._branch = maE.first;
p._iEdge = ( maReverse ? -maE.second : maE.second ) - 1; // countered from 1 to store sign
p._edgeParam = ( maE.first && maReverse ) ? ( 1. - edgeParam ) : edgeParam;
return true;
}
@ -1508,6 +1503,12 @@ bool SMESH_MAT2d::Branch::getBoundaryPoints(const BranchPoint& p,
bool SMESH_MAT2d::Branch::getParameter(const BranchPoint & p, double & u ) const
{
if ( this != p._branch && p._branch )
return p._branch->getParameter( p, u );
if ( isRemoved() )
return _proxyPoint._branch->getParameter( _proxyPoint, u );
if ( p._iEdge > _params.size()-1 )
return false;
if ( p._iEdge == _params.size()-1 )

View File

@ -4796,6 +4796,7 @@ class Mesh:
## Returns value of a functor for a given element
# @param funcType an item of SMESH.FunctorType enum
# Type "SMESH.FunctorType._items" in the Python Console to see all items.
# @param elemId element or node ID
# @param isElem @a elemId is ID of element or node
# @return the functor value or zero in case of invalid arguments

View File

@ -379,11 +379,12 @@ namespace
TopExp::MapShapes( shape, TopAbs_FACE, subFF );
TopoDS_Vertex VV[2];
TopTools_MapOfShape subChecked;
TopTools_MapOfShape subChecked/*, ridgeEE*/;
TopTools_MapIteratorOfMapOfShape vIt( cornerVV );
for ( ; vIt.More(); vIt.Next() )
{
TopoDS_Shape V0 = vIt.Key();
// walk from one corner VERTEX to another along ridge EDGEs
PShapeIteratorPtr riIt = SMESH_MesherHelper::GetAncestors( V0, mesh, TopAbs_EDGE );
while ( const TopoDS_Shape* riE = riIt->next() )
{
@ -405,7 +406,7 @@ namespace
{
if ( E->IsSame( ridgeE ) || !subEE.Contains( *E ) || !subChecked.Add( *E ))
continue;
// look for FACEs sharing E and ridgeE
// look for FACEs sharing both E and ridgeE
PShapeIteratorPtr fIt = SMESH_MesherHelper::GetAncestors( *E, mesh, TopAbs_FACE );
while ( const TopoDS_Shape* F = fIt->next() )
{
@ -422,12 +423,12 @@ namespace
break;
}
}
// look for the next ridge EDGE
// look for the next ridge EDGE ending at V1
if ( nextRidgeE.IsNull() )
{
eIt = SMESH_MesherHelper::GetAncestors( V1, mesh, TopAbs_EDGE );
while ( const TopoDS_Shape* E = eIt->next() )
if ( !ridgeE.IsSame( *E ) && !internEE.Contains( *E ) )
if ( !ridgeE.IsSame( *E ) && !internEE.Contains( *E ) && subEE.Contains( *E ))
{
nextRidgeE = *E;
break;
@ -465,7 +466,7 @@ bool StdMeshers_CompositeHexa_3D::findBoxFaces( const TopoDS_Shape& shape,
TopTools_MapOfShape cornerVertices;
getBlockCorners( mesh, shape, cornerVertices );
if ( cornerVertices.Extent() != 8 )
return error( COMPERR_BAD_INPUT_MESH, "Can't find 8 corners of a block" );
return error( COMPERR_BAD_INPUT_MESH, "Can't find 8 corners of a block by 2D mesh" );
TopTools_MapOfShape internalEdges;
if ( !getInternalEdges( mesh, shape, cornerVertices, internalEdges ))
return error( COMPERR_BAD_INPUT_MESH, "2D mesh is not suitable for i,j,k hexa meshing" );

View File

@ -349,19 +349,19 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
if ( node ) // nodes on internal vertices may be missing
{
if ( vertexNodes.insert( node ).second ||
fHelper.IsRealSeam( node->getshapeId() ))
fHelper.IsRealSeam ( node->getshapeId() ) ||
fHelper.IsDegenShape( node->getshapeId() ))
u2node.insert( u2node.end(), make_pair( prevNormPar, node ));
}
else if ( iE == 0 )
{
if ( nodes.empty() ) {
for ( ++iE; iE < myEdge.size(); ++iE )
if (( node = VertexNode( iE ))) {
u2node.insert( make_pair( prevNormPar, node ));
break;
}
--iE;
}
for ( ++iE; iE < myEdge.size(); ++iE )
if (( node = VertexNode( iE ))) {
u2node.insert( make_pair( prevNormPar, node ));
break;
}
--iE;
if ( !node )
return myPoints;
vertexNodes.insert( node );
@ -420,8 +420,11 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
if ( !node )
return myPoints;
}
if ( u2node.rbegin()->second == node )
if ( u2node.rbegin()->second == node &&
!fHelper.IsRealSeam ( node->getshapeId() ) &&
!fHelper.IsDegenShape( node->getshapeId() ))
u2node.erase( --u2node.end() );
u2node.insert( u2node.end(), make_pair( 1., node ));
}
@ -587,9 +590,9 @@ std::vector<const SMDS_MeshNode*> StdMeshers_FaceSide::GetOrderedNodes(int theEd
// Sort nodes of all edges putting them into a map
map< double, const SMDS_MeshNode*> u2node;
vector<const SMDS_MeshNode*> nodes;
set<const SMDS_MeshNode*> vertexNodes;
map< double, const SMDS_MeshNode*> u2node;
vector<const SMDS_MeshNode*> nodes;
set<const SMDS_MeshNode*> vertexNodes;
int iE = 0, iEnd = myEdge.size();
if ( theEdgeInd >= 0 )
{
@ -613,7 +616,8 @@ std::vector<const SMDS_MeshNode*> StdMeshers_FaceSide::GetOrderedNodes(int theEd
const SMDS_MeshNode* node = VertexNode( iE );
if ( node ) { // nodes on internal vertices may be missing
if ( vertexNodes.insert( node ).second ||
fHelper.IsRealSeam( node->getshapeId() ))
fHelper.IsRealSeam ( node->getshapeId() ) ||
fHelper.IsDegenShape( node->getshapeId() ))
u2node.insert( make_pair( prevNormPar, node ));
}
else if ( iE == 0 )
@ -667,20 +671,26 @@ std::vector<const SMDS_MeshNode*> StdMeshers_FaceSide::GetOrderedNodes(int theEd
if ( !node )
return resultNodes;
}
if ( u2node.rbegin()->second == node )
if ( u2node.rbegin()->second == node &&
!fHelper.IsRealSeam ( node->getshapeId() ) &&
!fHelper.IsDegenShape( node->getshapeId() ))
u2node.erase( --u2node.end() );
u2node.insert( u2node.end(), make_pair( 1., node ));
}
// Fill the result vector
if ( u2node.size() == myNbPonits )
if ( theEdgeInd < 0 &&
u2node.size() != myNbPonits &&
u2node.size() != NbPoints( /*update=*/true ))
{
resultNodes.reserve( u2node.size() );
map< double, const SMDS_MeshNode*>::iterator u2n = u2node.begin();
for ( ; u2n != u2node.end(); ++u2n )
resultNodes.push_back( u2n->second );
u2node.clear();
}
resultNodes.reserve( u2node.size() );
map< double, const SMDS_MeshNode*>::iterator u2n = u2node.begin();
for ( ; u2n != u2node.end(); ++u2n )
resultNodes.push_back( u2n->second );
}
else
{
@ -953,7 +963,7 @@ int StdMeshers_FaceSide::NbPoints(const bool update) const
{
if ( const SMESHDS_SubMesh* sm = myProxyMesh->GetSubMesh( Edge(i) ))
{
if ( sm->NbNodes() == sm->NbElements() - 1 )
if ( sm->NbNodes() == sm->NbElements()-1 || sm->NbElements() == 0 )
{
me->myNbPonits += sm->NbNodes();
if ( myIgnoreMediumNodes && sm->IsQuadratic() )
@ -973,12 +983,13 @@ int StdMeshers_FaceSide::NbPoints(const bool update) const
helper.SetSubShape( myFace );
std::set< const SMDS_MeshNode* > vNodes;
for ( int i = 0; i <= NbEdges(); ++i ) // nb VERTEXes is more than NbEdges() if !IsClosed()
const int nbV = NbEdges() + !IsClosed();
for ( int i = 0; i < nbV; ++i )
if ( const SMDS_MeshNode* n = VertexNode( i ))
{
if ( !vNodes.insert( n ).second &&
helper.IsRealSeam( n->getshapeId() ) &&
i < NbEdges())
( helper.IsRealSeam ( n->getshapeId() ) ||
helper.IsDegenShape( n->getshapeId() )))
me->myNbPonits++;
}
else

File diff suppressed because it is too large Load Diff

View File

@ -51,15 +51,19 @@ class STDMESHERS_EXPORT StdMeshers_QuadFromMedialAxis_1D2D: public StdMeshers_Qu
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap);
private:
virtual void SetEventListener(SMESH_subMesh* subMesh);
bool computeQuads( SMESH_MesherHelper& theHelper,
const TopoDS_Face& theFace,
const std::vector<TopoDS_Edge> theSinuEdges[2],
const std::vector<TopoDS_Edge> theShortEdges[2]);
static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll);
class Algo1D;
Algo1D* _regular1D;
private:
bool computeQuads( SMESH_MesherHelper& theHelper,
FaceQuadStruct::Ptr theQuad);
Algo1D* _regular1D;
const SMESHDS_Hypothesis* _hyp2D;
};
#endif

View File

@ -322,11 +322,11 @@ this one for this mesh/sub-mesh.</translation>
</message>
<message>
<source>SMESH_NUMBER_OF_LAYERS_HYPOTHESIS</source>
<translation>Radial Prism Parameter</translation>
<translation>Radial Discretization</translation>
</message>
<message>
<source>SMESH_NUMBER_OF_LAYERS_2D_HYPOTHESIS</source>
<translation>Radial Quadrangle Parameter</translation>
<translation>Radial Discretization</translation>
</message>
<message>
<source>SMESH_NUMBER_OF_LAYERS_TITLE</source>

View File

@ -136,3 +136,15 @@ StdMeshers_QuadFromMedialAxis_1D2D_i::~StdMeshers_QuadFromMedialAxis_1D2D_i()
{
MESSAGE( "StdMeshers_QuadFromMedialAxis_1D2D_i::~StdMeshers_QuadFromMedialAxis_1D2D_i" );
}
//================================================================================
/*!
* \brief Return true if the algorithm is applicable to a shape
*/
//================================================================================
CORBA::Boolean StdMeshers_QuadFromMedialAxis_1D2D_i::IsApplicable( const TopoDS_Shape &S,
CORBA::Boolean toCheckAll )
{
return ::StdMeshers_QuadFromMedialAxis_1D2D::IsApplicable( S, toCheckAll );
}

View File

@ -79,7 +79,7 @@ class STDMESHERS_I_EXPORT StdMeshers_QuadFromMedialAxis_1D2D_i:
virtual ~StdMeshers_QuadFromMedialAxis_1D2D_i();
// Return true if the algorithm is applicable to a shape
//static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll);
static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll);
};
#endif

View File

@ -219,7 +219,7 @@ STDMESHERS_I_EXPORT
else if (strcmp(aHypName, "Quadrangle_2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Quadrangle_2D_i, StdMeshers_Quadrangle_2D_i>;
else if (strcmp(aHypName, "QuadFromMedialAxis_1D2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_QuadFromMedialAxis_1D2D_i, StdMeshers_Quadrangle_2D_i>;
aCreator = new StdHypothesisCreator_i<StdMeshers_QuadFromMedialAxis_1D2D_i, StdMeshers_QuadFromMedialAxis_1D2D_i>;
else if (strcmp(aHypName, "Hexa_3D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Hexa_3D_i, StdMeshers_Hexa_3D_i>;
else if (strcmp(aHypName, "Projection_1D") == 0)