本文整理汇总了Python中start.start_cubit函数的典型用法代码示例。如果您正苦于以下问题:Python start_cubit函数的具体用法?Python start_cubit怎么用?Python start_cubit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了start_cubit函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plane
def plane(cfg):
import sys,os
from math import sqrt
from utilities import geo2utm
import start as start
#
#
cubit = start.start_cubit()
#
#
command = "reset"
cubit.cmd(command)
#
#
for p in [cfg.x1,cfg.x2,cfg.x3,cfg.x4]:
x_current,y_current=geo2utm(p[0],p[1],cfg.unit)
cubitcommand= 'create vertex '+ str( x_current )+ ' ' + str( y_current) +' '+ str( p[2] )
cubit.cmd(cubitcommand)
#
cubitcommand= 'create surface vertex 1 2 3 4'
cubit.cmd(cubitcommand)
command = "del vertex all"
cubit.cmd(command)
command = "save as 'plane.cub' overwrite"
cubit.cmd(command)
#
#
#
cubit.cmd("set info "+cfg.cubit_info)
cubit.cmd("set echo "+cfg.echo_info)
cubit.cmd("set journal "+cfg.jou_info)
开发者ID:EtienneBachmann,项目名称:specfem3d,代码行数:31,代码来源:surfaces.py
示例2: runimport
def runimport(geometryfile, iproc, filename=None):
import start as start
cubit = start.start_cubit()
cfg = start.start_cfg(filename=filename)
file1 = cfg.output_dir + '/' + geometryfile
cubitcommand = 'open "' + file1 + '" '
cubit.cmd(cubitcommand)
开发者ID:carltape,项目名称:specfem3d,代码行数:7,代码来源:utilities.py
示例3: runsave
def runsave(geometryfile,iproc,filename=None):
import start as start
cubit = start.start_cubit()
cfg = start.start_cfg(filename=filename)
flag=[0]
ner=cubit.get_error_count()
cubitcommand= 'save as "'+ cfg.output_dir+'/'+geometryfile+ '" overwrite'
cubit.cmd(cubitcommand)
ner2=cubit.get_error_count()
if ner == ner2:
flag=[1]
return flag
开发者ID:AlaaHadji,项目名称:specfem3d,代码行数:12,代码来源:utilities.py
示例4: check_orientation
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# GEOCUBIT is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with GEOCUBIT. If not, see <http://www.gnu.org/licenses/>. #
# #
#############################################################################
try:
import start as start
cubit = start.start_cubit()
except:
try:
import cubit
except:
print 'error importing cubit, check if cubit is installed'
pass
numpy = start.start_numpy()
def check_orientation(grdfileNAME):
try:
grdfile = open(grdfileNAME, 'r')
print 'reading ',grdfileNAME
except:
开发者ID:EtienneBachmann,项目名称:specfem3d,代码行数:31,代码来源:local_volume.py
示例5: surface_skin
def surface_skin(isurface=0,cfgname=None):
"""
create an acis surface interpolating no-intersecting lines
"""
import sys,os
from math import sqrt
from utilities import geo2utm
import start as start
#
#
cubit = start.start_cubit()
cfg = start.start_cfg(cfgname)
#
def define_next_line(directionx,directiony,n,data):
ndata=len(data)
command=''
ind=n
try:
record=data[ind]
except:
return False,False
try:
x,y,z=map(float,record.split())
except:
return False,False
txt=' Position ' + record
command=command+txt
x_store,y_store,z_store = x,y,z
icount=1
while True:
ind+=1
if ind >= ndata: return ind,command
record=data[ind]
try:
x,y,z=map(float,record.split())
except:
return ind,command
dx,dy = x-x_store,y-y_store
if directionx == 0 and dy/abs(dy) * directiony >= 0:
txt=' Position ' + record
command=command+txt
icount+=1
x_store,y_store,z_store = x,y,z
elif directiony == 0 and dx/abs(dx) == directionx :
txt=' Position ' + record
command=command+txt
icount+=1
x_store,y_store,z_store = x,y,z
else:
if icount==1:
x,y,z=x_store+1e-4*directionx,y_store+1e-4*directiony,z_store
txt=' Position ' +str(x)+ ' '+str(y)+ ' '+str(z)
command=command+txt
return ind,command
def create_line(position):
if position:
last_curve_store=cubit.get_last_id("curve")
command='create curve spline '+position
cubit.silent_cmd(command)
last_curve=cubit.get_last_id("curve")
if last_curve != last_curve_store:
return last_curve
else:
return False
else:
return False
command = "reset"
cubit.cmd(command)
#
position=True
#
try:
grdfile = open(cfg.surface_name[isurface], 'r')
except:
raise NameError, 'No such file or directory: '+ str( cfg.surface_name[isurface] )
#
directionx=cfg.directionx[isurface]
directiony=cfg.directiony[isurface]
step=cfg.step[isurface]
position=True
curveskin=[]
count_line=0
data=grdfile.read().split('\n')
ndata=len(data)
n=0
#
#
command = "set echo off"
cubit.cmd(command)
command = "set journal off"
cubit.cmd(command)
command = "set info off"
cubit.cmd(command)
#
while position:
index,position=define_next_line(directionx,directiony,n,data)
if n%step == 0:
curve=create_line(position)
if curve: curveskin.append(curve)
#.........这里部分代码省略.........
开发者ID:EtienneBachmann,项目名称:specfem3d,代码行数:101,代码来源:surfaces.py
注:本文中的start.start_cubit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论