picongpu.pypicongpu.species.operation.simpledensity
This file is part of PIConGPU. Copyright 2021-2024 PIConGPU contributors Authors: Hannes Troepgen, Brian Edward Marre License: GPLv3+
Classes
Place a set of species together, using the same density profile |
Module Contents
- class picongpu.pypicongpu.species.operation.simpledensity.SimpleDensity
Bases:
picongpu.pypicongpu.species.operation.densityoperation.DensityOperation
Place a set of species together, using the same density profile
These species will have the same macroparticle placement.
For this operation, only the random layout is supported.
parameters:
ppc: particles placed per cell
profile: density profile to use
species: species to be placed with the given profile note that their density ratios will be respected
- ppc
particles per cell (random layout), >0
- profile
density profile to use, describes the actual density
- species
species to be placed
- check_preconditions() None
check own parameters and species this operator will be applied to
Must be implemented (overwritten) by the operator.
Throws if a precondition is not met, and passes silently if everything is okay.
If this operator relies on certain constants of classes to be set, (e.g. mass, charge) this must be checked here.
All parameters, including the species this Operator is to be applied to must be passed beforehand. Note: there is no unified way of passing parameters, please define your own. (Rationale: The structure of parameters is very heterogeneous.)
- prebook_species_attributes() None
fills attributes_by_species
Must be implemented (overwritten) by the operator.
Generates the Attribute objects and pre-books them together with the species they are to be initialized for in self.attributes_by_species.
Will only be run after self.check_preconditions() has passed.
Note: Additional checks are not required, compatibility to other operations will be ensured from outside.
MUST NOT MODIFY THE SPECIES.
- attributes_by_species
attributes (exclusively) initialized by this operation
- bake_species_attributes() None
applies content of attributes_by_species to species
For each species in attributes_by_species.keys() assigns the attributes to their respective species, precisely appends to the list Species.attributes
Expects check_preconditions() and prebook_species_attributes() to have passed previously (without error).
Additionally, performs the following sanity checks:
at least one attribute is assigned
the species does not already have an attribute of the same type
every attribute is assigned exclusively to one species
Intended usage:
check for dependencies in used species
fill self.attributes_by_species (with newly generated objects) must be performed by self.prebook_species_attributes()
call self.bake_species_attributes() (this method) to set species.attributes accordingly
- __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