From c901830899da0dd389eb20a853c6846bc8494385 Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 12 Apr 2024 11:07:16 -0700 Subject: [PATCH 1/5] mesh_doctor installation through pip. --- .../geos_ats/machine_utilities.py | 2 +- geos_ats_package/geos_ats/test_steps.py | 16 ++++++------- geosx_mesh_doctor/mesh_doctor/__init__.py | 0 .../{ => mesh_doctor}/checks/__init__.py | 0 .../checks/check_fractures.py | 0 .../checks/collocated_nodes.py | 0 .../checks/element_volumes.py | 0 .../checks/fix_elements_orderings.py | 0 .../{ => mesh_doctor}/checks/generate_cube.py | 0 .../checks/generate_fractures.py | 0 .../checks/generate_global_ids.py | 0 .../{ => mesh_doctor}/checks/non_conformal.py | 0 .../{ => mesh_doctor}/checks/reorient_mesh.py | 0 .../checks/self_intersecting_elements.py | 0 .../checks/supported_elements.py | 0 .../checks/triangle_distance.py | 0 .../checks/vtk_polyhedron.py | 0 .../{ => mesh_doctor}/checks/vtk_utils.py | 0 .../{mesh_doctor.py => mesh_doctor/main.py} | 11 ++++----- .../{ => mesh_doctor}/parsing/__init__.py | 0 .../parsing/check_fractures_parsing.py | 0 .../{ => mesh_doctor}/parsing/cli_parsing.py | 0 .../parsing/collocated_nodes_parsing.py | 2 +- .../parsing/element_volumes_parsing.py | 2 +- .../parsing/fix_elements_orderings_parsing.py | 2 +- .../parsing/generate_cube_parsing.py | 2 +- .../parsing/generate_fractures_parsing.py | 2 +- .../parsing/generate_global_ids_parsing.py | 2 +- .../parsing/non_conformal_parsing.py | 2 +- .../self_intersecting_elements_parsing.py | 2 +- .../parsing/supported_elements_parsing.py | 2 +- .../parsing/vtk_output_parsing.py | 2 +- .../{ => mesh_doctor}/register.py | 8 +++---- .../tests/test_cli_parsing.py | 4 ++-- .../tests/test_collocated_nodes.py | 2 +- .../tests/test_element_volumes.py | 2 +- .../tests/test_generate_cube.py | 2 +- .../tests/test_generate_fractures.py | 8 +++---- .../tests/test_generate_global_ids.py | 2 +- .../tests/test_non_conformal.py | 4 ++-- .../tests/test_reorient_mesh.py | 6 ++--- .../tests/test_self_intersecting_elements.py | 2 +- .../tests/test_supported_elements.py | 6 ++--- .../tests/test_triangle_distance.py | 2 +- geosx_mesh_doctor/requirements.txt | 4 ---- geosx_mesh_doctor/setup.cfg | 24 +++++++++++++++++++ geosx_mesh_doctor/setup.py | 3 --- 47 files changed, 72 insertions(+), 56 deletions(-) create mode 100644 geosx_mesh_doctor/mesh_doctor/__init__.py rename geosx_mesh_doctor/{ => mesh_doctor}/checks/__init__.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/check_fractures.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/collocated_nodes.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/element_volumes.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/fix_elements_orderings.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/generate_cube.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/generate_fractures.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/generate_global_ids.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/non_conformal.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/reorient_mesh.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/self_intersecting_elements.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/supported_elements.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/triangle_distance.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/vtk_polyhedron.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/checks/vtk_utils.py (100%) rename geosx_mesh_doctor/{mesh_doctor.py => mesh_doctor/main.py} (87%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/__init__.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/check_fractures_parsing.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/cli_parsing.py (100%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/collocated_nodes_parsing.py (96%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/element_volumes_parsing.py (95%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/fix_elements_orderings_parsing.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/generate_cube_parsing.py (98%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/generate_fractures_parsing.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/generate_global_ids_parsing.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/non_conformal_parsing.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/self_intersecting_elements_parsing.py (95%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/supported_elements_parsing.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/parsing/vtk_output_parsing.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/register.py (91%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_cli_parsing.py (96%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_collocated_nodes.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_element_volumes.py (95%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_generate_cube.py (92%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_generate_fractures.py (97%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_generate_global_ids.py (92%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_non_conformal.py (96%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_reorient_mesh.py (96%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_self_intersecting_elements.py (95%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_supported_elements.py (94%) rename geosx_mesh_doctor/{ => mesh_doctor}/tests/test_triangle_distance.py (98%) delete mode 100644 geosx_mesh_doctor/requirements.txt create mode 100644 geosx_mesh_doctor/setup.cfg delete mode 100644 geosx_mesh_doctor/setup.py diff --git a/geos_ats_package/geos_ats/machine_utilities.py b/geos_ats_package/geos_ats/machine_utilities.py index 356de83a..dd3c58fe 100644 --- a/geos_ats_package/geos_ats/machine_utilities.py +++ b/geos_ats_package/geos_ats/machine_utilities.py @@ -12,7 +12,7 @@ def CheckForEarlyTimeOut( test, retval, fraction ): if ( config.max_retry > 0 ) and ( config.retry_err_regexp != "" ) and ( not hasattr( test, "checkstart" ) ): sourceFile = getattr( test, "errname" ) if os.path.exists( sourceFile ): - test.checkstart = 1 + testfrom checkstart = 1 with open( sourceFile ) as f: erroutput = f.read() if re.search( config.retry_err_regexp, erroutput ): diff --git a/geos_ats_package/geos_ats/test_steps.py b/geos_ats_package/geos_ats/test_steps.py index 54f7a2f7..7c7e43ac 100644 --- a/geos_ats_package/geos_ats/test_steps.py +++ b/geos_ats_package/geos_ats/test_steps.py @@ -412,16 +412,16 @@ def __init__( self, restartcheck_params=None, curvecheck_params=None, **kw ): self.setParams( kw, self.params ) checkOption = self.getCheckOption() - self.checksteps = [] + selffrom checksteps = [] if checkOption in [ "all", "curvecheck" ]: if curvecheck_params is not None: - self.checksteps.append( curvecheck( curvecheck_params, **kw ) ) + selffrom checksteps.append( curvecheck( curvecheck_params, **kw ) ) if checkOption in [ "all", "restartcheck" ]: if restartcheck_params is not None: - self.checksteps.append( restartcheck( restartcheck_params, **kw ) ) + selffrom checksteps.append( restartcheck( restartcheck_params, **kw ) ) - if not self.checksteps: + if not selffrom checksteps: raise Exception( f'This test does not have a restart or curve check enabled: {self.p.deck}' ) def label( self ): @@ -453,7 +453,7 @@ def update( self, dictionary ): # update all the checksteps if self.p.check: - for step in self.checksteps: + for step in selffrom checksteps: step.update( dictionary ) def insertStep( self, steps ): @@ -462,7 +462,7 @@ def insertStep( self, steps ): # the post conditions if self.p.check: - for step in self.checksteps: + for step in selffrom checksteps: step.insertStep( steps ) def makeArgs( self ): @@ -812,7 +812,7 @@ def infoTestStep( stepname ): # compute max param width: allparams = [ p.name for p in stepclass.params ] if hasattr( stepclass, "checkstepnames" ): - for checkstep in stepclass.checkstepnames: + for checkstep in stepclassfrom checkstepnames: checkclass = globals()[ checkstep ] if not hasattr( checkclass, "doc" ): continue @@ -825,7 +825,7 @@ def infoTestStep( stepname ): paramset = set( [ p.name for p in stepclass.params ] ) if hasattr( stepclass, "checkstepnames" ): - for checkstep in stepclass.checkstepnames: + for checkstep in stepclassfrom checkstepnames: logger.debug( f"CheckStep: {checkstep}" ) checkparams = [] checkclass = globals()[ checkstep ] diff --git a/geosx_mesh_doctor/mesh_doctor/__init__.py b/geosx_mesh_doctor/mesh_doctor/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/geosx_mesh_doctor/checks/__init__.py b/geosx_mesh_doctor/mesh_doctor/checks/__init__.py similarity index 100% rename from geosx_mesh_doctor/checks/__init__.py rename to geosx_mesh_doctor/mesh_doctor/checks/__init__.py diff --git a/geosx_mesh_doctor/checks/check_fractures.py b/geosx_mesh_doctor/mesh_doctor/checks/check_fractures.py similarity index 100% rename from geosx_mesh_doctor/checks/check_fractures.py rename to geosx_mesh_doctor/mesh_doctor/checks/check_fractures.py diff --git a/geosx_mesh_doctor/checks/collocated_nodes.py b/geosx_mesh_doctor/mesh_doctor/checks/collocated_nodes.py similarity index 100% rename from geosx_mesh_doctor/checks/collocated_nodes.py rename to geosx_mesh_doctor/mesh_doctor/checks/collocated_nodes.py diff --git a/geosx_mesh_doctor/checks/element_volumes.py b/geosx_mesh_doctor/mesh_doctor/checks/element_volumes.py similarity index 100% rename from geosx_mesh_doctor/checks/element_volumes.py rename to geosx_mesh_doctor/mesh_doctor/checks/element_volumes.py diff --git a/geosx_mesh_doctor/checks/fix_elements_orderings.py b/geosx_mesh_doctor/mesh_doctor/checks/fix_elements_orderings.py similarity index 100% rename from geosx_mesh_doctor/checks/fix_elements_orderings.py rename to geosx_mesh_doctor/mesh_doctor/checks/fix_elements_orderings.py diff --git a/geosx_mesh_doctor/checks/generate_cube.py b/geosx_mesh_doctor/mesh_doctor/checks/generate_cube.py similarity index 100% rename from geosx_mesh_doctor/checks/generate_cube.py rename to geosx_mesh_doctor/mesh_doctor/checks/generate_cube.py diff --git a/geosx_mesh_doctor/checks/generate_fractures.py b/geosx_mesh_doctor/mesh_doctor/checks/generate_fractures.py similarity index 100% rename from geosx_mesh_doctor/checks/generate_fractures.py rename to geosx_mesh_doctor/mesh_doctor/checks/generate_fractures.py diff --git a/geosx_mesh_doctor/checks/generate_global_ids.py b/geosx_mesh_doctor/mesh_doctor/checks/generate_global_ids.py similarity index 100% rename from geosx_mesh_doctor/checks/generate_global_ids.py rename to geosx_mesh_doctor/mesh_doctor/checks/generate_global_ids.py diff --git a/geosx_mesh_doctor/checks/non_conformal.py b/geosx_mesh_doctor/mesh_doctor/checks/non_conformal.py similarity index 100% rename from geosx_mesh_doctor/checks/non_conformal.py rename to geosx_mesh_doctor/mesh_doctor/checks/non_conformal.py diff --git a/geosx_mesh_doctor/checks/reorient_mesh.py b/geosx_mesh_doctor/mesh_doctor/checks/reorient_mesh.py similarity index 100% rename from geosx_mesh_doctor/checks/reorient_mesh.py rename to geosx_mesh_doctor/mesh_doctor/checks/reorient_mesh.py diff --git a/geosx_mesh_doctor/checks/self_intersecting_elements.py b/geosx_mesh_doctor/mesh_doctor/checks/self_intersecting_elements.py similarity index 100% rename from geosx_mesh_doctor/checks/self_intersecting_elements.py rename to geosx_mesh_doctor/mesh_doctor/checks/self_intersecting_elements.py diff --git a/geosx_mesh_doctor/checks/supported_elements.py b/geosx_mesh_doctor/mesh_doctor/checks/supported_elements.py similarity index 100% rename from geosx_mesh_doctor/checks/supported_elements.py rename to geosx_mesh_doctor/mesh_doctor/checks/supported_elements.py diff --git a/geosx_mesh_doctor/checks/triangle_distance.py b/geosx_mesh_doctor/mesh_doctor/checks/triangle_distance.py similarity index 100% rename from geosx_mesh_doctor/checks/triangle_distance.py rename to geosx_mesh_doctor/mesh_doctor/checks/triangle_distance.py diff --git a/geosx_mesh_doctor/checks/vtk_polyhedron.py b/geosx_mesh_doctor/mesh_doctor/checks/vtk_polyhedron.py similarity index 100% rename from geosx_mesh_doctor/checks/vtk_polyhedron.py rename to geosx_mesh_doctor/mesh_doctor/checks/vtk_polyhedron.py diff --git a/geosx_mesh_doctor/checks/vtk_utils.py b/geosx_mesh_doctor/mesh_doctor/checks/vtk_utils.py similarity index 100% rename from geosx_mesh_doctor/checks/vtk_utils.py rename to geosx_mesh_doctor/mesh_doctor/checks/vtk_utils.py diff --git a/geosx_mesh_doctor/mesh_doctor.py b/geosx_mesh_doctor/mesh_doctor/main.py similarity index 87% rename from geosx_mesh_doctor/mesh_doctor.py rename to geosx_mesh_doctor/mesh_doctor/main.py index 0e652acf..09e8692a 100644 --- a/geosx_mesh_doctor/mesh_doctor.py +++ b/geosx_mesh_doctor/mesh_doctor/main.py @@ -9,12 +9,11 @@ import logging -from parsing import CheckHelper -from parsing.cli_parsing import parse_and_set_verbosity -import register +from .parsing import CheckHelper +from .parsing.cli_parsing import parse_and_set_verbosity +from . import register as register - -def main(): +def test(): logging.basicConfig( format='[%(asctime)s][%(levelname)s] %(message)s' ) parse_and_set_verbosity( sys.argv ) main_parser, all_checks, all_checks_helpers = register.register() @@ -32,4 +31,4 @@ def main(): if __name__ == '__main__': - main() + test() diff --git a/geosx_mesh_doctor/parsing/__init__.py b/geosx_mesh_doctor/mesh_doctor/parsing/__init__.py similarity index 100% rename from geosx_mesh_doctor/parsing/__init__.py rename to geosx_mesh_doctor/mesh_doctor/parsing/__init__.py diff --git a/geosx_mesh_doctor/parsing/check_fractures_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/check_fractures_parsing.py similarity index 100% rename from geosx_mesh_doctor/parsing/check_fractures_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/check_fractures_parsing.py diff --git a/geosx_mesh_doctor/parsing/cli_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py similarity index 100% rename from geosx_mesh_doctor/parsing/cli_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py diff --git a/geosx_mesh_doctor/parsing/collocated_nodes_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/collocated_nodes_parsing.py similarity index 96% rename from geosx_mesh_doctor/parsing/collocated_nodes_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/collocated_nodes_parsing.py index fd737a83..09f5ea83 100644 --- a/geosx_mesh_doctor/parsing/collocated_nodes_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/collocated_nodes_parsing.py @@ -5,7 +5,7 @@ List, ) -from checks.collocated_nodes import Options, Result +from ..checks.collocated_nodes import Options, Result from . import COLLOCATES_NODES diff --git a/geosx_mesh_doctor/parsing/element_volumes_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/element_volumes_parsing.py similarity index 95% rename from geosx_mesh_doctor/parsing/element_volumes_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/element_volumes_parsing.py index 3c126cde..47e116ab 100644 --- a/geosx_mesh_doctor/parsing/element_volumes_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/element_volumes_parsing.py @@ -1,6 +1,6 @@ import logging -from checks.element_volumes import Options, Result +from ..checks.element_volumes import Options, Result from . import ELEMENT_VOLUMES diff --git a/geosx_mesh_doctor/parsing/fix_elements_orderings_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/fix_elements_orderings_parsing.py similarity index 97% rename from geosx_mesh_doctor/parsing/fix_elements_orderings_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/fix_elements_orderings_parsing.py index 7a620067..5432b0f4 100644 --- a/geosx_mesh_doctor/parsing/fix_elements_orderings_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/fix_elements_orderings_parsing.py @@ -11,7 +11,7 @@ VTK_WEDGE, ) -from checks.fix_elements_orderings import Options, Result +from ..checks.fix_elements_orderings import Options, Result from . import vtk_output_parsing, FIX_ELEMENTS_ORDERINGS diff --git a/geosx_mesh_doctor/parsing/generate_cube_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/generate_cube_parsing.py similarity index 98% rename from geosx_mesh_doctor/parsing/generate_cube_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/generate_cube_parsing.py index 3c8a17d2..e2573b64 100644 --- a/geosx_mesh_doctor/parsing/generate_cube_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/generate_cube_parsing.py @@ -1,6 +1,6 @@ import logging -from checks.generate_cube import Options, Result, FieldInfo +from ..checks.generate_cube import Options, Result, FieldInfo from . import vtk_output_parsing, generate_global_ids_parsing, GENERATE_CUBE from .generate_global_ids_parsing import GlobalIdsInfo diff --git a/geosx_mesh_doctor/parsing/generate_fractures_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/generate_fractures_parsing.py similarity index 97% rename from geosx_mesh_doctor/parsing/generate_fractures_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/generate_fractures_parsing.py index f3840895..43eaf797 100644 --- a/geosx_mesh_doctor/parsing/generate_fractures_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/generate_fractures_parsing.py @@ -1,6 +1,6 @@ import logging -from checks.generate_fractures import Options, Result, FracturePolicy +from ..checks.generate_fractures import Options, Result, FracturePolicy from . import vtk_output_parsing, GENERATE_FRACTURES diff --git a/geosx_mesh_doctor/parsing/generate_global_ids_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/generate_global_ids_parsing.py similarity index 97% rename from geosx_mesh_doctor/parsing/generate_global_ids_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/generate_global_ids_parsing.py index 06efd434..bc1ffb8b 100644 --- a/geosx_mesh_doctor/parsing/generate_global_ids_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/generate_global_ids_parsing.py @@ -1,7 +1,7 @@ from dataclasses import dataclass import logging -from checks.generate_global_ids import Options, Result +from ..checks.generate_global_ids import Options, Result from . import vtk_output_parsing, GENERATE_GLOBAL_IDS diff --git a/geosx_mesh_doctor/parsing/non_conformal_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/non_conformal_parsing.py similarity index 97% rename from geosx_mesh_doctor/parsing/non_conformal_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/non_conformal_parsing.py index 046c9605..c8db4d1e 100644 --- a/geosx_mesh_doctor/parsing/non_conformal_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/non_conformal_parsing.py @@ -5,7 +5,7 @@ List, ) -from checks.non_conformal import Options, Result +from ..checks.non_conformal import Options, Result from . import NON_CONFORMAL diff --git a/geosx_mesh_doctor/parsing/self_intersecting_elements_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/self_intersecting_elements_parsing.py similarity index 95% rename from geosx_mesh_doctor/parsing/self_intersecting_elements_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/self_intersecting_elements_parsing.py index b5c2f545..4b93f0ee 100644 --- a/geosx_mesh_doctor/parsing/self_intersecting_elements_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/self_intersecting_elements_parsing.py @@ -2,7 +2,7 @@ import numpy -from checks.self_intersecting_elements import Options, Result +from ..checks.self_intersecting_elements import Options, Result from . import SELF_INTERSECTING_ELEMENTS diff --git a/geosx_mesh_doctor/parsing/supported_elements_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/supported_elements_parsing.py similarity index 97% rename from geosx_mesh_doctor/parsing/supported_elements_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/supported_elements_parsing.py index b43ae042..9d699fa7 100644 --- a/geosx_mesh_doctor/parsing/supported_elements_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/supported_elements_parsing.py @@ -1,7 +1,7 @@ import logging import multiprocessing -from checks.supported_elements import Options, Result +from ..checks.supported_elements import Options, Result from . import SUPPORTED_ELEMENTS diff --git a/geosx_mesh_doctor/parsing/vtk_output_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/vtk_output_parsing.py similarity index 97% rename from geosx_mesh_doctor/parsing/vtk_output_parsing.py rename to geosx_mesh_doctor/mesh_doctor/parsing/vtk_output_parsing.py index be31037d..873ea4fe 100644 --- a/geosx_mesh_doctor/parsing/vtk_output_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/vtk_output_parsing.py @@ -2,7 +2,7 @@ import logging import textwrap -from checks.vtk_utils import VtkOutput +from ..checks.vtk_utils import VtkOutput __OUTPUT_FILE = "output" __OUTPUT_BINARY_MODE = "data-mode" diff --git a/geosx_mesh_doctor/register.py b/geosx_mesh_doctor/mesh_doctor/register.py similarity index 91% rename from geosx_mesh_doctor/register.py rename to geosx_mesh_doctor/mesh_doctor/register.py index 1626053b..f063dfe1 100644 --- a/geosx_mesh_doctor/register.py +++ b/geosx_mesh_doctor/mesh_doctor/register.py @@ -3,20 +3,20 @@ import logging from typing import Dict, Callable, Any, Tuple -import parsing -from parsing import CheckHelper, cli_parsing +import mesh_doctor.parsing as parsing +from .parsing import CheckHelper, cli_parsing __HELPERS: Dict[ str, Callable[ [ None ], CheckHelper ] ] = dict() __CHECKS: Dict[ str, Callable[ [ None ], Any ] ] = dict() def __load_module_check( module_name: str, check_fct="check" ): - module = importlib.import_module( "checks." + module_name ) + module = importlib.import_module( "mesh_doctor.checks." + module_name ) return getattr( module, check_fct ) def __load_module_check_helper( module_name: str, parsing_fct_suffix="_parsing" ): - module = importlib.import_module( "parsing." + module_name + parsing_fct_suffix ) + module = importlib.import_module( "mesh_doctor.parsing." + module_name + parsing_fct_suffix ) return CheckHelper( fill_subparser=module.fill_subparser, convert=module.convert, display_results=module.display_results ) diff --git a/geosx_mesh_doctor/tests/test_cli_parsing.py b/geosx_mesh_doctor/mesh_doctor/tests/test_cli_parsing.py similarity index 96% rename from geosx_mesh_doctor/tests/test_cli_parsing.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_cli_parsing.py index 1989e24d..fe7fd56b 100644 --- a/geosx_mesh_doctor/tests/test_cli_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_cli_parsing.py @@ -8,10 +8,10 @@ import pytest -from checks.vtk_utils import ( +from ..checks.vtk_utils import ( VtkOutput, ) -from checks.generate_fractures import ( +from ..checks.generate_fractures import ( FracturePolicy, Options, ) diff --git a/geosx_mesh_doctor/tests/test_collocated_nodes.py b/geosx_mesh_doctor/mesh_doctor/tests/test_collocated_nodes.py similarity index 97% rename from geosx_mesh_doctor/tests/test_collocated_nodes.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_collocated_nodes.py index d0b66458..a5849e3f 100644 --- a/geosx_mesh_doctor/tests/test_collocated_nodes.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_collocated_nodes.py @@ -11,7 +11,7 @@ vtkUnstructuredGrid, ) -from checks.collocated_nodes import Options, __check +from ..checks.collocated_nodes import Options, __check def get_points() -> Iterator[ Tuple[ vtkPoints, int ] ]: diff --git a/geosx_mesh_doctor/tests/test_element_volumes.py b/geosx_mesh_doctor/mesh_doctor/tests/test_element_volumes.py similarity index 95% rename from geosx_mesh_doctor/tests/test_element_volumes.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_element_volumes.py index 163300c1..d2991a8f 100644 --- a/geosx_mesh_doctor/tests/test_element_volumes.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_element_volumes.py @@ -9,7 +9,7 @@ vtkUnstructuredGrid, ) -from checks.element_volumes import Options, __check +from ..checks.element_volumes import Options, __check def test_simple_tet(): diff --git a/geosx_mesh_doctor/tests/test_generate_cube.py b/geosx_mesh_doctor/mesh_doctor/tests/test_generate_cube.py similarity index 92% rename from geosx_mesh_doctor/tests/test_generate_cube.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_generate_cube.py index 78713f81..e1439219 100644 --- a/geosx_mesh_doctor/tests/test_generate_cube.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_generate_cube.py @@ -1,4 +1,4 @@ -from checks.generate_cube import __build, Options, FieldInfo +from ..checks.generate_cube import __build, Options, FieldInfo def test_generate_cube(): diff --git a/geosx_mesh_doctor/tests/test_generate_fractures.py b/geosx_mesh_doctor/mesh_doctor/tests/test_generate_fractures.py similarity index 97% rename from geosx_mesh_doctor/tests/test_generate_fractures.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_generate_fractures.py index 077d9d75..bd3e3121 100644 --- a/geosx_mesh_doctor/tests/test_generate_fractures.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_generate_fractures.py @@ -20,12 +20,12 @@ from vtkmodules.util.numpy_support import ( numpy_to_vtk, ) -from checks.vtk_utils import ( +from ..checks.vtk_utils import ( to_vtk_id_list, ) -from checks.check_fractures import format_collocated_nodes -from checks.generate_cube import build_rectilinear_blocks_mesh, XYZ -from checks.generate_fractures import __split_mesh_on_fracture, Options, FracturePolicy +from ..checks.check_fractures import format_collocated_nodes +from ..checks.generate_cube import build_rectilinear_blocks_mesh, XYZ +from ..checks.generate_fractures import __split_mesh_on_fracture, Options, FracturePolicy @dataclass( frozen=True ) diff --git a/geosx_mesh_doctor/tests/test_generate_global_ids.py b/geosx_mesh_doctor/mesh_doctor/tests/test_generate_global_ids.py similarity index 92% rename from geosx_mesh_doctor/tests/test_generate_global_ids.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_generate_global_ids.py index f2998d7b..483b437b 100644 --- a/geosx_mesh_doctor/tests/test_generate_global_ids.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_generate_global_ids.py @@ -7,7 +7,7 @@ vtkVertex, ) -from checks.generate_global_ids import __build_global_ids +from ..checks.generate_global_ids import __build_global_ids def test_generate_global_ids(): diff --git a/geosx_mesh_doctor/tests/test_non_conformal.py b/geosx_mesh_doctor/mesh_doctor/tests/test_non_conformal.py similarity index 96% rename from geosx_mesh_doctor/tests/test_non_conformal.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_non_conformal.py index 0351ae98..3be57fb4 100644 --- a/geosx_mesh_doctor/tests/test_non_conformal.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_non_conformal.py @@ -1,7 +1,7 @@ import numpy -from checks.non_conformal import Options, __check -from checks.generate_cube import ( +from ..checks.non_conformal import Options, __check +from ..checks.generate_cube import ( build_rectilinear_blocks_mesh, XYZ, ) diff --git a/geosx_mesh_doctor/tests/test_reorient_mesh.py b/geosx_mesh_doctor/mesh_doctor/tests/test_reorient_mesh.py similarity index 96% rename from geosx_mesh_doctor/tests/test_reorient_mesh.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_reorient_mesh.py index f0ffd29e..987948d3 100644 --- a/geosx_mesh_doctor/tests/test_reorient_mesh.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_reorient_mesh.py @@ -14,9 +14,9 @@ import numpy -from checks.reorient_mesh import reorient_mesh -from checks.vtk_polyhedron import FaceStream -from checks.vtk_utils import ( +from ..checks.reorient_mesh import reorient_mesh +from ..checks.vtk_polyhedron import FaceStream +from ..checks.vtk_utils import ( to_vtk_id_list, vtk_iter, ) diff --git a/geosx_mesh_doctor/tests/test_self_intersecting_elements.py b/geosx_mesh_doctor/mesh_doctor/tests/test_self_intersecting_elements.py similarity index 95% rename from geosx_mesh_doctor/tests/test_self_intersecting_elements.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_self_intersecting_elements.py index 2b5455ab..c194a0aa 100644 --- a/geosx_mesh_doctor/tests/test_self_intersecting_elements.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_self_intersecting_elements.py @@ -7,7 +7,7 @@ vtkUnstructuredGrid, ) -from checks.self_intersecting_elements import Options, __check +from ..checks.self_intersecting_elements import Options, __check def test_jumbled_hex(): diff --git a/geosx_mesh_doctor/tests/test_supported_elements.py b/geosx_mesh_doctor/mesh_doctor/tests/test_supported_elements.py similarity index 94% rename from geosx_mesh_doctor/tests/test_supported_elements.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_supported_elements.py index 9d56932e..68e24460 100644 --- a/geosx_mesh_doctor/tests/test_supported_elements.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_supported_elements.py @@ -12,9 +12,9 @@ vtkUnstructuredGrid, ) -from checks.supported_elements import Options, check, __check -from checks.vtk_polyhedron import parse_face_stream, build_face_to_face_connectivity_through_edges, FaceStream -from checks.vtk_utils import ( +from ..checks.supported_elements import Options, check, __check +from ..checks.vtk_polyhedron import parse_face_stream, build_face_to_face_connectivity_through_edges, FaceStream +from ..checks.vtk_utils import ( to_vtk_id_list, ) diff --git a/geosx_mesh_doctor/tests/test_triangle_distance.py b/geosx_mesh_doctor/mesh_doctor/tests/test_triangle_distance.py similarity index 98% rename from geosx_mesh_doctor/tests/test_triangle_distance.py rename to geosx_mesh_doctor/mesh_doctor/tests/test_triangle_distance.py index f44b5e8c..8e32245c 100644 --- a/geosx_mesh_doctor/tests/test_triangle_distance.py +++ b/geosx_mesh_doctor/mesh_doctor/tests/test_triangle_distance.py @@ -4,7 +4,7 @@ from numpy.linalg import norm import pytest -from checks.triangle_distance import distance_between_two_segments, distance_between_two_triangles +from ..checks.triangle_distance import distance_between_two_segments, distance_between_two_triangles @dataclass( frozen=True ) diff --git a/geosx_mesh_doctor/requirements.txt b/geosx_mesh_doctor/requirements.txt deleted file mode 100644 index 4c9b1763..00000000 --- a/geosx_mesh_doctor/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -vtk >= 9.1 -networkx >= 2.4 -tqdm -numpy \ No newline at end of file diff --git a/geosx_mesh_doctor/setup.cfg b/geosx_mesh_doctor/setup.cfg new file mode 100644 index 00000000..22e67c0b --- /dev/null +++ b/geosx_mesh_doctor/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = mesh_doctor +version = 0.1.0 +description = Mesh doctor +author = Gazzolab +author_email = thomas.gazzola@totalenergies.com +license = LGPL-2.1 + +[options] +packages = + mesh_doctor + mesh_doctor.checks + mesh_doctor.parsing + mesh_doctor.tests +install_requires = + vtk >= 9.1 + networkx >= 2.4 + tqdm + numpy +python_requires = >=3.7 + +[options.entry_points] +console_scripts = + mesh_doctor = mesh_doctor.main:test diff --git a/geosx_mesh_doctor/setup.py b/geosx_mesh_doctor/setup.py deleted file mode 100644 index dc03ac1d..00000000 --- a/geosx_mesh_doctor/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup, find_packages - -setup( name='mesh_doctor', version='0.0.1', packages=find_packages() ) From 5aa1c804fa6d462e320dce35eb30ed3d28849880 Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 12 Apr 2024 11:12:55 -0700 Subject: [PATCH 2/5] fix unwanted changes. --- geos_ats_package/geos_ats/machine_utilities.py | 2 +- geos_ats_package/geos_ats/test_steps.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/geos_ats_package/geos_ats/machine_utilities.py b/geos_ats_package/geos_ats/machine_utilities.py index dd3c58fe..356de83a 100644 --- a/geos_ats_package/geos_ats/machine_utilities.py +++ b/geos_ats_package/geos_ats/machine_utilities.py @@ -12,7 +12,7 @@ def CheckForEarlyTimeOut( test, retval, fraction ): if ( config.max_retry > 0 ) and ( config.retry_err_regexp != "" ) and ( not hasattr( test, "checkstart" ) ): sourceFile = getattr( test, "errname" ) if os.path.exists( sourceFile ): - testfrom checkstart = 1 + test.checkstart = 1 with open( sourceFile ) as f: erroutput = f.read() if re.search( config.retry_err_regexp, erroutput ): diff --git a/geos_ats_package/geos_ats/test_steps.py b/geos_ats_package/geos_ats/test_steps.py index 7c7e43ac..74450248 100644 --- a/geos_ats_package/geos_ats/test_steps.py +++ b/geos_ats_package/geos_ats/test_steps.py @@ -412,16 +412,16 @@ def __init__( self, restartcheck_params=None, curvecheck_params=None, **kw ): self.setParams( kw, self.params ) checkOption = self.getCheckOption() - selffrom checksteps = [] + self.checksteps = [] if checkOption in [ "all", "curvecheck" ]: if curvecheck_params is not None: - selffrom checksteps.append( curvecheck( curvecheck_params, **kw ) ) + self.checksteps.append( curvecheck( curvecheck_params, **kw ) ) if checkOption in [ "all", "restartcheck" ]: if restartcheck_params is not None: - selffrom checksteps.append( restartcheck( restartcheck_params, **kw ) ) + self.checksteps.append( restartcheck( restartcheck_params, **kw ) ) - if not selffrom checksteps: + if not self.checksteps: raise Exception( f'This test does not have a restart or curve check enabled: {self.p.deck}' ) def label( self ): @@ -453,7 +453,7 @@ def update( self, dictionary ): # update all the checksteps if self.p.check: - for step in selffrom checksteps: + for step in self.checksteps: step.update( dictionary ) def insertStep( self, steps ): @@ -462,7 +462,7 @@ def insertStep( self, steps ): # the post conditions if self.p.check: - for step in selffrom checksteps: + for step in self.checksteps: step.insertStep( steps ) def makeArgs( self ): From c20940520d882f89d6e79585f18ce7137a61152e Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 12 Apr 2024 11:14:45 -0700 Subject: [PATCH 3/5] fix another unwanted change. --- geos_ats_package/geos_ats/test_steps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geos_ats_package/geos_ats/test_steps.py b/geos_ats_package/geos_ats/test_steps.py index 74450248..54f7a2f7 100644 --- a/geos_ats_package/geos_ats/test_steps.py +++ b/geos_ats_package/geos_ats/test_steps.py @@ -812,7 +812,7 @@ def infoTestStep( stepname ): # compute max param width: allparams = [ p.name for p in stepclass.params ] if hasattr( stepclass, "checkstepnames" ): - for checkstep in stepclassfrom checkstepnames: + for checkstep in stepclass.checkstepnames: checkclass = globals()[ checkstep ] if not hasattr( checkclass, "doc" ): continue @@ -825,7 +825,7 @@ def infoTestStep( stepname ): paramset = set( [ p.name for p in stepclass.params ] ) if hasattr( stepclass, "checkstepnames" ): - for checkstep in stepclassfrom checkstepnames: + for checkstep in stepclass.checkstepnames: logger.debug( f"CheckStep: {checkstep}" ) checkparams = [] checkclass = globals()[ checkstep ] From 372f0ec9b527a5b6aa300acd97f3e3e238850fe7 Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 12 Apr 2024 11:40:54 -0700 Subject: [PATCH 4/5] small fixes. --- geosx_mesh_doctor/mesh_doctor/main.py | 10 +++++----- geosx_mesh_doctor/setup.cfg | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/geosx_mesh_doctor/mesh_doctor/main.py b/geosx_mesh_doctor/mesh_doctor/main.py index 09e8692a..06b0f8ca 100644 --- a/geosx_mesh_doctor/mesh_doctor/main.py +++ b/geosx_mesh_doctor/mesh_doctor/main.py @@ -9,11 +9,11 @@ import logging -from .parsing import CheckHelper -from .parsing.cli_parsing import parse_and_set_verbosity -from . import register as register +from mesh_doctor.parsing import CheckHelper +from mesh_doctor.parsing.cli_parsing import parse_and_set_verbosity +from mesh_doctor import register as register -def test(): +def main(): logging.basicConfig( format='[%(asctime)s][%(levelname)s] %(message)s' ) parse_and_set_verbosity( sys.argv ) main_parser, all_checks, all_checks_helpers = register.register() @@ -31,4 +31,4 @@ def test(): if __name__ == '__main__': - test() + main() diff --git a/geosx_mesh_doctor/setup.cfg b/geosx_mesh_doctor/setup.cfg index 22e67c0b..c6f04c25 100644 --- a/geosx_mesh_doctor/setup.cfg +++ b/geosx_mesh_doctor/setup.cfg @@ -21,4 +21,4 @@ python_requires = >=3.7 [options.entry_points] console_scripts = - mesh_doctor = mesh_doctor.main:test + mesh_doctor = mesh_doctor.main:main From 6577323f054a9a3c13a236b665920bd4d9c55e4d Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 12 Apr 2024 11:50:10 -0700 Subject: [PATCH 5/5] GEOSX -> GEOS --- geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py b/geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py index a34010ba..6129f532 100644 --- a/geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py +++ b/geosx_mesh_doctor/mesh_doctor/parsing/cli_parsing.py @@ -48,7 +48,7 @@ def init_parser() -> argparse.ArgumentParser: Increase verbosity (-{__VERBOSITY_FLAG}, -{__VERBOSITY_FLAG * 2}) to get full information. """ formatter = lambda prog: argparse.RawTextHelpFormatter( prog, max_help_position=8 ) - parser = argparse.ArgumentParser( description='Inspects meshes for GEOSX.', + parser = argparse.ArgumentParser( description='Inspects meshes for GEOS.', epilog=textwrap.dedent( epilog_msg ), formatter_class=formatter ) # Nothing will be done with this verbosity/quiet input.