Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    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()
Ejemplo n.º 4
0
def hypersingular(domain,
                  range_,
                  dual_to_range,
                  label="HYP",
                  symmetry='no_symmetry',
                  parameters=None,
                  use_slp=False,
                  use_projection_spaces=True,
                  assemble_only_singular_part=False):
    """Return the Laplace hypersingular boundary operator.

    Parameters
    ----------
    domain : bempp.api.space.Space
        Domain space.
    range_ : bempp.api.space.Space
        Range space.
    dual_to_range : bempp.api.space.Space
        Dual space to the range space.
    label : string
        Label for the operator.
    symmetry : string
        Symmetry mode. Possible values are: 'no_symmetry',
        'symmetric', 'hermitian'.
    parameters : bempp.api.common.ParameterList
        Parameters for the operator. If none given the
        default global parameter object `bempp.api.global_parameters`
        is used.
    use_projection_spaces : bool
        Represent operator by projection from higher dimensional space
        if available. This parameter can speed up fast assembly routines,
        such as H-Matrices or FMM (default true).
    use_slp : True/False or boundary operator object
        The hypersingular operator can be represented as a sparse transformation
        of a single-layer operator. If `use_slp=True` this representation
        is used. If `use_slp=op` for a single-layer boundary operator
        assembled on a suitable space this operator is used to assemble the
        hypersingular operator. Note that if `use_slp=op` is used no checks are
        performed if the slp operator is correctly defined for representing
        the hypersingular operator. Hence, if no care is taken this option can
        lead to a wrong operator. Also, `use_slp=True` or `use_slp=op` is only
        valid if the `domain` and `dual_to_range` spaces are identical.
    assemble_only_singular_part : bool
        When assembled the operator will only contain components for adjacent or
        overlapping test and trial functions (default false).
        Note. This option is only used if `use_slp` is not specified.
    """

    import bempp.api
    from bempp.api.assembly.boundary_operator import BoundaryOperator

    if parameters is None:
        parameters = bempp.api.global_parameters

    if domain != dual_to_range and use_slp:
        use_slp = False

    if not use_slp:
        from bempp.api.operators.boundary._common import \
            get_operator_with_space_preprocessing
        return get_operator_with_space_preprocessing(
            _hypersingular_impl,
            domain,
            range_,
            dual_to_range,
            label,
            symmetry,
            parameters,
            use_projection_spaces=use_projection_spaces,
            assemble_only_singular_part=assemble_only_singular_part)
    else:

        if domain != dual_to_range:
            raise ValueError(
                "domain and dual_to_range spaces must be identical " +
                "if use_slp=True")

        if not isinstance(use_slp, BoundaryOperator):
            disc_space = domain.discontinuous_space
            slp = single_layer(disc_space,
                               range_,
                               disc_space,
                               parameters=parameters)
        else:
            slp = use_slp

        from bempp.api.assembly.functors import vector_surface_curl_functor
        from bempp.api.assembly.functors import scalar_function_value_functor
        from bempp.api.assembly.functors import \
            single_component_test_trial_integrand_functor
        from bempp.api.space.projection import rewrite_operator_spaces

        compound_op = bempp.api.ZeroBoundaryOperator(domain, slp.range,
                                                     dual_to_range)

        for i in range(3):
            curl_value_op = \
                bempp.api.operators.boundary.sparse.operator_from_functors(
                    domain, slp.domain, slp.domain,
                    scalar_function_value_functor(),
                    vector_surface_curl_functor(),
                    single_component_test_trial_integrand_functor(0, i),
                    label="CURL_OP[{0}]".format(i),
                    parameters=parameters)
            compound_op += curl_value_op.dual_product(slp) * curl_value_op

        # Now generate the compound operator

        return rewrite_operator_spaces(compound_op,
                                       domain=domain,
                                       range_=range_,
                                       dual_to_range=dual_to_range)