-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wrap pyvcell-fvsolver in pyvcell.solvers.fvsolver with safe typing
- Loading branch information
Showing
3 changed files
with
24 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from pathlib import Path | ||
|
||
from pyvcell_fvsolver import solve as _fv_solve, version as _fv_version # type: ignore[import-untyped] | ||
|
||
|
||
def solve(input_file: Path | str, vcg_file: Path | str, output_dir: Path | str) -> int: | ||
return_code = _fv_solve(fvInputFilename=str(input_file), vcgInputFilename=str(vcg_file), outputDir=str(output_dir)) | ||
if not isinstance(return_code, int): | ||
raise TypeError(f"Expected int but got {type(return_code)}") | ||
if return_code != 0: | ||
raise ValueError(f"Error in solve: {return_code}") | ||
return return_code | ||
|
||
|
||
def version() -> str: | ||
version_value = _fv_version() | ||
if not isinstance(version_value, str): | ||
raise TypeError(f"Expected str but got {type(version_value)}") | ||
return version_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters