picongpu.pypicongpu.species.constant.constant
This file is part of the PIConGPU. Copyright 2021-2023 PIConGPU contributors Authors: Hannes Troepgen, Brian Edward Marre License: GPLv3+
Module Contents
Classes
unmodifiable property of a species |
- class picongpu.pypicongpu.species.constant.constant.Constant
Bases:
picongpu.pypicongpu.rendering.RenderedObject
unmodifiable property of a species
Equal for all macroparticles, e.g. mass, charge, ionization levels etc. Owned by exactly one species.
PIConGPU term: “particle flags”
Parent class for actual SpeciesConstants
A Constant can have the following dependencies:
species objects
dependency species must be available for the init manager
code for dependency species will be generated before the code for this species
attributes (types)
dependency attributes must be generated by any property on the species with this constant
there are no further checks employed, the constant is never shown the concrete attribute object of its species
constants (types)
dependency constants must be present before the initmanager performs any actions
checks on the value of constants are not possible, only if a constant of a given type is present
(the concrete constant that is being checked is never passed to this constant)
- abstract check() None
ensure validity of self
If ok passes silently, else raises. Intendend to check for invalid value (ranges), perhaps types etc.
Must be overwritten in child implementation.
- abstract get_species_dependencies() List
get dependencies for definition
Returns a list of species which this flags requires being present. Mainly intended for ionization flags, i.e. should typically return [].
- abstract get_attribute_dependencies() List[type]
get required attributes (during execution)
During execution some constants require an attribute to be present, e.g. the pusher required the Momentum attribute
This method returns a list of attribute types which it requires on its species.
- abstract get_constant_dependencies() List[type]
get required constants (during execution)
Some constants (e.g. those selecting algorithms) may require other constants to be present.
This method returns the types of constants that must be present for this constant to be valid. Checking the value of these dependency constants is NOT possible.
Dependencies between constants MAY be circular. Rationale: Only presence of constants is checked, a reordering (as for inter-species-dependencies) is not performed, hence circular dependencies between constants can be handled.
However, as self-references do not make sense (theoretically speaking are always true), they are considered a programmer error and therefore self-references are NOT allowed.
This has no influence on the order of code generation.
- get_rendering_context() dict
get rendering context representation of this object
delegates work to _get_serialized and invokes checks performed by check_context_for_type(). :raise ValidationError: on schema violiation :raise RuntimeError: on schema not found :return: self as rendering context
- static check_context_for_type(type_to_check: type, context: dict) None
check if the given context is valid for the given type
Raises on error, passes silently if okay.
- Raises:
ValidationError – on schema violiation
RuntimeError – on schema not found