Skip to main content

Schemas

Python: phynexis.parsim Headers: src/parsim/schema/*.hpp

Schema definitions for particle node properties. Each schema describes a set of field slots (position, velocity, radius, etc.) that are allocated in a FieldManager and bound to a NodeSet via a BoundLayout.

All schemas inherit from phynexis.fields.FieldSchema.

Schema Types

Python ClassDescriptionSlots
NodeKinematicsSchemaPosition, velocity, acceleration, orientationpos, vel, acc, quat
NodeShapeSchemaShape ID and radiusshape_id, radius
NodeInertiaSchemaMass and inertia tensormass, inertia
NodeBoundsSchemaAABB bounding boxmin_bound, max_bound
NodeNodeLinkSchemaNode-to-node connectivitytarget, link_type
NodeGridLinkSchemaGrid-cell linkagecell_id, grid_level
NodeDomainLinkSchemaMPI domain linkagedomain_id, rank

Constructors

All schemas have a default constructor:

schema = pm.NodeKinematicsSchema()

with_prefix(prefix) (NodeNodeLinkSchema only)

Returns a copy of the schema with the given slot name prefix. Static method.

schema = pm.NodeNodeLinkSchema.with_prefix("bond_")

BoundLayout

A BoundLayout binds a schema to a concrete FieldManager, allocating the actual fields.

Python ClassSchema
BoundLayoutNodeKinematicsSchemaNodeKinematicsSchema
BoundLayoutNodeShapeSchemaNodeShapeSchema
BoundLayoutNodeInertiaSchemaNodeInertiaSchema
BoundLayoutNodeBoundsSchemaNodeBoundsSchema
BoundLayoutNodeNodeLinkSchemaNodeNodeLinkSchema
BoundLayoutNodeGridLinkSchemaNodeGridLinkSchema
BoundLayoutNodeDomainLinkSchemaNodeDomainLinkSchema
BoundLayoutSetSchemaGeneric set schema

Factory Methods

make_bound(manager, schema)

Static factory. Creates a bound layout and allocates fields in the given FieldManager.

Parameters:

ParameterTypeDescription
managerFieldManagerTarget field manager
schema*SchemaSchema instance

Returns: BoundLayout* (concrete subclass)

Example:

import phynexis
pm = phynexis.parsim
F = phynexis.fields

fm = F.FieldManager()
schema = pm.NodeKinematicsSchema()
layout = pm.BoundLayoutNodeKinematicsSchema.make_bound(fm, schema)
print(layout.is_valid()) # True

Instance Methods

MethodDescription
bind(manager)(Re-)bind to a different field manager
refresh()Refresh field handles from manager
is_valid()Returns True if all slots are bound
manager()Returns the bound FieldManager
handles()Returns a list of FieldHandle objects
fields()Returns a list of FieldBase* objects
slot_fields(slot)Returns fields for a named slot
slot_fields_count(slot)Returns number of fields in a slot
slot_fields_offset(slot)Returns offset of a slot in the handle list

Example:

# Access fields via the layout
fields = layout.fields()
print(len(fields))

# Access a specific slot
pos_fields = layout.slot_fields("pos")
print(len(pos_fields))

Known Issues

fields() returns FieldBase* without RTTI resolution

layout.fields() returns a list of FieldBase* pointers. The concrete subclass (e.g., ScalarField) is not resolved via RTTI in the current binding.

Workaround: Use layout.handles() to get FieldHandle objects, then retrieve fields via manager.get_field(handle).

Status: noted