picongpu.pypicongpu.species.operation.densityprofile.uniform
This file is part of PIConGPU. Copyright 2021-2024 PIConGPU contributors Authors: Hannes Troepgen, Brian Edward Marre License: GPLv3+
Classes
globally constant density |
Module Contents
- class picongpu.pypicongpu.species.operation.densityprofile.uniform.Uniform
Bases:
picongpu.pypicongpu.species.operation.densityprofile.densityprofile.DensityProfile
globally constant density
PIConGPU equivalent is the homogenous profile, but due to spelling ambiguities the PICMI name uniform is followed here.
- density_si
density at every point in space (kg * m^-3)
- check() None
check self, overwritten by child class
Perform checks if own parameters are valid. On error raise, if everything is okay pass silently.
- get_generic_profile_rendering_context() dict
retrieve a context valid for “any profile”
Problem: Every profile has its respective schema, and it is difficult in JSON (particularly in a mustache-compatible way) to get the type of the schema.
Solution: The normal rendering of profiles get_rendering_context() provides only their parameters, i.e. there is no meta information on types etc.
If a generic profile is requested one can use the schema for “DensityProfile” (this class), for which this method returns the correct content, which includes metainformation and the data on the schema itself.
E.g.:
{ "type": { "uniform": true, "gaussian": false, ... }, "data": DATA }
where DATA is the serialization as returned by get_rendering_context().
There are two context serialization methods for density profiles:
get_rendering_context()
provided by RenderedObject parent class, serialization (“context building”) performed by _get_serialized()
_get_serialized() implemented in every profile
checks against schema of respective profile
returned context is a representation of exactly this profile
(left empty == not implemented in parent ProfileDensity)
get_generic_profile_rendering_context()
implemented in parent densityprofile
returned representation is generic for any profile (i.e. contains meta information which type is actually used)
passes information from get_rendering_context() through
returned representation is designed for easy use with templating engine mustache
- __hash__()
custom hash function for indexing in dicts
- get_rendering_context() dict | None
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 violation :raise RuntimeError: on schema not found :return: self as rendering context
- static check_context_for_type(type_to_check: type, context: dict | None) None
check if the given context is valid for the given type
Raises on error, passes silently if okay.
- Raises:
ValidationError – on schema violation
RuntimeError – on schema not found