Ejemplo n.º 1
0
 def _init__with_2_param( self, *args ):
     if len(args) != 2:
        raise AssertionError( "len( args ) != 2" )
     argc = 0
     
     from Foam.finiteVolume import fvMesh
     try:
         fvMesh.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != fvMesh" )
     mesh = args[ argc ]; argc +=1
     
     from Foam.OpenFOAM import dictionary
     try:
         dictionary.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != dictionary" )
     dict_ = args[ argc ]
     PtrList_TypeBase.__init__( self )
     from Foam.OpenFOAM import polyPatchID, word, readLabel, readScalar
     self.patchID_ = polyPatchID( dict_.lookup( word( "patch" ) ), mesh.boundaryMesh() )
     self.faceIndex_ = readLabel( dict_.lookup( word( "face" ) ) )
     self.dir_ = self.getDir( dict_ )
     self.value_ = readScalar( dict_.lookup( word( "value" ) ) )
     self.checkPatchFace(mesh)
Ejemplo n.º 2
0
    def _init__with_2_param(self, *args):
        if len(args) != 2:
            raise AssertionError("len( args ) != 2")
        argc = 0

        from Foam.finiteVolume import fvMesh
        try:
            fvMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvMesh")
        mesh = args[argc]
        argc += 1

        from Foam.OpenFOAM import dictionary
        try:
            dictionary.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != dictionary")
        dict_ = args[argc]
        PtrList_TypeBase.__init__(self)
        from Foam.OpenFOAM import polyPatchID, word, readLabel, readScalar
        self.patchID_ = polyPatchID(dict_.lookup(word("patch")),
                                    mesh.boundaryMesh())
        self.faceIndex_ = readLabel(dict_.lookup(word("face")))
        self.dir_ = self.getDir(dict_)
        self.value_ = readScalar(dict_.lookup(word("value")))
        self.checkPatchFace(mesh)
Ejemplo n.º 3
0
 def __init__( self, mesh_ ):
     from Foam.finiteVolume import fvMesh
     try:
        fvMesh.ext_isinstance( mesh_ )
     except TypeError:
        raise AssertionError( "args[ argc ].__class__ != fvMesh" )
     from Foam.template import PtrList_INewBase
     PtrList_INewBase.__init__( self )
     self.mesh_ = mesh_
     pass
Ejemplo n.º 4
0
 def __init__(self, mesh_):
     from Foam.finiteVolume import fvMesh
     try:
         fvMesh.ext_isinstance(mesh_)
     except TypeError:
         raise AssertionError("args[ argc ].__class__ != fvMesh")
     from Foam.template import PtrList_INewBase
     PtrList_INewBase.__init__(self)
     self.mesh_ = mesh_
     pass
Ejemplo n.º 5
0
    def checkPatchFace( self, mesh ):

        from Foam.finiteVolume import fvMesh
        try:
            fvMesh.ext_isinstance( mesh )
        except TypeError:
            raise AssertionError( "args[ argc ].__class__ != fvMesh" )
        
        if not self.patchID_.active() or  self.faceIndex_ >= mesh.boundaryMesh()[self.patchID_.index()].ext_size():
           raise AssertionError ("Non-existing patch or index out of range ")
        
        pass
Ejemplo n.º 6
0
    def checkPatchFace(self, mesh):

        from Foam.finiteVolume import fvMesh
        try:
            fvMesh.ext_isinstance(mesh)
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvMesh")

        if not self.patchID_.active() or self.faceIndex_ >= mesh.boundaryMesh(
        )[self.patchID_.index()].ext_size():
            raise AssertionError("Non-existing patch or index out of range ")

        pass
Ejemplo n.º 7
0
    def _init__with_6_param(self, *args):
        if len(args) != 6:
            raise AssertionError("len( args ) != 6")

        argc = 0
        from Foam.finiteVolume import fvMesh
        try:
            fvMesh.ext_isinstance(args[argc])
        except TypeError:
            raise AssertionError("args[ argc ].__class__ != fvMesh")
        mesh = args[argc]
        argc += 1

        from Foam.OpenFOAM import word
        try:
            patchName = word(str(args[argc]))
        except ValueError:
            raise AttributeError("The second arg is not string")
        argc += 1

        try:
            faceIndex = int(args[argc])
        except ValueError:
            raise AttributeError("The third arg is not label")
        argc += 1

        try:
            dir_ = int(args[argc])
        except ValueError:
            raise AttributeError("The fourth arg is not direction")
        if dir_ < 0 or dir_ > 255:
            raise AttributeError("The fourth arg is not direction")
        argc += 1

        try:
            value = float(args[argc])
        except ValueError:
            raise AttributeError("The fifth arg is not scalar")

        from Foam.OpenFOAM import polyPatchID
        self.patchID_ = polyPatchID(patchName, mesh.boundaryMesh())
        self.faceIndex_ = faceIndex
        self.dir_ = dir_
        self.value_ = value
        self.checkPatchFace(mesh)
Ejemplo n.º 8
0
 def _init__with_6_param(self, *args):
     if len(args) != 6:
        raise AssertionError( "len( args ) != 6" )
     
     argc = 0
     from Foam.finiteVolume import fvMesh
     try:
         fvMesh.ext_isinstance( args[ argc ] )
     except TypeError:
         raise AssertionError( "args[ argc ].__class__ != fvMesh" )
     mesh = args[ argc ]; argc +=1
     
     from Foam.OpenFOAM import word
     try:
         patchName = word( str( args[ argc ] ) )
     except ValueError:
        raise AttributeError("The second arg is not string")
     argc +=1
     
     try:
        faceIndex = int( args[ argc ] )
     except ValueError:
        raise AttributeError("The third arg is not label")
     argc +=1
     
     try:
        dir_ = int( args[ argc ] )
     except ValueError:
        raise AttributeError("The fourth arg is not direction")
     if dir_ < 0 or dir_>255:
        raise AttributeError("The fourth arg is not direction") 
     argc +=1
     
     try:
        value = float( args[ argc ] )
     except ValueError:
        raise AttributeError ("The fifth arg is not scalar")
     
     from Foam.OpenFOAM import polyPatchID
     self.patchID_ = polyPatchID( patchName, mesh.boundaryMesh() )
     self.faceIndex_ = faceIndex
     self.dir_ = dir_
     self.value_ = value
     self.checkPatchFace(mesh)