Back to index

salome-med  6.5.0
Functions | Variables
Med_Gen_test Namespace Reference

Functions

def print_ord
def changeBlankToUnderScore
def getMedObjectFromStudy
def getMeshObjectFromStudy
def getSupportObjectFromStudy
def getFieldObjectFromStudy

Variables

tuple sg = SALOMEGUI_Swig()
string fileName = "cube_hexa8_quad4.med"
tuple medComp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
list filePath = os.environ["MED_ROOT_DIR"]
tuple filePathName = os.path.join(filePath, fileName)
tuple medObj = getMedObjectFromStudy(fileName)
tuple nbOfMeshes = medObj.getNumberOfMeshes()
tuple meshNames = medObj.getMeshNames()
list meshName = meshNames[i]
tuple meshObj = medObj.getMeshByName(meshName)
tuple nbFam = meshObj.getNumberOfFamilies(entity)
tuple nbGrp = meshObj.getNumberOfGroups(entity)
tuple familyObj = meshObj.getFamily(entity,j+1)
tuple groupObj = meshObj.getGroup(entity,j+1)
tuple familyName = (meshObj.getFamily(entity,j+1))
tuple groupName = (meshObj.getGroup(entity,j+1))
string entitySupport = "MED_NOEUD"
string entitySuppor = "MED_FACE"
string supportName = "SupportOnAll_"
tuple supportObj = getSupportObjectFromStudy(meshName,supportName)
tuple nbOfFields = medObj.getNumberOfFields()
tuple fieldNames = medObj.getFieldNames()
list fieldName = fieldNames[i]
tuple nbOfIt = medObj.getFieldNumberOfIteration(fieldName)
tuple dtitfield = medObj.getFieldIteration(fieldName,j)
list dt = dtitfield[0]
list it = dtitfield[1]
tuple fieldObj = getFieldObjectFromStudy(dt,it,fieldName,supportName,meshName)

Function Documentation

def Med_Gen_test.changeBlankToUnderScore (   stringWithBlank)

Definition at line 48 of file Med_Gen_test.py.

00048 
00049 def changeBlankToUnderScore(stringWithBlank):
00050     blank = ' '
00051     underscore = '_'
00052     decompString = string.split(stringWithBlank,blank)
00053     length = len(decompString)
00054     stringWithUnderScore = decompString[0]
00055     for i in range(1,length):
00056         stringWithUnderScore += underscore
00057         stringWithUnderScore += decompString[i]
00058     return stringWithUnderScore

Here is the caller graph for this function:

def Med_Gen_test.getFieldObjectFromStudy (   dt,
  it,
  fieldName,
  supportName,
  meshName 
)

Definition at line 111 of file Med_Gen_test.py.

00111 
00112 def getFieldObjectFromStudy(dt,it,fieldName,supportName,meshName):
00113     meshNameStudy = changeBlankToUnderScore(meshName)
00114     objNameInStudy = "/Med/MEDFIELD/"+fieldName+"/("+str(dt)+","+str(it)+")_ON_"+supportName+"_OF_"+meshNameStudy
00115     mySO = salome.myStudy.FindObjectByPath(objNameInStudy)
00116     if (mySO == None) :
00117         print objNameInStudy," cannot be found in the Study"
00118         return mySO
00119     else:
00120         anAttr = mySO.FindAttribute("AttributeIOR")[1]
00121         obj = salome.orb.string_to_object(anAttr.Value())
00122         myObj = obj._narrow(SALOME_MED.FIELDINT)
00123         if (myObj == None):
00124             myObj = obj._narrow(SALOME_MED.FIELDDOUBLE)
00125             if (myObj == None) :
00126                 print objNameInStudy," has been found in the Study but with the wrong type"
00127         return myObj

Here is the call graph for this function:

Definition at line 59 of file Med_Gen_test.py.

00059 
00060 def getMedObjectFromStudy(file):
00061     objNameInStudy = "MED_OBJECT_FROM_FILE_"+file
00062     compNameInStudy= "MED"
00063     listOfSO = salome.myStudy.FindObjectByName(objNameInStudy,compNameInStudy)
00064     listLength = len(listOfSO)
00065     if (listLength == 0) :
00066         print objNameInStudy," cannot be found in the Study under the component ",compNameInStudy
00067         return None
00068     elif (listLength > 1) :
00069         print "there are more than one instance of ",objNameInStudy," in the Study under the component ",compNameInStudy
00070         return None
00071     mySO = listOfSO[0]
00072     if (mySO == None) :
00073         print objNameInStudy," cannot be found in the Study"
00074         return mySO
00075     else:
00076         anAttr = mySO.FindAttribute("AttributeIOR")[1]
00077         obj = salome.orb.string_to_object(anAttr.Value())
00078         myObj = obj._narrow(SALOME_MED.MED)
00079         if (myObj == None) :
00080             print objNameInStudy," has been found in the Study but with the wrong type"
00081         return myObj

Definition at line 82 of file Med_Gen_test.py.

00082 
00083 def getMeshObjectFromStudy(meshName):
00084     objNameInStudy = "/Med/MEDMESH/"+meshName
00085     mySO = salome.myStudy.FindObjectByPath(objNameInStudy)
00086     if (mySO == None) :
00087         print objNameInStudy," cannot be found in the Study"
00088         return mySO
00089     else:
00090         anAttr = mySO.FindAttribute("AttributeIOR")[1]
00091         obj = salome.orb.string_to_object(anAttr.Value())
00092         myObj = obj._narrow(SALOME_MED.MESH)
00093         if (myObj == None) :
00094             print objNameInStudy," has been found in the Study but with the wrong type"
00095         return myObj

def Med_Gen_test.getSupportObjectFromStudy (   meshName,
  supportName 
)

Definition at line 96 of file Med_Gen_test.py.

00096 
00097 def getSupportObjectFromStudy(meshName,supportName):
00098     meshNameStudy = changeBlankToUnderScore(meshName)
00099     objNameInStudy = "/Med/MEDMESH/MEDSUPPORTS_OF_"+meshNameStudy+"/"+supportName
00100     mySO = salome.myStudy.FindObjectByPath(objNameInStudy)
00101     if (mySO == None) :
00102         print objNameInStudy," cannot be found in the Study"
00103         return mySO
00104     else:
00105         anAttr = mySO.FindAttribute("AttributeIOR")[1]
00106         obj = salome.orb.string_to_object(anAttr.Value())
00107         myObj = obj._narrow(SALOME_MED.SUPPORT)
00108         if (myObj == None) :
00109             print objNameInStudy," has been found in the Study but with the wrong type"
00110         return myObj

Here is the call graph for this function:

Definition at line 38 of file Med_Gen_test.py.

00038 
00039 def print_ord(i):
00040     if i == 0:
00041         return 'first'
00042     elif i == 1:
00043         return 'second'
00044     elif i == 2:
00045         return 'third'
00046     else:
00047         return `(i+1)`+'th'


Variable Documentation

Definition at line 236 of file Med_Gen_test.py.

tuple Med_Gen_test.dtitfield = medObj.getFieldIteration(fieldName,j)

Definition at line 235 of file Med_Gen_test.py.

string Med_Gen_test.entitySuppor = "MED_FACE"

Definition at line 220 of file Med_Gen_test.py.

string Med_Gen_test.entitySupport = "MED_NOEUD"

Definition at line 216 of file Med_Gen_test.py.

tuple Med_Gen_test.familyName = (meshObj.getFamily(entity,j+1))

Definition at line 201 of file Med_Gen_test.py.

tuple Med_Gen_test.familyObj = meshObj.getFamily(entity,j+1)

Definition at line 173 of file Med_Gen_test.py.

Definition at line 231 of file Med_Gen_test.py.

tuple Med_Gen_test.fieldNames = medObj.getFieldNames()

Definition at line 229 of file Med_Gen_test.py.

Definition at line 253 of file Med_Gen_test.py.

string Med_Gen_test.fileName = "cube_hexa8_quad4.med"

Definition at line 128 of file Med_Gen_test.py.

tuple Med_Gen_test.filePath = os.environ["MED_ROOT_DIR"]

Definition at line 136 of file Med_Gen_test.py.

Definition at line 139 of file Med_Gen_test.py.

tuple Med_Gen_test.groupName = (meshObj.getGroup(entity,j+1))

Definition at line 207 of file Med_Gen_test.py.

tuple Med_Gen_test.groupObj = meshObj.getGroup(entity,j+1)

Definition at line 178 of file Med_Gen_test.py.

Definition at line 237 of file Med_Gen_test.py.

tuple Med_Gen_test.medComp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")

Definition at line 132 of file Med_Gen_test.py.

Definition at line 146 of file Med_Gen_test.py.

Definition at line 153 of file Med_Gen_test.py.

tuple Med_Gen_test.meshNames = medObj.getMeshNames()

Definition at line 149 of file Med_Gen_test.py.

tuple Med_Gen_test.meshObj = medObj.getMeshByName(meshName)

Definition at line 156 of file Med_Gen_test.py.

tuple Med_Gen_test.nbFam = meshObj.getNumberOfFamilies(entity)

Definition at line 160 of file Med_Gen_test.py.

tuple Med_Gen_test.nbGrp = meshObj.getNumberOfGroups(entity)

Definition at line 161 of file Med_Gen_test.py.

tuple Med_Gen_test.nbOfFields = medObj.getNumberOfFields()

Definition at line 227 of file Med_Gen_test.py.

tuple Med_Gen_test.nbOfIt = medObj.getFieldNumberOfIteration(fieldName)

Definition at line 232 of file Med_Gen_test.py.

tuple Med_Gen_test.nbOfMeshes = medObj.getNumberOfMeshes()

Definition at line 148 of file Med_Gen_test.py.

tuple Med_Gen_test.sg = SALOMEGUI_Swig()

Definition at line 36 of file Med_Gen_test.py.

string Med_Gen_test.supportName = "SupportOnAll_"

Definition at line 224 of file Med_Gen_test.py.

Definition at line 225 of file Med_Gen_test.py.