Changeset 6304 for branches/numpy/anuga/pmesh/mesh.py
- Timestamp:
- Feb 10, 2009, 11:11:04 AM (16 years ago)
- Location:
- branches/numpy
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/pmesh/mesh.py
r6156 r6304 22 22 import types 23 23 import exceptions 24 25 import numpy as num 24 26 25 27 … … 37 39 except ImportError: 38 40 # Hand-built mockup of the things we need from the kinds package, since it 39 # was recently removed from the standard Numeric distro. Some users may41 # was recently removed from the standard numeric distro. Some users may 40 42 # not have it by default. 41 43 class _bunch: … … 117 119 118 120 class Vertex(Point): 119 """ 120 A point on the mesh. 121 """A point on the mesh. 121 122 Object attributes based on the Triangle program 122 123 """ 123 def __init__(self,X,Y, attributes = None): 124 125 VERTEXSQUARESIDELENGTH = 6 126 127 def __init__(self, X, Y, attributes=None): 124 128 __slots__ = ['x','y','attributes'] 125 126 assert (type(X) == types.FloatType or type(X) == types.IntType) 127 assert (type(Y) == types.FloatType or type(Y) == types.IntType) 128 self.x=X 129 self.y=Y 130 self.attributes=[] 131 132 if attributes is None: 133 self.attributes=[] 134 else: 129 130 # we don't care what we get, as long as we can get float *value* 131 self.x = float(X) 132 self.y = float(Y) 133 134 self.attributes = [] 135 if not attributes is None: 135 136 self.attributes=attributes 136 137 137 138 138 def setAttributes(self,attributes): 139 """ 140 attributes is a list. 141 """ 139 """attributes is a list. """ 140 142 141 self.attributes = attributes 143 142 144 VERTEXSQUARESIDELENGTH = 6145 143 def draw(self, canvas, tags, colour = 'black',scale = 1, xoffset = 0, 146 144 yoffset =0, ): … … 176 174 def __repr__(self): 177 175 return "[(%f,%f),%r]" % (self.x,self.y,self.attributes) 178 176 177 179 178 class Hole(Point): 180 """ 181 A region of the mesh were no triangles are generated. 179 """A region of the mesh were no triangles are generated. 182 180 Defined by a point in the hole enclosed by segments. 183 181 """ … … 201 199 202 200 class Region(Point): 203 """ 204 A region of the mesh, defined by a point in the region 205 enclosed by segments. Used to tag areas. 201 """A region of the mesh. 202 Defined by a point in the region enclosed by segments. Used to tag areas. 206 203 """ 204 207 205 CROSSLENGTH = 6 208 206 TAG = 0 209 207 MAXAREA = 1 210 208 211 def __init__(self,X,Y, tag = None, maxArea = None): 212 """Precondition: tag is a string and maxArea is a real 213 """ 214 # This didn't work. 215 #super(Region,self)._init_(self,X,Y) 209 def __init__(self, X, Y, tag=None, maxArea=None): 210 """Precondition: tag is a string and maxArea is a real""" 211 216 212 self.x=X 217 213 self.y=Y 218 self.attributes = [] # index 0 is the tag string219 #optoinal index 1 is the max triangle area220 #NOTE the size of this attribute is assumed221 # to be 1 or 2 in regionstrings2int214 self.attributes = [] # index 0 is the tag string 215 # optional index 1 is the max triangle area 216 # NOTE the size of this attribute is assumed 217 # to be 1 or 2 in regionstrings2int 222 218 if tag is None: 223 219 self.attributes.append("")
Note: See TracChangeset
for help on using the changeset viewer.