def getMatrixTetragridR(matrixTetragrid, prefix, xmlElement):
 rowKeys = 'Pr1 Pr2 Pr3 Pr4'.replace('P', prefix).split()
 evaluatedDictionary = evaluate.getEvaluatedDictionary(rowKeys, xmlElement)
 if (len(evaluatedDictionary.keys()) < 1):
  return matrixTetragrid
 for (rowKeyIndex, rowKey) in enumerate(rowKeys):
  if (rowKey in evaluatedDictionary):
   value = evaluatedDictionary[rowKey]
   if ((value == None) or (value == 'None')):
    print 'Warning, value in getMatrixTetragridR in matrix is None for rowKey for dictionary:'
    print rowKey
    print evaluatedDictionary
   else:
    matrixTetragrid = getIdentityMatrixTetragrid(matrixTetragrid)
    for (elementIndex, element) in enumerate(value):
     matrixTetragrid[rowKeyIndex][elementIndex] = element
 euclidean.removeListFromDictionary(xmlElement.attributeDictionary, rowKeys)
 return matrixTetragrid

def getMatrixTetragridR ( matrixTetragrid , prefix , xmlElement ) : rowKeys = 'Pr1 Pr2 Pr3 Pr4' . replace ( 'P' , prefix ) . split ( ) evaluatedDictionary = evaluate . getEvaluatedDictionary ( rowKeys , xmlElement ) if ( len ( evaluatedDictionary . keys ( ) ) < 1 ) : return matrixTetragrid for ( rowKeyIndex , rowKey ) in enumerate ( rowKeys ) : if ( rowKey in evaluatedDictionary ) : value = evaluatedDictionary [ rowKey ] if ( ( value == None ) or ( value == 'None' ) ) : print 'Warning, value in getMatrixTetragridR in matrix is None for rowKey for dictionary:' print rowKey print evaluatedDictionary else : matrixTetragrid = getIdentityMatrixTetragrid ( matrixTetragrid ) for ( elementIndex , element ) in enumerate ( value ) : matrixTetragrid [ rowKeyIndex ] [ elementIndex ] = element euclidean . removeListFromDictionary ( xmlElement . attributeDictionary , rowKeys ) return matrixTetragrid
get the matrix tetragrid from the xmlelement r values .