Package solvcon :: Module solver :: Class BaseSolver
[hide private]
[frames] | no frames]

Class BaseSolver

source code



Generic solver definition.  It is an abstract class and should not be used
to any concrete simulation case.  The concrete solver sub-classes should
override the empty init and final methods for initialization and 
finalization, respectively.

@cvar _clib_solve: the external dll (accessible through ctypes) which do
    the cell loop.  Subclass should override it.
@ctype _clib_solve: ctypes.CDLL
@cvar _exedatatype_: the C struct definition in ctypes.Structure.
@ctype _exedatatype_: ctypes.Structure

@cvar MESG_FILENAME_DEFAULT = the default file name for serial solver
    object.

@ivar _fpdtype: dtype for the floating point data in the block instance.
@itype _fpdtype: numpy.dtype

@ivar enable_mesg: flag if mesg device should be enabled.
@itype enable_mesg: bool
@ivar mesg: message printer attached to a certain solver object; designed
    and mainly used for parallel solver.
@itype mesg: solvcon.helper.Printer

@ivar runanchors: the list for the anchor objects to be run.
@itype runanchors: solvcon.anchor.AnchorList

@ivar exd: execution information for the solver.
@itype exd: ctypes.Structure
@ivar enable_tpool: flag to enable thread pool on binding.
@itype enable_tpool: bool
@ivar tpool: thread pool for solver.
@itype tpool: solvcon.mthread.ThreadPool
@ivar arglists: argument lists for C functions to be executed in the
    thread pool.
@itype arglists: list
@ivar mmnames: marching methods name.
@itype mmnames: list
@ivar marchret: return value set for march.

@ivar der: the dictionary to put derived data arrays.  Mostly used by
    Anchors.
@itype der: dict

Nested Classes [hide private]
  __metaclass__
Meta class to make classes with ctypes pointers or containers with ctypes pointers.
  _exedatatype_
Execution information for BaseSolver.
Instance Methods [hide private]
 
__create_mesg(self, force=False)
Create the message outputing device, which is intended for debugging and outputing messages related to the solver.
source code
 
__init__(self, **kw)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_set_time(self, time, time_increment)
Set the time for self and structures.
source code
 
_tcall(self, *args, **kw)
Use thread pool to call C functions in parallel (shared-memory).
source code
 
bind(self)
Put everything that cannot be pickled, such as file objects, ctypes pointers, etc., into self.
source code
 
dump(self, objfn)
Pickle self into the given filename.
source code
 
exhaust(self) source code
 
final(self) source code
 
init(self, **kw) source code
float
march(self, time, time_increment, steps_run, worker=None)
Default marcher for the solver object.
source code
 
postloop(self) source code
 
preloop(self) source code
 
provide(self) source code
 
unbind(self)
Release pointer.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
detect_ncore() source code
Class Variables [hide private]
  MESG_FILENAME_DEFAULT = 'solvcon.solver.log'
  MMNAMES = []
  _clib_solve = None
hash(x)
  _pointers_ = ['exd', 'tpool', 'arglists']
Properties [hide private]
  _clib_solvcon
  fpdtype
  fpdtypestr
  is_bound
Determine if all the pointers are fully bound.
  is_unbound
Determine if all the pointers are fully unbound.

Inherited from object: __class__

Method Details [hide private]

__create_mesg(self, force=False)

source code 

Create the message outputing device, which is intended for debugging and outputing messages related to the solver. The outputing device is most useful when running distributed solvers. The created device will be attach to self.

Parameters:
  • force (bool) - flag to force the creation. Default False,
Returns:
nothing

__init__(self, **kw)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

bind(self)

source code 

Put everything that cannot be pickled, such as file objects, ctypes pointers, etc., into self.

Returns:
nothing

dump(self, objfn)

source code 

Pickle self into the given filename.

Parameters:
  • objfn (str) - the output filename.

march(self, time, time_increment, steps_run, worker=None)

source code 

Default marcher for the solver object.

Parameters:
  • time (float) - starting time of marching.
  • time_increment (float) - temporal interval for the time step.
  • steps_run (int) - the count of time steps to run.
Returns: float
arbitrary return value.

Property Details [hide private]

_clib_solvcon

Get Method:
unreachable._clib_solvcon(self)

fpdtype

Get Method:
unreachable.fpdtype(self)

fpdtypestr

Get Method:
unreachable.fpdtypestr(self)

is_bound

Determine if all the pointers are fully bound.

Get Method:
unreachable.is_bound(self) - Determine if all the pointers are fully bound.

is_unbound

Determine if all the pointers are fully unbound.

Get Method:
unreachable.is_unbound(self) - Determine if all the pointers are fully unbound.