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
Merge branch 'V8_4_BR'
[modules/smesh.git]
/
src
/
SMESH
/
SMESH_HypoFilter.cxx
diff --git
a/src/SMESH/SMESH_HypoFilter.cxx
b/src/SMESH/SMESH_HypoFilter.cxx
index e19fd11a6b4da5a8c443b373c48fb664947b697c..8a81dca6297056edb38930d12dbcd7d84a2607d2 100644
(file)
--- a/
src/SMESH/SMESH_HypoFilter.cxx
+++ b/
src/SMESH/SMESH_HypoFilter.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
6
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-20,14
+20,16
@@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH SMESH : implementaion of SMESH idl descriptions
+// SMESH SMESH : implementa
t
ion of SMESH idl descriptions
// File : SMESH_HypoFilter.cxx
// Module : SMESH
//
#include "SMESH_HypoFilter.hxx"
// File : SMESH_HypoFilter.cxx
// Module : SMESH
//
#include "SMESH_HypoFilter.hxx"
+#include "SMESHDS_Mesh.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Hypothesis.hxx"
+#include "SMESH_Mesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
@@
-75,7
+77,7
@@
int SMESH_HypoFilter::DimPredicate::Value( const SMESH_Hypothesis* aHyp ) const
bool SMESH_HypoFilter::ApplicablePredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& /*aShape*/) const
{
bool SMESH_HypoFilter::ApplicablePredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& /*aShape*/) const
{
- return SMESH_subMesh::IsApplicableHypotesis( aHyp, (TopAbs_ShapeEnum)_shapeType );
+ return SMESH_subMesh::IsApplicableHypot
h
esis( aHyp, (TopAbs_ShapeEnum)_shapeType );
};
//=======================================================================
};
//=======================================================================
@@
-131,19
+133,22
@@
void SMESH_HypoFilter::IsMoreLocalThanPredicate::findPreferable()
{
const int shapeID = _mesh.GetMeshDS()->ShapeToIndex( _shape );
const TListOfListOfInt& listOfShapeIDList = _mesh.GetMeshOrder();
{
const int shapeID = _mesh.GetMeshDS()->ShapeToIndex( _shape );
const TListOfListOfInt& listOfShapeIDList = _mesh.GetMeshOrder();
- TListOfListOfInt::const_iterator listsIt = listOfShapeIDList.begin();
+ TListOfListOfInt::const_iterator
listsIt = listOfShapeIDList.begin();
for ( ; listsIt != listOfShapeIDList.end(); ++listsIt )
{
for ( ; listsIt != listOfShapeIDList.end(); ++listsIt )
{
- const TListOfInt& idList
= *listsIt;
+ const TListOfInt& idList = *listsIt;
TListOfInt::const_iterator idIt =
std::find( idList.begin(), idList.end(), shapeID );
if ( idIt != idList.end() && *idIt != idList.front() )
{
TListOfInt::const_iterator idIt =
std::find( idList.begin(), idList.end(), shapeID );
if ( idIt != idList.end() && *idIt != idList.front() )
{
- for (
; idIt != idList.end()
; --idIt )
+ for (
--idIt; true
; --idIt )
{
const TopoDS_Shape& shape = _mesh.GetMeshDS()->IndexToShape( *idIt );
if ( !shape.IsNull())
_preferableShapes.Add( shape );
{
const TopoDS_Shape& shape = _mesh.GetMeshDS()->IndexToShape( *idIt );
if ( !shape.IsNull())
_preferableShapes.Add( shape );
+
+ if ( idIt == idList.begin() )
+ break;
}
}
}
}
}
}
@@
-157,8
+162,9
@@
void SMESH_HypoFilter::IsMoreLocalThanPredicate::findPreferable()
bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
- if ( aShape.IsSame( _mesh.GetShapeToMesh() ))
- return false; // aHyp is global
+ if ( aShape.IsSame( _mesh.GetShapeToMesh() ) || // aHyp is global
+ aShape.IsSame( _shape ))
+ return false;
if ( SMESH_MesherHelper::IsSubShape( aShape, /*mainShape=*/_shape ))
return true;
if ( SMESH_MesherHelper::IsSubShape( aShape, /*mainShape=*/_shape ))
return true;
@@
-185,6
+191,7
@@
bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aH
//=======================================================================
SMESH_HypoFilter::SMESH_HypoFilter()
//=======================================================================
SMESH_HypoFilter::SMESH_HypoFilter()
+ : myNbPredicates(0)
{
}
{
}
@@
-194,6
+201,7
@@
SMESH_HypoFilter::SMESH_HypoFilter()
//=======================================================================
SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNegate )
//=======================================================================
SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNegate )
+ : myNbPredicates(0)
{
add( notNegate ? AND : AND_NOT, aPredicate );
}
{
add( notNegate ? AND : AND_NOT, aPredicate );
}
@@
-352,15
+360,14
@@
SMESH_HypoPredicate* SMESH_HypoFilter::HasType(const int theHypType)
bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
- if (
myPredicates.e
mpty() )
+ if (
IsE
mpty() )
return true;
return true;
- bool ok = ( myPredicates.front()->_logical_op <= AND_NOT );
- list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
- for ( ; pred != myPredicates.end(); ++pred )
+ bool ok = ( myPredicates[0]->_logical_op <= AND_NOT );
+ for ( int i = 0; i < myNbPredicates; ++i )
{
{
- bool ok2 =
(*pred)
->IsOk( aHyp, aShape );
- switch (
(*pred)
->_logical_op ) {
+ bool ok2 =
myPredicates[i]
->IsOk( aHyp, aShape );
+ switch (
myPredicates[i]
->_logical_op ) {
case AND: ok = ok && ok2; break;
case AND_NOT: ok = ok && !ok2; break;
case OR: ok = ok || ok2; break;
case AND: ok = ok && ok2; break;
case AND_NOT: ok = ok && !ok2; break;
case OR: ok = ok || ok2; break;
@@
-378,10
+385,11
@@
bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNegate )
{
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNegate )
{
- list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
- for ( ; pred != myPredicates.end(); ++pred )
+ SMESH_HypoPredicate** pred = &myPredicates[0];
+ SMESH_HypoPredicate** end = &myPredicates[myNbPredicates];
+ for ( ; pred != end; ++pred )
delete *pred;
delete *pred;
- my
Predicates.clear()
;
+ my
NbPredicates = 0
;
add( notNegate ? AND : AND_NOT, aPredicate );
return *this;
add( notNegate ? AND : AND_NOT, aPredicate );
return *this;
@@
-395,7
+403,11
@@
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bo
SMESH_HypoFilter::~SMESH_HypoFilter()
{
SMESH_HypoFilter::~SMESH_HypoFilter()
{
- Init(0);
+ SMESH_HypoPredicate** pred = &myPredicates[0];
+ SMESH_HypoPredicate** end = &myPredicates[myNbPredicates];
+ for ( ; pred != end; ++pred )
+ delete *pred;
+ myNbPredicates = 0;
}
}