picongpu.pypicongpu.customuserinput

This file is part of PIConGPU. Copyright 2024-2024 PIConGPU contributors Authors: Brian Edward Marre License: GPLv3+

Classes

InterfaceCustomUserInput

interface required from all custom input implementations

CustomUserInput

container for easy passing of additional input as dict from user script to rendering context of simulation input

Module Contents

class picongpu.pypicongpu.customuserinput.InterfaceCustomUserInput

Bases: picongpu.pypicongpu.rendering.RenderedObject, pydantic.BaseModel

Inheritance diagram of picongpu.pypicongpu.customuserinput.InterfaceCustomUserInput

interface required from all custom input implementations

check_does_not_change_existing_key_values(firstDict: dict, secondDict: dict)

check that updating firstDict with secondDict will not change any value in firstDict

check_tags(existing_tags: list[str], tags: list[str])

check that all entries in tags are valid tags and that all tags in the union if the list elements are unique

abstract get_tags() list[str]

get a list of all tags of this CustomUserInput

abstract check() None

throw error if self not correct/consistent

abstract get_generic_rendering_context() dict[str, Any]

create and init a CustomUserInput instance and return the result of calling get_rendering_context() on it

necessary since get_rendering_context() requires a schema to verify the result of _get_serialized() for the

class in the registry which does not exist for user implementations

along the lines of:
return CustomUserInput(

rendering_context=<serialized representation of implementation>, tags=<list of tags> ).get_rendering_context() )

__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

class picongpu.pypicongpu.customuserinput.CustomUserInput

Bases: InterfaceCustomUserInput

Inheritance diagram of picongpu.pypicongpu.customuserinput.CustomUserInput

container for easy passing of additional input as dict from user script to rendering context of simulation input

tags: list[str] | None = None

list of tags

rendering_context: dict[str, Any] | None = None

accumulation variable of added dictionaries

addToCustomInput(custom_input: dict[str, Any], tag: str)

append dictionary to custom input dictionary

check() None

no way to check without further knowledge, may be overwritten by the user

get_tags() list[str]

get a list of all tags of this CustomUserInput

get_generic_rendering_context() dict[str, Any]

create and init a CustomUserInput instance and return the result of calling get_rendering_context() on it

necessary since get_rendering_context() requires a schema to verify the result of _get_serialized() for the

class in the registry which does not exist for user implementations

along the lines of:
return CustomUserInput(

rendering_context=<serialized representation of implementation>, tags=<list of tags> ).get_rendering_context() )

check_does_not_change_existing_key_values(firstDict: dict, secondDict: dict)

check that updating firstDict with secondDict will not change any value in firstDict

check_tags(existing_tags: list[str], tags: list[str])

check that all entries in tags are valid tags and that all tags in the union if the list elements are unique

__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