mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 02:40: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_MISSING, // algo misses a hypothesis
|
||||||
HYP_CONCURENT, // several applicable hypotheses
|
HYP_CONCURENT, // several applicable hypotheses
|
||||||
HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
|
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
|
HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
|
||||||
// for Add/RemoveHypothesis operations
|
// for Add/RemoveHypothesis operations
|
||||||
HYP_INCOMPATIBLE, // hypothesis does not fit algo
|
HYP_INCOMPATIBLE, // hypothesis does not fit algo
|
||||||
|
@ -543,7 +543,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
// ----------------------
|
// ----------------------
|
||||||
// check mesh conformity
|
// check mesh conformity
|
||||||
// ----------------------
|
// ----------------------
|
||||||
if (event == ADD_ALGO)
|
if (event == ADD_ALGO || event == ADD_FATHER_ALGO)
|
||||||
{
|
{
|
||||||
if (IsApplicableHypotesis( anHyp ) &&
|
if (IsApplicableHypotesis( anHyp ) &&
|
||||||
!_father->IsNotConformAllowed() &&
|
!_father->IsNotConformAllowed() &&
|
||||||
@ -566,6 +566,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
|
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
|
||||||
|
|
||||||
// Serve Propagation of 1D hypothesis
|
// Serve Propagation of 1D hypothesis
|
||||||
|
// NOTE: it is possible to re-implement Propagation using EventListener
|
||||||
if (event == ADD_HYP) {
|
if (event == ADD_HYP) {
|
||||||
bool isPropagationOk = true;
|
bool isPropagationOk = true;
|
||||||
bool isPropagationHyp = ( strcmp( "Propagation", anHyp->GetName() ) == 0 );
|
bool isPropagationHyp = ( strcmp( "Propagation", anHyp->GetName() ) == 0 );
|
||||||
@ -617,6 +618,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
return SMESH_Hypothesis::HYP_OK; // nothing changes
|
return SMESH_Hypothesis::HYP_OK; // nothing changes
|
||||||
|
|
||||||
// Serve Propagation of 1D hypothesis
|
// Serve Propagation of 1D hypothesis
|
||||||
|
// NOTE: it is possible to re-implement Propagation using EventListener
|
||||||
if (event == REMOVE_HYP)
|
if (event == REMOVE_HYP)
|
||||||
{
|
{
|
||||||
bool isPropagationOk = true;
|
bool isPropagationOk = true;
|
||||||
@ -971,6 +973,29 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
break;
|
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 != oldAlgoState )
|
||||||
{
|
{
|
||||||
if (_algoState == HYP_OK )
|
if (_algoState == HYP_OK )
|
||||||
@ -995,18 +1020,22 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
|
bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
|
||||||
{
|
{
|
||||||
// MESSAGE( "SMESH_subMesh::IsConform" );
|
// MESSAGE( "SMESH_subMesh::IsConform" );
|
||||||
|
|
||||||
if ( !theAlgo ) return false;
|
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
|
// check only algo that doesn't NeedDescretBoundary(): because mesh made
|
||||||
// on a sub-shape will be ignored by theAlgo
|
// 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;
|
return true;
|
||||||
|
|
||||||
SMESH_Gen* gen =_father->GetGen();
|
SMESH_Gen* gen =_father->GetGen();
|
||||||
|
|
||||||
// only local algo is to be checked
|
// 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;
|
return true;
|
||||||
|
|
||||||
// check algo attached to adjacent shapes
|
// check algo attached to adjacent shapes
|
||||||
@ -1027,9 +1056,8 @@ bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
|
|||||||
// check algo attached to smAdjacent
|
// check algo attached to smAdjacent
|
||||||
SMESH_Algo * algo = gen->GetAlgo((*_father), adjacent);
|
SMESH_Algo * algo = gen->GetAlgo((*_father), adjacent);
|
||||||
if (algo &&
|
if (algo &&
|
||||||
//algo != theAlgo &&
|
!algo->NeedDescretBoundary() &&
|
||||||
!algo->NeedDescretBoundary() /*&&
|
algo->OnlyUnaryInput())
|
||||||
!gen->IsGlobalHypothesis( algo, *_father )*/)
|
|
||||||
return false; // NOT CONFORM MESH WILL BE PRODUCED
|
return false; // NOT CONFORM MESH WILL BE PRODUCED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1758,7 +1786,7 @@ const SMESH_Hypothesis* SMESH_subMesh::GetSimilarAttached(const TopoDS_Shape&
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : CheckConcurentHypothesis
|
//function : CheckConcurentHypothesis
|
||||||
//purpose : check if there are several applicable hypothesis attached to
|
//purpose : check if there are several applicable hypothesis attached to
|
||||||
// ansestors
|
// ancestors
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
SMESH_Hypothesis::Hypothesis_Status
|
SMESH_Hypothesis::Hypothesis_Status
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"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"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -1264,6 +1264,8 @@ msgstr "Can not unassign \"%1\":\n"
|
|||||||
msgid "SMESH_RM_HYP_WRN"
|
msgid "SMESH_RM_HYP_WRN"
|
||||||
msgstr "\"%1\" unassigned but:\n"
|
msgstr "\"%1\" unassigned but:\n"
|
||||||
|
|
||||||
|
# Hypothesis_Status:
|
||||||
|
|
||||||
msgid "SMESH_HYP_1"
|
msgid "SMESH_HYP_1"
|
||||||
msgstr "Algorithm misses a hypothesis"
|
msgstr "Algorithm misses a hypothesis"
|
||||||
|
|
||||||
@ -1274,26 +1276,34 @@ msgid "SMESH_HYP_3"
|
|||||||
msgstr "Hypothesis has a bad parameter value"
|
msgstr "Hypothesis has a bad parameter value"
|
||||||
|
|
||||||
msgid "SMESH_HYP_4"
|
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"
|
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"
|
msgid "SMESH_HYP_6"
|
||||||
msgstr "Non-conform mesh is produced using applied hypotheses"
|
msgstr "Unknown fatal error at hypothesis definition"
|
||||||
|
|
||||||
msgid "SMESH_HYP_7"
|
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"
|
msgid "SMESH_HYP_8"
|
||||||
msgstr "Hypothesis and submesh dimensions mismatch"
|
msgstr "Non-conform mesh is produced using applied hypotheses"
|
||||||
|
|
||||||
msgid "SMESH_HYP_9"
|
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"
|
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"
|
msgstr "Geomerty mismatches algorithm's expectation"
|
||||||
|
|
||||||
|
# AlgoStateErrorName
|
||||||
|
|
||||||
msgid "MISSING_ALGO"
|
msgid "MISSING_ALGO"
|
||||||
msgstr "%3 %2D algorithm is missing"
|
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
|
static SMESH::Hypothesis_Status ConvertHypothesisStatus
|
||||||
(SMESH_Hypothesis::Hypothesis_Status theStatus)
|
(SMESH_Hypothesis::Hypothesis_Status theStatus)
|
||||||
{
|
{
|
||||||
SMESH::Hypothesis_Status res;
|
switch (theStatus) {
|
||||||
switch (theStatus)
|
RETURNCASE( HYP_OK );
|
||||||
{
|
RETURNCASE( HYP_MISSING );
|
||||||
case SMESH_Hypothesis::HYP_OK:
|
RETURNCASE( HYP_CONCURENT );
|
||||||
res = SMESH::HYP_OK; break;
|
RETURNCASE( HYP_BAD_PARAMETER );
|
||||||
case SMESH_Hypothesis::HYP_MISSING:
|
RETURNCASE( HYP_HIDDEN_ALGO );
|
||||||
res = SMESH::HYP_MISSING; break;
|
RETURNCASE( HYP_HIDING_ALGO );
|
||||||
case SMESH_Hypothesis::HYP_CONCURENT:
|
RETURNCASE( HYP_UNKNOWN_FATAL );
|
||||||
res = SMESH::HYP_CONCURENT; break;
|
RETURNCASE( HYP_INCOMPATIBLE );
|
||||||
case SMESH_Hypothesis::HYP_BAD_PARAMETER:
|
RETURNCASE( HYP_NOTCONFORM );
|
||||||
res = SMESH::HYP_BAD_PARAMETER; break;
|
RETURNCASE( HYP_ALREADY_EXIST );
|
||||||
case SMESH_Hypothesis::HYP_INCOMPATIBLE:
|
RETURNCASE( HYP_BAD_DIM );
|
||||||
res = SMESH::HYP_INCOMPATIBLE; break;
|
RETURNCASE( HYP_BAD_SUBSHAPE );
|
||||||
case SMESH_Hypothesis::HYP_NOTCONFORM:
|
RETURNCASE( HYP_BAD_GEOMETRY );
|
||||||
res = SMESH::HYP_NOTCONFORM; break;
|
default:;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
return res;
|
return SMESH::HYP_UNKNOWN_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -349,6 +349,43 @@ def GetFunctor(theCriterion):
|
|||||||
print "Error: given parameter is not numerucal functor type."
|
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.
|
## Mother class to define algorithm, recommended to don't use directly.
|
||||||
@ -391,38 +428,6 @@ class Mesh_Algorithm:
|
|||||||
def GetId(self):
|
def GetId(self):
|
||||||
return self.algo.GetId()
|
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.
|
## Private method.
|
||||||
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
|
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
|
||||||
if geom is None:
|
if geom is None:
|
||||||
@ -443,7 +448,7 @@ class Mesh_Algorithm:
|
|||||||
self.algo = smesh.CreateHypothesis(hypo, so)
|
self.algo = smesh.CreateHypothesis(hypo, so)
|
||||||
SetName(self.algo, name + "/" + hypo)
|
SetName(self.algo, name + "/" + hypo)
|
||||||
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
|
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
|
||||||
self.TreatHypoStatus( status, hypo, name, 1 )
|
TreatHypoStatus( status, hypo, name, 1 )
|
||||||
|
|
||||||
## Private method
|
## Private method
|
||||||
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
|
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
|
||||||
@ -459,7 +464,7 @@ class Mesh_Algorithm:
|
|||||||
name = GetName(self.geom)
|
name = GetName(self.geom)
|
||||||
SetName(hypo, name + "/" + hyp + a)
|
SetName(hypo, name + "/" + hyp + a)
|
||||||
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
|
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
|
||||||
self.TreatHypoStatus( status, hyp, name, 0 )
|
TreatHypoStatus( status, hyp, name, 0 )
|
||||||
return hypo
|
return hypo
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user