ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_FloodEngineTemplate.H File Reference

A starting point for a new flood engine: declarations only. More...

#include <ERF_FloodEngine.H>
Include dependency graph for ERF_FloodEngineTemplate.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FloodEngineTemplate
 

Detailed Description

A starting point for a new flood engine: declarations only.

This class declares every FloodEngine method a new flood model provides. Nothing here has a body, no input selects it and nothing creates one, so it adds no code to ERF. Tests/FloodEngineExample is the smallest engine that works, and a complete engine directory to copy.

To start a new engine:

  1. Copy this file into the new model's engine directory (outside ERF), rename the class and the include guard, and write the bodies in a .cpp file there. Delete the declarations of the optional methods the engine does not provide (their defaults in FloodEngine then apply); a declaration left without a body fails to link.
  2. Read the model's inputs under its own prefix (flood.<engine>.* is recommended), so they never mix with the coupling's keys (FloodCouplingParams, erf.flood.*) or another engine's.
  3. Register the engine in that .cpp, at namespace scope: ERF_REGISTER_FLOOD_ENGINE(MyEngine, "my_flood") (ERF_FloodEngineRegistry.H), and give the engine directory a Make.package (GNU make, FLOOD_HOME) and an ERFFloodEngine.cmake defining erf_flood_engine_add(target) (CMake, ERF_FLOOD_ENGINE_DIRS).
  4. Run a restart of a coupled run against a straight run: the atmosphere and flood plotfiles must agree at zero tolerance.

The call order is the one documented on FloodEngine (ERF_FloodEngine.H). ERF_FloodCoupler.cpp checks at compile time that this class declares every method FloodEngine requires (the pure virtual ones), and override checks the signature of every method declared here. The optional methods are listed by hand: a new optional method in FloodEngine is added here too.