Skip to content

Commit

Permalink
Adjust Simulation constructor (#170)
Browse files Browse the repository at this point in the history
* Adjust Simulation constructor

* Make sure all "input variables" from the scheme docs can be passed into the constructor.
* Organize arguments into a column for readability.

* Update docs
  • Loading branch information
ChristopherHogan authored and stevengj committed Jan 16, 2018
1 parent a051029 commit ad748af
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 15 deletions.
12 changes: 11 additions & 1 deletion doc/docs/Python_User_Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ class Simulation(object):
extra_materials=[],
material_function=None,
epsilon_func=None,
epsilon_input_file=''):
epsilon_input_file='',
progress_interval=4,
subpixel_tol=1e-4,
subpixel_maxeval=100000,
ensure_periodicity=False,
num_chunks=0,
courant=0.5,
accurate_fields_near_cylorigin=False,
filename_prefix='',
output_volume=None,
output_single_precision=False):
```

All `Simulation` attributes are described in further detail here. In brackets after each variable is the type of value that it should hold. The classes, complex datatypes like `GeometricObject`, are described in a later subsection. The basic datatypes, like `integer`, `boolean`, `complex`, and `string` are defined by Python. `Vector3` is a `meep` class.
Expand Down
51 changes: 37 additions & 14 deletions python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,34 @@ def _harm(sim):

class Simulation(object):

def __init__(self, cell_size, resolution, geometry=[], sources=[], eps_averaging=True,
dimensions=2, boundary_layers=[], symmetries=[], verbose=False,
force_complex_fields=False, default_material=mp.Medium(), m=0, k_point=False,
extra_materials=[], material_function=None, epsilon_func=None, epsilon_input_file=''):
def __init__(self,
cell_size,
resolution,
geometry=[],
sources=[],
eps_averaging=True,
dimensions=2,
boundary_layers=[],
symmetries=[],
verbose=False,
force_complex_fields=False,
default_material=mp.Medium(),
m=0,
k_point=False,
extra_materials=[],
material_function=None,
epsilon_func=None,
epsilon_input_file='',
progress_interval=4,
subpixel_tol=1e-4,
subpixel_maxeval=100000,
ensure_periodicity=False,
num_chunks=0,
courant=0.5,
accurate_fields_near_cylorigin=False,
filename_prefix='',
output_volume=None,
output_single_precision=False):

self.cell_size = cell_size
self.geometry = geometry
Expand All @@ -245,32 +269,31 @@ def __init__(self, cell_size, resolution, geometry=[], sources=[], eps_averaging
self.symmetries = symmetries
self.geometry_center = Vector3()
self.eps_averaging = eps_averaging
self.subpixel_tol = 1e-4
self.subpixel_maxeval = 100000
self.ensure_periodicity = False
self.subpixel_tol = subpixel_tol
self.subpixel_maxeval = subpixel_maxeval
self.ensure_periodicity = ensure_periodicity
self.extra_materials = extra_materials
self.default_material = default_material
self.epsilon_input_file = epsilon_input_file
self.num_chunks = 0
self.courant = 0.5
self.num_chunks = num_chunks
self.courant = courant
self.global_d_conductivity = 0
self.global_b_conductivity = 0
self.special_kz = False
self.k_point = k_point
self.fields = None
self.structure = None
self.accurate_fields_near_cylorigin = False
self.accurate_fields_near_cylorigin = accurate_fields_near_cylorigin
self.m = m
self.force_complex_fields = force_complex_fields
self.verbose = verbose
self.progress_interval = 4
self.progress_interval = progress_interval
self.init_fields_hooks = []
self.progress_interval = 4
self.run_index = 0
self.filename_prefix = ''
self.output_append_h5 = None
self.output_single_precision = False
self.output_volume = None
self.output_single_precision = output_single_precision
self.output_volume = output_volume
self.last_eps_filename = ''
self.output_h5_hook = lambda fname: False
self.interactive = False
Expand Down

0 comments on commit ad748af

Please sign in to comment.