mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
PAL13073 (Submesh hypothesises do not work for NETGEN 1D-2D-3D)
add HYP_HIDDEN_ALGO and HYP_HIDING_ALGO Hypothesis_Status'es letting the user know that assigned algorithm will not be taken into account while mesh generation
This commit is contained in:
parent
428cfb6a77
commit
ff986a68db
@ -44,6 +44,8 @@ public:
|
||||
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
|
||||
|
@ -543,7 +543,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
// ----------------------
|
||||
// check mesh conformity
|
||||
// ----------------------
|
||||
if (event == ADD_ALGO)
|
||||
if (event == ADD_ALGO || event == ADD_FATHER_ALGO)
|
||||
{
|
||||
if (IsApplicableHypotesis( anHyp ) &&
|
||||
!_father->IsNotConformAllowed() &&
|
||||
@ -566,6 +566,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
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 );
|
||||
@ -617,6 +618,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
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;
|
||||
@ -971,6 +973,29 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
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 )
|
||||
@ -995,18 +1020,22 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
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
|
||||
@ -1027,9 +1056,8 @@ bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
|
||||
// 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
|
||||
}
|
||||
}
|
||||
@ -1758,7 +1786,7 @@ const SMESH_Hypothesis* SMESH_subMesh::GetSimilarAttached(const TopoDS_Shape&
|
||||
//=======================================================================
|
||||
//function : CheckConcurentHypothesis
|
||||
//purpose : check if there are several applicable hypothesis attached to
|
||||
// ansestors
|
||||
// ancestors
|
||||
//=======================================================================
|
||||
|
||||
SMESH_Hypothesis::Hypothesis_Status
|
||||
|
@ -6,7 +6,7 @@
|
||||
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"
|
||||
@ -1264,6 +1264,8 @@ msgstr "Can not unassign \"%1\":\n"
|
||||
msgid "SMESH_RM_HYP_WRN"
|
||||
msgstr "\"%1\" unassigned but:\n"
|
||||
|
||||
# Hypothesis_Status:
|
||||
|
||||
msgid "SMESH_HYP_1"
|
||||
msgstr "Algorithm misses a hypothesis"
|
||||
|
||||
@ -1274,26 +1276,34 @@ msgid "SMESH_HYP_3"
|
||||
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"
|
||||
|
||||
|
@ -295,36 +295,28 @@ int SMESH_Mesh_i::importMEDFile( const char* theFileName, const char* theMeshNam
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -349,6 +349,43 @@ def GetFunctor(theCriterion):
|
||||
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.
|
||||
@ -391,38 +428,6 @@ class Mesh_Algorithm:
|
||||
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:
|
||||
@ -443,7 +448,7 @@ class Mesh_Algorithm:
|
||||
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"):
|
||||
@ -459,7 +464,7 @@ class Mesh_Algorithm:
|
||||
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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user