Skip to main content

FieldSlot

C++: phynexis::fields::FieldSlot Python: phynexis.fields.FieldSlot Header: src/fields/core/field_slot.hpp

Description

FieldSlot describes a single field entry within a FieldSchema. It stores the field's name, type, dimension, and component naming rules. Think of it as a blueprint for one column in a structured data layout.

FieldSlot is a plain data struct exposed to Python with read/write attributes.

Constructors

FieldSlot()

Creates a default slot with name "default", FieldType.Scalar, ValueType.Double, and dimension 1.

Example:

import phynexis
slot = phynexis.fields.FieldSlot()
print(slot.name, slot.field_type, slot.value_type, slot.dimension)

Output:

default FieldType.Scalar ValueType.Double 1

Factory Methods

Factory methods are the recommended way to create FieldSlot instances. They set sensible defaults and generate appropriate component names.

FieldSlot.make_scalar(name, type=ValueType.Double)

Creates a scalar slot.

Parameters:

ParameterTypeDefaultDescription
namestrField name
typeValueTypeValueType.DoubleValue type

Returns: FieldSlot

Example:

import phynexis
F = phynexis.fields

s = F.FieldSlot.make_scalar("pressure", F.ValueType.Double)
print(s.name, s.dimension, s.get_field_names())

Output:

pressure 1 ['pressure']

FieldSlot.make_vec3(name, type=ValueType.Double)

Creates a 3-component vector slot. Component names default to ['x', 'y', 'z'].

Parameters:

ParameterTypeDefaultDescription
namestrBase name (prefix)
typeValueTypeValueType.DoubleValue type

Returns: FieldSlot

Example:

import phynexis
F = phynexis.fields

s = F.FieldSlot.make_vec3("velocity")
print(s.get_field_names())
print(s.get_component_names())

Output:

['velocity.x', 'velocity.y', 'velocity.z']
['x', 'y', 'z']

FieldSlot.make_vec4(name, type=ValueType.Double)

Creates a 4-component vector slot. Component names default to ['x', 'y', 'z', 'w'].

Parameters:

ParameterTypeDefaultDescription
namestrBase name
typeValueTypeValueType.DoubleValue type

Returns: FieldSlot

FieldSlot.make_vec6(name, type=ValueType.Double)

Creates a 6-component vector slot. Component names default to ['xx', 'yy', 'zz', 'xy', 'xz', 'yz'].

Parameters:

ParameterTypeDefaultDescription
namestrBase name
typeValueTypeValueType.DoubleValue type

Returns: FieldSlot

FieldSlot.make_vecn(name, dimension, type=ValueType.Double, delimiter=".", component_names=[])

Creates an N-component vector slot with arbitrary dimension.

Parameters:

ParameterTypeDefaultDescription
namestrBase name
dimensionintNumber of components
typeValueTypeValueType.DoubleValue type
delimiterstr"."Separator between base name and component
component_nameslist[str][]Custom component names (auto-generated if empty)

Returns: FieldSlot

Example:

import phynexis
F = phynexis.fields

s = F.FieldSlot.make_vecn("pos", 5, delimiter="_")
print(s.get_field_names())

Output:

['pos_c0', 'pos_c1', 'pos_c2', 'pos_c3', 'pos_c4']

FieldSlot.make_vecx(name, type=ValueType.Double)

Creates a variable-length vector (VecX) slot.

Parameters:

ParameterTypeDefaultDescription
namestrField name
typeValueTypeValueType.DoubleValue type

Returns: FieldSlot

Example:

import phynexis
F = phynexis.fields

s = F.FieldSlot.make_vecx("features")
print(s.name, s.field_type, s.dimension)

Output:

features FieldType.VecX 1

Properties

PropertyTypeAccessDescription
namestrread/writeField name or base name
field_typeFieldTyperead-onlyScalar or VecX
value_typeValueTyperead-onlyDouble, Int32, Bool, etc.
dimensionintread-onlyNumber of components (1 for scalar, 3 for vec3, etc.)
delimiterstrread/writeSeparator used in expanded field names
component_nameslist[str]read/writeComponent names (e.g. ['x', 'y', 'z'])

Methods

get_field_names()

Returns the fully expanded field names for this slot.

  • Scalar: returns [name]
  • Vec3: returns [name.x, name.y, name.z]
  • VecN: returns [name.c0, name.c1, ...] or custom component names

Returns: list[str]

Example:

import phynexis
F = phynexis.fields

s1 = F.FieldSlot.make_scalar("p")
s2 = F.FieldSlot.make_vec3("v")
s3 = F.FieldSlot.make_vecn("c", 2, component_names=["r", "g"])

print(s1.get_field_names())
print(s2.get_field_names())
print(s3.get_field_names())

Output:

['p']
['v.x', 'v.y', 'v.z']
['c.r', 'c.g']

get_component_names()

Returns the component names for this slot.

Returns: list[str]

Example:

import phynexis
F = phynexis.fields

s = F.FieldSlot.make_vec6("stress")
print(s.get_component_names())

Output:

['xx', 'yy', 'zz', 'xy', 'xz', 'yz']