# PLaSK User Manual

#### Page Contents

- GainReceiver2D Class
  - `GainReceiver2D`
  - Methods
  - Descriptions
    - Method Details
      - `GainReceiver2D.__call__()`
      - `GainReceiver2D.add_watch()`
      - `GainReceiver2D.attach()`
      - `GainReceiver2D.reset()`

# GainReceiver2D Class

class plask.flow.GainReceiver2D

  Receiver of the material gain in Cartesian2D geometry (1/cm).

  You may connect a provider to this receiver using either the connect method or an assignment operator. Then, you can read the provided value by calling this receiver with arguments identical as the ones of the corresponding provider `GainProvider2D`.

  Example

  Connect the receiver to a provider from some other solver:

      >>> solver.inGain = other_solver.outGain

  See also

  Provider of material gain: `plask.flow.GainProvider2D`

  Data filter for material gain: `plask.flow.GainFilter2D`

## Methods

`__call__`(...) | Get value from the connected provider
`add_watch`(callable) | Connect callable to watch receiver changes.
`attach`(source) | Attach some provider or constant value to the receiver.
`reset`() | Disconnect any provider of value from the receiver.

## Descriptions

### Method Details

GainReceiver2D.__call__(deriv, mesh, lam, interpolation='DEFAULT')
GainReceiver2D.__call__(mesh, lam, interpolation='DEFAULT')

  Get value from the connected provider

  Get value from the connected provider

GainReceiver2D.add_watch(callable)

  Connect callable to watch receiver changes.

  The callable will be called each time the value received by this receiver changes.

  The callable should accept two arguments: the first one will be the receiver and the second one gives information what is changed.

GainReceiver2D.attach(source)

  Attach some provider or constant value to the receiver.

  Parameters:

    source – source provider or value.

  Example

      >>> solver.inGain.attach(300.)
      >>> solver.inGain(any_mesh)[0]
      300.
      >>> solver.inGain(any_mesh)[-1]
      300.

      >>> solver.inGain.attach(other_solver.outGain)

  Note

  You may achieve the same effect by using the asignmnent operator if you put an existing provider at the right side of this operator:

      >>> solver.inGain = other_solver.outGain

GainReceiver2D.reset()

  Disconnect any provider of value from the receiver.