Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lems/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,25 @@ def process_args():

return parser.parse_args()

def main():
def run(file_path,include_dirs=[],dlems=False,nogui=False):
"""
Function for running from a script or shell.
"""
import argparse
args = argparse.Namespace()
args.lems_file = file_path
args.I = include_dirs
args.dlems = dlems
args.nogui = nogui
main(args=args)

def main(args=None):
"""
Program entry point.
"""

args = process_args()
if args is None:
args = process_args()

print('Parsing and resolving model: '+args.lems_file)
model = Model()
Expand Down
3 changes: 3 additions & 0 deletions lems/sim/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def add_child_to_group(self, group_name, child):
#print sorted(self.__dict__.keys())
#print ".........."
#print self.__dict__[group_name]
# Force group_name attribute to be a list before we append to it.
if type(self.__dict__[group_name]) is not list:
self.__dict__[group_name] = [self.__dict__[group_name]]
self.__dict__[group_name].append(child)
child.parent = self

Expand Down