ansys.dpf.core.field._LocalField#

class ansys.dpf.core.field._LocalField(field)#

Bases: ansys.dpf.core.field_base._LocalFieldBase, Field

Caches the internal data of a field so that it can be modified locally.

A single update request is to the server when the local field is deleted.

Parameters:

field (Field) – Field to copy

Examples

>>> from ansys.dpf import core as dpf
>>> import numpy as np
>>> num_entities = 3
>>> field_to_local = dpf.fields_factory.create_3d_vector_field(num_entities, location=dpf.locations.elemental_nodal)
>>> with field_to_local.as_local_field() as f:
...     for i in range(1,num_entities+1):
...         f.append(np.array([[0.1*i,0.2*i, 0.3*i],[0.1*i,0.2*i, 0.3*i]]),i)
...         f.get_entity_data(i-1),[[0.1*i,0.2*i, 0.3*i],[0.1*i,0.2*i, 0.3*i]]
(DPFArray([[0.1, 0.2, 0.3],
          [0.1, 0.2, 0.3]]), [[0.1, 0.2, 0.3], [0.1, 0.2, 0.3]])
(DPFArray([[0.2, 0.4, 0.6],
          [0.2, 0.4, 0.6]]), [[0.2, 0.4, 0.6], [0.2, 0.4, 0.6]])
(DPFArray([[0.3, 0.6, 0.9],
          [0.3, 0.6, 0.9]]), [[0.30000000000000004, 0.6000000000000001, 0.8999999999999999], [0.30000000000000004, 0.6000000000000001, 0.8999999999999999]])
_is_property_field = False#