本文整理汇总了Python中sfepy.fem.Domain.fix_element_orientation方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.fix_element_orientation方法的具体用法?Python Domain.fix_element_orientation怎么用?Python Domain.fix_element_orientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfepy.fem.Domain
的用法示例。
在下文中一共展示了Domain.fix_element_orientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from sfepy.fem import Domain [as 别名]
# 或者: from sfepy.fem.Domain import fix_element_orientation [as 别名]
def main():
parser = OptionParser(usage = usage, version = "%prog " + sfepy.__version__)
parser.add_option( "-m", "--mesh",
action = "store_true", dest = "save_mesh",
default = True,
help = "save surface mesh [default: %default]" )
parser.add_option( "-n", "--no-surface",
action = "store_true", dest = "no_surface",
default = False,
help = "do not output surface [default: %default]" )
(options, args) = parser.parse_args()
if (len( args ) == 2):
filename_in = args[0];
filename_out = args[1];
else:
parser.print_help(),
return
if (filename_in == '-'):
file_in = sys.stdin
else:
file_in = open( filename_in, "r" );
mesh = Mesh.from_file( filename_in )
if (filename_in != '-'):
file_in.close()
domain = Domain('domain', mesh)
domain.setup_groups()
if domain.has_faces():
domain.fix_element_orientation()
domain.setup_facets(create_edges=False)
lst, surf_faces = domain.surface_faces()
surf_mesh = Mesh.from_surface( surf_faces, mesh )
if options.save_mesh:
aux = edit_filename(filename_in, prefix='surf_', new_ext='.mesh')
surf_mesh.write(aux, io='auto')
if options.no_surface:
return
gr_s = surface_graph( surf_faces, mesh.n_nod )
## import sfepy.base.plotutils as plu
## plu.spy( gr_s )
## plu.pylab.show()
n_comp, comps = surface_components( gr_s, surf_faces )
# print 'components:', n_comp
ccs, comps = comps, nm.zeros( (0,1), nm.int32 )
for cc in ccs:
comps = nm.concatenate( (comps, cc[:,nm.newaxis]), 0 )
out = nm.concatenate( (lst, comps), 1 )
if (filename_out == '-'):
file_out = sys.stdout
else:
file_out = open( filename_out, "w" );
for row in out:
file_out.write( '%d %d %d %d\n' % (row[0], row[1], row[2], row[3]) )
if (filename_out != '-'):
file_out.close()