pystencils.grids.protocols.IField#

class pystencils.grids.protocols.IField(*args, **kwargs)#

Interface for algebraic fields to the pystencils code generator.

Algebraic fields in pystencils are functions

\[f: I \to \mathcal{D}\]

from an index space \(I \subset \mathbb{Z}^{k}\) to some domain \(\mathcal{D}\). The dimensionality \(k\) is the field’s spatial rank (or just rank). In code generation, fields are backed by \(m\)-dimensional memory buffers (where \(m \ge k\)). The IField protocol defines the interface any algebraic field type must define to communicate its memory properties to the code generator.

Each algebraic field type must provide the following information to the code generator:

  • its name;

  • its memory data type (dtype);

  • its buffer specification defining the required memory properties of the field’s underlying buffers;

  • its iteration limits defining the valid index space for a kernel’s spatial iteration.

property name: str#

Name of the field

property dtype: PsType | DynamicType#

Data type of the field’s elements

get_buffer_spec()#

Return the buffer specification defining the field’s memory properties

Return type:

FieldBufferSpec

get_iteration_limits()#

Return the iteration limits for kernels operating on this field

Return type:

IterationLimits