From 185f64a66cdffb12629875b8a7b59e5b50530e79 Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 12 Feb 2008 09:41:23 +0000 Subject: [PATCH] NPAL18773: incomprehensible SMESH TUI documentation. Move class Mesh to the beginning of the package (just after class smeshDC). --- src/SMESH_SWIG/smeshDC.py | 2198 ++++++++++++++++++------------------- 1 file changed, 1099 insertions(+), 1099 deletions(-) diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 371550437..f4a294088 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -421,1105 +421,6 @@ import omniORB omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC) -## Mother class to define algorithm, recommended to do not use directly. -# -# More details. -class Mesh_Algorithm: - # @class Mesh_Algorithm - # @brief Class Mesh_Algorithm - - #def __init__(self,smesh): - # self.smesh=smesh - def __init__(self): - self.mesh = None - self.geom = None - self.subm = None - self.algo = None - - ## Find hypothesis in study by its type name and parameters. - # Find only those hypothesis, which was created in smeshpyD engine. - def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD): - study = smeshpyD.GetCurrentStudy() - #to do: find component by smeshpyD object, not by its data type - scomp = study.FindComponent(smeshpyD.ComponentDataType()) - if scomp is not None: - res,hypRoot = scomp.FindSubObject(SMESH.Tag_HypothesisRoot) - # is hypotheses root label exists? - if res and hypRoot is not None: - iter = study.NewChildIterator(hypRoot) - # check all published hypotheses - while iter.More(): - hypo_so_i = iter.Value() - attr = hypo_so_i.FindAttribute("AttributeIOR")[1] - if attr is not None: - anIOR = attr.Value() - hypo_o_i = salome.orb.string_to_object(anIOR) - if hypo_o_i is not None: - # is hypothesis? - hypo_i = hypo_o_i._narrow(SMESH.SMESH_Hypothesis) - if hypo_i is not None: - # belongs to this engine? - if smeshpyD.GetObjectId(hypo_i) > 0: - # is it the needed hypothesis? - if hypo_i.GetName() == hypname: - # check args - if CompareMethod(hypo_i, args): - # found!!! - return hypo_i - pass - pass - pass - pass - pass - iter.Next() - pass - pass - pass - return None - - ## Find algorithm in study by its type name. - # Find only those algorithm, which was created in smeshpyD engine. - def FindAlgorithm (self, algoname, smeshpyD): - study = smeshpyD.GetCurrentStudy() - #to do: find component by smeshpyD object, not by its data type - scomp = study.FindComponent(smeshpyD.ComponentDataType()) - if scomp is not None: - res,hypRoot = scomp.FindSubObject(SMESH.Tag_AlgorithmsRoot) - # is algorithms root label exists? - if res and hypRoot is not None: - iter = study.NewChildIterator(hypRoot) - # check all published algorithms - while iter.More(): - algo_so_i = iter.Value() - attr = algo_so_i.FindAttribute("AttributeIOR")[1] - if attr is not None: - anIOR = attr.Value() - algo_o_i = salome.orb.string_to_object(anIOR) - if algo_o_i is not None: - # is algorithm? - algo_i = algo_o_i._narrow(SMESH.SMESH_Algo) - if algo_i is not None: - # belongs to this engine? - if smeshpyD.GetObjectId(algo_i) > 0: - # is it the needed algorithm? - if algo_i.GetName() == algoname: - # found!!! - return algo_i - pass - pass - pass - pass - iter.Next() - pass - pass - pass - return None - - ## If the algorithm is global, return 0; \n - # else return the submesh associated to this algorithm. - def GetSubMesh(self): - return self.subm - - ## Return the wrapped mesher. - def GetAlgorithm(self): - return self.algo - - ## Get list of hypothesis that can be used with this algorithm - def GetCompatibleHypothesis(self): - mylist = [] - if self.algo: - mylist = self.algo.GetCompatibleHypothesis() - return mylist - - ## Get name of algo - def GetName(self): - GetName(self.algo) - - ## Set name to algo - def SetName(self, name): - SetName(self.algo, name) - - ## Get id of algo - def GetId(self): - return self.algo.GetId() - - ## Private method. - def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): - if geom is None: - raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape" - algo = self.FindAlgorithm(hypo, mesh.smeshpyD) - if algo is None: - algo = mesh.smeshpyD.CreateHypothesis(hypo, so) - pass - self.Assign(algo, mesh, geom) - return self.algo - - ## Private method - def Assign(self, algo, mesh, geom): - if geom is None: - raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape" - self.mesh = mesh - piece = mesh.geom - if not geom: - self.geom = piece - else: - self.geom = geom - name = GetName(geom) - if name==NO_NAME: - name = mesh.geompyD.SubShapeName(geom, piece) - mesh.geompyD.addToStudyInFather(piece, geom, name) - self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) - - self.algo = algo - status = mesh.mesh.AddHypothesis(self.geom, self.algo) - TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True ) - - def CompareHyp (self, hyp, args): - print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName() - return False - - def CompareEqualHyp (self, hyp, args): - return True - - ## Private method - def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so", - UseExisting=0, CompareMethod=""): - hypo = None - if UseExisting: - if CompareMethod == "": CompareMethod = self.CompareHyp - hypo = self.FindHypothesis(hyp, args, CompareMethod, self.mesh.smeshpyD) - pass - if hypo is None: - hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so) - a = "" - s = "=" - i = 0 - n = len(args) - while i 0: + # is it the needed hypothesis? + if hypo_i.GetName() == hypname: + # check args + if CompareMethod(hypo_i, args): + # found!!! + return hypo_i + pass + pass + pass + pass + pass + iter.Next() + pass + pass + pass + return None + + ## Find algorithm in study by its type name. + # Find only those algorithm, which was created in smeshpyD engine. + def FindAlgorithm (self, algoname, smeshpyD): + study = smeshpyD.GetCurrentStudy() + #to do: find component by smeshpyD object, not by its data type + scomp = study.FindComponent(smeshpyD.ComponentDataType()) + if scomp is not None: + res,hypRoot = scomp.FindSubObject(SMESH.Tag_AlgorithmsRoot) + # is algorithms root label exists? + if res and hypRoot is not None: + iter = study.NewChildIterator(hypRoot) + # check all published algorithms + while iter.More(): + algo_so_i = iter.Value() + attr = algo_so_i.FindAttribute("AttributeIOR")[1] + if attr is not None: + anIOR = attr.Value() + algo_o_i = salome.orb.string_to_object(anIOR) + if algo_o_i is not None: + # is algorithm? + algo_i = algo_o_i._narrow(SMESH.SMESH_Algo) + if algo_i is not None: + # belongs to this engine? + if smeshpyD.GetObjectId(algo_i) > 0: + # is it the needed algorithm? + if algo_i.GetName() == algoname: + # found!!! + return algo_i + pass + pass + pass + pass + iter.Next() + pass + pass + pass + return None + + ## If the algorithm is global, return 0; \n + # else return the submesh associated to this algorithm. + def GetSubMesh(self): + return self.subm + + ## Return the wrapped mesher. + def GetAlgorithm(self): + return self.algo + + ## Get list of hypothesis that can be used with this algorithm + def GetCompatibleHypothesis(self): + mylist = [] + if self.algo: + mylist = self.algo.GetCompatibleHypothesis() + return mylist + + ## Get name of algo + def GetName(self): + GetName(self.algo) + + ## Set name to algo + def SetName(self, name): + SetName(self.algo, name) + + ## Get id of algo + def GetId(self): + return self.algo.GetId() + + ## Private method. + def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): + if geom is None: + raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape" + algo = self.FindAlgorithm(hypo, mesh.smeshpyD) + if algo is None: + algo = mesh.smeshpyD.CreateHypothesis(hypo, so) + pass + self.Assign(algo, mesh, geom) + return self.algo + + ## Private method + def Assign(self, algo, mesh, geom): + if geom is None: + raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape" + self.mesh = mesh + piece = mesh.geom + if not geom: + self.geom = piece + else: + self.geom = geom + name = GetName(geom) + if name==NO_NAME: + name = mesh.geompyD.SubShapeName(geom, piece) + mesh.geompyD.addToStudyInFather(piece, geom, name) + self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) + + self.algo = algo + status = mesh.mesh.AddHypothesis(self.geom, self.algo) + TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True ) + + def CompareHyp (self, hyp, args): + print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName() + return False + + def CompareEqualHyp (self, hyp, args): + return True + + ## Private method + def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so", + UseExisting=0, CompareMethod=""): + hypo = None + if UseExisting: + if CompareMethod == "": CompareMethod = self.CompareHyp + hypo = self.FindHypothesis(hyp, args, CompareMethod, self.mesh.smeshpyD) + pass + if hypo is None: + hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so) + a = "" + s = "=" + i = 0 + n = len(args) + while i