diff --git a/splinepy/_base.py b/splinepy/_base.py index edacb0edb..61cc0342c 100644 --- a/splinepy/_base.py +++ b/splinepy/_base.py @@ -15,5 +15,7 @@ def __init_subclass__(cls, *args, **kwargs): super().__init_subclass__(*args, **kwargs) cls._logi = _log.prepend_log("<" + cls.__qualname__ + ">", _log.info) cls._logd = _log.prepend_log("<" + cls.__qualname__ + ">", _log.debug) - cls._logw = _log.prepend_log("<" + cls.__qualname__ + ">", _log.warning) + cls._logw = _log.prepend_log( + "<" + cls.__qualname__ + ">", _log.warning + ) return super().__new__(cls) diff --git a/splinepy/io/cats.py b/splinepy/io/cats.py index 3b73df414..be5eeeb76 100644 --- a/splinepy/io/cats.py +++ b/splinepy/io/cats.py @@ -10,7 +10,7 @@ from splinepy.io import ioutils as _ioutils from splinepy.utils.log import debug as _debug -from splinepy.utils.log import warning as _warning +from splinepy.utils.log import warning as _warning # List of spline keywords (bundled here in case they change - many unused) CATS_XML_KEY_WORDS = { diff --git a/splinepy/io/gismo.py b/splinepy/io/gismo.py index 997e609b6..72bf5c6e8 100644 --- a/splinepy/io/gismo.py +++ b/splinepy/io/gismo.py @@ -10,6 +10,7 @@ from splinepy.utils.log import debug as _debug from splinepy.utils.log import warning as _warning + def _spline_to_ET( root, multipatch, @@ -230,7 +231,7 @@ def export( """ from splinepy import Multipatch as _Multipatch from splinepy.settings import NTHREADS as _NTHREADS - from splinepy.settings import TOLERANCE as _TOLERANCE + from splinepy.settings import TOLERANCE as _TOLERANCE from splinepy.spline import Spline as _Spline from splinepy.splinepy_core import orientations as _orientations @@ -264,7 +265,9 @@ def export( multipatch_element = _ET.SubElement( xml_data, "MultiPatch", id=str(0), parDim=str(multipatch.para_dim) ) - patch_range = _ET.SubElement(multipatch_element, "patches", type="id_range") + patch_range = _ET.SubElement( + multipatch_element, "patches", type="id_range" + ) patch_range.text = ( f"{index_offset} " f"{len(multipatch.patches) - 1 + index_offset}" ) @@ -570,7 +573,9 @@ def make_dictionary(ETelement): if patch_element is None: _debug("Unsupported format") if patch_element.attrib.get("type") != "id_range": - _debug(f"Invalid patch type {patch_element.attrib.get('type')}") + _debug( + f"Invalid patch type {patch_element.attrib.get('type')}" + ) patch_range = _matrix_from_node(patch_element).astype(_np.int64) offset = patch_range[0] n_splines = patch_range[1] - patch_range[0] + 1 diff --git a/splinepy/io/mfem.py b/splinepy/io/mfem.py index eb6ee0d08..2289a502b 100644 --- a/splinepy/io/mfem.py +++ b/splinepy/io/mfem.py @@ -11,7 +11,6 @@ from splinepy.io.ioutils import make_meaningful as _make_meaningful from splinepy.io.ioutils import next_line as _next_line - # keywords : possible assert value _mfem_meaningful_keywords = { "MFEM NURBS mesh v1.0": "intro", diff --git a/splinepy/microstructure/tiles/crossednuttile2d.py b/splinepy/microstructure/tiles/crossednuttile2d.py index 4ae52d7c6..936302a38 100644 --- a/splinepy/microstructure/tiles/crossednuttile2d.py +++ b/splinepy/microstructure/tiles/crossednuttile2d.py @@ -385,7 +385,9 @@ def _closing_tile( spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_right)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=bottom_right) + ) return spline_list @@ -549,6 +551,8 @@ def create_tile( spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_right)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=bottom_right) + ) return spline_list diff --git a/splinepy/microstructure/tiles/cube3d.py b/splinepy/microstructure/tiles/cube3d.py index b27aa793c..ccca11a67 100644 --- a/splinepy/microstructure/tiles/cube3d.py +++ b/splinepy/microstructure/tiles/cube3d.py @@ -58,7 +58,8 @@ def create_tile( self.check_params(parameters) if not ( - _np.all(parameters[:, :2] > 0.0) and _np.all(parameters[:, :2] < 0.5) + _np.all(parameters[:, :2] > 0.0) + and _np.all(parameters[:, :2] < 0.5) ): raise ValueError("The wall thickness must be in (0.0 and 0.5)") diff --git a/splinepy/microstructure/tiles/ellipsvoid.py b/splinepy/microstructure/tiles/ellipsvoid.py index 065cb0890..e2c1e0085 100644 --- a/splinepy/microstructure/tiles/ellipsvoid.py +++ b/splinepy/microstructure/tiles/ellipsvoid.py @@ -3,6 +3,7 @@ from splinepy.bezier import Bezier as _Bezier from splinepy.microstructure.tiles.tilebase import TileBase as _TileBase + class Ellipsvoid(_TileBase): """Void in form of an ellipse set into a unit cell. diff --git a/splinepy/microstructure/tiles/inversecrosstile3d.py b/splinepy/microstructure/tiles/inversecrosstile3d.py index e4efe914f..bcbc961d3 100644 --- a/splinepy/microstructure/tiles/inversecrosstile3d.py +++ b/splinepy/microstructure/tiles/inversecrosstile3d.py @@ -946,7 +946,9 @@ def create_tile( self.check_params(parameters) - if _np.any(parameters < min_radius) or _np.any(parameters > max_radius): + if _np.any(parameters < min_radius) or _np.any( + parameters > max_radius + ): raise ValueError( f"Radii must be in (0,{max_radius}) for " f"center_expansion {center_expansion}" diff --git a/splinepy/microstructure/tiles/nuttile2d.py b/splinepy/microstructure/tiles/nuttile2d.py index 072535226..488fd56af 100644 --- a/splinepy/microstructure/tiles/nuttile2d.py +++ b/splinepy/microstructure/tiles/nuttile2d.py @@ -390,7 +390,9 @@ def _closing_tile( spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_right)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=bottom_right) + ) return (spline_list, None) @@ -561,6 +563,8 @@ def create_tile( spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_right)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=bottom_right) + ) return (spline_list, None) diff --git a/splinepy/microstructure/tiles/nuttile3d.py b/splinepy/microstructure/tiles/nuttile3d.py index 378053f96..07973bc9e 100644 --- a/splinepy/microstructure/tiles/nuttile3d.py +++ b/splinepy/microstructure/tiles/nuttile3d.py @@ -189,7 +189,9 @@ def create_tile( spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=right)) - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=right_top)) + spline_list.append( + _Bezier(degrees=[1, 1, 1], control_points=right_top) + ) spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=bottom)) @@ -587,6 +589,8 @@ def closing_tile( spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_right)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=bottom_right) + ) return (spline_list, None) diff --git a/splinepy/microstructure/tiles/snappytile.py b/splinepy/microstructure/tiles/snappytile.py index 1b39161ad..46343b4b6 100644 --- a/splinepy/microstructure/tiles/snappytile.py +++ b/splinepy/microstructure/tiles/snappytile.py @@ -79,7 +79,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_1)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_1) + ) spline_2 = _np.array( [ [cl_2_inv, v_zero], @@ -89,7 +91,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_2)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_2) + ) spline_3 = _np.array( [ [v_zero, a_inv], @@ -99,7 +103,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_3)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_3) + ) spline_4 = _np.array( [ [cl_2_inv, a_inv], @@ -109,7 +115,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_4)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_4) + ) spline_5 = _np.array( [ @@ -120,7 +128,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_5)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_5) + ) spline_6 = _np.array( [ @@ -131,7 +141,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_6)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_6) + ) spline_7 = _np.array( [ @@ -146,7 +158,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[3, 1], control_points=spline_7)) + spline_list.append( + _Bezier(degrees=[3, 1], control_points=spline_7) + ) spline_8 = _np.array( [ @@ -161,7 +175,9 @@ def _closing_tile( ] ) + [v_one_half, v_zero] - spline_list.append(_Bezier(degrees=[3, 1], control_points=spline_8)) + spline_list.append( + _Bezier(degrees=[3, 1], control_points=spline_8) + ) spline_9 = _np.array( [ @@ -176,7 +192,9 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[3, 1], control_points=spline_9)) + spline_list.append( + _Bezier(degrees=[3, 1], control_points=spline_9) + ) spline_10 = _np.array( [ @@ -204,7 +222,9 @@ def _closing_tile( [cl_2, v_one], ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_1)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_1) + ) spline_2 = _np.array( [ [cl_2_inv, v_zero], @@ -213,7 +233,9 @@ def _closing_tile( [v_one, v_one], ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_2)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_2) + ) spline_3 = _np.array( [ [v_one_half - cl_2, v_one_half - b], @@ -222,7 +244,9 @@ def _closing_tile( [v_one_half + cl_2, v_one], ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=spline_3)) + spline_list.append( + _Bezier(degrees=[1, 1], control_points=spline_3) + ) spline_4 = _np.array( [ [cl_2, v_zero], @@ -235,7 +259,9 @@ def _closing_tile( [v_one_half - cl_2, v_one], ] ) - spline_list.append(_Bezier(degrees=[3, 1], control_points=spline_4)) + spline_list.append( + _Bezier(degrees=[3, 1], control_points=spline_4) + ) spline_5 = _np.array( [ [cl_2, v_one_half - b], @@ -249,7 +275,9 @@ def _closing_tile( ] ) + [v_one_half, v_zero] - spline_list.append(_Bezier(degrees=[3, 1], control_points=spline_5)) + spline_list.append( + _Bezier(degrees=[3, 1], control_points=spline_5) + ) return (spline_list, None) else: raise ValueError( diff --git a/splinepy/microstructure/tiles/tilebase.py b/splinepy/microstructure/tiles/tilebase.py index cf24345dd..0d7b768cc 100644 --- a/splinepy/microstructure/tiles/tilebase.py +++ b/splinepy/microstructure/tiles/tilebase.py @@ -98,7 +98,9 @@ def check_param_derivatives(self, derivatives): if derivatives is None: return False - if not (isinstance(derivatives, _np.ndarray) and derivatives.ndim == 3): + if not ( + isinstance(derivatives, _np.ndarray) and derivatives.ndim == 3 + ): raise TypeError("parameters must be three-dimensional np array") if not ( diff --git a/splinepy/multipatch.py b/splinepy/multipatch.py index a189b7423..ed0b55a9d 100644 --- a/splinepy/multipatch.py +++ b/splinepy/multipatch.py @@ -8,10 +8,11 @@ from splinepy._base import SplinepyBase as _SplinepyBase from splinepy.helpme import visualize as _visualize from splinepy.helpme.extract import Extractor as _Extractor -from splinepy.spline import _default_if_none -from splinepy.spline import _get_helper +from splinepy.spline import _default_if_none, _get_helper from splinepy.splinepy_core import PyMultipatch as _PyMultipatch -from splinepy.splinepy_core import boundaries_from_continuity as _boundaries_from_continuity +from splinepy.splinepy_core import ( + boundaries_from_continuity as _boundaries_from_continuity, +) from splinepy.utils.data import MultipatchData as _MultipatchData diff --git a/splinepy/spline.py b/splinepy/spline.py index 01ef41fcd..cdf81b541 100644 --- a/splinepy/spline.py +++ b/splinepy/spline.py @@ -9,8 +9,8 @@ from splinepy import helpme as _helpme from splinepy import io as _io from splinepy import settings as _settings -from splinepy import utils as _utils from splinepy import splinepy_core as _core +from splinepy import utils as _utils from splinepy._base import SplinepyBase as _SplinepyBase from splinepy.helpme import visualize as _visualize from splinepy.helpme.check import Checker as _Checker @@ -874,7 +874,7 @@ def knot_multiplicities(self): self._logd( "Returning multiplicities of knots if Bezier was BSpline" ) - return [np.array([d + 1, d + 1]) for d in self.degrees] + return [_np.array([d + 1, d + 1]) for d in self.degrees] else: self._logd("Retrieving knot multiplicities") @@ -1190,7 +1190,8 @@ def sample(self, resolutions, nthreads=None): self._logd(f"Sampling {_np.prod(resolutions)} points from spline.") return super().sample( - resolutions, nthreads=_default_if_none(nthreads, _settings.NTHREADS) + resolutions, + nthreads=_default_if_none(nthreads, _settings.NTHREADS), ) def derivative(self, queries, orders, nthreads=None): diff --git a/splinepy/utils/data.py b/splinepy/utils/data.py index 7461d1d3e..889e00439 100644 --- a/splinepy/utils/data.py +++ b/splinepy/utils/data.py @@ -14,7 +14,7 @@ __all__ = [ "PhysicalSpaceArray", - "DataHolder", + "_DataHolder", "enforce_contiguous_values", "cartesian_product", "SplineDataAdaptor", @@ -369,7 +369,8 @@ def cartesian_product(arrays, reverse=True): dim_reducing_views = ( *_accumulate( - _chain((_cartesian,), _repeat(0, n_arr - 1)), _np.ndarray.__getitem__ + _chain((_cartesian,), _repeat(0, n_arr - 1)), + _np.ndarray.__getitem__, ), ) idx = slice(None), *_repeat(None, n_arr - 1) diff --git a/tests/test_creator.py b/tests/test_creator.py index dd6845155..363f5c3c3 100644 --- a/tests/test_creator.py +++ b/tests/test_creator.py @@ -1,4 +1,5 @@ import numpy as np + import splinepy try: diff --git a/third_party/BSplineLib b/third_party/BSplineLib index 4b7e738a9..74756bdaa 160000 --- a/third_party/BSplineLib +++ b/third_party/BSplineLib @@ -1 +1 @@ -Subproject commit 4b7e738a9cd58db7bd1d329111b15c18d49d9006 +Subproject commit 74756bdaa73e4189e322899f34963b3431d9564b