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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

# 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) 

 

from __future__ import absolute_import, division, print_function 

 

from pymor.core import ImmutableInterface, abstractmethod 

from pymor.parameters.base import Parametric 

from pymor.tools import Named 

 

 

class ParameterSpaceInterface(ImmutableInterface): 

    '''Interface for parameter spaces. 

 

    Attributes 

    ---------- 

    parameter_type 

        |ParameterType| of the space. 

    ''' 

 

    parameter_type = None 

 

    @abstractmethod 

    def contains(self, mu): 

        '''`True` if `mu` is contained in the space.''' 

        pass 

 

 

class ParameterFunctionalInterface(ImmutableInterface, Parametric, Named): 

    '''Interface for parameter functionals. 

 

    A parameter functional is simply a function mapping a |Parameter| to 

    a number. 

    ''' 

 

    @abstractmethod 

    def evaluate(self, mu=None): 

        '''Evaluate the functional for the given |Parameter| `mu`.''' 

        pass 

 

    def __call__(self, mu=None): 

        return self.evaluate(mu)