当前位置: 首页>>代码示例>>Python>>正文


Python MeshIOAscii.filename方法代码示例

本文整理汇总了Python中pylith.meshio.MeshIOAscii.MeshIOAscii.filename方法的典型用法代码示例。如果您正苦于以下问题:Python MeshIOAscii.filename方法的具体用法?Python MeshIOAscii.filename怎么用?Python MeshIOAscii.filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylith.meshio.MeshIOAscii.MeshIOAscii的用法示例。


在下文中一共展示了MeshIOAscii.filename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_readwrite

# 需要导入模块: from pylith.meshio.MeshIOAscii import MeshIOAscii [as 别名]
# 或者: from pylith.meshio.MeshIOAscii.MeshIOAscii import filename [as 别名]
  def test_readwrite(self):
    """
    Test write() and read().
    """
    filenameIn = "data/mesh2Din3D.txt"
    filenameOut = "data/mesh2Din3D_test.txt"

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs._configure()

    io = MeshIOAscii()
    io.inventory.filename = filenameIn
    io.inventory.coordsys = cs
    io._configure()
    
    from spatialdata.units.Nondimensional import Nondimensional
    normalizer = Nondimensional()

    mesh = io.read(debug=False, interpolate=True)

    io.filename(filenameOut)
    io.write(mesh)

    fileE = open(filenameIn, "r")
    linesE = fileE.readlines()
    fileE.close()
    fileT = open(filenameOut, "r")
    linesT = fileT.readlines()
    fileT.close()

    self.assertEqual(len(linesE), len(linesT))
    for (lineE, lineT) in zip(linesE, linesT):
      self.assertEqual(lineE, lineT)
    return
开发者ID:panzhengyang,项目名称:pylith,代码行数:37,代码来源:TestMeshIOAscii.py

示例2: test_filename

# 需要导入模块: from pylith.meshio.MeshIOAscii import MeshIOAscii [as 别名]
# 或者: from pylith.meshio.MeshIOAscii.MeshIOAscii import filename [as 别名]
  def test_filename(self):
    """
    Test filename().
    """
    value = "hi.txt"

    io = MeshIOAscii()
    io.filename(value)
    self.assertEqual(value, io.filename())
    return
开发者ID:panzhengyang,项目名称:pylith,代码行数:12,代码来源:TestMeshIOAscii.py

示例3: test_readwrite

# 需要导入模块: from pylith.meshio.MeshIOAscii import MeshIOAscii [as 别名]
# 或者: from pylith.meshio.MeshIOAscii.MeshIOAscii import filename [as 别名]
  def test_readwrite(self):
    """
    Test read().
    """
    filenameGmvIn = "data/cube2_ascii.gmv"
    filenamePsetIn = "data/cube2_ascii.pset"
    filenameOut = "data/cube2_test.txt"
    filenameE = "data/cube2.txt"

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs._configure()

    # For now, we only test reading the file. We would like to write
    # the file and compare against the original.
    io = MeshIOLagrit()
    io.inventory.filenameGmv = filenameGmvIn
    io.inventory.filenamePset = filenamePsetIn
    io._configure()

    from spatialdata.units.Nondimensional import Nondimensional
    normalizer = Nondimensional()

    mesh = io.read(debug=False, interpolate=True)

    testhandler = MeshIOAscii()
    testhandler.filename(filenameOut)
    testhandler.coordsys = cs
    testhandler.write(mesh)

    fileE = open(filenameE, "r")
    linesE = fileE.readlines()
    fileE.close()
    fileT = open(filenameOut, "r")
    linesT = fileT.readlines()
    fileT.close()

    self.assertEqual(len(linesE), len(linesT))
    for (lineE, lineT) in zip(linesE, linesT):
      self.assertEqual(lineE, lineT)
    return
开发者ID:youngsolar,项目名称:pylith,代码行数:43,代码来源:TestMeshIOLagrit.py

示例4: test_readwrite

# 需要导入模块: from pylith.meshio.MeshIOAscii import MeshIOAscii [as 别名]
# 或者: from pylith.meshio.MeshIOAscii.MeshIOAscii import filename [as 别名]
    def test_readwrite(self):
        """
    Test read().
    """
        filenameIn = "data/twohex8.exo"
        filenameOut = "data/twohex8_test.txt"
        filenameE = "data/twohex8.txt"

        from spatialdata.geocoords.CSCart import CSCart

        cs = CSCart()
        cs._configure()

        # For now, we only test reading the file.
        io = MeshIOCubit()
        io.inventory.filename = filenameIn
        io.inventory.useNames = False
        io._configure()

        from spatialdata.units.Nondimensional import Nondimensional

        normalizer = Nondimensional()

        mesh = io.read(debug=False, interpolate=False)

        testhandler = MeshIOAscii()
        testhandler.filename(filenameOut)
        testhandler.coordsys = cs
        testhandler.write(mesh)

        fileE = open(filenameE, "r")
        linesE = fileE.readlines()
        fileE.close()
        fileT = open(filenameOut, "r")
        linesT = fileT.readlines()
        fileT.close()

        self.assertEqual(len(linesE), len(linesT))
        for (lineE, lineT) in zip(linesE, linesT):
            self.assertEqual(lineE, lineT)
        return
开发者ID:jjle,项目名称:pylith,代码行数:43,代码来源:TestMeshIOCubit.py


注:本文中的pylith.meshio.MeshIOAscii.MeshIOAscii.filename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。