diff --git a/catbird/model.py b/catbird/model.py index 12c5595..68bf092 100644 --- a/catbird/model.py +++ b/catbird/model.py @@ -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): @@ -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): diff --git a/catbird/param.py b/catbird/param.py index 11dbdd6..58f0d8f 100644 --- a/catbird/param.py +++ b/catbird/param.py @@ -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): @@ -29,8 +31,9 @@ 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" @@ -38,5 +41,5 @@ def __init__(self,attr_name, attr_type, is_array, default=None, allowed_vals=Non 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 diff --git a/catbird/syntax.py b/catbird/syntax.py index 0e1667d..2e0f853 100644 --- a/catbird/syntax.py +++ b/catbird/syntax.py @@ -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) diff --git a/setup.cfg b/setup.cfg index bdac09e..85077c7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,3 @@ [metadata] -description-file = README.md +description_file = README.md license_files = LICENSE \ No newline at end of file