Example #1
0
    def __init__(self, name, facility="solver"):
        Component.__init__(self, name, facility)

        self.all_variables = None
        self.communicator = None
        self.start_cpu_time = 0
        return
Example #2
0
    def __init__(self, name):
        if name is None:
            name = "user-manager"

        Component.__init__(self, name, facility="userManager")

        # public data
        self.home = ""
        self.passwd = None
        self.method = None
        
        self._users = {}
        self._reload = True
        self._encoder = None
        self._decoder = None

        # encoders
        self._encoders = {
            'md5': self._md5Encoder,
            'sha': self._shaEncoder,
            'crypt': self._cryptEncoder,
            }

        # decoders
        self._decoders = {
            'md5': self._md5Decoder,
            'sha': self._shaDecoder,
            'crypt': self._cryptDecoder,
            }

        return
Example #3
0
    def __init__(self, name="quadrature2dquadratic"):
        """
    Constructor.
    """
        Component.__init__(self, name, facility="quadrature")

        # These are just approximate points used to test the quadrature routine
        self.quadPtsRef = numpy.array(
            [[-0.75, -0.75], [0.75, -0.75], [-0.75, 0.75], [0, -0.75],
             [-0.75, 0], [0.25, 0.25]],
            dtype=numpy.float64)
        self.quadWts = numpy.array(
            [1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0],
            dtype=numpy.float64)
        #self.quadPtsRef = numpy.array( [[-0.64288254347276719, -0.68989794855663567],
        #                                [-0.84993777955478378, 0.28989794855663559],
        #                                [0.33278049202940285, -0.68989794855663567],
        #                                [-0.43996016900185175, 0.28989794855663559]],
        #                               dtype=numpy.float64)
        #self.quadWts = numpy.array([0.63608276,  0.36391724,  0.63608276,  0.36391724],
        #                           dtype=numpy.float64)
        self.numBasis = 6
        self.numQuadPts = 6
        self.spaceDim = 2
        self.cellDim = 2
        return
Example #4
0
 def __init__(self, name="values"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="database_values")
   self.values = []
   return
Example #5
0
 def __init__(self, name="mesh2din3dquadratic"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="mesh")
   
   self.spaceDim = 3
   self.cellDim = 2
   self.numVertices = 6
   self.numCells = 1
   self.gravityVec = numpy.array( [0.0, 0.0, -1.0e8],
                                  dtype=numpy.float64)
   self.vertices = numpy.array( [[ 2.0, -0.5, -0.5],
                                 [ 0.5,  3.0,  0.0],
                                 [-0.5,  0.0,  2.0],
                                 [ 0.0,  1.5,  1.0],
                                 [ 0.75, -0.25, 0.75],
                                 [ 1.25, 1.25, -0.25]],
                                dtype=numpy.float64)
   self.cells = numpy.array( [[0, 1, 2, 3, 4, 5]], dtype=numpy.int32)
   self.verticesRef = numpy.array( [[-1.0, -1.0],
                                    [+1.0, -1.0],
                                    [-1.0, +1.0],
                                    [ 0.0,  0.0],
                                    [-1.0,  0.0],
                                    [ 0.0, -1.0]],
                                   dtype=numpy.float64)
   return
Example #6
0
 def __init__(self, name="spatialdb"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="spatial_database")
     self._createModuleObj()
     return
Example #7
0
 def __init__(self, name="coordsys"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="coordsys")
   self._createModuleObj()
   return
Example #8
0
    def __init__(self, name):
        if name is None:
            name = 'evaluator'

        Component.__init__(self, name, facility='serviceRequestEvaluator')

        return
    def __init__(self, name='phonIsoSurfaceCalcor',
                 unitcell=None, phonondatasource=None, tau=None,
                 plotter=None, slicer=None,
                 Ei=50, Etransfer=20):
                 #branchtoplot=None, atomtoplot=None, energies=None):
        Component.__init__(self, name, facility='facility')
        self._uc = unitcell
        if phonondatasource is not None:
            self._phonondatasource = phonondatasource
        self._nkpts = None
        self._tau = tau
        self._phonondata = None
        self._kptGrid = None
        self._energyGrid = None
        self._polarizationGrid = None
        self._intensityGrid = None
        try:
            self._numatoms = unitcell.getNumAtoms()
        except:
            raise ValueError, "Unit cell is not valid: invalid number of atoms."
        #self._branchtoplot = branchtoplot
        #self._atomtoplot = atomtoplot
        #self._energies = energies
        if plotter is None:
            plotter = VTKIsoSurfacePlotter()
        self._plotter = plotter

        if slicer is None:
            slicer = VTKPlaneSlicer()
        self._slicer = slicer

        # neutron scattering parameters:
        self.Ei = Ei
        self.Etransfer = Etransfer
Example #10
0
 def __init__(self, name="petsc"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="petsc_manager")
   self.options = []
   return
 def __init__(self, name=None):
     if name is None:
         name = 'Urea Forcefield'
     Component.__init__(self, name, facility='facility')
     self.i=self.inventory
     self.i.CAndOBond.assignInteraction('morseGulpEx10')
     self.i.CAndOBond.i.interIntra = 'intramolecular'
     self.i.CAndNBond.assignInteraction('morseGulpEx10')
     self.i.CAndNBond.i.interIntra = 'intramolecular'
     self.i.HAndNBond.assignInteraction('morseGulpEx10')
     self.i.HAndNBond.i.interIntra = 'intramolecular'
     self.i.CAndO.assignInteraction('lennardGulpEx10')
     self.i.CAndO.i.interIntra = 'intermolecular'
     self.i.CAndN.assignInteraction('lennardGulpEx10')
     self.i.CAndN.i.interIntra = 'intermolecular'
     self.i.OAndO.assignInteraction('lennardGulpEx10')
     self.i.OAndO.i.interIntra = 'intermolecular'
     self.i.NAndO.assignInteraction('lennardGulpEx10')
     self.i.NAndO.i.interIntra = 'intermolecular'
     self.i.NAndN.assignInteraction('lennardGulpEx10')
     self.i.NAndN.i.interIntra = 'intermolecular'
     self.i.CAndC.assignInteraction('lennardGulpEx10')  
     self.i.CAndC.i.interIntra = 'intermolecular'     
     self.i.NAndCAndO.assignInteraction('threeBodyGulpEx10')
     self.i.HAndNAndC.assignInteraction('threeBodyGulpEx10')
     self.i.HAndNAndH.assignInteraction('threeBodyGulpEx10')
     self.i.NAndCAndN.assignInteraction('threeBodyGulpEx10')
     self.i.OAndCAndNAndH.assignInteraction('torsionGulpEx10')
     self.i.NAndCAndNAndH.assignInteraction('torsionGulpEx10')
     self.i.OAndCAndNAndN.assignInteraction('torsionGulpEx10')
Example #12
0
 def __init__(self, name="nondimensional"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="nondimensional")
   self._createModuleObj()
   return
Example #13
0
 def __init__(self, name="timehistory"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="temporal_database")
   self._createModuleObj()
   return
Example #14
0
 def __init__(self, name="shapers"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="shapers")
   self.shapers = []
   return
Example #15
0
 def __init__(self, name="geometry"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="geometry")
   self.vertices = None
   return
Example #16
0
 def _fini(self):
     Component._fini(self)
     import sys
     if self.logstream != sys.stdout: self.logstream.close()
     if self.errlogstream != sys.stderr and self.errlogstream != self.logstream:
         self.errlogstream.close()
     return
Example #17
0
    def _init(self):
        base._init(self)

        # connect to the database
        import pyre.db
        dbkwds = DbAddressResolver().resolve(self.inventory.db)
        self.db = pyre.db.connect(wrapper=self.inventory.dbwrapper, **dbkwds)
Example #18
0
 def _configure(self):
     Component._configure(self)
     self.logfile = self.inventory.logfile
     errlogfile = self.inventory.errlogfile
     if errlogfile == '': errlogfile = self.logfile
     self.errlogfile = errlogfile
     return
Example #19
0
 def __init__(self, name="simpleio"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="simpledb_io")
     self._createModuleObj()
     return
Example #20
0
    def __init__(self):
        Component.__init__(self, "lm3drun", "solver")

        print ""
        print "Hello from lm3drun.__init__!"

        return
 def __init__(self, name="solution2dquadratic"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="solution")
   
   # Input fields
   self.dt = 0.01
   self.fieldTIncr = numpy.array([ -0.4, -0.6,
                                    +0.7, +0.8,
                                    +0.0, +0.2,
                                    -0.5, -0.4,
                                    +0.3, +0.9,
                                    -0.3, -0.9 ], dtype=numpy.float64)
   self.fieldT = numpy.array([ -0.3, -0.4,
                               +0.5, +0.6,
                               +0.0, +0.1,
                               -0.2, -0.3,
                               +0.2, +0.3,
                               -0.1, -0.2 ], dtype=numpy.float64)
   self.fieldTmdt = numpy.array([ -0.2, -0.3,
                                  +0.3, +0.4,
                                  +0.0, -0.1,
                                  -0.3, -0.2,
                                  +0.1, +0.4,
                                  -0.2, -0.6 ], dtype=numpy.float64)
   return
Example #22
0
 def __init__(self, name="geometry"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="geometry")
     self.vertices = None
     return
Example #23
0
    def __init__(self, name, facility=None):
        if facility is None:
            facility = "service"
            
        Component.__init__(self, name, facility)

        # number of idle seconds before onTimeout gets called
        self.timeout = 0

        # the event loop and dispatcher
        self.selector = None

        # the monitor of my servcie port that gets me network connections
        self.monitor = None

        # the object repsonsible for extracting service requests from the network stream
        self.marshaller = None
        
        # the object repsonsible for translating service requests into method calls
        self.evaluator = None
        
        # someone must supply a weaver for rendering my current state in _storeConfiguration()
        # this is typically done by my parent
        self.weaver = None

        return
Example #24
0
 def __init__(self, name="simpleio"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="simpledb_io")
   self._createModuleObj()
   return
Example #25
0
 def __init__(self, name="timehistory"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="temporal_database")
     self._createModuleObj()
     return
Example #26
0
    def __init__(self, name = 'geometer'):
        Component.__init__(self, name, 'geometer')
        base.__init__(self)

        import journal
        self._warning = journal.warning( 'mcni.pyre_support.geometer' )
        return
Example #27
0
    def __init__(self):
        Component.__init__(self, "lm3drun", "solver")

	print ""
        print "Hello from lm3drun.__init__!"

        return
Example #28
0
 def __init__(self, name="quadrature2dquadratic"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="quadrature")
   
   # These are just approximate points used to test the quadrature routine
   self.quadPtsRef = numpy.array( [[-0.75,-0.75],
                                   [0.75,-0.75],
                                   [-0.75,0.75],
                                   [0,-0.75],
                                   [-0.75,0],
                                   [0.25,0.25]],
                                  dtype=numpy.float64)
   self.quadWts = numpy.array([1.0/3.0, 1.0/3.0, 1.0/3.0, 1.0/3.0, 1.0/3.0, 1.0/3.0],
                              dtype=numpy.float64)
   #self.quadPtsRef = numpy.array( [[-0.64288254347276719, -0.68989794855663567],
   #                                [-0.84993777955478378, 0.28989794855663559],
   #                                [0.33278049202940285, -0.68989794855663567],
   #                                [-0.43996016900185175, 0.28989794855663559]],
   #                               dtype=numpy.float64)
   #self.quadWts = numpy.array([0.63608276,  0.36391724,  0.63608276,  0.36391724],
   #                           dtype=numpy.float64)
   self.numBasis = 6
   self.numQuadPts = 6
   self.spaceDim = 2
   self.cellDim = 2
   return
Example #29
0
 def __init__(self, name='convertdata'):
   """Constructor."""
   Component.__init__(self, name, facility='convertdata')
   self._fileSrc = None
   self._fileDest = None
   self._command = None
   return
Example #30
0
  def __init__(self, name="mesh2dquadratic"):
    """
    Constructor.
    """
    Component.__init__(self, name, facility="mesh")
    
    self.spaceDim = 2
    self.cellDim = 2
    self.numVertices = 6
    self.numCells = 1
    self.gravityVec = numpy.array( [0.0, -1.0e8],
                                   dtype=numpy.float64)
    self.vertices = numpy.array( [[-1.0, -1.0],
                                  [+1.0, +0.2],
                                  [-1.5, +0.5],
                                  [-0.25, +0.35],
                                  [-1.25, -0.25],
                                  [0.0, -0.4]],
                                 dtype=numpy.float64)
    self.cells = numpy.array( [[0, 1, 2, 3, 4, 5]], dtype=numpy.int32)
    self.verticesRef = numpy.array( [[-1.0, -1.0],
                                     [+1.0, -1.0],
                                     [-1.0, +1.0],
                                     [ 0.0,  0.0],
                                     [-1.0,  0.0],
                                     [ 0.0, -1.0]],
                                    dtype=numpy.float64)

    a = (2.0**2 + 1.2**2)**0.5
    b = (2.5**2 + 0.3**2)**0.5
    c = (0.5**2 + 1.5**2)**0.5
    k = 0.5 * (a + b + c)
    r = (k*(k-a)*(k-b)*(k-c))**0.5 / k
    self.minCellWidth = min(a, b, c, 3.0*r)
    return
Example #31
0
    def _configure(self):
        Component._configure(self)

        self.host = self.inventory.host
        self.port = self.inventory.port

        return
Example #32
0
 def __init__(self, name="spatialdb"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="spatial_database")
   self._createModuleObj()
   return
Example #33
0
    def __init__(self, name='geometer'):
        Component.__init__(self, name, 'geometer')
        base.__init__(self)

        import journal
        self._warning = journal.warning('mcni.pyre_support.geometer')
        return
Example #34
0
 def __init__(self):
     Component.__init__(self, "tabulator", "tabulator")
     self.low = 0.0
     self.high = 1.0
     self.step = 0.1
     self.functor = None
     return
Example #35
0
 def __init__(self, name="values"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="database_values")
     self.values = []
     return
Example #36
0
    def __init__(self, name):
        if name is None:
            name = 'evaluator'

        Component.__init__(self, name, facility='serviceRequestEvaluator')

        return
Example #37
0
 def _configure(self):
     """
 Set attributes based on inventory.
 """
     Component._configure(self)
     ModuleSpatialDB.label(self, self.inventory.label)
     return
Example #38
0
 def __init__(self, name="coordsys"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="coordsys")
     self._createModuleObj()
     return
Example #39
0
  def __init__(self, name="mesh2dquadratic"):
    """
    Constructor.
    """
    Component.__init__(self, name, facility="mesh")
    
    self.spaceDim = 2
    self.cellDim = 2
    self.numVertices = 6
    self.numCells = 1
    self.gravityVec = numpy.array( [0.0, -1.0e8],
                                   dtype=numpy.float64)
    self.vertices = numpy.array( [[-1.0, -1.0],
                                  [+1.0, +0.2],
                                  [-1.5, +0.5],
                                  [-0.25, +0.35],
                                  [-1.25, -0.25],
                                  [0.0, -0.4]],
                                 dtype=numpy.float64)
    self.cells = numpy.array( [[0, 1, 2, 3, 4, 5]], dtype=numpy.int32)
    self.verticesRef = numpy.array( [[-1.0, -1.0],
                                     [+1.0, -1.0],
                                     [-1.0, +1.0],
                                     [ 0.0,  0.0],
                                     [-1.0,  0.0],
                                     [ 0.0, -1.0]],
                                    dtype=numpy.float64)

    a = (2.0**2 + 1.2**2)**0.5
    b = (2.5**2 + 0.3**2)**0.5
    c = (0.5**2 + 1.5**2)**0.5
    k = 0.5 * (a + b + c)
    r = (k*(k-a)*(k-b)*(k-c))**0.5 / k
    self.minCellWidth = min(a, b, c, 3.0*r)
    return
Example #40
0
    def __init__(self, name, facility="solver"):
        Component.__init__(self, name, facility)

        self.all_variables = None
        self.communicator = None
        self.start_cpu_time = 0
        return
Example #41
0
    def __init__(self, name="solution3dquadratic"):
        """
    Constructor.
    """
        Component.__init__(self, name, facility="solution")

        # Input fields
        self.dt = 0.01
        self.fieldTIncr = numpy.array([
            +0.3, -0.4, -0.4, -0.6, +0.8, +0.2, +0.5, +0.5, +0.7, -0.7, -0.5,
            -0.7, -0.6, -0.3, +0.8, -0.4, -0.8, -0.5, +0.7, +0.8, -0.5, -0.5,
            -0.5, -0.7, -0.3, -0.9, +0.8, -0.1, +0.5, -0.9
        ],
                                      dtype=numpy.float64)
        self.fieldT = numpy.array([
            +0.1, -0.2, -0.6, -0.3, +0.4, +0.9, +0.6, +0.8, +0.5, -0.8, -0.6,
            -0.8, -0.0, -0.2, +0.6, -0.4, -0.7, -0.2, +0.7, +0.6, -0.1, -0.4,
            -0.3, -0.3, -0.7, -0.6, +0.1, -0.9, +0.3, -0.8
        ],
                                  dtype=numpy.float64)
        self.fieldTmdt = numpy.array([
            +0.2, -0.3, -0.1, -0.4, +0.2, +0.3, -0.5, +0.2, +0.2, -0.3, -0.8,
            -0.3, -0.5, -0.9, +0.4, -0.3, -0.6, -0.8, +0.9, +0.5, -0.2, -0.7,
            -0.2, -0.9, -0.5, -0.8, +0.4, -0.4, +0.5, -0.7
        ],
                                     dtype=numpy.float64)
        return
Example #42
0
 def _configure(self):
   """
   Setup members using inventory.
   """
   Component._configure(self)
   pylith.perf.Material.Material.__init__(self, self.inventory.label, self.inventory.size)
   return
Example #43
0
 def __init__(self, name="shapers"):
     """
 Constructor.
 """
     Component.__init__(self, name, facility="shapers")
     self.shapers = []
     return
Example #44
0
    def __init__(self, name):
        if name is None:
            name = "user-manager"

        Component.__init__(self, name, facility="userManager")

        # public data
        self.home = ""
        self.passwd = None
        self.method = None
        
        self._users = {}
        self._reload = True
        self._encoder = None
        self._decoder = None

        # encoders
        self._encoders = {
            'md5': self._md5Encoder,
            'sha': self._shaEncoder,
            'crypt': self._cryptEncoder,
            }

        # decoders
        self._decoders = {
            'md5': self._md5Decoder,
            'sha': self._shaDecoder,
            'crypt': self._cryptDecoder,
            }

        return
Example #45
0
    def __init__(self, name="mesh2din3dlinearxy"):
        """
    Constructor.
    """
        Component.__init__(self, name, facility="mesh")

        self.spaceDim = 3
        self.cellDim = 2
        self.numVertices = 3
        self.numCells = 1
        self.gravityVec = numpy.array([0.0, 0.0, -1.0e8], dtype=numpy.float64)
        self.vertices = numpy.array(
            [[0.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0]],
            dtype=numpy.float64)
        self.cells = numpy.array([[0, 1, 2]], dtype=numpy.int32)
        self.verticesRef = numpy.array(
            [[-1.0, -1.0], [+1.0, -1.0], [-1.0, +1.0]], dtype=numpy.float64)

        a = (1.0**2 + 0.0**2 + 0.0**2)**0.5
        b = (1.0**2 + 0.0**2 + 1.0**2)**0.5
        c = (0.0**2 + 0.0**2 + 1.0**2)**0.5
        k = 0.5 * (a + b + c)
        r = (k * (k - a) * (k - b) * (k - c))**0.5 / k
        self.minCellWidth = r
        return
Example #46
0
 def __init__(self, name="mesh2din3dquadratic"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="mesh")
   
   self.spaceDim = 3
   self.cellDim = 2
   self.numVertices = 6
   self.numCells = 1
   self.gravityVec = numpy.array( [0.0, 0.0, -1.0e8],
                                  dtype=numpy.float64)
   self.vertices = numpy.array( [[ 2.0, -0.5, -0.5],
                                 [ 0.5,  3.0,  0.0],
                                 [-0.5,  0.0,  2.0],
                                 [ 0.0,  1.5,  1.0],
                                 [ 0.75, -0.25, 0.75],
                                 [ 1.25, 1.25, -0.25]],
                                dtype=numpy.float64)
   self.cells = numpy.array( [[0, 1, 2, 3, 4, 5]], dtype=numpy.int32)
   self.verticesRef = numpy.array( [[-1.0, -1.0],
                                    [+1.0, -1.0],
                                    [-1.0, +1.0],
                                    [ 0.0,  0.0],
                                    [-1.0,  0.0],
                                    [ 0.0, -1.0]],
                                   dtype=numpy.float64)
   return
Example #47
0
  def __init__(self, name="mesh2din3dlinearyz"):
    """
    Constructor.
    """
    Component.__init__(self, name, facility="mesh")
    
    self.spaceDim = 3
    self.cellDim = 2
    self.numVertices = 3
    self.numCells = 1
    self.gravityVec = numpy.array( [0.0, 0.0, -1.0e8],
                                   dtype=numpy.float64)
    self.vertices = numpy.array( [[ 0.0,  0.0,  0.0],
                                  [ 0.0,  1.0,  0.0],
                                  [ 0.0,  0.0,  1.0]],
                                 dtype=numpy.float64)
    self.cells = numpy.array( [[0, 1, 2]], dtype=numpy.int32)
    self.verticesRef = numpy.array( [[-1.0, -1.0],
                                     [+1.0, -1.0],
                                     [-1.0, +1.0]],
                                    dtype=numpy.float64)

    a = (0.0**2 + 1.0**2 + 0.0**2)**0.5
    b = (0.0**2 + 1.0**2 + 0.0**2)**0.5
    c = (0.0**2 + 0.0**2 + 1.0**2)**0.5
    k = 0.5 * (a + b + c)
    r = (k*(k-a)*(k-b)*(k-c))**0.5 / k
    self.minCellWidth = r
    return
Example #48
0
    def __init__(self):
        Component.__init__(self, "locator", facility="recordLocator")
        self._alphabet = None
        self._base = None
        self._hashtable = None

        return
Example #49
0
    def __init__(self, name, facility=None):
        if facility is None:
            facility = "service"

        Component.__init__(self, name, facility)

        # number of idle seconds before onTimeout gets called
        self.timeout = 0

        # the event loop and dispatcher
        self.selector = None

        # the monitor of my servcie port that gets me network connections
        self.monitor = None

        # the object repsonsible for extracting service requests from the network stream
        self.marshaller = None

        # the object repsonsible for translating service requests into method calls
        self.evaluator = None

        # someone must supply a weaver for rendering my current state in _storeConfiguration()
        # this is typically done by my parent
        self.weaver = None

        return
Example #50
0
    def _init(self):
        Component._init(self)

        # connect to the database
        import pyre.db
        dbkwds = DbAddressResolver().resolve(self.inventory.db)
        self.db = pyre.db.connect(wrapper=self.inventory.dbwrapper, **dbkwds)
Example #51
0
 def __init__(self, name="petsc"):
   """
   Constructor.
   """
   Component.__init__(self, name, facility="petsc_manager")
   self.options = []
   return
Example #52
0
 def __init__(self, name="dumpparameters"):
     """
     Constructor.
     """
     Component.__init__(self, name="dumpparamters", facility="dumpparameters")
     self.info = None
     return
Example #53
0
    def __init__(self, name="mesh3dlinear"):
        """
    Constructor.
    """
        Component.__init__(self, name, facility="mesh")

        self.spaceDim = 3
        self.cellDim = 3
        self.numVertices = 4
        self.numCells = 1
        self.gravityVec = numpy.array([0.0, 0.0, -1.0e8], dtype=numpy.float64)
        self.vertices = numpy.array([[-0.5, -1.0, -0.5], [1.0, -0.1, -0.3],
                                     [2.0, -0.5, -0.4], [-0.2, 0.5, 2.0]],
                                    dtype=numpy.float64)
        self.cells = numpy.array([[0, 1, 2, 3]], dtype=numpy.int32)
        self.verticesRef = numpy.array(
            [[-1.0, -1.0, -1.0], [-1.0, +1.0, -1.0], [+1.0, -1.0, -1.0],
             [-1.0, -1.0, +1.0]],
            dtype=numpy.float64)

        v0 = self.vertices[0, :]
        v1 = self.vertices[1, :]
        v2 = self.vertices[2, :]
        v3 = self.vertices[3, :]

        e01 = ((v0[0] - v1[0])**2 + (v0[1] - v1[1])**2 +
               (v0[2] - v1[2])**2)**0.5
        e12 = ((v1[0] - v2[0])**2 + (v1[1] - v2[1])**2 +
               (v1[2] - v2[2])**2)**0.5
        e20 = ((v2[0] - v0[0])**2 + (v2[1] - v0[1])**2 +
               (v2[2] - v0[2])**2)**0.5
        e03 = ((v0[0] - v3[0])**2 + (v0[1] - v3[1])**2 +
               (v0[2] - v3[2])**2)**0.5
        e13 = ((v1[0] - v3[0])**2 + (v1[1] - v3[1])**2 +
               (v1[2] - v3[2])**2)**0.5
        e23 = ((v2[0] - v3[0])**2 + (v2[1] - v3[1])**2 +
               (v2[2] - v3[2])**2)**0.5

        vol = 1.0 / 6.0 * numpy.linalg.det(
            numpy.array(
                [[1.0, v0[0], v0[1], v0[2]], [1.0, v2[0], v2[1], v2[2]],
                 [1.0, v1[0], v1[1], v1[2]], [1.0, v3[0], v3[1], v3[2]]],
                dtype=numpy.float64))
        cross012 = numpy.cross(v1 - v0, v2 - v0)
        area012 = 0.5 * (numpy.dot(cross012, cross012))**0.5

        cross013 = numpy.cross(v1 - v0, v3 - v0)
        area013 = 0.5 * (numpy.dot(cross013, cross013))**0.5

        cross123 = numpy.cross(v2 - v1, v3 - v1)
        area123 = 0.5 * (numpy.dot(cross123, cross123))**0.5

        cross203 = numpy.cross(v0 - v2, v3 - v2)
        area203 = 0.5 * (numpy.dot(cross203, cross203))**0.5

        area = area012 + area013 + area123 + area203
        r = 3.0 * vol / area
        self.minCellWidth = min(e01, e12, e20, e03, e13, e23, 6.38 * r)
        return
Example #54
0
    def _init(self):
        Component._init(self)
        
        self._alphabet = list(self.inventory.alphabet)
        self._base = len(self._alphabet)
        self._hashtable = self._hash(self._alphabet)

        return