#coding: utf8
import plask


class Diffusion2D(plask.Solver):
    """
    Diffusion2D(name="")
    
    Calculates carrier pairs concentration in active region using FEM in one-dimensional cartesian space
    """
    abs_accuracy = None
    """
    Required absolute minimal concentration accuracy
    """

    accuracy = None
    """
    Required relative accuracy
    """

    def compute_initial(self):
        """
        compute_initial(self)
        
            Perform the initial computation
        """

    def compute_overthreshold(self):
        """
        compute_overthreshold(self)
        
            Perform the overthreshold computation
        """

    def compute_threshold(self):
        """
        compute_threshold(self)
        
            Perform the threshold computation
        """

    current_mesh = None
    """
    Horizontal adaptive mesh)
    """

    fem_method = None
    """
    Finite-element method (linear of parabolic)
    """

    geometry = None
    """
    Geometry provided to the solver
    """

    def get_total_burning(self):
        """
        get_total_burning(self)
        
            Compute total power burned over threshold [mW].
        """

    id = None
    """
    Id of the solver object. (read only)
    
    Example:
        >>> mysolver.id
        mysolver:category.type
    """

    inCurrentDensity = None
    """
    Receiver of the current density required for computations [kA/cm²].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.CurrentDensityReceiver2D`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inCurrentDensity = other_solver.outCurrentDensity
    
    See also:
    
       Receciver class: :class:`plask.flow.CurrentDensityReceiver2D`
    
       Provider class: :class:`plask.flow.CurrentDensityProvider2D`
    
       Data filter: :class:`plask.filter.CurrentDensityFilter2D`
    """

    inGain = None
    """
    Receiver of the material gain required for computations [1/cm].
    It is required only for the overthreshold computations.
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.GainReceiver2D`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inGain = other_solver.outGain
    
    See also:
    
       Receciver class: :class:`plask.flow.GainReceiver2D`
    
       Provider class: :class:`plask.flow.GainProvider2D`
    
       Data filter: :class:`plask.filter.GainFilter2D`
    """

    inLightE = None
    """
    Receiver of the electric field required for computations [V/m].
    It is required only for the overthreshold computations.
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.ModeLightEReceiver2D`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inLightE = other_solver.outModeLightE
    
    See also:
    
       Receciver class: :class:`plask.flow.ModeLightEReceiver2D`
    
       Provider class: :class:`plask.flow.ModeLightEProvider2D`
    
       Data filter: :class:`plask.filter.ModeLightEFilter2D`
    """

    inTemperature = None
    """
    Receiver of the temperature required for computations [K].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.TemperatureReceiver2D`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inTemperature = other_solver.outTemperature
    
    See also:
    
       Receciver class: :class:`plask.flow.TemperatureReceiver2D`
    
       Provider class: :class:`plask.flow.TemperatureProvider2D`
    
       Data filter: :class:`plask.filter.TemperatureFilter2D`
    """

    initial = None
    """
    True if we start from initial computations
    """

    def initialize(self):
        """
        initialize(self)
        
            Initialize solver.
            
            This method manually initialized the solver and sets :attr:`initialized` to
            *True*. Normally calling it is not necessary, as each solver automatically
            initializes itself when needed.
            
            Returns:
                bool: solver :attr:`initialized` state prior to this method call.
        """

    initialized = None
    """
    True if the solver has been initialized. (read only)
    
    Solvers usually get initialized at the beginning of the computations.
    You can clean the initialization state and free the memory by calling
    the :meth:`invalidate` method.
    """

    interpolation = None
    """
    Interpolation method used for injection current
    """

    def invalidate(self):
        """
        invalidate(self)
        
            Set the solver back to uninitialized state.
            
            This method frees the memory allocated by the solver and sets
            :attr:`initialized` to *False*.
        """

    def load_xpl(self, xpl, manager):
        """
        load_xpl(self, xpl, manager)
        
            Load configuration from XPL reader.
            
            This method should be overriden in custom Python solvers.
            
            Example:
              .. code-block:: python
            
                 def load_xpl(self, xpl, manager):
                     for tag in xpl:
                         if tag == 'config':
                             self.a = tag['a']
                             self.b = tag.get('b', 0)
                             if 'c' in tag:
                                 self.c = tag['c']
                         if tag == 'combined':
                             for subtag in tag:
                                 if subtag == 'withtext':
                                     self.data = subtag.attrs
                                     # Text must be read last
                                     self.text = subtag.text
                         elif tag == 'geometry':
                             self.geometry = tag.getitem(manager.geo, 'ref')
        """

    maxiters = None
    """
    Maximum number of allowed iterations before attempting to refine mesh
    """

    maxrefines = None
    """
    Maximum number of allowed mesh refinements
    """

    mesh = None
    """
    Mesh provided to the solver
    """

    mode_burns = None
    """
    Power burned over threshold by each mode [mW].
    """

    outCarriersConcentration = None
    """
    Provider of the computed carriers concentration [1/cm³].
    
    
    outCarriersConcentration(n=0, mesh, interpolation='default')
    
    :param str type: Detailed information which carriers are returned. It can be
                     'majority' to return majority carriers in given material,
                     'pairs' for the concentration of electron-hole pairs,
                     'electrons', or 'holes' for particular carriers type.
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the carriers concentration 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.inCarriersConcentration = solver.outCarriersConcentration
    
       Obtain the provided field:
    
       >>> solver.outCarriersConcentration(0, mesh)
       <plask.Data at 0x1234567>
    
       Test the number of provided values:
    
       >>> len(solver.outCarriersConcentration)
       3
    
    See also:
    
       Provider class: :class:`plask.flow.CarriersConcentrationProvider2D`
    
       Receciver class: :class:`plask.flow.CarriersConcentrationReceiver2D`
    """



class DiffusionCyl(plask.Solver):
    """
    DiffusionCyl(name="")
    
    Calculates carrier pairs concentration in active region using FEM in one-dimensional cylindrical space
    """
    abs_accuracy = None
    """
    Required absolute minimal concentration accuracy
    """

    accuracy = None
    """
    Required relative accuracy
    """

    def compute_initial(self):
        """
        compute_initial(self)
        
            Perform the initial computation
        """

    def compute_overthreshold(self):
        """
        compute_overthreshold(self)
        
            Perform the overthreshold computation
        """

    def compute_threshold(self):
        """
        compute_threshold(self)
        
            Perform the threshold computation
        """

    current_mesh = None
    """
    Horizontal adaptive mesh)
    """

    fem_method = None
    """
    Finite-element method (linear of parabolic)
    """

    geometry = None
    """
    Geometry provided to the solver
    """

    def get_total_burning(self):
        """
        get_total_burning(self)
        
            Compute total power burned over threshold [mW].
        """

    id = None
    """
    Id of the solver object. (read only)
    
    Example:
        >>> mysolver.id
        mysolver:category.type
    """

    inCurrentDensity = None
    """
    Receiver of the current density required for computations [kA/cm²].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.CurrentDensityReceiverCyl`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inCurrentDensity = other_solver.outCurrentDensity
    
    See also:
    
       Receciver class: :class:`plask.flow.CurrentDensityReceiverCyl`
    
       Provider class: :class:`plask.flow.CurrentDensityProviderCyl`
    
       Data filter: :class:`plask.filter.CurrentDensityFilterCyl`
    """

    inGain = None
    """
    Receiver of the material gain required for computations [1/cm].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.GainReceiverCyl`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inGain = other_solver.outGain
    
    See also:
    
       Receciver class: :class:`plask.flow.GainReceiverCyl`
    
       Provider class: :class:`plask.flow.GainProviderCyl`
    
       Data filter: :class:`plask.filter.GainFilterCyl`
    """

    inLightE = None
    """
    Receiver of the electric field required for computations [V/m].
    It is required only for the overthreshold computations.
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.ModeLightEReceiverCyl`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inLightE = other_solver.outModeLightE
    
    See also:
    
       Receciver class: :class:`plask.flow.ModeLightEReceiverCyl`
    
       Provider class: :class:`plask.flow.ModeLightEProviderCyl`
    
       Data filter: :class:`plask.filter.ModeLightEFilterCyl`
    """

    inTemperature = None
    """
    Receiver of the temperature required for computations [K].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.TemperatureReceiverCyl`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inTemperature = other_solver.outTemperature
    
    See also:
    
       Receciver class: :class:`plask.flow.TemperatureReceiverCyl`
    
       Provider class: :class:`plask.flow.TemperatureProviderCyl`
    
       Data filter: :class:`plask.filter.TemperatureFilterCyl`
    """

    inWavelength = None
    """
    Receiver of the wavelength required for computations [nm].
    It is required only for the overthreshold computations.
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.ModeWavelengthReceiver`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inWavelength = other_solver.outModeWavelength
    
    See also:
    
       Receciver class: :class:`plask.flow.ModeWavelengthReceiver`
    
       Provider class: :class:`plask.flow.ModeWavelengthProvider`
    
       Data filter: :class:`plask.filter.ModeWavelengthFilter`
    """

    initial = None
    """
    True if we start from initial computations
    """

    def initialize(self):
        """
        initialize(self)
        
            Initialize solver.
            
            This method manually initialized the solver and sets :attr:`initialized` to
            *True*. Normally calling it is not necessary, as each solver automatically
            initializes itself when needed.
            
            Returns:
                bool: solver :attr:`initialized` state prior to this method call.
        """

    initialized = None
    """
    True if the solver has been initialized. (read only)
    
    Solvers usually get initialized at the beginning of the computations.
    You can clean the initialization state and free the memory by calling
    the :meth:`invalidate` method.
    """

    interpolation = None
    """
    Interpolation method used for injection current
    """

    def invalidate(self):
        """
        invalidate(self)
        
            Set the solver back to uninitialized state.
            
            This method frees the memory allocated by the solver and sets
            :attr:`initialized` to *False*.
        """

    def load_xpl(self, xpl, manager):
        """
        load_xpl(self, xpl, manager)
        
            Load configuration from XPL reader.
            
            This method should be overriden in custom Python solvers.
            
            Example:
              .. code-block:: python
            
                 def load_xpl(self, xpl, manager):
                     for tag in xpl:
                         if tag == 'config':
                             self.a = tag['a']
                             self.b = tag.get('b', 0)
                             if 'c' in tag:
                                 self.c = tag['c']
                         if tag == 'combined':
                             for subtag in tag:
                                 if subtag == 'withtext':
                                     self.data = subtag.attrs
                                     # Text must be read last
                                     self.text = subtag.text
                         elif tag == 'geometry':
                             self.geometry = tag.getitem(manager.geo, 'ref')
        """

    maxiters = None
    """
    Maximum number of allowed iterations before attempting to refine mesh
    """

    maxrefines = None
    """
    Maximum number of allowed mesh refinements
    """

    mesh = None
    """
    Mesh provided to the solver
    """

    mode_burns = None
    """
    Power burned over threshold by each mode [mW].
    """

    outCarriersConcentration = None
    """
    Provider of the computed carriers concentration [1/cm³].
    
    
    outCarriersConcentration(n=0, mesh, interpolation='default')
    
    :param str type: Detailed information which carriers are returned. It can be
                     'majority' to return majority carriers in given material,
                     'pairs' for the concentration of electron-hole pairs,
                     'electrons', or 'holes' for particular carriers type.
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the carriers concentration 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.inCarriersConcentration = solver.outCarriersConcentration
    
       Obtain the provided field:
    
       >>> solver.outCarriersConcentration(0, mesh)
       <plask.Data at 0x1234567>
    
       Test the number of provided values:
    
       >>> len(solver.outCarriersConcentration)
       3
    
    See also:
    
       Provider class: :class:`plask.flow.CarriersConcentrationProviderCyl`
    
       Receciver class: :class:`plask.flow.CarriersConcentrationReceiverCyl`
    """

