Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #32116
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 3, 2021
2 parents d9520ae + fc59c9d commit ce76586
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 123 deletions.
212 changes: 121 additions & 91 deletions src/sage/manifolds/chart.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/sage/manifolds/chart_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ def derivative(self, coord):
# NB: for efficiency, we access directly to the "private" attributes
# of other classes. A more conventional OOP writing would be
# coordsi = coord - self._chart.domain().start_index()
coordsi = coord - self._chart._domain._sindex
coordsi = coord - self._chart.domain()._sindex
if coordsi < 0 or coordsi >= self._nc:
raise ValueError("coordinate index out of range")
return self._der[coordsi]
Expand Down
33 changes: 17 additions & 16 deletions src/sage/manifolds/differentiable/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class DiffChart(Chart):
on differentiable manifolds over `\RR`.
"""
def __init__(self, domain, coordinates, names, calc_method, coord_restrictions):
def __init__(self, domain, coordinates, calc_method=None, periods=None, coord_restrictions=None):
r"""
Construct a chart.
Expand All @@ -276,8 +276,8 @@ def __init__(self, domain, coordinates, names, calc_method, coord_restrictions):
sage: TestSuite(X).run()
"""
Chart.__init__(self, domain, coordinates=coordinates, names=names,
calc_method=calc_method)
super().__init__(domain, coordinates, calc_method=calc_method,
periods=periods, coord_restrictions=coord_restrictions)
# Construction of the coordinate frame associated to the chart:
self._frame = CoordFrame(self)
self._coframe = self._frame._coframe
Expand Down Expand Up @@ -391,8 +391,8 @@ def transition_map(self, other, transformations, intersection_name=None,
[Chart (R^2, (x, y)), Chart (U, (r, phi)), Chart (U, (x, y))]
"""
dom1 = self._domain
dom2 = other._domain
dom1 = self.domain()
dom2 = other.domain()
dom = dom1.intersection(dom2, name=intersection_name)
if dom is dom1:
chart1 = self
Expand Down Expand Up @@ -548,7 +548,7 @@ def restrict(self, subset, restrictions=None):
Chart (B, (z1, z2))
"""
if subset == self._domain:
if subset == self.domain():
return self
if subset not in self._dom_restrict:
resu = Chart.restrict(self, subset, restrictions=restrictions)
Expand All @@ -558,8 +558,8 @@ def restrict(self, subset, restrictions=None):
sframe._subframes.add(resu._frame)
sframe._restrictions[subset] = resu._frame
# The subchart frame is not a "top frame" in the supersets
# (including self._domain):
for dom in self._domain.open_supersets():
# (including self.domain()):
for dom in self.domain().open_supersets():
if resu._frame in dom._top_frames:
# it was added by the Chart constructor invoked in
# Chart.restrict above
Expand Down Expand Up @@ -942,7 +942,8 @@ class RealDiffChart(DiffChart, RealChart):
:meth:`~sage.manifolds.chart.RealChart.plot`.
"""
def __init__(self, domain, coordinates, names, calc_method, coord_restrictions):
def __init__(self, domain, coordinates, calc_method=None,
bounds=None, periods=None, coord_restrictions=None):
r"""
Construct a chart on a real differentiable manifold.
Expand All @@ -960,8 +961,8 @@ def __init__(self, domain, coordinates, names, calc_method, coord_restrictions):
sage: TestSuite(X).run()
"""
RealChart.__init__(self, domain, coordinates=coordinates, names=names,
calc_method = calc_method)
RealChart.__init__(self, domain, coordinates, calc_method=calc_method,
bounds=bounds, periods=periods, coord_restrictions=coord_restrictions)
# Construction of the coordinate frame associated to the chart:
self._frame = CoordFrame(self)
self._coframe = self._frame._coframe
Expand Down Expand Up @@ -1031,7 +1032,7 @@ def restrict(self, subset, restrictions=None):
True
"""
if subset == self._domain:
if subset == self.domain():
return self
if subset not in self._dom_restrict:
resu = RealChart.restrict(self, subset, restrictions=restrictions)
Expand All @@ -1041,8 +1042,8 @@ def restrict(self, subset, restrictions=None):
sframe._subframes.add(resu._frame)
sframe._restrictions[subset] = resu._frame
# The subchart frame is not a "top frame" in the supersets
# (including self._domain):
for dom in self._domain.open_supersets():
# (including self.domain()):
for dom in self.domain().open_supersets():
if resu._frame in dom._top_frames:
# it was added by the Chart constructor invoked in
# Chart.restrict above
Expand Down Expand Up @@ -1125,8 +1126,8 @@ def __init__(self, chart1, chart2, *transformations):
self._jacobian = self._transf.jacobian()
# If the two charts are on the same open subset, the Jacobian matrix is
# added to the dictionary of changes of frame:
if chart1._domain == chart2._domain:
domain = chart1._domain
if chart1.domain() == chart2.domain():
domain = chart1.domain()
frame1 = chart1._frame
frame2 = chart2._frame
vf_module = domain.vector_field_module()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/manifolds/differentiable/diff_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,9 +1080,9 @@ def paral_comp(tcomp, chart1, chart2, coord2_1, jacob,
coord1 = chart1._xx
ff = tensor._express[chart2]
resu_fc.append( chart1.function(ff(*(phi(*coord1)))) )
dom_resu = resu_fc[0].parent()._chart._domain
dom_resu = resu_fc[0].parent()._chart.domain()
for fc in resu_fc[1:]:
dom_resu = dom_resu.union(fc.parent()._chart._domain)
dom_resu = dom_resu.union(fc.parent()._chart.domain())
resu = dom_resu.scalar_field(name=resu_name,
latex_name=resu_latex_name)
for fc in resu_fc:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/scalarfield_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def _coerce_map_from_(self, other):
elif isinstance(other, DiffScalarFieldAlgebra):
return self._domain.is_subset(other._domain)
elif isinstance(other, ChartFunctionRing):
return self._domain.is_subset(other._chart._domain)
return self._domain.is_subset(other._chart.domain())
else:
return False

Expand Down
4 changes: 2 additions & 2 deletions src/sage/manifolds/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ def orientation(self):
# Try the default chart:
def_chart = self._def_chart
if def_chart is not None:
if def_chart._domain is self:
if def_chart.domain() is self:
self._orientation = [self._def_chart]
# Still no orientation? Choose arbitrary chart:
if not self._orientation:
Expand Down Expand Up @@ -1967,7 +1967,7 @@ def scalar_field(self, coord_expression=None, chart=None, name=None,
if isinstance(coord_expression, dict):
# check validity of entry
for chart in coord_expression:
if not chart._domain.is_subset(self):
if not chart.domain().is_subset(self):
raise ValueError("the {} is not defined ".format(chart) +
"on some subset of the " + str(self))
alg = self.scalar_field_algebra()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def coordinates(self, chart=None, old_chart=None):
chart = dom._def_chart
def_chart = chart
else:
dom = chart._domain
dom = chart.domain()
def_chart = dom._def_chart
if self not in dom:
raise ValueError("the point does not belong to the domain " +
Expand Down
16 changes: 8 additions & 8 deletions src/sage/manifolds/scalarfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ def add_expr_by_continuation(self, chart, subdomain):
if self.is_immutable():
raise ValueError("the expressions of an immutable element "
"cannot be changed")
if not chart._domain.is_subset(self._domain):
if not chart.domain().is_subset(self._domain):
raise ValueError("the chart is not defined on a subset of " +
"the scalar field domain")
schart = chart.restrict(subdomain)
Expand Down Expand Up @@ -2088,7 +2088,7 @@ def set_restriction(self, rst):
self._restrictions[rst._domain] = rst.copy(name=self._name,
latex_name=self._latex_name)
for chart, expr in rst._express.items():
intersection = chart._domain.intersection(rst._domain)
intersection = chart.domain().intersection(rst._domain)
self._express[chart.restrict(intersection)] = expr
self._is_zero = False # a priori

Expand Down Expand Up @@ -2164,13 +2164,13 @@ def _display_expression(self, chart, result):
coords = chart[:]
if len(coords) == 1:
coords = coords[0]
if chart._domain == self._domain:
if chart.domain() == self._domain:
if self._name is not None:
result._txt += " "
result._latex += " & "
else:
result._txt += "on " + chart._domain._name + ": "
result._latex += r"\mbox{on}\ " + latex(chart._domain) + \
result._txt += "on " + chart.domain()._name + ": "
result._latex += r"\mbox{on}\ " + latex(chart.domain()) + \
r": & "
result._txt += repr(coords) + " |--> " + repr(expression) + "\n"
result._latex += latex(coords) + r"& \longmapsto & " + \
Expand Down Expand Up @@ -2212,13 +2212,13 @@ def _display_expression(self, chart, result):
if max_dom is None:
try:
self.coord_function(sch)
max_dom = sch._domain
max_dom = sch.domain()
except (TypeError, ValueError):
pass
elif max_dom.is_subset(sch._domain):
elif max_dom.is_subset(sch.domain()):
try:
self.coord_function(sch)
max_dom = sch._domain
max_dom = sch.domain()
except (TypeError, ValueError):
pass
if max_dom is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/scalarfield_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def _coerce_map_from_(self, other):
elif isinstance(other, ScalarFieldAlgebra):
return self._domain.is_subset(other._domain)
elif isinstance(other, ChartFunctionRing):
return self._domain.is_subset(other._chart._domain)
return self._domain.is_subset(other._chart.domain())
else:
return False

Expand Down

0 comments on commit ce76586

Please sign in to comment.