From 3131ed20735f46727cb35d43baf0b3ddec54ebac Mon Sep 17 00:00:00 2001 From: Martin Campos Pinto Date: Fri, 21 Feb 2025 19:50:09 +0100 Subject: [PATCH 1/4] small changes on domain to handle single patches in mp simulations --- sympde/topology/domain.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/sympde/topology/domain.py b/sympde/topology/domain.py index 1acf9a5d..bc4b8044 100644 --- a/sympde/topology/domain.py +++ b/sympde/topology/domain.py @@ -6,7 +6,7 @@ import yaml import os -from collections import abc +from collections import abc, OrderedDict from typing import Union as TypeUnion, Optional, List, Dict, Iterable, TYPE_CHECKING # Union clashes with core.basic.Union @@ -180,6 +180,26 @@ def mapping(self) -> Optional[Mapping]: """The mapping that maps the logical domain to the physical domain""" return self.args[3] + @property + def subdomains(self) -> tuple: + """returns subdomains as tuple of Domains""" + if isinstance( self.interior, iterable_types): + subs = self.interior + else: + subs = [self.interior] + return tuple(subs) + + @property + def mappings(self) -> OrderedDict: + return OrderedDict([(P.logical_domain, P.mapping) + for P in self.subdomains]) + # if isinstance( self.interior, iterable_types): + # subdomains = self.interior + # else: + # subdomains = [self.interior] + # return OrderedDict([(P.logical_domain, P.mapping) + # for P in subdomains]) + @property def logical_domain(self) -> Domain: """The domain is the image of the logical_domain under the mapping""" @@ -481,6 +501,11 @@ def join(cls, patches, connectivity, name): assert isinstance(connectivity, (tuple, list)) assert isinstance(name, str) + if len(patches) == 1: + # single patch domain: return the patch + assert len(connectivity) == 0 + return patches[0] + assert all(p.dim==patches[0].dim for p in patches) dim = int(patches[0].dim) From 81231c5deda375988ec9a289f3e291061c131c4e Mon Sep 17 00:00:00 2001 From: Martin Campos Pinto Date: Tue, 4 Mar 2025 17:07:44 +0100 Subject: [PATCH 2/4] removing comments --- sympde/topology/domain.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sympde/topology/domain.py b/sympde/topology/domain.py index bc4b8044..86074021 100644 --- a/sympde/topology/domain.py +++ b/sympde/topology/domain.py @@ -193,12 +193,6 @@ def subdomains(self) -> tuple: def mappings(self) -> OrderedDict: return OrderedDict([(P.logical_domain, P.mapping) for P in self.subdomains]) - # if isinstance( self.interior, iterable_types): - # subdomains = self.interior - # else: - # subdomains = [self.interior] - # return OrderedDict([(P.logical_domain, P.mapping) - # for P in subdomains]) @property def logical_domain(self) -> Domain: From 68fc4192aa6af319c3c2c8fb649cde7e72e89ff5 Mon Sep 17 00:00:00 2001 From: Martin Campos Pinto Date: Tue, 4 Mar 2025 17:31:17 +0100 Subject: [PATCH 3/4] removing white spaces in domain.py --- sympde/topology/domain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sympde/topology/domain.py b/sympde/topology/domain.py index 86074021..e785f3c5 100644 --- a/sympde/topology/domain.py +++ b/sympde/topology/domain.py @@ -183,7 +183,7 @@ def mapping(self) -> Optional[Mapping]: @property def subdomains(self) -> tuple: """returns subdomains as tuple of Domains""" - if isinstance( self.interior, iterable_types): + if isinstance( self.interior, iterable_types): subs = self.interior else: subs = [self.interior] From 8e457600ed347a72351fca107173c641c94c39c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaman=20G=C3=BC=C3=A7l=C3=BC?= Date: Wed, 5 Mar 2025 12:28:32 +0100 Subject: [PATCH 4/4] Update pyproject.toml Increase version to 0.19.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8b791aaf..077cb53d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "sympde" -version = "0.19.0" +version = "0.19.1" description = "Symbolic calculus for partial differential equations (and variational forms)" readme = "README.rst" requires-python = ">= 3.8, < 3.13"