summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-12-14 15:31:24 +0100
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-12-14 15:31:24 +0100
commitc5f35afa41b2dac89471ba63d80fd2ae8eebbc2f (patch)
tree9c626b413fc0f4022b6694252a6734741897558f
parentMerge branch u/tscrim/top_manifolds_refactor into Sage 6.10.rc1 + public/mani... (diff)
Make AbstractSet inherit from UniqueRepresentation; correct doctests; start to change documentation.
-rw-r--r--src/doc/en/reference/manifolds/manifold.rst6
-rw-r--r--src/sage/manifolds/abstract.py12
-rw-r--r--src/sage/manifolds/manifold.py11
-rw-r--r--src/sage/manifolds/point.py56
-rw-r--r--src/sage/manifolds/subset.py17
5 files changed, 25 insertions, 77 deletions
diff --git a/src/doc/en/reference/manifolds/manifold.rst b/src/doc/en/reference/manifolds/manifold.rst
index 4180570..d7a0d18 100644
--- a/src/doc/en/reference/manifolds/manifold.rst
+++ b/src/doc/en/reference/manifolds/manifold.rst
@@ -6,8 +6,12 @@ Topological manifolds
sage/manifolds/manifold
- sage/manifolds/point
+ sage/manifolds/abstract
sage/manifolds/subset
+ sage/manifolds/structure
+
+ sage/manifolds/point
+
sage/manifolds/chart
diff --git a/src/sage/manifolds/abstract.py b/src/sage/manifolds/abstract.py
index 539393f..709f5a1 100644
--- a/src/sage/manifolds/abstract.py
+++ b/src/sage/manifolds/abstract.py
@@ -11,7 +11,7 @@ AUTHORS:
#*****************************************************************************
# Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
-# Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl>
+# Copyright (C) 2015 Travis Scrimshaw <tscrimsh@umn.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
@@ -27,7 +27,7 @@ from sage.categories.sets_cat import Sets
from sage.rings.integer import Integer
from sage.manifolds.point import ManifoldPoint
-class AbstractObject(object):
+class AbstractNamedObject(object):
"""
An abstract object.
@@ -84,11 +84,11 @@ class AbstractObject(object):
"""
return self._latex_name
-class AbstractSet(AbstractObject, UniqueRepresentation, Parent):
+class AbstractSet(AbstractNamedObject, UniqueRepresentation, Parent):
"""
An abstract set.
- An abstract set is an :class:`AbstractObject` along with its known
+ An abstract set is an :class:`AbstractNamedObject` along with its known
subsets, supersets, intersections, unions, and open covers.
"""
def __init__(self, name, latex_name, base=None, category=None):
@@ -102,7 +102,7 @@ class AbstractSet(AbstractObject, UniqueRepresentation, Parent):
sage: A = M.subset('A'); A
Subset A of the 2-dimensional topological manifold M
"""
- AbstractObject.__init__(self, name, latex_name)
+ AbstractNamedObject.__init__(self, name, latex_name)
category = Sets().or_subcategory(category)
Parent.__init__(self, base=base, category=category)
@@ -160,7 +160,7 @@ class AbstractSet(AbstractObject, UniqueRepresentation, Parent):
Point on the 2-dimensional topological manifold M
sage: X(p)
(-2, 3)
- sage: p.containing_set()
+ sage: p.parent()
Subset A of the 2-dimensional topological manifold M
sage: p in A
True
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index f18e7ab..d1d4249 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -344,7 +344,7 @@ class Manifold(AbstractSet):
(without ``unique_tag``, the
:class:`~sage.structure.unique_representation.UniqueRepresentation`
behavior inherited from
- :class:`~sage.manifolds.subset.TopologicalManifoldSubset`
+ :class:`~sage.manifolds.abstract.AbstractSet`
would return the previously constructed object corresponding to these
arguments).
@@ -875,7 +875,8 @@ class Manifold(AbstractSet):
- ``self``
- EXAMPLES::
+ EXAMPLES:
+
"""
if other.manifold() is not self:
raise ValueError("{} is not a subset of this manifold".format(other))
@@ -896,7 +897,8 @@ class Manifold(AbstractSet):
- instance of :class:`ManifoldSubset` representing the
subset that is the intersection of the current subset with ``other``
- EXAMPLES::
+ EXAMPLES:
+
"""
if other.manifold() is not self:
raise ValueError("{} is not a subset of this manifold".format(other))
@@ -1502,7 +1504,8 @@ class Manifold(AbstractSet):
- ``latex_name`` -- ignored
- ``is_open`` -- ignored
- EXAMPLES::
+ EXAMPLES:
+
"""
return self
diff --git a/src/sage/manifolds/point.py b/src/sage/manifolds/point.py
index b99b3b5..01fa11f 100644
--- a/src/sage/manifolds/point.py
+++ b/src/sage/manifolds/point.py
@@ -33,7 +33,7 @@ Defining a point in `\RR^3` by its spherical coordinates::
sage: p in U
True
sage: p.parent()
- 3-dimensional topological manifold R^3
+ Open subset U of the 3-dimensional topological manifold R^3
sage: c_spher(p)
(1, 1/2*pi, pi)
sage: p.coord(c_spher) # equivalent to above
@@ -70,7 +70,7 @@ Points can be compared::
from sage.structure.element import Element
-# TODO: Inherit from AbstractObject
+# TODO: Inherit from AbstractNamedObject
class ManifoldPoint(Element):
r"""
Point of a topological manifold.
@@ -119,20 +119,13 @@ class ManifoldPoint(Element):
2-dimensional topological manifold M
sage: U = M.open_subset('U', coord_def={c_xy: x>0})
sage: q = U.point((2,1), name='q')
+ sage: q.parent()
+ Open subset U of the 2-dimensional topological manifold M
sage: q in U
True
sage: q in M
True
- Note that the parent of a point is always the manifold, not the subset
- in which it has been defined (the latter being returned by the method
- :meth:`containing_set`)::
-
- sage: q.parent()
- 2-dimensional topological manifold M
- sage: q.containing_set()
- Open subset U of the 2-dimensional topological manifold M
-
By default, the LaTeX symbol of the point is deduced from its name::
sage: latex(p)
@@ -244,47 +237,6 @@ class ManifoldPoint(Element):
return r'\mbox{' + str(self) + r'}'
return self._latex_name
- # TODO: Convert these doctests to doctests elsewhere
- def containing_set(self):
- r"""
- Return a manifold subset that contains the point.
-
- A priori, this method returns the manifold subset (possibly the
- manifold itself) in which the point has been defined.
-
- OUTPUT:
-
- - an instance of
- :class:`~sage.manifolds.subset.ManifoldSubset`
-
- EXAMPLES:
-
- Points on a 2-dimensional manifold::
-
- sage: M = Manifold(2, 'M', structure='topological')
- sage: X.<x,y> = M.chart()
- sage: p = M.point((1,3), name='p'); p
- Point p on the 2-dimensional topological manifold M
- sage: p.containing_set()
- 2-dimensional topological manifold M
- sage: U = M.open_subset('U', coord_def={X: x>0})
- sage: q = U.point((2,1), name='q'); q
- Point q on the 2-dimensional topological manifold M
- sage: q.containing_set()
- Open subset U of the 2-dimensional topological manifold M
-
- Note that in the present case, the containing set is tighter than the
- parent, which is always the manifold::
-
- sage: q.parent()
- 2-dimensional topological manifold M
- sage: q.containing_set().is_subset(q.parent())
- True
- sage: q.containing_set() != q.parent()
- True
-
- """
- return self._subset
def coord(self, chart=None, old_chart=None):
r"""
diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py
index 23c20b0..3d2fdd3 100644
--- a/src/sage/manifolds/subset.py
+++ b/src/sage/manifolds/subset.py
@@ -126,27 +126,16 @@ class ManifoldSubset(AbstractSet):
Subset B of the 2-dimensional topological manifold M,
2-dimensional topological manifold M]
- The manifold is itself a subset::
-
- sage: isinstance(M, ManifoldSubset)
- True
-
- Instances of :class:`ManifoldSubset` are Sage's facade sets
- (see :meth:`~sage.categories.sets_cat.Sets.SubcategoryMethods.Facade`):
- their elements are manifold points
- (class :class:`~sage.manifolds.point.ManifoldPoint`),
- which have the manifold (and not the subset) as parent::
+ Instances of :class:`ManifoldSubset` are parents::
sage: isinstance(A, Parent)
True
sage: A.category()
- Category of facade sets
- sage: A.facade_for()
- (2-dimensional topological manifold M,)
+ Category of subobjects of sets
sage: p = A.an_element(); p
Point on the 2-dimensional topological manifold M
sage: p.parent()
- 2-dimensional topological manifold M
+ Subset A of the 2-dimensional topological manifold M
sage: p in A
True
sage: p in M