本文整理汇总了Python中sfepy.base.conf.ProblemConf.from_module方法的典型用法代码示例。如果您正苦于以下问题:Python ProblemConf.from_module方法的具体用法?Python ProblemConf.from_module怎么用?Python ProblemConf.from_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfepy.base.conf.ProblemConf
的用法示例。
在下文中一共展示了ProblemConf.from_module方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stokes_slip_bc
# 需要导入模块: from sfepy.base.conf import ProblemConf [as 别名]
# 或者: from sfepy.base.conf.ProblemConf import from_module [as 别名]
def test_stokes_slip_bc(self):
import scipy.sparse as sp
from sfepy.base.conf import ProblemConf
from sfepy.discrete import Problem
import examples.navier_stokes.stokes_slip_bc as ssb
conf = ProblemConf.from_module(ssb)
pb = Problem.from_conf(conf, init_solvers=False)
pb.time_update()
variables = pb.get_variables()
adi = variables.adi
lcdi = variables.lcdi
mtx = variables.mtx_lcbc
ok = adi.var_names == lcdi.var_names
self.report('same adi-lcdi ordering:', ok)
ublock = mtx[adi.indx['u']]
ir, ic = ublock.nonzero()
ir += adi.indx['u'].start
i0, i1 = adi.indx['u'].start, adi.indx['u'].stop
_ok0 = (i0 <= ir).all() and (ir < i1).all()
self.report('u block rows in [%d %d[: %s' % (i0, i1, _ok0))
i0, i1 = lcdi.indx['u'].start, lcdi.indx['u'].stop
_ok1 = (i0 <= ic).all() and (ic < i1).all()
self.report('u block cols in [%d %d[: %s' % (i0, i1, _ok1))
ok = ok and _ok0 and _ok1
pblock = mtx[adi.indx['p']]
ir, ic, iv = sp.find(pblock)
ir += adi.indx['p'].start
i0, i1 = adi.indx['p'].start, adi.indx['p'].stop
_ok0 = (i0 <= ir).all() and (ir < i1).all()
self.report('p block rows in [%d %d[: %s' % (i0, i1, _ok0))
i0, i1 = lcdi.indx['p'].start, lcdi.indx['p'].stop
_ok1 = (i0 <= ic).all() and (ic < i1).all()
self.report('p block cols in [%d %d[: %s' % (i0, i1, _ok1))
ok = ok and _ok0 and _ok1
_ok0 = (len(ir) == adi.n_dof['p'])
self.report('p block size correct:', _ok0)
_ok1 = ((ir - adi.indx['p'].start) == (ic - lcdi.indx['p'].start)).all()
self.report('p block diagonal:', _ok1)
_ok2 = (iv == 1.0).all()
self.report('p block identity:', _ok2)
ok = ok and _ok0 and _ok1 and _ok2
return ok