コード例 #1
0
ファイル: commonproblem.py プロジェクト: apdimier/Etumos
    def __init__(self, body = None, value = None, description = None):
        """
        domain can be a region of the domain, it could also be a simple body associated to .
        """
        if isInstance(body,[CartesianMesh, Body]):
            pass
        else:
            memberShip(body.support,[CartesianMesh, Body])
            pass
        self.body   = body
        self.zone = body
        self.domain = body
        
#        if domain !=None:
#            if isinstance(domain,Region):
#                memberShip(domain.support,[CartesianMesh, Body])
#            elif isinstance(domain,Body):
#                pass
#            elif isinstance(domain,CartesianMesh):
#                pass
#        self.domain = domain
        #
        #
        #
        if not isinstance(value,(Head,Pressure)):
            pass
        else:
            #print "dbg CommonInitialCondition",value
            if type(value) == None:
                self.value = Head(0.0,"m")
                pass
            elif isinstance(value,Head):
                self.value = value
                pass
            else:
                raise Exception(" to modify, the pressure must be scaled to be entered as a head")
        if not isinstance(value,(Displacement)):
            pass
        else:
            #print "dbg CommonInitialCondition",value
            if type(value) == None:
                self.value = Displacement(0.0,"m")
                pass
            elif isinstance(value,Displacement):
                self.value = value
                pass
            else:
                raise Exception(" to modify, the pressure must be scaled to be entered as a head")
        if description == None:
            self.description = None
            pass
        else:
            self.description = description
            pass
        return None
コード例 #2
0
    def __init__(self, body=None, value=None, description=None):
        """
        domain can be a region of the domain, it could also be a simple body associated to.
        """
        if isInstance(body, [CartesianMesh, Body]):
            pass
        else:
            memberShip(body.support, [CartesianMesh, Body])
            pass
        self.body = body
        self.zone = body
        self.domain = body
        #        if domain !=None:
        #            if isinstance(domain,Region):
        #                memberShip(domain.support,[CartesianMesh, Body])
        #            elif isinstance(domain,Body):
        #                pass
        #            elif isinstance(domain,CartesianMesh):
        #                pass
        #        self.domain = domain
        #
        #
        #
        print(" the value for initial condition is: ", type(value), value,
              value.__class__.__name__)
        #raw_input(__name__+": the value for initial condition is")
        if isinstance(value, PhysicalQuantity):
            if not isinstance(value, (Head, Pressure)):
                pass
            else:
                #print "dbg CommonInitialCondition",value
                if type(value) == None:
                    self.value = Head(0.0, "m")
                    pass
                elif isinstance(value, Head):
                    self.value = value
                    pass
                else:
                    self.value = value
                    #raise Exception(" to modify, the pressure must be scaled to be entered as a head")
            if not isinstance(value, (Displacement)):
                pass
            else:
                #print "dbg CommonInitialCondition",value
                if type(value) == None:
                    self.value = Displacement(0.0, "m")
                    pass
                elif isinstance(value, Displacement):
                    self.value = value
                    pass
        elif type(value) in [ListType, TupleType]:
            self.value = {}
            for val in value:
                if isinstance(val,
                              (Head, Pressure, Displacement, Temperature)):
                    print(" value val.__class__.__name__ ",
                          val.__class__.__name__)
                    self.value[val.__class__.__name__] = val
                else:
                    pass
                    #raise Warning("check the way a value of type "+val.__class__.__name__+" can be treated")
                pass

        if description == None:
            print(dir(body))
            self.description = "CommonInitialCondition stretched over the body "
            pass
        else:
            self.description = description
            pass
        return None
コード例 #3
0
ファイル: commonproblem.py プロジェクト: apdimier/Etumos
class CommonInitialCondition:
    """
    Common InitialCondition definition. 
    It means we should use that class for any kind of problem, hydraulic, chemical/transport ...
    """    
    def __init__(self, body = None, value = None, description = None):
        """
        domain can be a region of the domain, it could also be a simple body associated to .
        """
        if isInstance(body,[CartesianMesh, Body]):
            pass
        else:
            memberShip(body.support,[CartesianMesh, Body])
            pass
        self.body   = body
        self.zone = body
        self.domain = body
        
#        if domain !=None:
#            if isinstance(domain,Region):
#                memberShip(domain.support,[CartesianMesh, Body])
#            elif isinstance(domain,Body):
#                pass
#            elif isinstance(domain,CartesianMesh):
#                pass
#        self.domain = domain
        #
        #
        #
        if not isinstance(value,(Head,Pressure)):
            pass
        else:
            #print "dbg CommonInitialCondition",value
            if type(value) == None:
                self.value = Head(0.0,"m")
                pass
            elif isinstance(value,Head):
                self.value = value
                pass
            else:
                raise Exception(" to modify, the pressure must be scaled to be entered as a head")
        if not isinstance(value,(Displacement)):
            pass
        else:
            #print "dbg CommonInitialCondition",value
            if type(value) == None:
                self.value = Displacement(0.0,"m")
                pass
            elif isinstance(value,Displacement):
                self.value = value
                pass
            else:
                raise Exception(" to modify, the pressure must be scaled to be entered as a head")
        if description == None:
            self.description = None
            pass
        else:
            self.description = description
            pass
        return None

    def getBody(self):
        """
        to retrieve the domain
        
        """
        if isInstance(self.body,Body):
            return self.body
        else:
            return None

    def getDomain(self):
        """
        to retrieve the domain
        """
        return self.domain

    def getRegion(self):
        """
        syntaxic equivalence
        """
        return self.body

    def getSupport(self):
        """
        get initial conditions  zones
        """
        dir(self.domain)
        return self.domain

    def getValue(self):
        """
        get initial conditions Value
        """
        return self.value.getValue()

    def getZone(self):
        """
        to retrieve the domain
        
        """
        if isInstance(self.body,Body):
            return self.body
        else:
            return None
コード例 #4
0
class CommonInitialCondition(object):
    """
    Common InitialCondition definition. 
    It means we should use that class for any kind of problem, hydraulic, chemical/transport ...
    """
    def __init__(self, body=None, value=None, description=None):
        """
        domain can be a region of the domain, it could also be a simple body associated to.
        """
        if isInstance(body, [CartesianMesh, Body]):
            pass
        else:
            memberShip(body.support, [CartesianMesh, Body])
            pass
        self.body = body
        self.zone = body
        self.domain = body
        #        if domain !=None:
        #            if isinstance(domain,Region):
        #                memberShip(domain.support,[CartesianMesh, Body])
        #            elif isinstance(domain,Body):
        #                pass
        #            elif isinstance(domain,CartesianMesh):
        #                pass
        #        self.domain = domain
        #
        #
        #
        print(" the value for initial condition is: ", type(value), value,
              value.__class__.__name__)
        #raw_input(__name__+": the value for initial condition is")
        if isinstance(value, PhysicalQuantity):
            if not isinstance(value, (Head, Pressure)):
                pass
            else:
                #print "dbg CommonInitialCondition",value
                if type(value) == None:
                    self.value = Head(0.0, "m")
                    pass
                elif isinstance(value, Head):
                    self.value = value
                    pass
                else:
                    self.value = value
                    #raise Exception(" to modify, the pressure must be scaled to be entered as a head")
            if not isinstance(value, (Displacement)):
                pass
            else:
                #print "dbg CommonInitialCondition",value
                if type(value) == None:
                    self.value = Displacement(0.0, "m")
                    pass
                elif isinstance(value, Displacement):
                    self.value = value
                    pass
        elif type(value) in [ListType, TupleType]:
            self.value = {}
            for val in value:
                if isinstance(val,
                              (Head, Pressure, Displacement, Temperature)):
                    print(" value val.__class__.__name__ ",
                          val.__class__.__name__)
                    self.value[val.__class__.__name__] = val
                else:
                    pass
                    #raise Warning("check the way a value of type "+val.__class__.__name__+" can be treated")
                pass

        if description == None:
            print(dir(body))
            self.description = "CommonInitialCondition stretched over the body "
            pass
        else:
            self.description = description
            pass
        return None

    def getBody(self):
        """
        To retrieve the domain
        """
        if isInstance(self.body, Body):
            return self.body
        else:
            return None

    def getDomain(self):
        """
        to retrieve the domain
        """
        return self.domain

    def getRegion(self):
        """
        syntaxic equivalence
        """
        return self.body

    def getSupport(self):
        """
        get initial conditions  zones
        """
        dir(self.domain)
        return self.domain

    def getValue(self):
        """
        get initial conditions Value
        """
        print("dbg commonproblem getValue: ", self.value)
        return self.value.getValue()

    def getZone(self):
        """
        to retrieve the domain
        
        """
        if isInstance(self.body, Body):
            return self.body
        else:
            return None