#coding: utf8
import plask


class DriftDiffusion2D(plask.Solver):
    """
    DriftDiffusion2D(name="")
    
    Finite element drift-diffusion electrical solver for 2D Cartesian geometry.
    """
    FullIon = None
    """
    True if dopants are completely ionized
    """

    Pol = None
    """
    True if polarization effects are taken into account
    """

    Raug = None
    """
    True if Auger recombination is taken into account
    """

    Rrad = None
    """
    True if radiative recombination is taken into account
    """

    Rsrh = None
    """
    True if SRH recombination is taken into account
    """

    SchottkyN = None
    """
    Schottky barrier for n-type constact
    """

    SchottkyP = None
    """
    Schottky barrier for p-type constact
    """

    algorithm = None
    """
    Chosen matrix factorization algorithm
    """

    def compute(self, loops=0):
        """
        compute(self, loops=0)
        
            Run drift-diffusion calculations
        """

    def find_energy_levels(self):
        """
        find_energy_levels(self)
        
            Run energy levels calculations - TEST
        """

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

    def get_total_current(self, nact=0):
        """
        get_total_current(self, nact=0)
        
            Get total current flowing through active region [mA]
        """

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

    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`
    """

    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.
    """

    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*.
        """

    itererr = None
    """
    Allowed residual iteration for iterative method
    """

    iterlim = None
    """
    Maximum number of iterations for iterative method
    """

    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')
        """

    logfreq = None
    """
    Frequency of iteration progress reporting
    """

    loopsFn = None
    """
    Loops limit for the electrons quasi-Fermi level
    """

    loopsFp = None
    """
    Loops limit for the holes quasi-Fermi level
    """

    loopsV = None
    """
    Loops limit for the potential
    """

    loopsV0 = None
    """
    Loops limit for the built-in potential
    """

    loopsVi = None
    """
    Loops limit for the initial potential estimate
    """

    maxerrFn = None
    """
    Limit for the electrons quasi-Fermi level updates
    """

    maxerrFp = None
    """
    Limit for the holes quasi-Fermi level updates
    """

    maxerrV = None
    """
    Limit for the potential updates
    """

    maxerrV0 = None
    """
    Limit for the built-in potential updates
    """

    maxerrVi = None
    """
    Limit for the initial potential estimate updates
    """

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

    outBandEdges = None
    """
    Provider of the computed conduction and valence band edges [eV].
    
    
    outBandEdges(n=0, mesh, interpolation='default')
    
    :param int n: Value number.
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the conduction and valence band edges on the specified mesh **[eV]**.
    
    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.inBandEdges = solver.outBandEdges
    
       Obtain the provided field:
    
       >>> solver.outBandEdges(0, mesh)
       <plask.Data at 0x1234567>
    
       Test the number of provided values:
    
       >>> len(solver.outBandEdges)
       3
    
    See also:
    
       Provider class: :class:`plask.flow.BandEdgesProvider2D`
    
       Receciver class: :class:`plask.flow.BandEdgesReceiver2D`
    """

    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`
    """

    outCurrentDensityForElectrons = None
    """
    Provider of the computed current density [kA/cm²].
    
    
    outCurrentDensityForElectrons(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the current density on the specified mesh **[kA/cm²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inCurrentDensity = solver.outCurrentDensityForElectrons
    
       Obtain the provided field:
    
       >>> solver.outCurrentDensityForElectrons(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.CurrentDensityProvider2D`
    
       Receciver class: :class:`plask.flow.CurrentDensityReceiver2D`
    """

    outCurrentDensityForHoles = None
    """
    Provider of the computed current density [kA/cm²].
    
    
    outCurrentDensityForHoles(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the current density on the specified mesh **[kA/cm²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inCurrentDensity = solver.outCurrentDensityForHoles
    
       Obtain the provided field:
    
       >>> solver.outCurrentDensityForHoles(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.CurrentDensityProvider2D`
    
       Receciver class: :class:`plask.flow.CurrentDensityReceiver2D`
    """

    outFermiLevels = None
    """
    Provider of the computed quasi-Fermi levels for electrons and holes [eV].
    
    
    outFermiLevels(n=0, mesh, interpolation='default')
    
    :param int n: Value number.
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the quasi-Fermi levels for electrons and holes on the specified mesh **[eV]**.
    
    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.inFermiLevels = solver.outFermiLevels
    
       Obtain the provided field:
    
       >>> solver.outFermiLevels(0, mesh)
       <plask.Data at 0x1234567>
    
       Test the number of provided values:
    
       >>> len(solver.outFermiLevels)
       3
    
    See also:
    
       Provider class: :class:`plask.flow.FermiLevelsProvider2D`
    
       Receciver class: :class:`plask.flow.FermiLevelsReceiver2D`
    """

    outHeat = None
    """
    Provider of the computed heat sources density [W/m³].
    
    
    outHeat(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the heat sources density on the specified mesh **[W/m³]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inHeat = solver.outHeat
    
       Obtain the provided field:
    
       >>> solver.outHeat(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.HeatProvider2D`
    
       Receciver class: :class:`plask.flow.HeatReceiver2D`
    """

    outPotential = None
    """
    Provider of the computed potential [V].
    
    
    outPotential(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the potential on the specified mesh **[V]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inPotential = solver.outPotential
    
       Obtain the provided field:
    
       >>> solver.outPotential(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.PotentialProvider2D`
    
       Receciver class: :class:`plask.flow.PotentialReceiver2D`
    """

    voltage_boundary = None
    """
    Boundary conditions of the first kind (constant potential) 
    
    This field holds a list of boundary conditions for the solver. You may access
    and alter is elements a normal Python list. Each element is a special class
    that has two attributes:
    
    ============= ==================================================================
    :attr:`place` Boundary condition location (:class:`plask.mesh.RectangularBase2D.Boundary`).
    :attr:`value` Boundary condition value.
    ============= ==================================================================
    
    When you add new boundary condition, you may use two-argument ``append``, or
    ``prepend`` methods, or three-argument ``insert`` method, where you separately
    specify the place and the value. See the below example for clarification.
    
    Example:
        >>> solver.voltage_boundary.clear()
        >>> solver.voltage_boundary.append(solver.mesh.Bottom(), some_value)
        >>> solver.voltage_boundary[0].value = different_value
        >>> solver.voltage_boundary.insert(0, solver.mesh.Top(), new_value)
        >>> solver.voltage_boundary[1].value == different_value
        True
    """



class DriftDiffusionCyl(plask.Solver):
    """
    DriftDiffusionCyl(name="")
    
    Finite element drift-diffusion electrical solver for 2D cylindrical geometry.
    """
    FullIon = None
    """
    True if dopants are completely ionized
    """

    Pol = None
    """
    True if polarization effects are taken into account
    """

    Raug = None
    """
    True if Auger recombination is taken into account
    """

    Rrad = None
    """
    True if radiative recombination is taken into account
    """

    Rsrh = None
    """
    True if SRH recombination is taken into account
    """

    SchottkyN = None
    """
    Schottky barrier for n-type constact
    """

    SchottkyP = None
    """
    Schottky barrier for p-type constact
    """

    algorithm = None
    """
    Chosen matrix factorization algorithm
    """

    def compute(self, loops=0):
        """
        compute(self, loops=0)
        
            Run drift-diffusion calculations
        """

    def find_energy_levels(self):
        """
        find_energy_levels(self)
        
            Run energy levels calculations - TEST
        """

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

    def get_total_current(self, nact=0):
        """
        get_total_current(self, nact=0)
        
            Get total current flowing through active region [mA]
        """

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

    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`
    """

    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.
    """

    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*.
        """

    itererr = None
    """
    Allowed residual iteration for iterative method
    """

    iterlim = None
    """
    Maximum number of iterations for iterative method
    """

    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')
        """

    logfreq = None
    """
    Frequency of iteration progress reporting
    """

    loopsFn = None
    """
    Loops limit for the electrons quasi-Fermi level
    """

    loopsFp = None
    """
    Loops limit for the holes quasi-Fermi level
    """

    loopsV = None
    """
    Loops limit for the potential
    """

    loopsV0 = None
    """
    Loops limit for the built-in potential
    """

    loopsVi = None
    """
    Loops limit for the initial potential estimate
    """

    maxerrFn = None
    """
    Limit for the electrons quasi-Fermi level updates
    """

    maxerrFp = None
    """
    Limit for the holes quasi-Fermi level updates
    """

    maxerrV = None
    """
    Limit for the potential updates
    """

    maxerrV0 = None
    """
    Limit for the built-in potential updates
    """

    maxerrVi = None
    """
    Limit for the initial potential estimate updates
    """

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

    outBandEdges = None
    """
    Provider of the computed conduction and valence band edges [eV].
    
    
    outBandEdges(n=0, mesh, interpolation='default')
    
    :param int n: Value number.
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the conduction and valence band edges on the specified mesh **[eV]**.
    
    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.inBandEdges = solver.outBandEdges
    
       Obtain the provided field:
    
       >>> solver.outBandEdges(0, mesh)
       <plask.Data at 0x1234567>
    
       Test the number of provided values:
    
       >>> len(solver.outBandEdges)
       3
    
    See also:
    
       Provider class: :class:`plask.flow.BandEdgesProviderCyl`
    
       Receciver class: :class:`plask.flow.BandEdgesReceiverCyl`
    """

    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`
    """

    outCurrentDensityForElectrons = None
    """
    Provider of the computed current density [kA/cm²].
    
    
    outCurrentDensityForElectrons(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the current density on the specified mesh **[kA/cm²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inCurrentDensity = solver.outCurrentDensityForElectrons
    
       Obtain the provided field:
    
       >>> solver.outCurrentDensityForElectrons(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.CurrentDensityProviderCyl`
    
       Receciver class: :class:`plask.flow.CurrentDensityReceiverCyl`
    """

    outCurrentDensityForHoles = None
    """
    Provider of the computed current density [kA/cm²].
    
    
    outCurrentDensityForHoles(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the current density on the specified mesh **[kA/cm²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inCurrentDensity = solver.outCurrentDensityForHoles
    
       Obtain the provided field:
    
       >>> solver.outCurrentDensityForHoles(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.CurrentDensityProviderCyl`
    
       Receciver class: :class:`plask.flow.CurrentDensityReceiverCyl`
    """

    outFermiLevels = None
    """
    Provider of the computed quasi-Fermi levels for electrons and holes [eV].
    
    
    outFermiLevels(n=0, mesh, interpolation='default')
    
    :param int n: Value number.
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the quasi-Fermi levels for electrons and holes on the specified mesh **[eV]**.
    
    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.inFermiLevels = solver.outFermiLevels
    
       Obtain the provided field:
    
       >>> solver.outFermiLevels(0, mesh)
       <plask.Data at 0x1234567>
    
       Test the number of provided values:
    
       >>> len(solver.outFermiLevels)
       3
    
    See also:
    
       Provider class: :class:`plask.flow.FermiLevelsProviderCyl`
    
       Receciver class: :class:`plask.flow.FermiLevelsReceiverCyl`
    """

    outHeat = None
    """
    Provider of the computed heat sources density [W/m³].
    
    
    outHeat(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the heat sources density on the specified mesh **[W/m³]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inHeat = solver.outHeat
    
       Obtain the provided field:
    
       >>> solver.outHeat(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.HeatProviderCyl`
    
       Receciver class: :class:`plask.flow.HeatReceiverCyl`
    """

    outPotential = None
    """
    Provider of the computed potential [V].
    
    
    outPotential(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the potential on the specified mesh **[V]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inPotential = solver.outPotential
    
       Obtain the provided field:
    
       >>> solver.outPotential(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.PotentialProviderCyl`
    
       Receciver class: :class:`plask.flow.PotentialReceiverCyl`
    """

    voltage_boundary = None
    """
    Boundary conditions of the first kind (constant potential) 
    
    This field holds a list of boundary conditions for the solver. You may access
    and alter is elements a normal Python list. Each element is a special class
    that has two attributes:
    
    ============= ==================================================================
    :attr:`place` Boundary condition location (:class:`plask.mesh.RectangularBase2D.Boundary`).
    :attr:`value` Boundary condition value.
    ============= ==================================================================
    
    When you add new boundary condition, you may use two-argument ``append``, or
    ``prepend`` methods, or three-argument ``insert`` method, where you separately
    specify the place and the value. See the below example for clarification.
    
    Example:
        >>> solver.voltage_boundary.clear()
        >>> solver.voltage_boundary.append(solver.mesh.Bottom(), some_value)
        >>> solver.voltage_boundary[0].value = different_value
        >>> solver.voltage_boundary.insert(0, solver.mesh.Top(), new_value)
        >>> solver.voltage_boundary[1].value == different_value
        True
    """

