Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New hierarchy for Mapping classes #168

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9440752
fixing git workflow
Sworzzy Jul 4, 2024
4ebd475
fixing the workflow so psydac runs
Sworzzy Jul 4, 2024
6b6a14a
rectifying error of jacobian_inv_eval method
Sworzzy Jul 5, 2024
108e70b
add AnalytciMapping to sympde/topology/__init__.py
Sworzzy Jul 8, 2024
b7a7d07
changes mapping class names and files, tests not made yet
Sworzzy Jul 11, 2024
565cd17
deleting prints in base_analytic_mapping
Sworzzy Jul 11, 2024
6dfd682
changing AbstractMapping to BaseMapping to keep domain undefined Mapping
Sworzzy Jul 12, 2024
9674c41
trying to add mapping undefined domain
Sworzzy Jul 12, 2024
053a21f
continuing mapping undefined domain
Sworzzy Jul 13, 2024
718c251
''
Sworzzy Jul 13, 2024
60bc10b
''
Sworzzy Jul 13, 2024
ea383d3
''
Sworzzy Jul 13, 2024
4b23aa6
problem comes from BaseMapping doesn't have implemented call method, …
Sworzzy Jul 23, 2024
0a79a2c
trying to solve circular dependencies
Sworzzy Jul 23, 2024
5bf0c33
solving circular dependencies v2
Sworzzy Jul 23, 2024
bdff699
trying to fix domain undefined mapping
Sworzzy Jul 23, 2024
3f91d94
deleting a print
Sworzzy Jul 24, 2024
b98415d
appropriate method for setting mappings for a Dom
Sworzzy Jul 25, 2024
318fde3
changed the structure of the constructors of BaseMapping and
Sworzzy Jul 26, 2024
cb82607
trying to make the new hierearchy work : mapping undefined
Sworzzy Jul 26, 2024
6d06619
repair bug for TerminalExpr with Jacobian : replacing deprecated if s…
Sworzzy Jul 29, 2024
1e534e2
getting rid of the __gypyccel__ and __psydac__ git status inconveniences
Sworzzy Jul 29, 2024
156bc48
test_api_feec_2d and test_2d_multipatch_mapping_maxwell run with doma…
Sworzzy Aug 6, 2024
543d572
removed .DS_Store, repo cleaned
Sworzzy Aug 15, 2024
3158ea0
supported changes made in commit <adding test with numpy constants>
Sworzzy Aug 20, 2024
221cbed
Merge branch 'master' into feature-lagarrigue
Sworzzy Aug 20, 2024
b741067
merged branch master into feature-lagarrigue
Sworzzy Aug 20, 2024
bd61b53
adapting few changes in sympde tests
Sworzzy Aug 21, 2024
e71dd99
test_mapping_evaluation last version
Sworzzy Aug 21, 2024
5a51f54
deleting .DS_Store
Sworzzy Sep 6, 2024
542ac10
changes to make CI pass
Sworzzy Sep 7, 2024
6d06f8b
test_mapping_evaluation.py should work now
Sworzzy Sep 7, 2024
dffd49b
use previous Collela Mapping
campospinto Sep 17, 2024
7bd08f6
trailing whitespace solving
Sworzzy Sep 18, 2024
786b1c1
circular imports
Sworzzy Sep 18, 2024
59c11e2
trailing whitespaces
Sworzzy Sep 18, 2024
15e7ad6
trailing whitespace
Sworzzy Sep 18, 2024
fc51c95
trailing whitespace
Sworzzy Sep 18, 2024
49dc124
trailing whitespace
Sworzzy Sep 18, 2024
4638b8e
trailing whitespace
Sworzzy Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Sworzzy marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ doc/utils/*.png

# Swap files
*.swp

__gpyccel__/*
__psydac__/*
6 changes: 4 additions & 2 deletions sympde/expr/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
from sympde.topology.basic import Boundary, Interface
from sympde.topology.basic import InteriorDomain
from sympde.topology.domain import NormalVector, TangentVector, NCube, NCubeInterior
from sympde.topology.mapping import JacobianSymbol, InterfaceMapping, MultiPatchMapping, JacobianInverseSymbol
from sympde.topology.mapping import LogicalExpr, PullBack
from sympde.topology.base_mapping import JacobianSymbol, JacobianInverseSymbol
from sympde.topology.base_mapping import LogicalExpr, PullBack
from sympde.topology.base_mapping import InterfaceMapping, MultiPatchMapping
yguclu marked this conversation as resolved.
Show resolved Hide resolved


# TODO fix circular dependency between sympde.expr.evaluation and sympde.topology.mapping

Expand Down
4 changes: 2 additions & 2 deletions sympde/expr/tests/test_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from sympde.topology import dx1, dx2, dx3
from sympde.topology import dx, dy, dz
from sympde.topology import Mapping
from sympde.topology import BaseMapping
from sympde.topology import ScalarFunctionSpace, VectorFunctionSpace
from sympde.topology import element_of, elements_of
from sympde.topology import InteriorDomain, Union
Expand Down Expand Up @@ -867,7 +867,7 @@ def test_terminal_expr_bilinear_2d_4():
def test_terminal_expr_bilinear_3d_1():

domain = Domain('Omega', dim=3)
M = Mapping('M', dim=3)
M = BaseMapping('M', dim=3)

mapped_domain = M(domain)

Expand Down
10 changes: 5 additions & 5 deletions sympde/expr/tests/test_tensor_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from sympde.topology import elements_of
from sympde.topology import Boundary
from sympde.topology import Domain
from sympde.topology import Mapping
from sympde.topology import BaseMapping

from sympde.expr.expr import BilinearForm, integral
from sympde.expr.evaluation import TensorExpr
Expand Down Expand Up @@ -59,11 +59,11 @@ def test_tensorize_2d_2():
# ...

#==============================================================================
def test_tensorize_2d_1_mapping():
def test_tensorize_2d_1_BaseMapping():

DIM = 2

M = Mapping('Map', dim=DIM)
M = BaseMapping('Map', dim=DIM)

domain = M(Domain('Omega', dim=DIM))

Expand All @@ -85,10 +85,10 @@ def test_tensorize_2d_1_mapping():
# ...

#==============================================================================
def test_tensorize_2d_2_mapping():
def test_tensorize_2d_2_BaseMapping():

DIM = 2
M = Mapping('M', dim=DIM)
M = BaseMapping('M', dim=DIM)
domain = M(Domain('Omega', dim=DIM))

V = VectorFunctionSpace('V', domain)
Expand Down
18 changes: 9 additions & 9 deletions sympde/topology/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .basic import *
from .derivatives import *
from .datatype import *
from .domain import *
from .mapping import *
from .measure import *
from .space import *
from .analytical_mapping import *
from .callable_mapping import *
from .basic import *
from .derivatives import *
from .datatype import *
from .domain import *
from .base_mapping import *
from .base_analytic_mapping import *
from .analytic_mappings import *
from .measure import *
from .space import *
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .mapping import Mapping
from .base_analytic_mapping import BaseAnalyticMapping

class IdentityMapping(Mapping):
class IdentityMapping(BaseAnalyticMapping):
"""
Represents an identity 1D/2D/3D Mapping object.
Represents an identity 1D/2D/3D BaseAnalyticMapping object.

Examples

Expand All @@ -12,9 +12,9 @@ class IdentityMapping(Mapping):
'z': 'x3'}

#==============================================================================
class AffineMapping(Mapping):
class AffineMapping(BaseAnalyticMapping):
"""
Represents a 1D/2D/3D Affine Mapping object.
Represents a 1D/2D/3D Affine BaseAnalyticMapping object.

Examples

Expand All @@ -24,9 +24,9 @@ class AffineMapping(Mapping):
'z': 'c3 + a31*x1 + a32*x2 + a33*x3'}

#==============================================================================
class PolarMapping(Mapping):
class PolarMapping(BaseAnalyticMapping):
"""
Represents a Polar 2D Mapping object (Annulus).
Represents a Polar 2D BaseAnalyticMapping object (Annulus).

Examples

Expand All @@ -38,9 +38,9 @@ class PolarMapping(Mapping):
_pdim = 2

#==============================================================================
class TargetMapping(Mapping):
class TargetMapping(BaseAnalyticMapping):
"""
Represents a Target 2D Mapping object.
Represents a Target 2D BaseAnalyticMapping object.

Examples

Expand All @@ -52,9 +52,9 @@ class TargetMapping(Mapping):
_pdim = 2

#==============================================================================
class CzarnyMapping(Mapping):
class CzarnyMapping(BaseAnalyticMapping):
"""
Represents a Czarny 2D Mapping object.
Represents a Czarny 2D BaseAnalyticMapping object.

Examples

Expand All @@ -67,19 +67,27 @@ class CzarnyMapping(Mapping):
_pdim = 2

#==============================================================================
class CollelaMapping2D(Mapping):
"""
Represents a Collela 2D Mapping object.
class CollelaMapping2D(BaseAnalyticMapping):

"""
_expressions = {'x': '2.*(x1 + eps*sin(2.*pi*k1*x1)*sin(2.*pi*k2*x2)) - 1.',
'y': '2.*(x2 + eps*sin(2.*pi*k1*x1)*sin(2.*pi*k2*x2)) - 1.'}

_ldim = 2
_pdim = 2
_ldim = 2
_pdim = 2


#==============================================================================
class CollelaMapping3D(BaseAnalyticMapping):

_expressions = {'x': 'k1*(x1 + eps*sin(2.*pi*x1)*sin(2.*pi*x2))',
'y': 'k2*(x2 + eps*sin(2.*pi*x1)*sin(2.*pi*x2))',
'z': 'k3*x3'}

_ldim = 3
_pdim = 3

#==============================================================================
class TorusMapping(Mapping):
class TorusMapping(BaseAnalyticMapping):
"""
Parametrization of a torus (or a portion of it) of major radius R0, using
toroidal coordinates (x1, x2, x3) = (r, theta, phi), where:
Expand All @@ -98,7 +106,7 @@ class TorusMapping(Mapping):

#==============================================================================
# TODO [YG, 07.10.2022]: add test in sympde/topology/tests/test_logical_expr.py
class TorusSurfaceMapping(Mapping):
class TorusSurfaceMapping(BaseAnalyticMapping):
"""
3D surface obtained by "slicing" the torus above at r = a.
The parametrization uses the coordinates (x1, x2) = (theta, phi), where:
Expand All @@ -116,7 +124,7 @@ class TorusSurfaceMapping(Mapping):

#==============================================================================
# TODO [YG, 07.10.2022]: add test in sympde/topology/tests/test_logical_expr.py
class TwistedTargetSurfaceMapping(Mapping):
class TwistedTargetSurfaceMapping(BaseAnalyticMapping):
"""
3D surface obtained by "twisting" the TargetMapping out of the (x, y) plane

Expand All @@ -129,7 +137,7 @@ class TwistedTargetSurfaceMapping(Mapping):
_pdim = 3

#==============================================================================
class TwistedTargetMapping(Mapping):
class TwistedTargetMapping(BaseAnalyticMapping):
"""
3D volume obtained by "extruding" the TwistedTargetSurfaceMapping along z.

Expand All @@ -142,7 +150,7 @@ class TwistedTargetMapping(Mapping):
_pdim = 3

#==============================================================================
class SphericalMapping(Mapping):
class SphericalMapping(BaseAnalyticMapping):
"""
Parametrization of a sphere (or a portion of it) using spherical
coordinates (x1, x2, x3) = (r, theta, phi), where:
Expand All @@ -158,3 +166,38 @@ class SphericalMapping(Mapping):

_ldim = 3
_pdim = 3

#==============================================================================
class Collela3D(BaseAnalyticMapping):

_expressions = {'x':'2.*(x1 + 0.1*sin(2.*pi*x1)*sin(2.*pi*x2)) - 1.',
'y':'2.*(x2 + 0.1*sin(2.*pi*x1)*sin(2.*pi*x2)) - 1.',
'z':'2.*x3 - 1.'}

#==============================================================================
yguclu marked this conversation as resolved.
Show resolved Hide resolved
class TransposedPolarMapping(BaseAnalyticMapping):
"""
Represents a Transposed (x1 <> x2) Polar 2D Mapping object (Annulus).

Examples

"""
_expressions = {'x': 'c1 + (rmin*(1-x2)+rmax*x2)*cos(x1)',
'y': 'c2 + (rmin*(1-x2)+rmax*x2)*sin(x1)'}

_ldim = 2
_pdim = 2

#==============================================================================
class TransposedPolarMapping(BaseAnalyticMapping):
"""
Represents a Transposed (x1 <> x2) Polar 2D Mapping object (Annulus).

Examples

"""
_expressions = {'x': 'c1 + (rmin*(1-x2)+rmax*x2)*cos(x1)',
'y': 'c2 + (rmin*(1-x2)+rmax*x2)*sin(x1)'}

_ldim = 2
_pdim = 2
yguclu marked this conversation as resolved.
Show resolved Hide resolved
Loading