59 PetscFunctionBeginUser;
60 PetscCheck(descriptor != NULL, PETSC_COMM_SELF, PETSC_ERR_ARG_NULL,
61 "Particle field descriptor output cannot be NULL.");
63 PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE,
64 "Invalid ParticleFieldId value %d.", (
int)field_id);
66 PETSC_COMM_SELF, PETSC_ERR_PLIB,
67 "Particle field catalog entry %d is not initialized consistently.", (
int)field_id);
70 PetscFunctionReturn(0);
79 PetscFunctionBeginUser;
80 PetscCheck(field_name != NULL, PETSC_COMM_SELF, PETSC_ERR_ARG_NULL,
81 "Particle field name cannot be NULL.");
82 PetscCheck(field_id != NULL, PETSC_COMM_SELF, PETSC_ERR_ARG_NULL,
83 "ParticleFieldId output cannot be NULL.");
87 PetscBool match = PETSC_FALSE;
89 PetscCall(PetscStrcasecmp(field_name, descriptor->
canonical_name, &match));
90 if (!match && descriptor->
alias_1) PetscCall(PetscStrcasecmp(field_name, descriptor->
alias_1, &match));
91 if (!match && descriptor->
alias_2) PetscCall(PetscStrcasecmp(field_name, descriptor->
alias_2, &match));
93 *field_id = descriptor->
id;
94 PetscFunctionReturn(0);
99 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_UNKNOWN_TYPE,
100 "Particle field name '%s' is not registered in the persistent particle field catalog.",
const char * ParticleFieldName(ParticleFieldId field_id)
Returns the canonical PETSc name without performing name lookup.
PetscErrorCode ParticleFieldIdFromName(const char *field_name, ParticleFieldId *field_id)
Resolves particle field text once by searching canonical names and aliases.
static const ParticleFieldDescriptor gParticleFieldCatalog[PARTICLE_FIELD_ID_COUNT]
PetscErrorCode ParticleFieldGetDescriptor(ParticleFieldId field_id, const ParticleFieldDescriptor **descriptor)
Validates and returns one immutable particle-field descriptor.
#define PARTICLE_FIELD_ENTRY(field_id_, name_, alias1_, alias2_, components_, type_, registration_, capabilities_, default_, scatter_target_)
Typed identities and metadata for persistent solver-particle fields.
ParticleFieldId
Compile-time identity for a persistent solver-particle field.
@ PARTICLE_FIELD_ID_LOCATION_STATUS
@ PARTICLE_FIELD_ID_WEIGHT
@ PARTICLE_FIELD_ID_POSITION
@ PARTICLE_FIELD_ID_CELL_ID
@ PARTICLE_FIELD_ID_DIFFUSIVITY_GRADIENT
@ PARTICLE_FIELD_ID_COUNT
@ PARTICLE_FIELD_ID_DIFFUSIVITY
@ PARTICLE_FIELD_ID_INVALID
@ PARTICLE_FIELD_ID_VELOCITY
@ PARTICLE_FIELD_CAPABILITY_MODEL_UPDATE
@ PARTICLE_FIELD_CAPABILITY_DEFAULT_INITIALIZE
@ PARTICLE_FIELD_CAPABILITY_EULERIAN_SCATTER
@ PARTICLE_FIELD_CAPABILITY_NONE
@ PARTICLE_FIELD_REGISTRATION_PETSC
@ PARTICLE_FIELD_REGISTRATION_PICURV
const char * canonical_name
Immutable metadata for one persistent particle field.