27
27
import math
28
28
from pathlib import Path
29
29
import tempfile
30
+ from typing import Optional
30
31
from typing import Union
31
32
import warnings
32
33
@@ -5574,19 +5575,19 @@ def insert_infinite_sphere(
5574
5575
@pyaedt_function_handler ()
5575
5576
def insert_near_field_sphere (
5576
5577
self ,
5577
- radius = 20 ,
5578
+ radius : Union [ float , int , str ] = 20 ,
5578
5579
radius_units = "mm" ,
5579
- x_start = 0 ,
5580
- x_stop = 180 ,
5581
- x_step = 10 ,
5582
- y_start = 0 ,
5583
- y_stop = 180 ,
5584
- y_step = 10 ,
5585
- angle_units = "deg" ,
5586
- custom_radiation_faces = None ,
5587
- custom_coordinate_system = None ,
5588
- name = None ,
5589
- ):
5580
+ x_start : Union [ float , int , str ] = 0 ,
5581
+ x_stop : Union [ float , int , str ] = 180 ,
5582
+ x_step : Union [ float , int , str ] = 10 ,
5583
+ y_start : Union [ float , int , str ] = 0 ,
5584
+ y_stop : Union [ float , int , str ] = 180 ,
5585
+ y_step : Union [ float , int , str ] = 10 ,
5586
+ angle_units : str = "deg" ,
5587
+ custom_radiation_faces : Optional [ str ] = None ,
5588
+ custom_coordinate_system : Optional [ str ] = None ,
5589
+ name : Optional [ str ] = None ,
5590
+ ) -> NearFieldSetup :
5590
5591
"""Create a near field sphere.
5591
5592
5592
5593
.. note::
@@ -5648,26 +5649,22 @@ def insert_near_field_sphere(
5648
5649
props ["CoordSystem" ] = custom_coordinate_system
5649
5650
else :
5650
5651
props ["CoordSystem" ] = ""
5651
- bound = NearFieldSetup (self , name , props , "NearFieldSphere" )
5652
- if bound .create ():
5653
- self .field_setups .append (bound )
5654
- return bound
5655
- return False
5652
+ return self ._create_field_setup (name , props , "NearFieldSphere" )
5656
5653
5657
5654
@pyaedt_function_handler ()
5658
5655
def insert_near_field_box (
5659
5656
self ,
5660
- u_length = 20 ,
5661
- u_samples = 21 ,
5662
- v_length = 20 ,
5663
- v_samples = 21 ,
5664
- w_length = 20 ,
5665
- w_samples = 21 ,
5666
- units = "mm" ,
5667
- custom_radiation_faces = None ,
5668
- custom_coordinate_system = None ,
5669
- name = None ,
5670
- ):
5657
+ u_length : Union [ float , int , str ] = 20 ,
5658
+ u_samples : Union [ float , int , str ] = 21 ,
5659
+ v_length : Union [ float , int , str ] = 20 ,
5660
+ v_samples : Union [ float , int , str ] = 21 ,
5661
+ w_length : Union [ float , int , str ] = 20 ,
5662
+ w_samples : Union [ float , int , str ] = 21 ,
5663
+ units : str = "mm" ,
5664
+ custom_radiation_faces : Optional [ str ] = None ,
5665
+ custom_coordinate_system : Optional [ str ] = None ,
5666
+ name : Optional [ str ] = None ,
5667
+ ) -> NearFieldSetup :
5671
5668
"""Create a near field box.
5672
5669
5673
5670
.. note::
@@ -5723,24 +5720,20 @@ def insert_near_field_box(
5723
5720
props ["CoordSystem" ] = custom_coordinate_system
5724
5721
else :
5725
5722
props ["CoordSystem" ] = "Global"
5726
- bound = NearFieldSetup (self , name , props , "NearFieldBox" )
5727
- if bound .create ():
5728
- self .field_setups .append (bound )
5729
- return bound
5730
- return False
5723
+ return self ._create_field_setup (name , props , "NearFieldBox" )
5731
5724
5732
5725
@pyaedt_function_handler ()
5733
5726
def insert_near_field_rectangle (
5734
5727
self ,
5735
- u_length = 20 ,
5736
- u_samples = 21 ,
5737
- v_length = 20 ,
5738
- v_samples = 21 ,
5739
- units = "mm" ,
5740
- custom_radiation_faces = None ,
5741
- custom_coordinate_system = None ,
5742
- name = None ,
5743
- ):
5728
+ u_length : Union [ float , int , str ] = 20 ,
5729
+ u_samples : Union [ float , int , str ] = 21 ,
5730
+ v_length : Union [ float , int , str ] = 20 ,
5731
+ v_samples : Union [ float , int , str ] = 21 ,
5732
+ units : str = "mm" ,
5733
+ custom_radiation_faces : Optional [ str ] = None ,
5734
+ custom_coordinate_system : Optional [ str ] = None ,
5735
+ name : Optional [ str ] = None ,
5736
+ ) -> NearFieldSetup :
5744
5737
"""Create a near field rectangle.
5745
5738
5746
5739
.. note::
@@ -5790,20 +5783,17 @@ def insert_near_field_rectangle(
5790
5783
props ["CoordSystem" ] = custom_coordinate_system
5791
5784
else :
5792
5785
props ["CoordSystem" ] = "Global"
5793
- bound = NearFieldSetup (self , name , props , "NearFieldRectangle" )
5794
- if bound .create ():
5795
- self .field_setups .append (bound )
5796
- return bound
5797
- return False
5786
+
5787
+ return self ._create_field_setup (name , props , "NearFieldRectangle" )
5798
5788
5799
5789
@pyaedt_function_handler (line = "assignment" )
5800
5790
def insert_near_field_line (
5801
5791
self ,
5802
- assignment ,
5803
- points = 1000 ,
5804
- custom_radiation_faces = None ,
5805
- name = None ,
5806
- ):
5792
+ assignment : str ,
5793
+ points : Union [ float , str ] = 1000 ,
5794
+ custom_radiation_faces : Optional [ str ] = None ,
5795
+ name : str = None ,
5796
+ ) -> NearFieldSetup :
5807
5797
"""Create a near field line.
5808
5798
5809
5799
.. note::
@@ -5830,6 +5820,7 @@ def insert_near_field_line(
5830
5820
name = generate_unique_name ("Line" )
5831
5821
5832
5822
props = dict ({"UseCustomRadiationSurface" : custom_radiation_faces is not None })
5823
+
5833
5824
if custom_radiation_faces :
5834
5825
props ["CustomRadiationSurface" ] = custom_radiation_faces
5835
5826
else :
@@ -5838,19 +5829,15 @@ def insert_near_field_line(
5838
5829
props ["NumPts" ] = points
5839
5830
props ["Line" ] = assignment
5840
5831
5841
- bound = NearFieldSetup (self , name , props , "NearFieldLine" )
5842
- if bound .create ():
5843
- self .field_setups .append (bound )
5844
- return bound
5845
- return False
5832
+ return self ._create_field_setup (name , props , "NearFieldLine" )
5846
5833
5847
5834
@pyaedt_function_handler ()
5848
5835
def insert_near_field_points (
5849
5836
self ,
5850
5837
input_file : Union [str , Path ] = None ,
5851
- coordinate_system = "Global" ,
5852
- name = None ,
5853
- ):
5838
+ coordinate_system : str = "Global" ,
5839
+ name : Optional [ str ] = None ,
5840
+ ) -> NearFieldSetup :
5854
5841
"""Create a near field line.
5855
5842
5856
5843
.. note::
@@ -5880,11 +5867,7 @@ def insert_near_field_points(
5880
5867
props ["CoordSystem" ] = coordinate_system
5881
5868
props ["PointListFile" ] = str (point_file )
5882
5869
5883
- bound = NearFieldSetup (self , name , props , "NearFieldPoints" )
5884
- if bound .create ():
5885
- self .field_setups .append (bound )
5886
- return bound
5887
- return False
5870
+ return self ._create_field_setup (name , props , "NearFieldPoints" )
5888
5871
5889
5872
@pyaedt_function_handler ()
5890
5873
def set_sbr_current_sources_options (self , conformance = False , thin_sources = False , power_fraction = 0.95 ):
0 commit comments