예제 #1
0
 def __call__(self, restriction=None):
     """
     This could be used to return a fieldproxy binded on the same
     fieldHandler than self, but with options that restrict the
     usage to a domain specified by the given arguments (restricted
     to a component, to a part of the mesh, ...).
     """
     xmed.wrn("Not implemented yet. Return the field itself")
     self.__restriction = restriction
     return self
예제 #2
0
 def __call__(self, restriction=None):
     """
     This could be used to return a fieldproxy binded on the same
     fieldHandler than self, but with options that restrict the
     usage to a domain specified by the given arguments (restricted
     to a component, to a part of the mesh, ...).
     """
     xmed.wrn("Not implemented yet. Return the field itself")
     self.__restriction = restriction
     return self
예제 #3
0
 def __setattr__(self, name, value):
     """
     This method realizes the write proxy pattern toward the field
     handler. Only some attributes are writable. The list is
     specified in the PROXY_ATTRIBUTES_MAP table.
     """
     if name in PROXY_ATTRIBUTES_MAP.keys():
         if PROXY_ATTRIBUTES_MAP[name] is not None:
             xmed.wrn("The modification of this attribute can't be done that way")
             msg="Use f.update(%s=\"%s\") instead to ensure synchronisation of data."
             xmed.inf(msg%(PROXY_ATTRIBUTES_MAP[name],value))
         else:
             xmed.err("The modification of the attribute %s is not possible"%name)
     else:
         self.__dict__[name] = value
예제 #4
0
 def __setattr__(self, name, value):
     """
     This method realizes the write proxy pattern toward the field
     handler. Only some attributes are writable. The list is
     specified in the PROXY_ATTRIBUTES_MAP table.
     """
     if name in PROXY_ATTRIBUTES_MAP.keys():
         if PROXY_ATTRIBUTES_MAP[name] is not None:
             xmed.wrn(
                 "The modification of this attribute can't be done that way"
             )
             msg = "Use f.update(%s=\"%s\") instead to ensure synchronisation of data."
             xmed.inf(msg % (PROXY_ATTRIBUTES_MAP[name], value))
         else:
             xmed.err(
                 "The modification of the attribute %s is not possible" %
                 name)
     else:
         self.__dict__[name] = value
예제 #5
0
def status(local=True, remote=False):
    """
    This function return the status of the medop context, i.e. the
    list of fields defined in this python session.
    """
    status = ""
    if local is True:
        dvars = pyConsoleGlobals
        if dvars is None:
            xmed.wrn(
                "The stat function required the specification of the python context"
            )
            xmed.inf(
                "Type this command \"import xmed; xmed.setConsoleGlobals(globals())"
            )
        if remote is True:
            status = "========= Fields used in the current context ===\n"
        for varkey in dvars.keys():
            var = dvars[varkey]
            if isinstance(var, FieldProxy):
                status += "%s \t(id=%s, name=%s)\n" % (varkey, var.id,
                                                       var.fieldname)

    if remote is True:
        if local is True:
            status += "\n========= Fields available in the data manager ===\n"
        fieldHandlerList = xmed.dataManager.getFieldHandlerList()
        for fieldHandler in fieldHandlerList:
            status += "id=%s\tname\t= %s\n\tmesh\t= %s\n\t(it,dt)\t= (%s,%s)\n\tsource\t= %s\n" % (
                fieldHandler.id, fieldHandler.fieldname, fieldHandler.meshname,
                fieldHandler.iteration, fieldHandler.order,
                fieldHandler.source)
            status += "---------\n"

        if len(fieldHandlerList) > 0:
            status += "(use 'f=get(id)' to get a field in the current context)"

    return status
예제 #6
0
def status(local=True,remote=False):
    """
    This function return the status of the medop context, i.e. the
    list of fields defined in this python session.
    """
    status=""
    if local is True:
        dvars = pyConsoleGlobals
        if dvars is None:
            xmed.wrn("The stat function required the specification of the python context")
            xmed.inf("Type this command \"import xmed; xmed.setConsoleGlobals(globals())")
        if remote is True:
            status="========= Fields used in the current context ===\n"
        for varkey in dvars.keys():
            var = dvars[varkey]
            if isinstance(var, FieldProxy):
                status+="%s \t(id=%s, name=%s)\n"%(varkey,var.id,var.fieldname)

    if remote is True:
        if local is True:
            status+="\n========= Fields available in the data manager ===\n"
        fieldHandlerList = xmed.dataManager.getFieldHandlerList()
        for fieldHandler in fieldHandlerList:
            status+="id=%s\tname\t= %s\n\tmesh\t= %s\n\t(it,dt)\t= (%s,%s)\n\tsource\t= %s\n"%(
                fieldHandler.id,
                fieldHandler.fieldname,
                fieldHandler.meshname,
                fieldHandler.iteration,
                fieldHandler.order,
                fieldHandler.source)
            status+="---------\n"

        if len(fieldHandlerList) > 0:
            status+="(use 'f=get(id)' to get a field in the current context)"
    
    return status
예제 #7
0
 def __iadd__(self, operande):
     """
     These methods implements the augmented arithmetic assignments (+=)
     """
     xmed.wrn("NOT IMPLEMENTED YET")
예제 #8
0
 def __iadd__(self, operande):
     """
     These methods implements the augmented arithmetic assignments (+=)
     """
     xmed.wrn("NOT IMPLEMENTED YET")