-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathsurface_builder.py
More file actions
64 lines (55 loc) · 1.96 KB
/
Copy pathsurface_builder.py
File metadata and controls
64 lines (55 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2024, Battelle Energy Alliance, LLC All Rights Reserved.
from montepy.surfaces.axis_plane import AxisPlane
from montepy.surfaces.surface import Surface, InitInput
from montepy.surfaces.surface_type import SurfaceType
from montepy.surfaces.cylinder_on_axis import CylinderOnAxis
from montepy.surfaces.cylinder_par_axis import CylinderParAxis
from montepy.surfaces.general_plane import GeneralPlane
from montepy.surfaces.general_sphere import GeneralSphere
from montepy.surfaces.sphere_at_origin import SphereAtOrigin
from montepy.surfaces.sphere_on_axis import SphereOnAxis
def parse_surface(input: InitInput):
"""Builds a Surface object for the type of Surface
Parameters
----------
input : Union[Input, str]
The Input object representing the input
Returns
-------
Surface
A Surface object properly parsed. If supported a sub-class of
Surface will be given.
"""
ST = SurfaceType
buffer_surface = Surface(input)
type_of_surface = buffer_surface.surface_type
if type_of_surface in [ST.C_X, ST.C_Y, ST.C_Z]:
return CylinderParAxis(input)
elif type_of_surface in [ST.CX, ST.CY, ST.CZ]:
return CylinderOnAxis(input)
elif type_of_surface in [ST.PX, ST.PY, ST.PZ]:
return AxisPlane(input)
elif type_of_surface == ST.P:
return GeneralPlane(input)
elif type_of_surface == ST.S:
return GeneralSphere(input)
elif type_of_surface == ST.SO:
return SphereAtOrigin(input)
elif type_of_surface in [ST.SX, ST.SY, ST.SZ]:
return SphereOnAxis(input)
else:
return buffer_surface
surface_builder = parse_surface
"""Alias for :func:`parse_surface`.
:deprecated: 1.0.0
Renamed to be :func:`parse_surface` to be more pythonic.
Parameters
----------
input : Union[Input, str]
The Input object representing the input
Returns
-------
Surface
A Surface object properly parsed. If supported a sub-class of
Surface will be given.
"""