本文整理汇总了Python中dolfin.Function.vector()[keys]方法的典型用法代码示例。如果您正苦于以下问题:Python Function.vector()[keys]方法的具体用法?Python Function.vector()[keys]怎么用?Python Function.vector()[keys]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dolfin.Function
的用法示例。
在下文中一共展示了Function.vector()[keys]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: montecarlo
# 需要导入模块: from dolfin import Function [as 别名]
# 或者: from dolfin.Function import vector()[keys] [as 别名]
def montecarlo(self, V, interface, **kwargs):
import _hybridmc as core
dims = kwargs.get("Omega")
bc = DirichletBC(V, 1.0, interface)
coords, keys = tools.get_boundary_coords(bc)
dim = len(dims)
nof_nodes = len(coords) / dim
D = np.array(dims, dtype=np.float_)
node_coord = np.array(coords, dtype=np.float_)
f = kwargs.get("f")
q = kwargs.get("q")
walks = kwargs.get("walks", 5000)
btol = kwargs.get("btol", 1e-13)
threads = kwargs.get("threads", 6)
mpi_workers = kwargs.get("mpi_workers", 0)
OpenCL = kwargs.get("OpenCL", False)
if OpenCL and not core.opencl:
print "**** WARNING **** : Module %s compiled without OpenCL supprt. Recompile with -DOPENCL_SUPPORT" % (
__name__
)
print "**** WARNING **** : Running multithread CPU version"
OpenCL = False
if not OpenCL:
f = Expression(f)
q = Expression(q)
value = core.montecarlo(D, dim, node_coord, nof_nodes, f, q, walks, btol, threads, mpi_workers)
est = Function(V)
est.vector()[keys] = value
mcbc = DirichletBC(V, est, interface)
return mcbc, est