本文整理汇总了Python中sfepy.fem.ProblemDefinition.from_conf_file方法的典型用法代码示例。如果您正苦于以下问题:Python ProblemDefinition.from_conf_file方法的具体用法?Python ProblemDefinition.from_conf_file怎么用?Python ProblemDefinition.from_conf_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfepy.fem.ProblemDefinition
的用法示例。
在下文中一共展示了ProblemDefinition.from_conf_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_problem
# 需要导入模块: from sfepy.fem import ProblemDefinition [as 别名]
# 或者: from sfepy.fem.ProblemDefinition import from_conf_file [as 别名]
def create_problem(filename):
from sfepy.fem import ProblemDefinition
problem = ProblemDefinition.from_conf_file(filename,
init_equations=False,
init_solvers=False)
return problem
示例2: recover_micro_hook
# 需要导入模块: from sfepy.fem import ProblemDefinition [as 别名]
# 或者: from sfepy.fem.ProblemDefinition import from_conf_file [as 别名]
def recover_micro_hook( micro_filename, region, macro,
naming_scheme = 'step_iel',
recovery_file_tag='' ):
# Create a micro-problem instance.
required, other = get_standard_keywords()
required.remove( 'equations' )
pb = ProblemDefinition.from_conf_file(micro_filename,
required=required,
other=other,
init_equations=False,
init_solvers=False)
coefs_filename = pb.conf.options.get_default_attr('coefs_filename', 'coefs')
output_dir = pb.conf.options.get_default_attr('output_dir', '.')
coefs_filename = op.join(output_dir, coefs_filename) + '.h5'
# Coefficients and correctors
coefs = Coefficients.from_file_hdf5( coefs_filename )
corrs = get_correctors_from_file( dump_names = coefs.dump_names )
recovery_hook = get_default_attr( pb.conf.options,
'recovery_hook', None )
if recovery_hook is not None:
recovery_hook = getattr( pb.conf.funmod, recovery_hook )
aux = max(pb.domain.shape.n_gr, 2)
format = get_print_info( aux, fill = '0' )[1] \
+ '_' + get_print_info( pb.domain.mesh.n_el, fill = '0' )[1]
for ig, ii, iel in region.iter_cells():
print 'ig: %d, ii: %d, iel: %d' % (ig, ii, iel)
local_macro = {}
for k, v in macro.iteritems():
local_macro[k] = v[ii,0]
out = recovery_hook( pb, corrs, local_macro )
# save data
suffix = format % (ig, iel)
micro_name = pb.get_output_name(extra='recovered_'\
+ recovery_file_tag + suffix)
filename = op.join(output_dir, op.basename(micro_name))
fpv = pb.conf.options.get_default_attr('file_per_var', False)
pb.save_state(filename, out=out,
file_per_var=fpv)