def __init__(self, grid, domains, closed, comp_key=None): from bempp.core.space.space import function_space as _function_space from bempp.api.assembly.functors import hcurl_function_value_functor super(SNCSpace, self).__init__( _function_space(grid._impl, "SNC", 0, domains, closed), comp_key) self._order = 0 self._has_non_barycentric_space = True self._non_barycentric_space = self if not closed: self._discontinuous_space = function_space( grid, "DP", 1, domains=domains, closed=closed, reference_point_on_segment=False, element_on_segment=True) else: self._discontinuous_space = function_space( grid, "DP", 1, domains=domains, closed=closed, reference_point_on_segment=True, element_on_segment=False) self._evaluation_functor = hcurl_function_value_functor() self._super_space = self self._hdiv_space = function_space(grid, "RWG", 0, domains, closed) self._is_barycentric = False self._grid = grid
def __init__( self, grid, order, domains=None, closed=True, reference_point_on_segment=True, element_on_segment=False, comp_key=None): from bempp.core.space.space import function_space as _function_space from bempp.api.assembly.functors import scalar_function_value_functor super( DiscontinuousPolynomialSpace, self).__init__( _function_space( grid._impl, "DP", order, domains, closed, False, reference_point_on_segment, element_on_segment), comp_key=comp_key) self._order = order self._has_non_barycentric_space = True self._non_barycentric_space = self self._discontinuous_space = self self._super_space = self self._evaluation_functor = scalar_function_value_functor() self._is_barycentric = False self._grid = grid
def Neo_function_space(grid, kind, order, L, domains=None, closed=True, strictly_on_segment=False, reference_point_on_segment=True, element_on_segment=False): from bempp.core.space.space import function_space as _function_space space = Neo_Space(_function_space(grid._impl, kind, order, domains, closed, strictly_on_segment, reference_point_on_segment, element_on_segment), kind, order, L) return space
def function_space(grid, kind, order, domains=None, closed=True): """ Return a space defined over a given grid. Parameters ---------- grid : bempp.api.grid.Grid The grid object over which the space is defined. kind : string The type of space. Currently, the following types are supported: "P" : Continuous and piecewise polynomial functions. "DP" : Discontinuous and elementwise polynomial functions. "B-P": Polynomial spaces on barycentric grids. "B-DP": Polynomial discontinuous spaces on barycentric grids. "DUAL": Dual space on dual grid (only implemented for constants). "RT": Raviart-Thomas Vector spaces. order : int The order of the space, e.g. 0 for piecewise const, 1 for piecewise linear functions. domains : list List of integers specifying a list of physical entities of subdomains that should be included in the space. closed : bool Specifies whether the space is defined on a closed or open subspace. Notes ----- The most frequent used types are the space of piecewise constant functions (kind="DP", order=0) and the space of continuous, piecewise linear functions (kind="P", order=1). This is a factory function that initializes a space object. To see a detailed help for space objects see the documentation of the instantiated object. Examples -------- To initialize a space of piecewise constant functions use >>> space = function_space(grid,"DP",0) To initialize a space of continuous, piecewise linear functions, use >>> space = function_space(grid,"P",1) """ from bempp.core.space.space import function_space as _function_space return Space(_function_space(grid._impl, kind, order, domains, closed))
def __init__(self, grid, comp_key=None): from bempp.core.space.space import function_space as _function_space from bempp.api.assembly.functors import hdiv_function_value_functor super(BuffaChristiansenSpace, self).__init__(_function_space( grid._impl, "BC", 0), comp_key) self._order = 0 self._has_non_barycentric_space = False self._non_barycentric_space = None self._discontinuous_space = function_space( grid.barycentric_grid(), "DP", 1) self._super_space = function_space(grid.barycentric_grid(), "RWG", 0) self._evaluation_functor = hdiv_function_value_functor() self._is_barycentric = True self._grid = grid.barycentric_grid()
def __init__(self, grid, comp_key=None): from bempp.core.space.space import function_space as _function_space from bempp.api.assembly.functors import scalar_function_value_functor super(DualSpace, self).__init__( _function_space(grid._impl, "DUAL", 0), comp_key) self._order = 0 self._has_non_barycentric_space = False self._non_barycentric_space = None self._discontinuous_space = function_space( grid.barycentric_grid(), "DP", 0) self._super_space = self._discontinuous_space self._evaluation_functor = scalar_function_value_functor() self._is_barycentric = True self._grid = grid.barycentric_grid()
def __init__(self, grid, order, comp_key=None): from bempp.core.space.space import function_space as _function_space from bempp.api.assembly.functors import scalar_function_value_functor super(BarycentricContinuousPolynomialSpace, self).__init__( _function_space(grid._impl, "B-P", order), comp_key) self._order = order self._has_non_barycentric_space = True self._non_barycentric_space = function_space(grid, "P", order) self._discontinuous_space = function_space( grid.barycentric_grid(), "DP", order) self._super_space = self._discontinuous_space self._evaluation_functor = scalar_function_value_functor() self._is_barycentric = True self._grid = grid.barycentric_grid()
def __init__(self, grid, comp_key=None): from bempp.core.space.space import function_space as _function_space from bempp.api.assembly.functors import hcurl_function_value_functor super(BarycentricNCSpace, self).__init__( _function_space(grid._impl, "B-NC", 0), comp_key) self._order = 0 self._has_non_barycentric_space = True self._non_barycentric_space = function_space(grid, "NC", 0) self._discontinuous_space = function_space( grid.barycentric_grid(), "DP", 1) self._evaluation_functor = hcurl_function_value_functor() self._super_space = function_space(grid.barycentric_grid(), "NC", 0) self._hdiv_space = function_space(grid, "B-RT", 0) self._is_barycentric = True self._grid = grid.barycentric_grid()
def function_space(grid, kind, order, domains=None, closed=True, strictly_on_segment=False, reference_point_on_segment=True, element_on_segment=False): """ Return a space defined over a given grid. Parameters ---------- grid : bempp.api.grid.Grid The grid object over which the space is defined. kind : string The type of space. Currently, the following types are supported: "P" : Continuous and piecewise polynomial functions. "DP" : Discontinuous and elementwise polynomial functions. "B-P": Polynomial spaces on barycentric grids. "B-DP": Polynomial discontinuous spaces on barycentric grids. "DUAL": Dual space on dual grid (only implemented for constants). "RT": Raviart-Thomas Vector spaces. order : int The order of the space, e.g. 0 for piecewise const, 1 for piecewise linear functions. domains : list List of integers specifying a list of physical entities of subdomains that should be included in the space. closed : bool Specifies whether the space is defined on a closed or open subspace. strictly_on_segment: bool Specifies whether local basis functions are truncated to the domains specified (True) or if they are allowed to extend past the domains (False). Default is False. This argument is only used for scalar continuous spaces. reference_point_on_segment: bool If true only include a dof if its reference point (i.e. the dof position) is part of the segment. This argument is only used for discontinuous spaces (default is True). element_on_segment: bool If true restrict the dofs to those whose support element is part of the segment (default is False). Notes ----- The most frequent used types are the space of piecewise constant functions (kind="DP", order=0) and the space of continuous, piecewise linear functions (kind="P", order=1). Either one of `reference_point_on_segment` or `element_on_segment` must be true for discontinuous spaces. For piecewise constant spaces neither of these two options has any effect. This is a factory function that initializes a space object. To see a detailed help for space objects see the documentation of the instantiated object. Examples -------- To initialize a space of piecewise constant functions use >>> space = function_space(grid,"DP",0) To initialize a space of continuous, piecewise linear functions, use >>> space = function_space(grid,"P",1) """ from types import MethodType from bempp.core.space.space import function_space as _function_space space = Space(_function_space(grid._impl, kind, order, domains, closed, strictly_on_segment, reference_point_on_segment, element_on_segment)) # Add a surface gradient function for spaces that support it if kind == "P" or kind == "DP": space.evaluate_surface_gradient = MethodType(_evaluate_local_surface_gradient, space) return space