本文整理汇总了Python中sfepy.base.base.Struct.offsets方法的典型用法代码示例。如果您正苦于以下问题:Python Struct.offsets方法的具体用法?Python Struct.offsets怎么用?Python Struct.offsets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfepy.base.base.Struct
的用法示例。
在下文中一共展示了Struct.offsets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_evaluate_cache
# 需要导入模块: from sfepy.base.base import Struct [as 别名]
# 或者: from sfepy.base.base.Struct import offsets [as 别名]
def get_evaluate_cache(self, cache=None, share_geometry=False,
verbose=False):
"""
Get the evaluate cache for :func:`Variable.evaluate_at()
<sfepy.discrete.variables.Variable.evaluate_at()>`.
Parameters
----------
cache : Struct instance, optional
Optionally, use the provided instance to store the cache data.
share_geometry : bool
Set to True to indicate that all the probes will work on the same
domain. Certain data are then computed only for the first probe and
cached.
verbose : bool
If False, reduce verbosity.
Returns
-------
cache : Struct instance
The evaluate cache.
"""
try:
from scipy.spatial import cKDTree as KDTree
except ImportError:
from scipy.spatial import KDTree
if cache is None:
cache = Struct(name='evaluate_cache')
tt = time.clock()
if (cache.get('iconn', None) is None) or not share_geometry:
mesh = self.mesh
offsets, iconn = make_inverse_connectivity(mesh.conns, mesh.n_nod,
ret_offsets=True)
ii = nm.where(offsets[1:] == offsets[:-1])[0]
if len(ii):
raise ValueError('some vertices not in any element! (%s)' % ii)
cache.offsets = offsets
cache.iconn = iconn
output('iconn: %f s' % (time.clock()-tt), verbose=verbose)
tt = time.clock()
if (cache.get('kdtree', None) is None) or not share_geometry:
cache.kdtree = KDTree(mesh.coors)
output('kdtree: %f s' % (time.clock()-tt), verbose=verbose)
return cache