# GainProvider2D Class¶

class plask.flow.GainProvider2D(data)

Provider of the material gain in Cartesian2D geometry [1/cm].

This class is used for material gain provider in binary solvers. You can also create a custom provider for your Python solver.

Parameters: data – Data object to interpolate or callable returning it for given mesh. The callable must accept the same arguments as the provider __call__ method (see below). It must also be able to give its length (i.e. have the __len__ method defined) that gives the number of different provided values.

To obtain the value from the provider simply call it. The call signature is as follows:

solver.outGain(deriv='', mesh, wavelength, interpolation='default')
Parameters: deriv (str) – Gain derivative to return. can be ‘’ (empty) or ‘conc’. In the latter case, the gain derivative over carriers concentration is returned. mesh (mesh) – Target mesh to get the field at. interpolation (str) – Requested interpolation method. wavelength (float) – The wavelength at which the gain is computed [nm]. Data with the material gain on the specified mesh [1/cm].

You may obtain the number of different values this provider can return by testing its length.

Example

Connect the provider to a receiver in some other solver:

>>> other_solver.inGain = solver.outGain


Obtain the provided field:

>>> solver.outGain(0, mesh, wavelength)


Test the number of provided values:

>>> len(solver.outGain)
3


Receiver of material gain: plask.flow.GainReceiver2D Data filter for material gain: plask.flow.GainFilter2D

## Methods¶

 __call__(…) Get value from the provider. set_changed() Inform all connected receivers that the provided value has changed.

## Descriptions¶

### Method Details¶

GainProvider2D.__call__(deriv, mesh, wavelength, interpolation='DEFAULT')
GainProvider2D.__call__(mesh, wavelength, interpolation='DEFAULT')

Get value from the provider.

Parameters: deriv (str) – Gain derivative to return. can be ‘’ (empty) or ‘conc’. In the latter case, the gain derivative over carriers concentration is returned. mesh (mesh) – Target mesh to get the field at. interpolation (str) – Requested interpolation method. wavelength (float) – The wavelength at which the gain is computed [nm].
GainProvider2D.set_changed()

Inform all connected receivers that the provided value has changed.

The receivers will have its changed attribute set to True and solvers will call the provider again if they need its value (otherwise they might take it from the cache.