Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert main modulef90 to python #3426

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ LIST(APPEND PROCESS_SRCS
structure_variables.f90
output.f90
init_module.f90
main_module.f90
error_handling.f90
global_variables.f90
constraint_variables.f90
Expand All @@ -118,6 +117,7 @@ LIST(APPEND PROCESS_SRCS
stellarator_variables.f90
stellarator.f90
stellarator_configuration.f90
input.f90
)

PREPROCESS()
Expand Down
29 changes: 29 additions & 0 deletions process/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class ProcessException(Exception):
"""A base Exception to derive other PROCESS exceptions from"""

def __init__(self, *args, **kwargs):
super().__init__(*args)
self._diagnostics = kwargs

def __str__(self):
exception_message = super().__str__()
diagnostics_message = "\n".join(
[f"\t{d}: {repr(v)}" for d, v in self._diagnostics.items()]
)

if diagnostics_message:
return f"{exception_message}\n{diagnostics_message}"

return exception_message


class ProcessValidationError(ProcessException):
"""Exception raised when validating PROCESS input.

E.g. initial values, constraint/variable combinations, switch combinations"""

pass


class ProcessValueError(ProcessException, ValueError):
pass
Loading
Loading