Coverage for src/pymor/domaindescriptions/basic : 66%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
'''Describes a rectangular domain.
|BoundaryTypes| can be associated edgewise.
Parameters ---------- domain List of two points defining the lower-left and upper-right corner of the domain. left The |BoundaryType| of the left edge. right The |BoundaryType| of the right edge. top The |BoundaryType| of the top edge. bottom The |BoundaryType| of the bottom edge.
Attributes ---------- domain left right top bottom '''
top=BoundaryType('dirichlet'), bottom=BoundaryType('dirichlet')):
def lower_left(self): return self.domain[0]
def upper_right(self): return self.domain[1]
def width(self): return self.domain[1, 0] - self.domain[0, 0]
def height(self): return self.domain[1, 1] - self.domain[0, 1]
def volume(self): return self.width * self.height
def diameter(self): return np.sqrt(self.width ** 2 + self.height ** 2)
left = ', left=' + repr(self.left) if self.left != BoundaryType('dirichlet') else '' right = ', right=' + repr(self.right) if self.right != BoundaryType('dirichlet') else '' top = ', top=' + repr(self.top) if self.top != BoundaryType('dirichlet') else '' bottom = ', bottom=' + repr(self.bottom) if self.bottom != BoundaryType('dirichlet') else '' return 'RectDomain({}{})'.format(str(self.domain).replace('\n', ','), left + right + top + bottom)
'''Describes a cylindrical domain.
|BoundaryTypes| can be associated edgewise.
Parameters ---------- domain List of two points defining the lower-left and upper-right corner of the domain. The left and right edge are identified. top The |BoundaryType| of the top edge. bottom The |BoundaryType| of the bottom edge.
Attributes ---------- domain top bottom '''
def lower_left(self): return self.domain[0]
def upper_right(self): return self.domain[1]
def width(self): return self.domain[1, 0] - self.domain[0, 0]
def height(self): return self.domain[1, 1] - self.domain[0, 1]
def volume(self): return self.width * self.height
def diameter(self): return np.sqrt(self.width ** 2 + self.height ** 2)
top = ', top=' + repr(self.top) if self.top != BoundaryType('dirichlet') else '' bottom = ', bottom=' + repr(self.bottom) if self.bottom != BoundaryType('dirichlet') else '' return 'CylindricalDomain({}{})'.format(str(self.domain).replace('\n', ','), top + bottom)
'''Describes a domain with the topology of a torus.
Parameters ---------- domain List of two points defining the lower-left and upper-right corner of the domain. The left and right edge are identified, as well as the bottom and top edge
Attributes ---------- domain '''
def lower_left(self): return self.domain[0]
def upper_right(self): return self.domain[1]
def width(self): return self.domain[1, 0] - self.domain[0, 0]
def height(self): return self.domain[1, 1] - self.domain[0, 1]
def volume(self): return self.width * self.height
def diameter(self): return np.sqrt(self.width ** 2 + self.height ** 2)
return 'TorusDomain({})'.format(str(self.domain).replace('\n', ','))
'''Describes an interval domain.
|BoundaryTypes| can be associated edgewise.
Parameters ---------- domain List [x_l, x_r] providing the left and right endpoint. left The |BoundaryType| of the left endpoint. right The |BoundaryType| of the right endpoint.
Attributes ---------- domain left right '''
def width(self): return self.domain[1] - self.domain[0]
left = ', left=' + repr(self.top) if self.top != BoundaryType('dirichlet') else '' right = ', right=' + repr(self.bottom) if self.bottom != BoundaryType('dirichlet') else '' return 'LineDomain({}{})'.format(self.domain, left + right)
'''Describes a domain with the topology of a circle, i.e. a line with identified end points.
Parameters ---------- domain List [x_l, x_r] providing the left and right endpoint.
Attributes ---------- domain '''
def width(self): return self.domain[1] - self.domain[0]
return 'CircleDomain({})'.format(self.domain) |