Box#
- final class Box[source]#
Bases:
MultiConstructorBaseModel,_VolumeEntityBaseBox in three-dimensional space, defined by center, size, and rotation.
Example
>>> Box( ... name="box", ... axis_of_rotation=(1, 0, 0), ... angle_of_rotation=45 * unyt.deg, ... center=(1, 1, 1) * unyt.m, ... size=(0.2, 0.3, 2) * unyt.m, ... )
Define a box using principal axes:
>>> Box.from_principal_axes( ... name="box", ... axes=[(0, 1, 0), (0, 0, 1)], ... center=(0, 0, 0) * unyt.m, ... size=(0.2, 0.3, 2) * unyt.m, ... )
Attributes
Properties
Additional Constructors
- classmethod from_principal_axes(name, center, size, axes)[source]#
Construct box from principal axes.
- Parameters:
name (str)
center (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/Vector3Json.json'}, 'units': {'type': 'string'}}, 'required': ['value', 'units'], 'additionalProperties': False}, mode=None)])
size (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/PositiveVector3Json.json'}, 'units': {'type': 'string'}}, 'required': ['value', 'units'], 'additionalProperties': False}, mode=None)])
axes (Annotated[tuple[Axis, Axis], AfterValidator(func=~flow360_schema.models.entities.base._check_axis_is_orthogonal)])
- Return type:
Self
- classmethod from_file(filename)#
Load a Flow360BaseModel from a .json file.
- Parameters:
filename (str)
- Return type:
Flow360BaseModel
Methods