本文整理汇总了Python中spatialdata.geocoords.CSCart.CSCart类的典型用法代码示例。如果您正苦于以下问题:Python CSCart类的具体用法?Python CSCart怎么用?Python CSCart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSCart类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
"""
Setup mesh and associated field.
"""
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
self.mesh = importer.read(debug=False, interpolate=False)
self.field = Field(self.mesh)
self.field.allocate()
return
开发者ID:jjle,项目名称:pylith,代码行数:26,代码来源:TestMeshField.py
示例2: setUp
def setUp(self):
"""
Setup mesh and associated field.
"""
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
self.mesh = importer.read(debug=False, interpolate=False)
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(self.mesh)
fields.add("disp t+dt", "displacement")
fields.solutionName("disp t+dt")
solution = fields.solution()
solution.newSection(solution.VERTICES_FIELD, self.mesh.dimension())
solution.allocate()
solution.zero()
self.fields = fields
self.jacobian = Jacobian(solution)
return
开发者ID:panzhengyang,项目名称:pylith,代码行数:32,代码来源:TestJacobian.py
示例3: test_databasemulti
def test_databasemulti(self):
locs = numpy.array([[2.3, -0.1, 1.8], [2.0, 0.4, -2.0]], numpy.float64)
cs = CSCart()
cs._configure()
queryVals = ["two", "one"]
dataE = numpy.array([[0.0207, 1.17], [0.0209, 1.15]], numpy.float64)
errE = numpy.array([0, 0], numpy.int32)
db = self._db
db.open()
db.queryVals(queryVals)
data = numpy.zeros(dataE.shape, dtype=numpy.float64)
err = numpy.zeros(errE.shape, dtype=numpy.int32)
db.multiquery(data, err, locs, cs)
db.close()
self.assertEqual(len(errE), len(err))
for vE, v in zip(errE, err):
self.assertEqual(vE, v)
self.assertEqual(len(dataE.shape), len(data.shape))
for dE, d in zip(dataE.shape, data.shape):
self.assertEqual(dE, d)
for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
self.assertAlmostEqual(vE, v, 6)
return
开发者ID:koson,项目名称:spatialdata,代码行数:27,代码来源:TestSimpleGridDB.py
示例4: test_readwrite
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,代码行数:35,代码来源:TestMeshIOAscii.py
示例5: _runTest
def _runTest(self, filenameIn, filenameOut, filenameOutE, faultGroup=None):
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
io = MeshIOAscii()
io.inventory.filename = filenameIn
io.inventory.coordsys = cs
io._configure()
mesh = io.read(debug=False, interpolate=True)
if not faultGroup is None:
from pylith.faults.FaultCohesiveKin import FaultCohesiveKin
fault = FaultCohesiveKin()
fault.inventory.matId = 10
fault.inventory.faultLabel = faultGroup
fault._configure()
nvertices = fault.numVerticesNoMesh(mesh)
firstFaultVertex = 0
firstLagrangeVertex = nvertices
firstFaultCell = 2*nvertices
fault.adjustTopology(mesh,
firstFaultVertex,
firstLagrangeVertex,
firstFaultCell)
from pylith.topology.RefineUniform import RefineUniform
refiner = RefineUniform()
meshRefined = refiner.refine(mesh)
return
开发者ID:youngsolar,项目名称:pylith,代码行数:35,代码来源:TestRefineUniform.py
示例6: test_database
def test_database(self):
locs = numpy.array([[3.5, 0.1, 0.8], [8.0, -0.4, 1.8]], numpy.float64)
cs = CSCart()
cs._configure()
queryVals = ["two", "one"]
dataE = numpy.array([[0.0220, 1.04], [0.0222, 1.02]], numpy.float64)
errE = [0, 0]
db = self._db
db.open()
db.queryVals(queryVals)
data = numpy.zeros(dataE.shape, dtype=numpy.float64)
err = []
nlocs = locs.shape[0]
for i in xrange(nlocs):
e = db.query(data[i, :], locs[i, :], cs)
err.append(e)
db.close()
self.assertEqual(len(errE), len(err))
for vE, v in zip(errE, err):
self.assertEqual(vE, v)
self.assertEqual(len(dataE.shape), len(data.shape))
for dE, d in zip(dataE.shape, data.shape):
self.assertEqual(dE, d)
for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
self.assertAlmostEqual(vE, v, 6)
return
开发者ID:koson,项目名称:spatialdata,代码行数:30,代码来源:TestSimpleGridDB.py
示例7: getCellSizeDB
def getCellSizeDB(points):
from spatialdata.geocoords.CSCart import CSCart
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
# Coordinate system for mesh (must match coordsys in ExodusII file)
cs = CSCart()
cs._configure()
cs.initialize()
# Spatial database with physical properties (Vs)
dbIO = SimpleIOAscii()
dbIO.inventory.filename = filenameDB
dbIO._configure()
db = SimpleDB()
db.inventory.iohandler = dbIO
db.inventory.label = "Physical properties"
db.inventory.queryType = "linear"
db._configure()
(npoints, spacedim) = points.shape
# Query database
db.open()
db.queryVals(["vs"])
data = numpy.zeros((npoints, 1), dtype=numpy.float64)
err = numpy.zeros((npoints,), dtype=numpy.int32)
db.multiquery(data, err, points, cs)
db.close()
vs = data[:,0]
cellSize = minPeriod*vs / 10.0
return cellSize
开发者ID:panzhengyang,项目名称:pylith,代码行数:34,代码来源:exodus_add_properties.py
示例8: test_preinitialize
def test_preinitialize(self):
"""
Test preinitialize().
WARNING: This is not a rigorous test of initialize() because we
don't verify the results.
"""
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 2
cell.inventory.order = 1
cell.inventory.degree = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature.inventory.minJacobian = 1.0e-4
quadrature._configure()
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
iohandler = SimpleIOAscii()
iohandler.inventory.filename = "data/matinitialize.spatialdb"
iohandler._configure()
db = SimpleDB()
db.inventory.label = "material properties"
db.inventory.iohandler = iohandler
db._configure()
from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
material = ElasticPlaneStrain()
material.inventory.quadrature = quadrature
material.inventory.dbProperties = db
material.inventory.label = "my material"
material.inventory.id = 54
material._configure()
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/twoelems.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
material.preinitialize(mesh)
# No test of result.
return
开发者ID:youngsolar,项目名称:pylith,代码行数:58,代码来源:TestMaterial.py
示例9: _preinitialize
def _preinitialize(self):
"""
Setup mesh and integrator and preinitialize integrator.
"""
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
# Setup mesh
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
# Setup material
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 2
cell.inventory.degree = 1
cell.inventory.order = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
iohandler = SimpleIOAscii()
iohandler.inventory.filename = "data/elasticplanestrain.spatialdb"
iohandler._configure()
db = SimpleDB()
db.inventory.label = "elastic plane strain"
db.inventory.iohandler = iohandler
db._configure()
from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
material = ElasticPlaneStrain()
material.inventory.label = "elastic plane strain"
material.inventory.id = 0
material.inventory.dbProperties = db
material.inventory.quadrature = quadrature
material._configure()
from pylith.meshio.OutputMatElastic import OutputMatElastic
material.output = OutputMatElastic()
material.output._configure()
material.output.writer._configure()
# Setup integrator
integrator = ElasticityImplicitLgDeform()
integrator.preinitialize(mesh, material)
return (mesh, integrator)
开发者ID:rishabhdutta,项目名称:pylith,代码行数:58,代码来源:TestElasticityImplicitLgDeform.py
示例10: test
def test(self):
"""
Test GenSimpleDBApp with 1-D data in 2-D space.
"""
from spatialdata.spatialdb.generator.GenSimpleDBApp import GenSimpleDBApp
from spatialdata.geocoords.CSCart import CSCart
from spatialdata.spatialdb.SimpleDB import SimpleDB
app = GenSimpleDBApp()
app.run()
# Test write using query
db = SimpleDB()
db.inventory.iohandler.inventory.filename = \
"data/gen1Din2D.spatialdb"
db.inventory.iohandler._configure()
db.inventory.label = "test"
db.inventory.queryType = "nearest"
db._configure()
qlocs = numpy.array( [[-2.0, 2.0],
[ 3.0, -4.0],
[ 0.0, 0.7]],
numpy.float64)
dataE = numpy.array( [[-0.15, 3.45],
[2.4, 6.4],
[-0.6, 3.45]], numpy.float64)
errE = [0, 0, 0]
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
db.open()
db.queryVals(["two", "one"])
data = numpy.zeros(dataE.shape, dtype=numpy.float64)
err = []
nlocs = qlocs.shape[0]
for i in xrange(nlocs):
e = db.query(data[i,:], qlocs[i,:], cs)
err.append(e)
db.close()
self.assertEqual(len(errE), len(err))
for vE, v in zip(errE, err):
self.assertEqual(vE, v)
self.assertEqual(len(dataE.shape), len(data.shape))
for dE, d in zip(dataE.shape, data.shape):
self.assertEqual(dE, d)
for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
self.assertAlmostEqual(vE, v, 6)
return
开发者ID:koson,项目名称:spatialdata,代码行数:56,代码来源:TestGenSimpleDBApp.py
示例11: _initialize
def _initialize(self):
"""
Initialize DirichletBoundary boundary condition.
"""
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
from spatialdata.spatialdb.SimpleDB import SimpleDB
db = SimpleDB()
db.inventory.label = "TestDirichletBoundary tri3"
db.inventory.iohandler.inventory.filename = "data/tri3_disp.spatialdb"
db.inventory.iohandler._configure()
db._configure()
from spatialdata.spatialdb.SimpleDB import SimpleDB
dbRate = SimpleDB()
dbRate.inventory.label = "TestDirichletBoundary tri3"
dbRate.inventory.iohandler.inventory.filename = "data/tri3_vel.spatialdb"
dbRate.inventory.iohandler._configure()
dbRate._configure()
from pylith.bc.DirichletBoundary import DirichletBoundary
bc = DirichletBoundary()
bc.inventory.output._configure()
bc.inventory.output.writer._configure()
bc.inventory.label = "bc"
bc.inventory.bcDOF = [1]
bc.inventory.dbInitial = db
bc.inventory.dbRate = dbRate
bc._configure()
bc.preinitialize(mesh)
bc.initialize(totalTime=0.0, numTimeSteps=1, normalizer=normalizer)
# Setup field
from pylith.topology.Field import Field
field = Field(mesh)
field.newSection(field.VERTICES_FIELD, cs.spaceDim())
return (mesh, bc, field)
开发者ID:jjle,项目名称:pylith,代码行数:53,代码来源:TestDirichletBoundary.py
示例12: test_coordsys
def test_coordsys(self):
"""
Test coordsys().
"""
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
mesh = Mesh()
mesh.coordsys(cs)
self.assertEqual(cs.spaceDim(), mesh.coordsys().spaceDim())
return
开发者ID:geodynamics,项目名称:pylith,代码行数:13,代码来源:TestMesh.py
示例13: run
def run(self):
"""
Generate the database.
"""
# Domain
x = numpy.arange(-4000.0, 4000.1, 1000.0)
y = numpy.arange(-4000.0, 4000.1, 1000.0)
z = numpy.arange(-6000.0, 0000.1, 1000.0)
nptsX = x.shape[0]
nptsY = y.shape[0]
nptsZ = z.shape[0]
xx = x * numpy.ones( (nptsY*nptsZ, 1), dtype=numpy.float64)
yy0 = y * numpy.ones( (nptsZ, 1), dtype=numpy.float64)
yy = yy0.ravel() * numpy.ones( (nptsX, 1), dtype=numpy.float64)
zz = z * numpy.ones( (nptsX*nptsY, 1), dtype=numpy.float64)
xyz = numpy.zeros( (nptsX*nptsY*nptsZ, 3), dtype=numpy.float64)
xyz[:,0] = numpy.ravel(xx)
xyz[:,1] = numpy.ravel(numpy.transpose(yy))
xyz[:,2] = numpy.ravel(numpy.transpose(zz))
from rigidbody_soln import AnalyticalSoln
soln = AnalyticalSoln()
disp = soln.displacement(xyz)
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 3
cs._configure()
data = {'locs': xyz,
'coordsys': cs,
'data_dim': 2,
'values': [{'name': "displacement-x",
'units': "m",
'data': numpy.ravel(disp[:,0])},
{'name': "displacement-y",
'units': "m",
'data': numpy.ravel(disp[:,1])},
{'name': "displacement-z",
'units': "m",
'data': numpy.ravel(disp[:,2])}]}
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
io = SimpleIOAscii()
io.inventory.filename = "rigidbody_disp.spatialdb"
io._configure()
io.write(data)
return
开发者ID:jjle,项目名称:pylith,代码行数:48,代码来源:rigidbody_gendb.py
示例14: run
def run(self):
"""
Generate the database.
"""
# Domain
x = numpy.arange(-4000.0, 4000.1, 500.0)
y = numpy.arange(-4000.0, 4000.1, 500.0)
z = numpy.arange(-6000.0, 0.1, 500.0)
nxpts = x.shape[0]
nypts = y.shape[0]
nzpts = z.shape[0]
xx = numpy.tile(x, (1,nypts*nzpts))
yy = numpy.tile(y, (nxpts,nzpts)).transpose()
zz = numpy.tile(z, (nxpts*nypts,1)).transpose()
xyz = numpy.zeros( (nxpts*nypts*nzpts, 3), dtype=numpy.float64)
xyz[:,0] = numpy.ravel(xx)
xyz[:,1] = numpy.ravel(yy)
xyz[:,2] = numpy.ravel(zz)
from axialdisp_soln import AnalyticalSoln
soln = AnalyticalSoln()
disp = soln.displacement(xyz)
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 3
cs._configure()
data = {'points': xyz,
'coordsys': cs,
'data_dim': 3,
'values': [{'name': "displacement-x",
'units': "m",
'data': numpy.ravel(disp[:,0])},
{'name': "displacement-y",
'units': "m",
'data': numpy.ravel(disp[:,1])},
{'name': "displacement-z",
'units': "m",
'data': numpy.ravel(disp[:,2])}]}
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
io = SimpleIOAscii()
io.inventory.filename = "axial_disp.spatialdb"
io._configure()
io.write(data)
return
开发者ID:jjle,项目名称:pylith,代码行数:48,代码来源:axialdisp_gendb.py
示例15: run
def run(self):
"""
Generate the database.
"""
from sheardisp_soln import AnalyticalSoln
soln = AnalyticalSoln()
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 3
cs._configure()
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
io = SimpleIOAscii()
for component in ["x","y","z"]:
if component == "y":
xyz = numpy.array([[-40.0e+3, 0.0, 0.0],
[+40.0e+3, 0.0, 0.0]], dtype=numpy.float64)
ic = 1
elif component == "x":
xyz = numpy.array([[0.0, -40.0e+3, 0.0],
[0.0, +40.0e+3, 0.0]], dtype=numpy.float64)
ic = 0
elif component == "z":
xyz = numpy.array([[0.0, 0.0, -40.0e+3],
[0.0, 0.0, 0.0]], dtype=numpy.float64)
ic = 2
disp = soln.displacement(xyz)
io.inventory.filename = "shear_disp%s.spatialdb" % component
io._configure()
data = {'points': xyz,
'coordsys': cs,
'data_dim': 1,
'values': [{'name': "displacement-%s" % component,
'units': "m",
'data': numpy.ravel(disp[0,:,ic])},
]}
io.write(data)
return
开发者ID:rishabhdutta,项目名称:pylith,代码行数:42,代码来源:sheardisp_gendb.py
示例16: run
def run(self):
"""
Generate the database.
"""
# Domain
x = numpy.arange(-4000.0, 4000.1, 1000.0)
y = numpy.arange(-4000.0, 4000.1, 1000.0)
npts = x.shape[0]
xx = x * numpy.ones((npts, 1), dtype=numpy.float64)
yy = y * numpy.ones((npts, 1), dtype=numpy.float64)
xy = numpy.zeros((npts ** 2, 2), dtype=numpy.float64)
xy[:, 0] = numpy.ravel(xx)
xy[:, 1] = numpy.ravel(numpy.transpose(yy))
from sheardisp_soln import AnalyticalSoln
soln = AnalyticalSoln()
disp = soln.displacement(xy)
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
data = {
"points": xy,
"coordsys": cs,
"data_dim": 2,
"values": [
{"name": "displacement-x", "units": "m", "data": numpy.ravel(disp[0, :, 0])},
{"name": "displacement-y", "units": "m", "data": numpy.ravel(disp[0, :, 1])},
],
}
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
io = SimpleIOAscii()
io.inventory.filename = "shear_disp.spatialdb"
io._configure()
io.write(data)
return
开发者ID:panzhengyang,项目名称:pylith,代码行数:42,代码来源:sheardisp_gendb.py
示例17: run
def run(self):
"""
Generate the database.
"""
# Domain
dx = 200.0
x = numpy.arange(-1000.0, 1000.1, dx)
y = numpy.arange(-1000.0, 0.1, dx)
nptsx = x.shape[0]
nptsy = y.shape[0]
xx = x * numpy.ones( (nptsy, 1), dtype=numpy.float64)
yy = y * numpy.ones( (nptsx, 1), dtype=numpy.float64)
xy = numpy.zeros( (nptsx*nptsy, 2), dtype=numpy.float64)
xy[:,0] = numpy.ravel(xx)
xy[:,1] = numpy.ravel(numpy.transpose(yy))
from compressrotate_soln import AnalyticalSoln
soln = AnalyticalSoln()
disp = soln.displacement(xy)
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
data = {'points': xy,
'coordsys': cs,
'data_dim': 2,
'values': [{'name': "displacement-x",
'units': "m",
'data': numpy.ravel(disp[0,:,0])},
{'name': "displacement-y",
'units': "m",
'data': numpy.ravel(disp[0,:,1])}]}
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
io = SimpleIOAscii()
io.inventory.filename = "compressrotate_disp.spatialdb"
io._configure()
io.write(data)
return
开发者ID:geodynamics,项目名称:pylith,代码行数:41,代码来源:compressrotate_gendb.py
示例18: test_readwrite
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,代码行数:41,代码来源:TestMeshIOLagrit.py
示例19: test_readwrite
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,代码行数:41,代码来源:TestMeshIOCubit.py
示例20: _getMesh
def _getMesh(self):
"""
Get mesh from file.
"""
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
return mesh
开发者ID:youngsolar,项目名称:pylith,代码行数:21,代码来源:TestSubMesh.py
注:本文中的spatialdata.geocoords.CSCart.CSCart类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论