"""
Module mwd_output
Defined at smash/solver/derived_type/mwd_output.f90 lines 26-83
This module `mwd_output` encapsulates all SMASH output.
This module is wrapped and differentiated.
OutputDT type:
</> Public
========================== =====================================
`Variables` Description
========================== =====================================
``qsim`` Simulated discharge at gauge [m3/s]
``qsim_domain`` Simulated discharge whole domain [m3/s]
``sparse_qsim_domain`` Sparse simulated discharge whole domain [m3/s]
``net_prcp_domain`` Net precipitaition whole domain [mm/dt]
``sparse_net_prcp_domain`` Sparse net precipitation whole domain [mm/dt]
``cost`` Cost value
``cost_jobs`` Objective function cost value
``cost_jreg`` Regularization function cost value
``cost_jobs_initial`` Objective function initial cost value
``cost_jreg_initial`` Regularization function initial cost value
``fstates`` Final states(StatesDT)
========================== =====================================
contains
[1] OutputDT_initialise
"""
from __future__ import print_function, absolute_import, division
from smash.solver._mw_derived_type_copy import copy_output
from smash.solver._f90wrap_decorator import char_array_getter_handler, char_array_setter_handler
from smash.solver._f90wrap_decorator import char_getter_handler
from smash.solver._f90wrap_decorator import getter_index_handler, setter_index_handler
from smash.solver import _solver
import f90wrap.runtime
import logging
import numpy
from smash.solver._mwd_states import StatesDT
_arrays = {}
_objs = {}
[docs]@f90wrap.runtime.register_class("solver.OutputDT")
class OutputDT(f90wrap.runtime.FortranDerivedType):
"""
Type(name=outputdt)
Defined at smash/solver/derived_type/mwd_output.f90 lines 32-46
Notes
-----
OutputDT Derived Type.
"""
def __init__(self, setup, mesh, handle=None):
"""
self = Outputdt(setup, mesh)
Defined at smash/solver/derived_type/mwd_output.f90 lines 49-83
Parameters
----------
setup : Setupdt
mesh : Meshdt
Returns
-------
this : Outputdt
Notes
-----
OutputDT initialisation subroutine.
only: sp
only: SetupDT
only: MeshDT
only: StatesDT, StatesDT_initialise
"""
f90wrap.runtime.FortranDerivedType.__init__(self)
result = _solver.f90wrap_outputdt_initialise(setup=setup._handle, \
mesh=mesh._handle)
self._handle = result[0] if isinstance(result, tuple) else result
def __del__(self):
"""
Destructor for class Outputdt
Defined at smash/solver/derived_type/mwd_output.f90 lines 32-46
Parameters
----------
this : Outputdt
Object to be destructed
Automatically generated destructor for outputdt
"""
if self._alloc:
try:
_solver.f90wrap_outputdt_finalise(this=self._handle)
except:
pass
def copy(self):
return copy_output(self)
@property
def qsim(self):
"""
Element qsim ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 36
"""
array_ndim, array_type, array_shape, array_handle = \
_solver.f90wrap_outputdt__array__qsim(self._handle)
if array_handle in self._arrays:
qsim = self._arrays[array_handle]
else:
qsim = f90wrap.runtime.get_array(f90wrap.runtime.sizeof_fortran_t,
self._handle,
_solver.f90wrap_outputdt__array__qsim)
self._arrays[array_handle] = qsim
return qsim
@qsim.setter
def qsim(self, qsim):
self.qsim[...] = qsim
@property
def qsim_domain(self):
"""
Element qsim_domain ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 37
"""
array_ndim, array_type, array_shape, array_handle = \
_solver.f90wrap_outputdt__array__qsim_domain(self._handle)
if array_handle in self._arrays:
qsim_domain = self._arrays[array_handle]
else:
qsim_domain = f90wrap.runtime.get_array(f90wrap.runtime.sizeof_fortran_t,
self._handle,
_solver.f90wrap_outputdt__array__qsim_domain)
self._arrays[array_handle] = qsim_domain
return qsim_domain
@qsim_domain.setter
def qsim_domain(self, qsim_domain):
self.qsim_domain[...] = qsim_domain
@property
def sparse_qsim_domain(self):
"""
Element sparse_qsim_domain ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 38
"""
array_ndim, array_type, array_shape, array_handle = \
_solver.f90wrap_outputdt__array__sparse_qsim_domain(self._handle)
if array_handle in self._arrays:
sparse_qsim_domain = self._arrays[array_handle]
else:
sparse_qsim_domain = f90wrap.runtime.get_array(f90wrap.runtime.sizeof_fortran_t,
self._handle,
_solver.f90wrap_outputdt__array__sparse_qsim_domain)
self._arrays[array_handle] = sparse_qsim_domain
return sparse_qsim_domain
@sparse_qsim_domain.setter
def sparse_qsim_domain(self, sparse_qsim_domain):
self.sparse_qsim_domain[...] = sparse_qsim_domain
@property
def net_prcp_domain(self):
"""
Element net_prcp_domain ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 39
"""
array_ndim, array_type, array_shape, array_handle = \
_solver.f90wrap_outputdt__array__net_prcp_domain(self._handle)
if array_handle in self._arrays:
net_prcp_domain = self._arrays[array_handle]
else:
net_prcp_domain = f90wrap.runtime.get_array(f90wrap.runtime.sizeof_fortran_t,
self._handle,
_solver.f90wrap_outputdt__array__net_prcp_domain)
self._arrays[array_handle] = net_prcp_domain
return net_prcp_domain
@net_prcp_domain.setter
def net_prcp_domain(self, net_prcp_domain):
self.net_prcp_domain[...] = net_prcp_domain
@property
def sparse_net_prcp_domain(self):
"""
Element sparse_net_prcp_domain ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 40
"""
array_ndim, array_type, array_shape, array_handle = \
_solver.f90wrap_outputdt__array__sparse_net_prcp_domain(self._handle)
if array_handle in self._arrays:
sparse_net_prcp_domain = self._arrays[array_handle]
else:
sparse_net_prcp_domain = \
f90wrap.runtime.get_array(f90wrap.runtime.sizeof_fortran_t,
self._handle,
_solver.f90wrap_outputdt__array__sparse_net_prcp_domain)
self._arrays[array_handle] = sparse_net_prcp_domain
return sparse_net_prcp_domain
@sparse_net_prcp_domain.setter
def sparse_net_prcp_domain(self, sparse_net_prcp_domain):
self.sparse_net_prcp_domain[...] = sparse_net_prcp_domain
@property
def cost(self):
"""
Element cost ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 41
"""
return _solver.f90wrap_outputdt__get__cost(self._handle)
@cost.setter
def cost(self, cost):
_solver.f90wrap_outputdt__set__cost(self._handle, cost)
@property
def cost_jobs(self):
"""
Element cost_jobs ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 42
"""
return _solver.f90wrap_outputdt__get__cost_jobs(self._handle)
@cost_jobs.setter
def cost_jobs(self, cost_jobs):
_solver.f90wrap_outputdt__set__cost_jobs(self._handle, cost_jobs)
@property
def cost_jreg(self):
"""
Element cost_jreg ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 43
"""
return _solver.f90wrap_outputdt__get__cost_jreg(self._handle)
@cost_jreg.setter
def cost_jreg(self, cost_jreg):
_solver.f90wrap_outputdt__set__cost_jreg(self._handle, cost_jreg)
@property
def _cost_jobs_initial(self):
"""
Element cost_jobs_initial ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 44
"""
return _solver.f90wrap_outputdt__get__cost_jobs_initial(self._handle)
@_cost_jobs_initial.setter
def _cost_jobs_initial(self, cost_jobs_initial):
_solver.f90wrap_outputdt__set__cost_jobs_initial(self._handle, \
cost_jobs_initial)
@property
def _cost_jreg_initial(self):
"""
Element cost_jreg_initial ftype=real(sp) pytype=float
Defined at smash/solver/derived_type/mwd_output.f90 line 45
"""
return _solver.f90wrap_outputdt__get__cost_jreg_initial(self._handle)
@_cost_jreg_initial.setter
def _cost_jreg_initial(self, cost_jreg_initial):
_solver.f90wrap_outputdt__set__cost_jreg_initial(self._handle, \
cost_jreg_initial)
@property
def fstates(self):
"""
Element fstates ftype=type(statesdt) pytype=Statesdt
Defined at smash/solver/derived_type/mwd_output.f90 line 46
"""
fstates_handle = _solver.f90wrap_outputdt__get__fstates(self._handle)
if tuple(fstates_handle) in self._objs:
fstates = self._objs[tuple(fstates_handle)]
else:
fstates = StatesDT.from_handle(fstates_handle)
self._objs[tuple(fstates_handle)] = fstates
return fstates
@fstates.setter
def fstates(self, fstates):
fstates = fstates._handle
_solver.f90wrap_outputdt__set__fstates(self._handle, fstates)
def __str__(self):
ret = ['<outputdt>{\n']
ret.append(' qsim : ')
ret.append(repr(self.qsim))
ret.append(',\n qsim_domain : ')
ret.append(repr(self.qsim_domain))
ret.append(',\n sparse_qsim_domain : ')
ret.append(repr(self.sparse_qsim_domain))
ret.append(',\n net_prcp_domain : ')
ret.append(repr(self.net_prcp_domain))
ret.append(',\n sparse_net_prcp_domain : ')
ret.append(repr(self.sparse_net_prcp_domain))
ret.append(',\n cost : ')
ret.append(repr(self.cost))
ret.append(',\n cost_jobs : ')
ret.append(repr(self.cost_jobs))
ret.append(',\n cost_jreg : ')
ret.append(repr(self.cost_jreg))
ret.append(',\n fstates : ')
ret.append(repr(self.fstates))
ret.append('}')
return ''.join(ret)
_dt_array_initialisers = []
_array_initialisers = []
_dt_array_initialisers = []
try:
for func in _array_initialisers:
func()
except ValueError:
logging.debug('unallocated array(s) detected on import of module "mwd_output".')
for func in _dt_array_initialisers:
func()