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


Python ProblemDefinition.from_conf_file方法代码示例

本文整理汇总了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
开发者ID:taldcroft,项目名称:sfepy,代码行数:9,代码来源:extractor.py

示例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)
开发者ID:taldcroft,项目名称:sfepy,代码行数:50,代码来源:recovery.py


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