Skip to content
Open
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
3 changes: 2 additions & 1 deletion catbird/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self,factory_in):
self.moose_objects=[]

# Add attributes to this model with default assignments
self.load_default_syntax()
# self.load_default_syntax()

# Envisage this being overridden downstream.
def load_default_syntax(self):
Expand All @@ -27,6 +27,7 @@ def load_default_syntax(self):
self.add_syntax("Materials")
self.add_syntax("BCs")
self.add_syntax("Outputs")
self.add_syntax("ICs")


def add_syntax(self,syntax_name,**kwargs_in):
Expand Down
9 changes: 6 additions & 3 deletions catbird/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ class MooseParam():
"""
Class to contain all information about a MOOSE parameter
"""
def __init__(self,attr_name, attr_type, is_array, default=None, allowed_vals=None, description=None):
def __init__(self,attr_name, attr_type, is_array, default=None, allowed_vals=None, required=False, description=None, cpp_type=None):

assert attr_type is not type(None)

self.attr_type=attr_type
self.allowed_vals=allowed_vals
self.is_array=is_array
self.cpp_type = cpp_type
self.required = required

# Set name
if not isinstance(attr_name, str):
Expand All @@ -29,14 +31,15 @@ def __init__(self,attr_name, attr_type, is_array, default=None, allowed_vals=Non
# Set docstring
doc_str = '\n'
doc_str += attr_name+' : '
doc_str += f'{attr_type.__name__}\n'
doc_str += f'{cpp_type}\n'
if description is not None and description != "":
self.description = description
doc_str += " "
doc_str += description
doc_str += "\n"
if allowed_vals is not None:
doc_str += f' Allowed values: {allowed_vals}\n'
if default is not None:
doc_str += f' Default value: {default}\n'

doc_str += f' Required: {required}\n'
self.doc=doc_str
10 changes: 10 additions & 0 deletions catbird/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,23 @@ def get_params_list(json_obj,syntax_path):
else:
default = _convert_to_type(attr_type, param_info['default'])

is_required=False
if 'required' in param_info.keys():
is_required=param_info['required']

cpp_type = None
if 'cpp_type' in param_info.keys():
cpp_type = param_info['cpp_type']

# Create and add a MOOSE parameter
moose_param=MooseParam(param_name,
attr_type,
is_array,
default=default,
allowed_vals=allowed_values,
required=is_required,
description=param_info.get('description'),
cpp_type=cpp_type
)

moose_param_list.append(moose_param)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[metadata]
description-file = README.md
description_file = README.md
license_files = LICENSE