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

Commit

Permalink
Merge #32009
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Jun 20, 2021
2 parents 5d5e7ba + 8ba174c commit e6070fd
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 46 deletions.
40 changes: 20 additions & 20 deletions src/sage/manifolds/chart.py
Expand Up @@ -335,7 +335,7 @@ def __init__(self, domain, coordinates='', names=None, calc_method=None):
# The chart is added to the domain's atlas, as well as to all the
# atlases of the domain's supersets; moreover the first defined chart
# is considered as the default chart
for sd in self._domain.open_supersets():
for sd in domain.open_supersets():
# the chart is added in the top charts only if its coordinates have
# not been used:
for chart in sd._atlas:
Expand All @@ -347,7 +347,7 @@ def __init__(self, domain, coordinates='', names=None, calc_method=None):
if sd._def_chart is None:
sd._def_chart = self
# The chart is added to the list of the domain's covering charts:
self._domain._covering_charts.append(self)
domain._covering_charts.append(self)
# Initialization of the set of charts that are restrictions of the
# current chart to subsets of the chart domain:
self._subcharts = set([self])
Expand All @@ -361,7 +361,7 @@ def __init__(self, domain, coordinates='', names=None, calc_method=None):
# The null and one functions of the coordinates:
# Expression in self of the zero and one scalar fields of open sets
# containing the domain of self:
for dom in self._domain.open_supersets():
for dom in domain.open_supersets():
dom._zero_scalar_field._express[self] = self.function_ring().zero()
dom._one_scalar_field._express[self] = self.function_ring().one()

Expand Down Expand Up @@ -401,10 +401,10 @@ def _init_coordinates(self, coord_list):
for prop in coord_properties[1:]:
prop1 = prop.strip()
if prop1[0:6] == 'period':
if self._manifold.base_field_type() in ['real', 'complex']:
if domain.base_field_type() in ['real', 'complex']:
period = SR(prop1[7:])
else:
period = self._manifold.base_field()(prop1[7:])
period = domain.base_field()(prop1[7:])
self._periods[coord_index + self._sindex] = period
else:
# prop1 is the coordinate's LaTeX symbol
Expand All @@ -426,7 +426,7 @@ def _repr_(self):
Chart (M, (x, y))
"""
return 'Chart ({}, {})'.format(self._domain._name, self._xx)
return 'Chart ({}, {})'.format(self.domain()._name, self._xx)

def _latex_(self):
r"""
Expand All @@ -445,7 +445,7 @@ def _latex_(self):
\left(M,({\zeta_1}, {\zeta2})\right)
"""
description = r'\left(' + latex(self._domain).strip() + ',('
description = r'\left(' + latex(self.domain()).strip() + ',('
n = len(self._xx)
for i in range(n-1):
description += latex(self._xx[i]).strip() + ', '
Expand Down Expand Up @@ -727,10 +727,10 @@ 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:
if not subset.is_subset(self._domain):
if not subset.is_subset(self.domain()):
raise ValueError("the specified subset is not a subset " +
"of the domain of definition of the chart")
coordinates = ""
Expand Down Expand Up @@ -799,7 +799,7 @@ def valid_coordinates(self, *coordinates, **kwds):
False
"""
if len(coordinates) != self._domain._dim:
if len(coordinates) != self.domain()._dim:
return False
if 'parameters' in kwds:
parameters = kwds['parameters']
Expand Down Expand Up @@ -981,8 +981,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 @@ -2043,10 +2043,10 @@ def restrict(self, subset, restrictions=None):
True
"""
if subset == self._domain:
if subset == self.domain():
return self
if subset not in self._dom_restrict:
if not subset.is_subset(self._domain):
if not subset.is_subset(self.domain()):
raise ValueError("the specified subset is not a subset " +
"of the domain of definition of the chart")
coordinates = ""
Expand Down Expand Up @@ -2738,10 +2738,10 @@ def _plot_xx_list(xx_list, rem_coords, ranges, steps, number_values):
transf = None # to be the MultiCoordFunction object relating self
# to the ambient chart
if mapping is None:
if not self._domain.is_subset(chart._domain):
if not self.domain().is_subset(chart.domain()):
raise ValueError("the domain of {} is not ".format(self) +
"included in that of {}".format(chart))
coord_changes = chart._domain._coord_changes
coord_changes = chart.domain()._coord_changes
for chart_pair in coord_changes:
if chart_pair == (self, chart):
transf = coord_changes[chart_pair]._transf
Expand All @@ -2756,10 +2756,10 @@ def _plot_xx_list(xx_list, rem_coords, ranges, steps, number_values):
if not isinstance(mapping, ContinuousMap):
raise TypeError("the argument 'mapping' must be a "
"continuous manifold map")
if not self._domain.is_subset(mapping._domain):
if not self.domain().is_subset(mapping.domain()):
raise ValueError("the domain of {} is not ".format(self) +
"included in that of {}".format(mapping))
if not chart._domain.is_subset(mapping._codomain):
if not chart.domain().is_subset(mapping._codomain):
raise ValueError("the domain of {} is not ".format(chart) +
"included in the codomain of {}".format(
mapping))
Expand Down Expand Up @@ -3019,8 +3019,8 @@ def __init__(self, chart1, chart2, *transformations):
self._inverse = None
# If the two charts are on the same open subset, the coordinate change
# is added to the subset (and supersets) dictionary:
if chart1._domain == chart2._domain:
domain = chart1._domain
if chart1.domain() == chart2.domain():
domain = chart1.domain()
for sdom in domain.open_supersets():
sdom._coord_changes[(chart1, chart2)] = self

Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/chart_func.py
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
20 changes: 10 additions & 10 deletions src/sage/manifolds/differentiable/chart.py
Expand Up @@ -395,8 +395,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 @@ -552,7 +552,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 @@ -562,8 +562,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 @@ -1035,7 +1035,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 @@ -1045,8 +1045,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 @@ -1129,8 +1129,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
Expand Up @@ -1071,9 +1071,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
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
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
Expand Up @@ -371,7 +371,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
Expand Up @@ -2027,7 +2027,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 @@ -2074,7 +2074,7 @@ def set_restriction(self, rst):
self._restrictions[rst._domain].set_name(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 @@ -2150,13 +2150,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 @@ -2198,13 +2198,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
Expand Up @@ -527,7 +527,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 e6070fd

Please sign in to comment.