Back to index

salome-med  6.5.0
Functions | Variables
batchmode_medcorba_test Namespace Reference

Functions

def AnalyzeField
def getMeshObjectFromStudy
def getFieldDoubleObjectFromStudy
def getFieldIntObjectFromStudy
def getMedObjectFromStudy

Variables

list filePath = os.environ["MED_ROOT_DIR"]
tuple poa = batchmode_salome.orb.resolve_initial_references("RootPOA")
tuple poaManager = poa._get_the_POAManager()
 studyCurrent = batchmode_salome.myStudyName
 studyCurrentId = batchmode_salome.myStudyId
string fileName = "cube_hexa8_quad4.med"
tuple medFile = os.path.join( filePath, fileName )
tuple med_comp = batchmode_salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
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

Definition at line 44 of file batchmode_medcorba_test.py.

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

def batchmode_medcorba_test.getFieldDoubleObjectFromStudy (   number,
  subnumber 
)

Definition at line 100 of file batchmode_medcorba_test.py.

00100 
00101 def getFieldDoubleObjectFromStudy(number,subnumber):
00102     mySO = batchmode_salome.myStudy.FindObject("MEDFIELD")
00103     mysub = mySO.FindSubObject(number)[1]
00104     if mysub:
00105         mysubsub = mysub.FindSubObject(subnumber)[1]
00106         if mysubsub:
00107             Builder = batchmode_salome.myStudy.NewBuilder()
00108             anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR")
00109             obj = batchmode_salome.orb.string_to_object(anAttr.Value())
00110             myObj = obj._narrow(SALOME_MED.FIELDDOUBLE)
00111             return myObj
00112         else:
00113             print "ERROR: No FieldDouble Object stored in this Study"
00114             return None
00115     else:
00116         print "ERROR: No FieldDouble Object stored in this Study"
00117         return None
00118 
00119 
00120 #==============================================================================

def batchmode_medcorba_test.getFieldIntObjectFromStudy (   number,
  subnumber 
)

Definition at line 121 of file batchmode_medcorba_test.py.

00121 
00122 def getFieldIntObjectFromStudy(number,subnumber):
00123     mySO = batchmode_salome.myStudy.FindObject("MEDFIELD")
00124     mysub = mySO.FindSubObject(number)[1]
00125     if mysub:
00126         mysubsub = mysub.FindSubObject(subnumber)[1]
00127         if mysubsub:
00128             Builder = batchmode_salome.myStudy.NewBuilder()
00129             anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR")
00130             obj = batchmode_salome.orb.string_to_object(anAttr.Value())
00131             myObj = obj._narrow(SALOME_MED.FIELDINT)
00132             return myObj
00133         else:
00134             print "ERROR: No FieldInt Object stored in this Study"
00135             return None
00136     else:
00137         print "ERROR: No FieldInt Object stored in this Study"
00138         return None
00139 
00140 #==============================================================================

Definition at line 141 of file batchmode_medcorba_test.py.

00141 
00142 def getMedObjectFromStudy(file):
00143     objNameInStudy = "MED_OBJECT_FROM_FILE_"+file
00144     compNameInStudy= "MED"
00145     listOfSO = batchmode_salome.myStudy.FindObjectByName(objNameInStudy,
00146                                                          compNameInStudy)
00147     listLength = len(listOfSO)
00148     if (listLength == 0) :
00149         print "ERROR: ",objNameInStudy," cannot be found in the Study under the component ",compNameInStudy
00150         return None
00151     elif (listLength > 1) :
00152         print "ERROR: there are more than one instance of ",objNameInStudy," in the Study under the component ",compNameInStudy
00153         return None
00154     mySO = listOfSO[0]
00155     if (mySO == None) :
00156         print "ERROR: ",objNameInStudy," cannot be found in the Study"
00157         return mySO
00158     else:
00159         anAttr = mySO.FindAttribute("AttributeIOR")[1]
00160         obj = batchmode_salome.orb.string_to_object(anAttr.Value())
00161         myObj = obj._narrow(SALOME_MED.MED)
00162         if (myObj == None) :
00163             print "ERROR: ",objNameInStudy," has been found in the Study but with the wrong type"
00164         return myObj
00165 
00166 #==============================================================================
00167 #
00168 # Since Corba pointeurs will be generated in this Python script
00169 # a POA has to be registred to activate those Corba pointeurs
00170 # and make them available by any clients (in general). In our
00171 # case, it is to make those pointeurs avail able to itself
00172 #==============================================================================

Definition at line 83 of file batchmode_medcorba_test.py.

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


Variable Documentation

tuple batchmode_medcorba_test.attributesids = familycorba.getAttributesIdentifiers()

Definition at line 246 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.attributesvals = familycorba.getAttributesValues()

Definition at line 247 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.familyBool = familycorba.isOnAllElements()

Definition at line 238 of file batchmode_medcorba_test.py.

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

Definition at line 234 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.familyDescription = familycorba.getDescription()

Definition at line 236 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.familyEntity = familycorba.getEntity()

Definition at line 237 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.familyIdentifier = familycorba.getIdentifier()

Definition at line 242 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.familyName = familycorba.getName()

Definition at line 235 of file batchmode_medcorba_test.py.

Definition at line 280 of file batchmode_medcorba_test.py.

Definition at line 271 of file batchmode_medcorba_test.py.

Definition at line 293 of file batchmode_medcorba_test.py.

Definition at line 284 of file batchmode_medcorba_test.py.

Definition at line 307 of file batchmode_medcorba_test.py.

Definition at line 298 of file batchmode_medcorba_test.py.

Definition at line 320 of file batchmode_medcorba_test.py.

Definition at line 311 of file batchmode_medcorba_test.py.

string batchmode_medcorba_test.fileName = "cube_hexa8_quad4.med"

Definition at line 186 of file batchmode_medcorba_test.py.

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

Definition at line 39 of file batchmode_medcorba_test.py.

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

Definition at line 264 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.med_comp = batchmode_salome.lcc.FindOrLoadComponent("FactoryServer", "MED")

Definition at line 193 of file batchmode_medcorba_test.py.

Definition at line 197 of file batchmode_medcorba_test.py.

Definition at line 188 of file batchmode_medcorba_test.py.

Definition at line 211 of file batchmode_medcorba_test.py.

Definition at line 209 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.meshNames = med_obj.getMeshNames()

Definition at line 203 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.nbFam = meshcorba.getNumberOfFamilies(entity)

Definition at line 221 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.nbFields = med_obj.getNumberOfFields()

Definition at line 201 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.nbMeshes = med_obj.getNumberOfMeshes()

Definition at line 199 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.nbNodes = meshcorba.getNumberOfNodes()

Definition at line 213 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.nbOfAtt = familycorba.getNumberOfAttributes()

Definition at line 243 of file batchmode_medcorba_test.py.

Definition at line 265 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.nbOfElmtsOfType = familycorba.getNumberOfElements(type)

Definition at line 259 of file batchmode_medcorba_test.py.

Definition at line 255 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.number = familycorba.getNumber(type)

Definition at line 260 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.poa = batchmode_salome.orb.resolve_initial_references("RootPOA")

Definition at line 174 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.poaManager = poa._get_the_POAManager()

Definition at line 175 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.spaceDim = meshcorba.getSpaceDimension()

Definition at line 215 of file batchmode_medcorba_test.py.

batchmode_medcorba_test.studyCurrent = batchmode_salome.myStudyName

Definition at line 180 of file batchmode_medcorba_test.py.

batchmode_medcorba_test.studyCurrentId = batchmode_salome.myStudyId

Definition at line 181 of file batchmode_medcorba_test.py.

Definition at line 268 of file batchmode_medcorba_test.py.

Definition at line 267 of file batchmode_medcorba_test.py.

Definition at line 258 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.types = familycorba.getTypes()

Definition at line 254 of file batchmode_medcorba_test.py.

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

Definition at line 272 of file batchmode_medcorba_test.py.

tuple batchmode_medcorba_test.valueIverif = fieldScalDblLoc.getValue()

the only way as field support not defined

Definition at line 274 of file batchmode_medcorba_test.py.