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

Commit

Permalink
Refactor Manifold.open_subset methods through new method _init_open_s…
Browse files Browse the repository at this point in the history
…ubset
  • Loading branch information
Matthias Koeppe committed Apr 15, 2021
1 parent 004c23a commit ef1614a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
lightlike submanifold) and in General Relativity. In geometry of lightlike
submanifolds, according to the dimension `r` of the radical distribution
(see below for definition of radical distribution), degenerate submanifolds
have been classify into 4 subgroups: `r`-lightlike submanifolds, Coisotropic
have been classified into 4 subgroups: `r`-lightlike submanifolds, Coisotropic
submanifolds, Isotropic submanifolds and Totally lightlike submanifolds.
(See the book of Krishan L. Duggal and Aurel Bejancu [DS2010]_.)
Expand Down
26 changes: 1 addition & 25 deletions src/sage/manifolds/differentiable/differentiable_submanifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,29 +281,5 @@ def open_subset(self, name, latex_name=None, coord_def={}):
diff_degree=self._diff_degree,
latex_name=latex_name,
start_index=self._sindex)
## Copy of DifferentiableManifold.open_subset. Refactor?
resu._calculus_method = self._calculus_method
resu._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(resu)
self._top_subsets.add(resu)
# Charts on the result from the coordinate definition:
for chart, restrictions in coord_def.items():
if chart not in self._atlas:
raise ValueError("the {} does not belong to ".format(chart) +
"the atlas of {}".format(self))
chart.restrict(resu, restrictions)
# Transition maps on the result inferred from those of self:
for chart1 in coord_def:
for chart2 in coord_def:
if chart2 != chart1 and (chart1, chart2) in self._coord_changes:
self._coord_changes[(chart1, chart2)].restrict(resu)
#!# update vector frames and change of frames
#
## Extras for Submanifold
if self._immersed:
resu.set_immersion(self._immersion.restrict(resu),
var=self._var, t_inverse=self._t_inverse)
if self._embedded:
resu.declare_embedding()
self._init_open_subset(resu, coord_def=coord_def)
return resu
22 changes: 5 additions & 17 deletions src/sage/manifolds/differentiable/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,25 +826,13 @@ def open_subset(self, name, latex_name=None, coord_def={}):
diff_degree=self._diff_degree,
latex_name=latex_name,
start_index=self._sindex)
resu._calculus_method = self._calculus_method
resu._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(resu)
self._top_subsets.add(resu)
# Charts on the result from the coordinate definition:
for chart, restrictions in coord_def.items():
if chart not in self._atlas:
raise ValueError("the {} does not belong to ".format(chart) +
"the atlas of {}".format(self))
chart.restrict(resu, restrictions)
# Transition maps on the result inferred from those of self:
for chart1 in coord_def:
for chart2 in coord_def:
if chart2 != chart1 and (chart1, chart2) in self._coord_changes:
self._coord_changes[(chart1, chart2)].restrict(resu)
#!# update vector frames and change of frames
self._init_open_subset(resu, coord_def=coord_def)
return resu

def _init_open_subset(self, resu, coord_def):
super()._init_open_subset(resu, coord_def=coord_def)
#!# update vector frames and change of frames

def diff_map(self, codomain, coord_functions=None, chart1=None,
chart2=None, name=None, latex_name=None):
r"""
Expand Down
19 changes: 1 addition & 18 deletions src/sage/manifolds/differentiable/pseudo_riemannian.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,22 +745,5 @@ def open_subset(self, name, latex_name=None, coord_def={}):
latex_name=latex_name,
metric_latex_name=self._metric_latex_name,
start_index=self._sindex)
resu._calculus_method = self._calculus_method
resu._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(resu)
self._top_subsets.add(resu)
# Charts on the result from the coordinate definition:
for chart, restrictions in coord_def.items():
if chart not in self._atlas:
raise ValueError("the {} does not belong to ".format(chart) +
"the atlas of {}".format(self))
chart.restrict(resu, restrictions)
# Transition maps on the result inferred from those of self:
for chart1 in coord_def:
for chart2 in coord_def:
if chart2 != chart1 and (chart1, chart2) in self._coord_changes:
self._coord_changes[(chart1, chart2)].restrict(resu)
#!# update non-coordinate vector frames and change of frames
#
self._init_open_subset(resu, coord_def=coord_def)
return resu
Original file line number Diff line number Diff line change
Expand Up @@ -460,31 +460,7 @@ def open_subset(self, name, latex_name=None, coord_def={}):
latex_name=latex_name,
metric_latex_name=self._metric_latex_name,
start_index=self._sindex)
## Copy of PseudoRiemannianManifold.open_subset. Refactor?
resu._calculus_method = self._calculus_method
resu._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(resu)
self._top_subsets.add(resu)
# Charts on the result from the coordinate definition:
for chart, restrictions in coord_def.items():
if chart not in self._atlas:
raise ValueError("the {} does not belong to ".format(chart) +
"the atlas of {}".format(self))
chart.restrict(resu, restrictions)
# Transition maps on the result inferred from those of self:
for chart1 in coord_def:
for chart2 in coord_def:
if chart2 != chart1 and (chart1, chart2) in self._coord_changes:
self._coord_changes[(chart1, chart2)].restrict(resu)
#!# update non-coordinate vector frames and change of frames
#
## Extras for Submanifold
if self._immersed:
resu.set_immersion(self._immersion.restrict(resu),
var=self._var, t_inverse=self._t_inverse)
if self._embedded:
resu.declare_embedding()
self._init_open_subset(resu, coord_def=coord_def)
return resu

def ambient_metric(self):
Expand Down
5 changes: 4 additions & 1 deletion src/sage/manifolds/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,10 @@ def open_subset(self, name, latex_name=None, coord_def={}):
base_manifold=self._manifold,
latex_name=latex_name,
start_index=self._sindex)
self._init_open_subset(resu, coord_def=coord_def)
return resu

def _init_open_subset(self, resu, coord_def):
resu._calculus_method = self._calculus_method
resu._supersets.update(self._supersets)
for sd in self._supersets:
Expand All @@ -888,7 +892,6 @@ def open_subset(self, name, latex_name=None, coord_def={}):
for chart2 in coord_def:
if chart2 != chart1 and (chart1, chart2) in self._coord_changes:
self._coord_changes[(chart1, chart2)].restrict(resu)
return resu

def get_chart(self, coordinates, domain=None):
r"""
Expand Down
23 changes: 5 additions & 18 deletions src/sage/manifolds/topological_submanifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,30 +317,17 @@ def open_subset(self, name, latex_name=None, coord_def={}):
base_manifold=self._manifold,
latex_name=latex_name,
start_index=self._sindex)
## Copy of TopologicalManifold.open_subset. Refactor?
resu._calculus_method = self._calculus_method
resu._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(resu)
self._top_subsets.add(resu)
# Charts on the result from the coordinate definition:
for chart, restrictions in coord_def.items():
if chart not in self._atlas:
raise ValueError("the {} does not belong to ".format(chart) +
"the atlas of {}".format(self))
chart.restrict(resu, restrictions)
# Transition maps on the result inferred from those of self:
for chart1 in coord_def:
for chart2 in coord_def:
if chart2 != chart1 and (chart1, chart2) in self._coord_changes:
self._coord_changes[(chart1, chart2)].restrict(resu)
self._init_open_subset(resu, coord_def=coord_def)
return resu

def _init_open_subset(self, resu, coord_def):
super()._init_open_subset(resu, coord_def=coord_def)
## Extras for Submanifold
if self._immersed:
resu.set_immersion(self._immersion.restrict(resu),
var=self._var, t_inverse=self._t_inverse)
if self._embedded:
resu.declare_embedding()
return resu

def set_immersion(self, phi, inverse=None, var=None,
t_inverse=None):
Expand Down

0 comments on commit ef1614a

Please sign in to comment.