pystencils.field.Field.create_generic

pystencils.field.Field.create_generic#

static Field.create_generic(field_name, spatial_dimensions, dtype=DynamicType.NUMERIC_TYPE, index_dimensions=0, layout='numpy', index_shape=None, field_type=FieldType.GENERIC)#

Creates a generic field where the field size is not fixed i.e. can be called with arrays of different sizes.

Field Element Type By default, the data type of the field entries is left undetermined until code generation, at which point it is set to the default numerical type of the kernel. You can specify a concrete type using the dtype parameter.

Parameters:
  • field_name – symbolic name for the field

  • dtype (str | type | dtype | PsType | DynamicType) – Data type of the field entries

  • spatial_dimensions – see documentation of Field

  • index_dimensions – see documentation of Field

  • layout – tuple specifying the loop ordering of the spatial dimensions e.g. (2, 1, 0 ) means that the outer loop loops over dimension 2, the second outer over dimension 1, and the inner loop over dimension 0. Also allowed: the strings ‘numpy’ (0,1,..d) or ‘reverse_numpy’ (d, …, 1, 0)

  • index_shape – optional shape of the index dimensions i.e. maximum values allowed for each index dimension, has to be a list or tuple

  • field_type – besides the normal GENERIC fields, there are INDEXED fields that store indices of the domain that should be iterated over, BUFFER fields that are used to generate communication packing/unpacking kernels, and STAGGERED fields, which store values half-way to the next cell

Return type:

Field