picongpu.pypicongpu.species.operation.densityprofile.densityprofile

This file is part of PIConGPU. Copyright 2021-2024 PIConGPU contributors Authors: Hannes Troepgen, Brian Edward Marre, Julian Lenz License: GPLv3+

Classes

DensityProfile

(abstract) parent class of all density profiles

Module Contents

class picongpu.pypicongpu.species.operation.densityprofile.densityprofile.DensityProfile

Bases: picongpu.pypicongpu.rendering.SelfRegisteringRenderedObject

Inheritance diagram of picongpu.pypicongpu.species.operation.densityprofile.densityprofile.DensityProfile

(abstract) parent class of all density profiles

A density profile describes the density in space.

classmethod __init_subclass__()
get_rendering_context()

retrieve a generic context containing type information specifying a subclass

Problem: Every self-registered subclass 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 self-registered subclasses via get_rendering_context() provides only their parameters, i.e. there is no meta information on types etc.

If a generic context is requested one can use the schema for parent class, for which this method returns the correct content. It includes metainformation and the data on the schema itself.

E.g.:

{
    "type": {
        "phasespace": true,
        "auto": false,
        ...
    },
    "data": DATA
}

where DATA is the serialization as returned by get_rendering_context().

__hash__()

custom hash function for indexing in dicts

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 violation

  • RuntimeError – on schema not found