Back to index

salome-med  6.5.0
Functions | Variables
medcorba_test Namespace Reference

Functions

def AnalyzeField
def getMeshObjectFromStudy
def getMedObjectFromStudy

Variables

tuple sg = SALOMEGUI_Swig()
list filePath = os.environ["MED_ROOT_DIR"]
 studyCurrent = salome.myStudyName
 studyCurrentId = salome.myStudyId
string fileName = "cube_hexa8_quad4.med"
tuple medFile = os.path.join( filePath, fileName )
tuple med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
string msg = "SALOME.SALOME_Exception caght, see details:"
tuple med_obj = getMedObjectFromStudy(fileName)
tuple nbMeshes = med_obj.getNumberOfMeshes()
tuple nbFields = med_obj.getNumberOfFields()
tuple meshNames = med_obj.getMeshNames()
list meshName = meshNames[0]
tuple meshcorba = getMeshObjectFromStudy(meshName)
tuple nbNodes = meshcorba.getNumberOfNodes()
tuple spaceDim = meshcorba.getSpaceDimension()
tuple nbFam = meshcorba.getNumberOfFamilies(entity)
tuple familycorba = meshcorba.getFamily(entity,j+1)
tuple familyName = familycorba.getName()
tuple familyDescription = familycorba.getDescription()
tuple familyEntity = familycorba.getEntity()
tuple familyBool = familycorba.isOnAllElements()
tuple familyIdentifier = familycorba.getIdentifier()
tuple nbOfAtt = familycorba.getNumberOfAttributes()
tuple attributesids = familycorba.getAttributesIdentifiers()
tuple attributesvals = familycorba.getAttributesValues()
tuple types = familycorba.getTypes()
tuple nbOfTypes = len(types)
list type = types[k]
tuple nbOfElmtsOfType = familycorba.getNumberOfElements(type)
tuple number = familycorba.getNumber(type)
tuple lengthValue = familycorba.getNumberOfElements(SALOME_MED.MED_ALL_ELEMENTS)
int nbOfComp = 1
tuple supportOutLocal = SUPPORTClient( familycorba )
tuple supportOutCorba = createCorbaSupport( supportOutLocal )
tuple fieldScalDblLoc = createLocalFieldDouble(nbOfComp,lengthValue)
list value = [ random() for k in range(lengthValue*nbOfComp) ]
tuple valueIverif = fieldScalDblLoc.getValue()
 the only way as field support not defined
tuple fieldScalDblCorba = createCorbaFieldDouble(supportOutCorba,fieldScalDblLoc)
tuple fieldScalIntLoc = createLocalFieldInt(nbOfComp,lengthValue)
tuple fieldScalIntCorba = createCorbaFieldInt(supportOutCorba,fieldScalIntLoc)
tuple fieldVectDblLoc = createLocalFieldDouble(nbOfComp,lengthValue)
tuple fieldVectDblCorba = createCorbaFieldDouble(supportOutCorba,fieldVectDblLoc)
tuple fieldVectIntLoc = createLocalFieldInt(nbOfComp,lengthValue)
tuple fieldVectIntCorba = createCorbaFieldInt(supportOutCorba,fieldVectIntLoc)

Function Documentation

def medcorba_test.AnalyzeField (   field)

Definition at line 47 of file medcorba_test.py.

00047 
00048 def AnalyzeField(field):
00049     name = field.getName()
00050     desc = field.getDescription()
00051     nbComp = field.getNumberOfComponents()
00052     itNum = field.getIterationNumber()
00053     ordNum = field.getOrderNumber()
00054 
00055     print "Analysis of the field ",name," with the description ",desc
00056     print "iteration number ",itNum," order Number ",ordNum
00057     print "It has ",nbComp," component(s)"
00058 
00059     fieldValue = field.getValue(SALOME_MED.MED_FULL_INTERLACE)
00060     fieldSupport = field.getSupport()
00061     fieldMesh = fieldSupport.getMesh()
00062     fieldEntity = fieldSupport.getEntity()
00063     bool = fieldSupport.isOnAllElements()
00064 
00065     if bool:
00066         print "The support of this field is on all entities ",fieldEntity," of the mesh ",fieldMesh.getName()
00067         if fieldEntity == SALOME_MED.MED_NODE:
00068             nbValByComp = fieldMesh.getNumberOfNodes()
00069         else:
00070             nbValByComp = fieldMesh.getNumberOfElements(fieldEntity,SALOME_MED.MED_ALL_ELEMENTS)
00071         print "and its dimension (number of values by component of the field) is ",nbValByComp
00072     else:
00073         print "The support of this field is partially on entities ",fieldEntity," of the mesh ",fieldMesh.getName()
00074         nbValByComp = fieldSupport.getNumberOfElements(SALOME_MED.MED_ALL_ELEMENTS)
00075         print "and its dimension (number of values by component of the field) is ",nbValByComp
00076 
00077     for i in range(nbComp):
00078         compName = field.getComponentName(i+1)
00079         compUnit = field.getComponentUnit(i+1)
00080         print "The ",(i+1),"-th  component ",compName," with the unit ",compUnit
00081 
00082     for i in range(nbValByComp):
00083         print "  * ",fieldValue[i*nbComp:(i+1)*nbComp]
00084 
00085 #==============================================================================

Definition at line 102 of file medcorba_test.py.

00102 
00103 def getMedObjectFromStudy(file):
00104     objNameInStudy = "MED_OBJECT_FROM_FILE_"+file
00105     compNameInStudy= "MED"
00106     listOfSO = salome.myStudy.FindObjectByName(objNameInStudy,compNameInStudy)
00107     listLength = len(listOfSO)
00108     if (listLength == 0) :
00109         print "ERROR: ",objNameInStudy," cannot be found in the Study under the component ",compNameInStudy
00110         return None
00111     elif (listLength > 1) :
00112         print "ERROR: there are more than one instance of ",objNameInStudy," in the Study under the component ",compNameInStudy
00113         return None
00114     mySO = listOfSO[0]
00115     if (mySO == None) :
00116         print "ERROR: ",objNameInStudy," cannot be found in the Study"
00117         return mySO
00118     else:
00119         anAttr = mySO.FindAttribute("AttributeIOR")[1]
00120         obj = salome.orb.string_to_object(anAttr.Value())
00121         myObj = obj._narrow(SALOME_MED.MED)
00122         if (myObj == None) :
00123             print "ERROR: ",objNameInStudy," has been found in the Study but with the wrong type"
00124         return myObj
00125 
00126 #==============================================================================

Definition at line 86 of file medcorba_test.py.

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


Variable Documentation

tuple medcorba_test.attributesids = familycorba.getAttributesIdentifiers()

Definition at line 207 of file medcorba_test.py.

tuple medcorba_test.attributesvals = familycorba.getAttributesValues()

Definition at line 208 of file medcorba_test.py.

tuple medcorba_test.familyBool = familycorba.isOnAllElements()

Definition at line 199 of file medcorba_test.py.

tuple medcorba_test.familycorba = meshcorba.getFamily(entity,j+1)

Definition at line 195 of file medcorba_test.py.

tuple medcorba_test.familyDescription = familycorba.getDescription()

Definition at line 197 of file medcorba_test.py.

tuple medcorba_test.familyEntity = familycorba.getEntity()

Definition at line 198 of file medcorba_test.py.

tuple medcorba_test.familyIdentifier = familycorba.getIdentifier()

Definition at line 203 of file medcorba_test.py.

tuple medcorba_test.familyName = familycorba.getName()

Definition at line 196 of file medcorba_test.py.

Definition at line 241 of file medcorba_test.py.

tuple medcorba_test.fieldScalDblLoc = createLocalFieldDouble(nbOfComp,lengthValue)

Definition at line 232 of file medcorba_test.py.

Definition at line 254 of file medcorba_test.py.

tuple medcorba_test.fieldScalIntLoc = createLocalFieldInt(nbOfComp,lengthValue)

Definition at line 245 of file medcorba_test.py.

Definition at line 268 of file medcorba_test.py.

tuple medcorba_test.fieldVectDblLoc = createLocalFieldDouble(nbOfComp,lengthValue)

Definition at line 259 of file medcorba_test.py.

Definition at line 281 of file medcorba_test.py.

tuple medcorba_test.fieldVectIntLoc = createLocalFieldInt(nbOfComp,lengthValue)

Definition at line 272 of file medcorba_test.py.

string medcorba_test.fileName = "cube_hexa8_quad4.med"

Definition at line 133 of file medcorba_test.py.

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

Definition at line 42 of file medcorba_test.py.

tuple medcorba_test.lengthValue = familycorba.getNumberOfElements(SALOME_MED.MED_ALL_ELEMENTS)

Definition at line 225 of file medcorba_test.py.

tuple medcorba_test.med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")

Definition at line 140 of file medcorba_test.py.

Definition at line 158 of file medcorba_test.py.

tuple medcorba_test.medFile = os.path.join( filePath, fileName )

Definition at line 135 of file medcorba_test.py.

Definition at line 172 of file medcorba_test.py.

Definition at line 170 of file medcorba_test.py.

tuple medcorba_test.meshNames = med_obj.getMeshNames()

Definition at line 164 of file medcorba_test.py.

string medcorba_test.msg = "SALOME.SALOME_Exception caght, see details:"

Definition at line 149 of file medcorba_test.py.

tuple medcorba_test.nbFam = meshcorba.getNumberOfFamilies(entity)

Definition at line 182 of file medcorba_test.py.

tuple medcorba_test.nbFields = med_obj.getNumberOfFields()

Definition at line 162 of file medcorba_test.py.

tuple medcorba_test.nbMeshes = med_obj.getNumberOfMeshes()

Definition at line 160 of file medcorba_test.py.

tuple medcorba_test.nbNodes = meshcorba.getNumberOfNodes()

Definition at line 174 of file medcorba_test.py.

tuple medcorba_test.nbOfAtt = familycorba.getNumberOfAttributes()

Definition at line 204 of file medcorba_test.py.

Definition at line 226 of file medcorba_test.py.

tuple medcorba_test.nbOfElmtsOfType = familycorba.getNumberOfElements(type)

Definition at line 220 of file medcorba_test.py.

Definition at line 216 of file medcorba_test.py.

tuple medcorba_test.number = familycorba.getNumber(type)

Definition at line 221 of file medcorba_test.py.

tuple medcorba_test.sg = SALOMEGUI_Swig()

Definition at line 33 of file medcorba_test.py.

tuple medcorba_test.spaceDim = meshcorba.getSpaceDimension()

Definition at line 176 of file medcorba_test.py.

medcorba_test.studyCurrent = salome.myStudyName

Definition at line 127 of file medcorba_test.py.

medcorba_test.studyCurrentId = salome.myStudyId

Definition at line 128 of file medcorba_test.py.

tuple medcorba_test.supportOutCorba = createCorbaSupport( supportOutLocal )

Definition at line 229 of file medcorba_test.py.

tuple medcorba_test.supportOutLocal = SUPPORTClient( familycorba )

Definition at line 228 of file medcorba_test.py.

Definition at line 219 of file medcorba_test.py.

tuple medcorba_test.types = familycorba.getTypes()

Definition at line 215 of file medcorba_test.py.

list medcorba_test.value = [ random() for k in range(lengthValue*nbOfComp) ]

Definition at line 233 of file medcorba_test.py.

tuple medcorba_test.valueIverif = fieldScalDblLoc.getValue()

the only way as field support not defined

Definition at line 235 of file medcorba_test.py.