HYP_MISSING, // algo misses a hypothesis
HYP_CONCURENT, // several applicable hypotheses
HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
+ HYP_HIDDEN_ALGO, // an algo is hidden by an upper dim algo generating all-dim elements
+ HYP_HIDING_ALGO, // an algo hides lower dim algos by generating all-dim elements
HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
// for Add/RemoveHypothesis operations
HYP_INCOMPATIBLE, // hypothesis does not fit algo
// ----------------------
// check mesh conformity
// ----------------------
- if (event == ADD_ALGO)
+ if (event == ADD_ALGO || event == ADD_FATHER_ALGO)
{
if (IsApplicableHypotesis( anHyp ) &&
!_father->IsNotConformAllowed() &&
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
// Serve Propagation of 1D hypothesis
+ // NOTE: it is possible to re-implement Propagation using EventListener
if (event == ADD_HYP) {
bool isPropagationOk = true;
bool isPropagationHyp = ( strcmp( "Propagation", anHyp->GetName() ) == 0 );
return SMESH_Hypothesis::HYP_OK; // nothing changes
// Serve Propagation of 1D hypothesis
+ // NOTE: it is possible to re-implement Propagation using EventListener
if (event == REMOVE_HYP)
{
bool isPropagationOk = true;
break;
}
+ // detect algorithm hidding
+ //
+ if ( ret == SMESH_Hypothesis::HYP_OK &&
+ ( event == ADD_ALGO || event == ADD_FATHER_ALGO ) &&
+ algo->GetName() == anHyp->GetName() )
+ {
+ // is algo hidden?
+ SMESH_Gen* gen = _father->GetGen();
+ TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
+ for ( ; ( ret == SMESH_Hypothesis::HYP_OK && it.More()); it.Next() ) {
+ if ( SMESH_Algo* upperAlgo = gen->GetAlgo( *_father, it.Value() ))
+ if ( !upperAlgo->NeedDescretBoundary() )
+ ret = SMESH_Hypothesis::HYP_HIDDEN_ALGO;
+ }
+ // is algo hiding?
+ if ( ret == SMESH_Hypothesis::HYP_OK && !algo->NeedDescretBoundary() ) {
+ map<int, SMESH_subMesh*>::reverse_iterator i_sm = _mapDepend.rbegin();
+ for ( ; ( ret == SMESH_Hypothesis::HYP_OK && i_sm != _mapDepend.rend()) ; ++i_sm )
+ if ( gen->GetAlgo( *_father, i_sm->second->_subShape ))
+ ret = SMESH_Hypothesis::HYP_HIDING_ALGO;
+ }
+ }
+
if ( _algoState != oldAlgoState )
{
if (_algoState == HYP_OK )
bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
{
// MESSAGE( "SMESH_subMesh::IsConform" );
-
if ( !theAlgo ) return false;
+ // Suppose that theAlgo is applicable to _subShape, do not check it here
+ //if ( !IsApplicableHypotesis( theAlgo )) return false;
+
// check only algo that doesn't NeedDescretBoundary(): because mesh made
// on a sub-shape will be ignored by theAlgo
- if ( theAlgo->NeedDescretBoundary() )
+ if ( theAlgo->NeedDescretBoundary() ||
+ !theAlgo->OnlyUnaryInput() ) // all adjacent shapes will be meshed by this algo?
return true;
SMESH_Gen* gen =_father->GetGen();
// only local algo is to be checked
- if ( gen->IsGlobalHypothesis( theAlgo, *_father ))
+ //if ( gen->IsGlobalHypothesis( theAlgo, *_father ))
+ if ( _subShape.ShapeType() == _father->GetMeshDS()->ShapeToMesh().ShapeType() )
return true;
// check algo attached to adjacent shapes
// check algo attached to smAdjacent
SMESH_Algo * algo = gen->GetAlgo((*_father), adjacent);
if (algo &&
- //algo != theAlgo &&
- !algo->NeedDescretBoundary() /*&&
- !gen->IsGlobalHypothesis( algo, *_father )*/)
+ !algo->NeedDescretBoundary() &&
+ algo->OnlyUnaryInput())
return false; // NOT CONFORM MESH WILL BE PRODUCED
}
}
//=======================================================================
//function : CheckConcurentHypothesis
//purpose : check if there are several applicable hypothesis attached to
-// ansestors
+// ancestors
//=======================================================================
SMESH_Hypothesis::Hypothesis_Status
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"PO-Revision-Date: 2006-12-29 11:56+0300\n"
+"PO-Revision-Date: 2007-01-19 10:44+0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
msgid "SMESH_RM_HYP_WRN"
msgstr "\"%1\" unassigned but:\n"
+# Hypothesis_Status:
+
msgid "SMESH_HYP_1"
msgstr "Algorithm misses a hypothesis"
msgstr "Hypothesis has a bad parameter value"
msgid "SMESH_HYP_4"
-msgstr "Unknown fatal error at hypothesis definition"
+msgstr "Algorithm is hidden by an algorithm of upper dimension generating all-dimensions elements"
msgid "SMESH_HYP_5"
-msgstr "Hypothesis is not suitable in the current context"
+msgstr "Algorithm hides algorithm(s) of lower dimension by generating all-dimensions elements"
msgid "SMESH_HYP_6"
-msgstr "Non-conform mesh is produced using applied hypotheses"
+msgstr "Unknown fatal error at hypothesis definition"
msgid "SMESH_HYP_7"
-msgstr "Such dimention hypothesis is already assigned to the shape"
+msgstr "Hypothesis is not suitable in the current context"
msgid "SMESH_HYP_8"
-msgstr "Hypothesis and submesh dimensions mismatch"
+msgstr "Non-conform mesh is produced using applied hypotheses"
msgid "SMESH_HYP_9"
-msgstr "Shape is neither the main one, nor its subshape, nor a valid group"
+msgstr "Such dimention hypothesis is already assigned to the shape"
msgid "SMESH_HYP_10"
+msgstr "Hypothesis and submesh dimensions mismatch"
+
+msgid "SMESH_HYP_11"
+msgstr "Shape is neither the main one, nor its subshape, nor a valid group"
+
+msgid "SMESH_HYP_12"
msgstr "Geomerty mismatches algorithm's expectation"
+# AlgoStateErrorName
+
msgid "MISSING_ALGO"
msgstr "%3 %2D algorithm is missing"
*/
//=============================================================================
+#define RETURNCASE(hyp_stat) case SMESH_Hypothesis::hyp_stat: return SMESH::hyp_stat;
+
static SMESH::Hypothesis_Status ConvertHypothesisStatus
(SMESH_Hypothesis::Hypothesis_Status theStatus)
{
- SMESH::Hypothesis_Status res;
- switch (theStatus)
- {
- case SMESH_Hypothesis::HYP_OK:
- res = SMESH::HYP_OK; break;
- case SMESH_Hypothesis::HYP_MISSING:
- res = SMESH::HYP_MISSING; break;
- case SMESH_Hypothesis::HYP_CONCURENT:
- res = SMESH::HYP_CONCURENT; break;
- case SMESH_Hypothesis::HYP_BAD_PARAMETER:
- res = SMESH::HYP_BAD_PARAMETER; break;
- case SMESH_Hypothesis::HYP_INCOMPATIBLE:
- res = SMESH::HYP_INCOMPATIBLE; break;
- case SMESH_Hypothesis::HYP_NOTCONFORM:
- res = SMESH::HYP_NOTCONFORM; break;
- case SMESH_Hypothesis::HYP_ALREADY_EXIST:
- res = SMESH::HYP_ALREADY_EXIST; break;
- case SMESH_Hypothesis::HYP_BAD_DIM:
- res = SMESH::HYP_BAD_DIM; break;
- case SMESH_Hypothesis::HYP_BAD_SUBSHAPE:
- res = SMESH::HYP_BAD_SUBSHAPE; break;
- case SMESH_Hypothesis::HYP_BAD_GEOMETRY:
- res = SMESH::HYP_BAD_GEOMETRY; break;
- default:
- res = SMESH::HYP_UNKNOWN_FATAL;
+ switch (theStatus) {
+ RETURNCASE( HYP_OK );
+ RETURNCASE( HYP_MISSING );
+ RETURNCASE( HYP_CONCURENT );
+ RETURNCASE( HYP_BAD_PARAMETER );
+ RETURNCASE( HYP_HIDDEN_ALGO );
+ RETURNCASE( HYP_HIDING_ALGO );
+ RETURNCASE( HYP_UNKNOWN_FATAL );
+ RETURNCASE( HYP_INCOMPATIBLE );
+ RETURNCASE( HYP_NOTCONFORM );
+ RETURNCASE( HYP_ALREADY_EXIST );
+ RETURNCASE( HYP_BAD_DIM );
+ RETURNCASE( HYP_BAD_SUBSHAPE );
+ RETURNCASE( HYP_BAD_GEOMETRY );
+ default:;
}
- return res;
+ return SMESH::HYP_UNKNOWN_FATAL;
}
//=============================================================================
print "Error: given parameter is not numerucal functor type."
+## Private method. Print error message if a hypothesis was not assigned.
+def TreatHypoStatus(status, hypName, geomName, isAlgo):
+ if isAlgo:
+ hypType = "algorithm"
+ else:
+ hypType = "hypothesis"
+ pass
+ if status == HYP_UNKNOWN_FATAL :
+ reason = "for unknown reason"
+ elif status == HYP_INCOMPATIBLE :
+ reason = "this hypothesis mismatches algorithm"
+ elif status == HYP_NOTCONFORM :
+ reason = "not conform mesh would be built"
+ elif status == HYP_ALREADY_EXIST :
+ reason = hypType + " of the same dimension already assigned to this shape"
+ elif status == HYP_BAD_DIM :
+ reason = hypType + " mismatches shape"
+ elif status == HYP_CONCURENT :
+ reason = "there are concurrent hypotheses on sub-shapes"
+ elif status == HYP_BAD_SUBSHAPE :
+ reason = "shape is neither the main one, nor its subshape, nor a valid group"
+ elif status == HYP_BAD_GEOMETRY:
+ reason = "geometry mismatches algorithm's expectation"
+ elif status == HYP_HIDDEN_ALGO:
+ reason = "it is hidden by an algorithm of upper dimension generating all-dimensions elements"
+ elif status == HYP_HIDING_ALGO:
+ reason = "it hides algorithm(s) of lower dimension by generating all-dimensions elements"
+ else:
+ return
+ hypName = '"' + hypName + '"'
+ geomName= '"' + geomName+ '"'
+ if status < HYP_UNKNOWN_FATAL:
+ print hypName, "was assigned to", geomName,"but", reason
+ else:
+ print hypName, "was not assigned to",geomName,":", reason
+ pass
+
## Mother class to define algorithm, recommended to don't use directly.
def GetId(self):
return self.algo.GetId()
- ## Private method. Print error message if a hypothesis was not assigned.
- def TreatHypoStatus(self, status, hypName, geomName, isAlgo):
- if isAlgo:
- hypType = "algorithm"
- else:
- hypType = "hypothesis"
- if status == HYP_UNKNOWN_FATAL :
- reason = "for unknown reason"
- elif status == HYP_INCOMPATIBLE :
- reason = "this hypothesis mismatches algorithm"
- elif status == HYP_NOTCONFORM :
- reason = "not conform mesh would be built"
- elif status == HYP_ALREADY_EXIST :
- reason = hypType + " of the same dimension already assigned to this shape"
- elif status == HYP_BAD_DIM :
- reason = hypType + " mismatches shape"
- elif status == HYP_CONCURENT :
- reason = "there are concurrent hypotheses on sub-shapes"
- elif status == HYP_BAD_SUBSHAPE :
- reason = "shape is neither the main one, nor its subshape, nor a valid group"
- elif status == HYP_BAD_GEOMETRY:
- reason = "geometry mismatches algorithm's expectation"
- else:
- return
- hypName = '"' + hypName + '"'
- geomName= '"' + geomName+ '"'
- if status < HYP_UNKNOWN_FATAL:
- print hypName, "was assigned to", geomName,"but", reason
- else:
- print hypName, "was not assigned to",geomName,":", reason
- pass
-
## Private method.
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
if geom is None:
self.algo = smesh.CreateHypothesis(hypo, so)
SetName(self.algo, name + "/" + hypo)
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
- self.TreatHypoStatus( status, hypo, name, 1 )
+ TreatHypoStatus( status, hypo, name, 1 )
## Private method
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
name = GetName(self.geom)
SetName(hypo, name + "/" + hyp + a)
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
- self.TreatHypoStatus( status, hyp, name, 0 )
+ TreatHypoStatus( status, hyp, name, 0 )
return hypo