From ffb45d9c82a59474517d26685c6e314784a25c92 Mon Sep 17 00:00:00 2001 From: Simon Bilodeau Date: Thu, 3 Oct 2024 22:06:43 +0000 Subject: [PATCH 1/4] refine method for ResolutionSpec --- meshwell/resolution.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/meshwell/resolution.py b/meshwell/resolution.py index 63ea0e0..422c7ba 100644 --- a/meshwell/resolution.py +++ b/meshwell/resolution.py @@ -1,8 +1,7 @@ -from dataclasses import dataclass import numpy as np +import copy -@dataclass class ResolutionSpec: """ Object holding resolution information for an entity and its boundaries. @@ -45,3 +44,17 @@ class ResolutionSpec: resolution_points: float = np.inf distmax_points: float | None = None sizemax_points: float | None = None + + def refine(self, resolution_factor: float): + result = copy.copy(self) + result.resolution_volumes *= resolution_factor + result.resolution_surfaces *= resolution_factor + if result.sizemax_surfaces is not None: + result.sizemax_surfaces *= resolution_factor + result.resolution_curves *= resolution_factor + if result.sizemax_curves is not None: + result.sizemax_curves *= resolution_factor + result.resolution_points *= resolution_factor + if result.sizemax_points is not None: + result.sizemax_points *= resolution_factor + return result From c901d90779390518bf38362cc06d3de5c76f3903 Mon Sep 17 00:00:00 2001 From: Simon Bilodeau Date: Thu, 3 Oct 2024 22:19:48 +0000 Subject: [PATCH 2/4] fix pydantic --- meshwell/resolution.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meshwell/resolution.py b/meshwell/resolution.py index 422c7ba..b6fabbb 100644 --- a/meshwell/resolution.py +++ b/meshwell/resolution.py @@ -1,8 +1,9 @@ import numpy as np import copy +from pydantic import BaseModel -class ResolutionSpec: +class ResolutionSpec(BaseModel): """ Object holding resolution information for an entity and its boundaries. From 93dab9e9fbec11053bc1041ec65365c84596fd7b Mon Sep 17 00:00:00 2001 From: Simon Bilodeau Date: Thu, 3 Oct 2024 22:21:19 +0000 Subject: [PATCH 3/4] update changelog --- docs/changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 5ac656c..67c27d8 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,9 @@ # [Changelog](https://keepachangelog.com/en/1.0.0/) +## 1.2.3 + +- resolution_factor method in ResolutionSpec [PR#70](https://github.com/simbilod/meshwell/pull/70) + ## 1.1.2 - ResolutionSpec instead of resolution dict [PR#69](https://github.com/simbilod/meshwell/pull/69) From 45a155fe371d39622c6565a2e461a98746ebf3ba Mon Sep 17 00:00:00 2001 From: Simon Bilodeau Date: Thu, 3 Oct 2024 22:25:35 +0000 Subject: [PATCH 4/4] increment version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 89fea23..08f6a73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", ] -version="1.1.2" +version="1.1.3" authors = [ {name = "Simon Bilodeau", email = "sb30@princeton.edu"}, ]