next up previous [pdf]

Next: Case: Constant-density Acoustics Up: I/O Previous: I/O

IWaveInfo

Definition of an IWAVE application amounts to initialization, in global namespace of the static public data members of the IWaveInfo class:
  static FIELD iwave_fields[]; 
  static IOKEY iwave_iokeys[];
  static FD_MODELINIT minit;
  static FD_MODELDEST mdest;
  static FD_TIMESTEP timestep;
  static FD_TIMEGRID timegrid;
  static FD_STENCIL createstencil;
  static FD_CHECK check;
These initializations must occur precisely once for each application. The recommended procedure is to assign all members except iwave_iokeys in a model definition header file, which includes both the declarations of the static data types (via #include "iwinfo.hh") and of the function data members (via #include of the main model header file). The iwave_iokeys array, on the other hand, should be assigned at the top of each command file, after #include of the model definition file.

This organization allows the model application library (object files defining various functions) to be linked without alteration to a variety of drivers (main program files) implementing different input/output choices. I have identified two main use cases:

A negative consequence of IWAVE's reliance on static global definitions is that only one IWAVE modeling application can be active in a given process. This disadvantage is offset by two considerations: (1) in the use cases for which IWAVE was designed, only one modeling application per process is required; (2) the creation of a new IWAVE application is as simple as one can imagine, requiring only the definition of a couple of arrays and half-a-dozen functions with specified signatures, and their assignment to static data of IWaveInfo. If in the future interesting use cases arise in which truly distinct modeling packages must be combined in the same process, then simple modificiations of the IWAVE overall structure will answer, with slightly increased burden on the programmer.


next up previous [pdf]

Next: Case: Constant-density Acoustics Up: I/O Previous: I/O

2015-04-20