示例#1
0
    def getField(self, fieldID, time):
        Data = pyvtk.VtkData('micress/sim.vtk')
        mupif.log.debug(Data.header)

        dim=[]
        dim=Data.structure.dimensions
        mupif.log.debug(dim)

        #Number of nodes in each direction
        nx=dim[0]
        ny=dim[1]
        nz=dim[2]

        #coordinates of the points
        coords=[]
        coords= Data.structure.get_points()

        numNodes = Data.point_data.length
        mupif.log.debug(numNodes)

        if (self.mesh == None):
            self.mesh = VtkReader2.readMesh(numNodes,nx,ny,nz,coords)

        f = VtkReader2.readField(self.mesh, Data,FieldID.FID_Concentration, "conc1", "micress/sim.vtk", 1)
        return f
示例#2
0
    def test_ReadField(self):
        THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
        my_file = os.path.join(THIS_FOLDER, 'testVtkReader2.vtk')
        my_file = open(THIS_FOLDER + '/testVtkReader2.vtk', 'rb')
        Data = pyvtk.VtkData(my_file)

        dim = []
        dim = Data.structure.dimensions
        #Number of nodes in each direction
        nx = dim[0]
        ny = dim[1]
        nz = dim[2]
        #coordinates of the points
        coords = []
        coords = Data.structure.get_points()
        #numNodes = Data.point_data.length
        numNodes = len(coords)
        mesh = VtkReader2.readMesh(numNodes, nx, ny, nz, coords)

        fc = VtkReader2.readField(
            mesh, Data, FieldID.FID_Concentration,
            Physics.PhysicalQuantities.getDimensionlessUnit(), "s", "conc",
            my_file, 1)
        self.assertTrue(fc.fieldID == FieldID.FID_Concentration)
        self.assertTrue(fc.fieldType == Field.FieldType.FT_vertexBased)
示例#3
0
    def getField(self, fieldID, time):
        Data = pyvtk.VtkData('micress/sim.vtk')
        log.debug(Data.header)

        dim = []
        dim = Data.structure.dimensions
        log.debug(dim)

        #Number of nodes in each direction
        nx = dim[0]
        ny = dim[1]
        nz = dim[2]

        #coordinates of the points
        coords = []
        coords = Data.structure.get_points()

        numNodes = Data.point_data.length
        log.debug(numNodes)

        if (self.mesh == None):
            self.mesh = VtkReader2.readMesh(numNodes, nx, ny, nz, coords)

        f = VtkReader2.readField(self.mesh, Data, FieldID.FID_Concentration,
                                 PQ.getDimensionlessUnit(), timeUnits, "conc1",
                                 "micress/sim.vtk", 1)
        return f
示例#4
0
    def test_ReadMesh(self):
        m = VtkReader2.readMesh(8, 2, 2, 2, ((0., 0., 0.), (1., 0., 0.),(1., 1., 0.),(0., 1., 0.),(0., 0., 1.), (1., 0., 1.),(1., 1., 1.),(0., 1., 1.)))
        nV = m.getNumberOfVertices()
        nC = m.getNumberOfCells()

        self.assertTrue(nV == 8)
        self.assertTrue(nC == 1)
示例#5
0
from __future__ import print_function

import sys
sys.path.append('../../..')
sys.path.append('.')
import mupif
from mupif import VtkReader2
from mupif import Application
from mupif import FieldID
import pyvtk
## 
VtkReader2.pyvtk_monkeypatch()


class Micress(Application.Application):

    def __init__ (self, file):
        super(Micress, self).__init__(file)
        self.mesh = None
        super(Micress, self).__init__(file)

    def getField(self, fieldID, time):
        Data = pyvtk.VtkData('micress/sim.vtk')
        mupif.log.debug(Data.header)

        dim=[]
        dim=Data.structure.dimensions
        mupif.log.debug(dim)

        #Number of nodes in each direction
        nx=dim[0]
示例#6
0
import sys
sys.path.append('../../..')
sys.path.append('.')
from mupif import VtkReader2
from mupif import Model
from mupif import FieldID
import pyvtk
import logging
log = logging.getLogger()

import mupif.Physics.PhysicalQuantities as PQ
timeUnits = PQ.PhysicalUnit('s', 1., [0, 0, 1, 0, 0, 0, 0, 0, 0])
##
VtkReader2.pyvtk_monkeypatch()


class Micress(Model.Model):
    def __init__(self, file):
        super(Micress, self).__init__(file)
        self.mesh = None
        super(Micress, self).__init__(file)

    def getField(self, fieldID, time):
        Data = pyvtk.VtkData('micress/sim.vtk')
        log.debug(Data.header)

        dim = []
        dim = Data.structure.dimensions
        log.debug(dim)

        #Number of nodes in each direction