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


Python CSCart.setSpaceDim方法代码示例

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


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

示例1: reverse

# 需要导入模块: from spatialdata.geocoords.CSCart import CSCart [as 别名]
# 或者: from spatialdata.geocoords.CSCart.CSCart import setSpaceDim [as 别名]
# (negative, y is negative)
tractions_bg_normal = density*gacc*(vertices[:,1])

# Background shear tractions are reverse (in 2-D right-lateral is negative)
# because the normal tractions are negative.
tractions_bg_shear = coef_friction*tractions_bg_normal

# Combine traction changes and background tractions
tractions_shear = tractions_bg_shear + tractions_change[:,0]
tractions_normal = tractions_bg_normal + tractions_change[:,1]

# Create coordinate system for spatial database
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(2)

# Create writer for spatial database file
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
writer = SimpleIOAscii()
writer.inventory.filename = "afterslip_tractions.spatialdb"
writer._configure()
writer.write({'points': vertices,
              'coordsys': cs,
              'data_dim': 1,
              'values': [{'name': "traction-shear",
                          'units': "Pa",
                          'data': tractions_shear},
                         {'name': "traction-normal",
                          'units': "Pa",
                          'data': tractions_normal}]})
开发者ID:panzhengyang,项目名称:pylith,代码行数:33,代码来源:afterslip_tractions.py

示例2: CSCart

# 需要导入模块: from spatialdata.geocoords.CSCart import CSCart [as 别名]
# 或者: from spatialdata.geocoords.CSCart.CSCart import setSpaceDim [as 别名]
#!/usr/bin/env python
"""
This script creates a spatial database for the initial stress and state
variables for a Drucker-Prager 3D elastoplastic material.
"""

material = "dp3d"

import numpy
import h5py

from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(3)

filenameH5 = "output/grav_static_%s-visco.h5" % material
filenameDB = "grav_statevars-%s.spatialdb" % material

# Open HDF5 file and get coordinates, cells, and stress.
h5 = h5py.File(filenameH5, "r")
vertices = h5['geometry/vertices'][:]
cells = numpy.array(h5['topology/cells'][:], dtype=numpy.int)
stress = h5['cell_fields/stress'][0,:,:]
strain = h5['cell_fields/total_strain'][0,:,:]
strainPlastic = h5['cell_fields/plastic_strain'][0,:,:]
h5.close()

# Get cell centers for output.
cellCoords = vertices[cells,:]
开发者ID:geodynamics,项目名称:pylith,代码行数:33,代码来源:gen_dp3d_statedb.py


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