netxsimdg
Loading...
Searching...
No Matches
Nextsim::ConfigOutput Class Reference

#include <ConfigOutput.hpp>

Inheritance diagram for Nextsim::ConfigOutput:
Inheritance graph
Collaboration diagram for Nextsim::ConfigOutput:
Collaboration graph

Public Types

enum  { PERIOD_KEY , START_KEY , FIELDNAMES_KEY }
 
- Public Types inherited from Nextsim::ModelComponent
enum class  ProtectedArray {
  H_ICE , C_ICE , H_SNOW , T_ICE ,
  T_AIR , DEW_2M , P_AIR , MIXRAT ,
  SW_IN , LW_IN , MLD , SNOW ,
  SSS , SST , EXT_SSS , EXT_SST ,
  EVAP_MINUS_PRECIP , ML_BULK_CP , TF , WIND_SPEED ,
  WIND_U , WIND_V , HTRUE_ICE , HTRUE_SNOW ,
  OCEAN_U , OCEAN_V , ICE_U , ICE_V ,
  SLAB_SST , SLAB_SSS , SLAB_QDW , SLAB_FDW ,
  COUNT
}
 
enum class  SharedArray {
  H_ICE = SharedArrayOffset , C_ICE , H_SNOW , T_ICE ,
  Q_IA , Q_IC , Q_IO , Q_OW ,
  DQIA_DT , Q_PEN_SW , HSNOW_MELT , SUBLIM ,
  DELTA_HICE , DELTA_CICE , NEW_ICE , COUNT
}
 
typedef Logged::level OutputLevel
 
typedef std::function< void(size_t, const TimestepTime &)> IteratedFn
 
- Public Types inherited from Nextsim::Configured< ConfigOutput >
typedef ConfigurationHelp::HelpMap HelpMap
 
using ConfigType
 

Public Member Functions

void setFilenamePrefix (const std::string &filePrefix) override
 Sets the output file name.
 
void outputState (const ModelMetadata &meta) override
 Outputs the passed ModelState.
 
std::string getName () const override
 Returns the name of the component.
 
void setData (const ModelState::DataMap &) override
 Set the initial data of the component from the passed ModelState.
 
ModelState getState () const override
 Returns a ModelState from this component.
 
ModelState getState (const OutputLevel &) const override
 Returns a ModelState from this component at a specified level.
 
void configure () override
 The configuration function.
 
ModelState getStateRecursive (const OutputSpec &os) const override
 Returns the state of the ModelComponent and any ModelComponents it depends on.
 
- Public Member Functions inherited from Nextsim::IDiagnosticOutput
void setData (const ModelState::DataMap &state)
 Set the initial data of the component from the passed ModelState.
 
- Public Member Functions inherited from Nextsim::ModelComponent
virtual std::unordered_set< std::string > hFields () const
 Returns the names of all Type::H ModelArrays defined in this component.
 
virtual std::unordered_set< std::string > uFields () const
 Returns the names of all Type::U ModelArrays defined in this component.
 
virtual std::unordered_set< std::string > vFields () const
 Returns the names of all Type::V ModelArrays defined in this component.
 
virtual std::unordered_set< std::string > zFields () const
 Returns the names of all Type::Z ModelArrays defined in this component.
 
- Public Member Functions inherited from Nextsim::Configured< ConfigOutput >
const std::map< int, std::string > keyMap
 
const std::map< int, std::string > keyMap
 
const std::map< int, std::string > keyMap
 
const std::map< int, std::string > keyMap
 
virtual ConfigMap getConfiguration () const
 Returns the current configuration of the object.
 
- Public Member Functions inherited from Nextsim::ConfiguredBase

Additional Inherited Members

- Static Public Member Functions inherited from Nextsim::ModelComponent
static void setAllModuleData (const ModelState &stateIn)
 
static ModelState getAllModuleState ()
 
static void unregisterAllModules ()
 
static void getAllFieldNames (std::unordered_set< std::string > &uF, std::unordered_set< std::string > &vF, std::unordered_set< std::string > &zF)
 
static void registerExternalSharedArray (SharedArray type, ModelArray *addr)
 Registers a ModelArray into a SharedArray slot from outside any ModelComponent object. Intended for testing and debugging.
 
static void registerExternalProtectedArray (ProtectedArray type, ModelArray *addr)
 Registers a ModelArray into a ProtectedArray slot from outside any ModelComponent object. Intended for testing and debugging.
 
static const MARBackingStore & getSharedArray ()
 Returns a const reference to the store for SharedArray fields.
 
static const MARConstBackingStore & getProtectedArray ()
 Returns a const reference to the store for ProtectedArray fields.
 
- Static Public Member Functions inherited from Nextsim::Configured< ConfigOutput >
static T getConfiguration (const std::string &name, const T &defaultValue)
 Gets the value of the configuration with a given name from the default Configurator.
 
static void tryConfigure (T &ref)
 Template function for conditionally configuring references.
 
static void tryConfigure (T *ptr)
 Template function for conditionally configuring classes via a pointer.
 
static ConfigMap tryGetConfiguration (T &ref)
 Template function for conditionally retrieving class configuration via a reference.
 
static ConfigMap tryGetConfiguration (T *ptr)
 Template function for conditionally retrieving class configuration via a pointer.
 
static HelpMap & getHelpText (HelpMap &map, bool getAll)
 Gets the text to be printed as the help text for this configuration.
 
static HelpMap & getHelpRecursive (HelpMap &map, bool getAll)
 Gets the configuration help text for the current class as well as any classes used herein.
 
static void clearConfigurationMap ()
 Clear the configuration map. Usually used only in test suites.
 
- Static Public Attributes inherited from Nextsim::ModelComponent
static const size_t SharedArrayOffset = 0
 
- Static Public Attributes inherited from Nextsim::Configured< ConfigOutput >
static const std::map< int, std::string > keyMap
 A per-class static map to provide compile-time checking of configuration keys.
 
- Protected Member Functions inherited from Nextsim::ModelComponent
void registerModule ()
 
- Protected Member Functions inherited from Nextsim::Configured< ConfigOutput >
void addOption (const std::string &name, const T &defaultValue)
 Adds an option to the per-class option map.
 
retrieveValue (const std::string &name)
 Retrieves a configured value of a single option.
 
- Static Protected Member Functions inherited from Nextsim::ModelComponent
static void registerSharedArray (SharedArray type, ModelArray *addr)
 
static void registerProtectedArray (ProtectedArray type, const ModelArray *addr)
 
static void overElements (IteratedFn fn, const TimestepTime &tst)
 
static void setOceanMask (const ModelArray &mask)
 Sets the model-wide land-ocean mask (for HField arrays).
 
static void noLandMask ()
 
static ModelArray mask (const ModelArray &data)
 Returns a copy of the provided ModelArray, masked according to the land-ocean mask.
 
static const ModelArrayoceanMask ()
 Returns the ocean mask.
 
- Protected Attributes inherited from Nextsim::IDiagnosticOutput
const std::map< std::string, ProtectedArray > protectedArrayNames
 
const std::map< std::string, SharedArray > sharedArrayNames
 
const std::map< std::string, std::string > protectedExternalNames
 
const std::map< std::string, std::string > sharedExternalNames
 
- Static Protected Attributes inherited from Nextsim::ModelComponent
static ModelArrayp_oceanMaskH = nullptr
 

Detailed Description

An implementation of the diagnostic output that allows some configuration of the file output period and frequency, as well as the fields the files contain.

Definition at line 25 of file ConfigOutput.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 30 of file ConfigOutput.hpp.

Constructor & Destructor Documentation

◆ ConfigOutput()

Nextsim::ConfigOutput::ConfigOutput ( )

Definition at line 27 of file ConfigOutput.cpp.

Member Function Documentation

◆ configure()

void Nextsim::ConfigOutput::configure ( )
overridevirtual

The configuration function.

Implements Nextsim::Configured< ConfigOutput >.

Definition at line 40 of file ConfigOutput.cpp.

◆ getName()

std::string Nextsim::ConfigOutput::getName ( ) const
inlineoverridevirtual

Returns the name of the component.

Implements Nextsim::ModelComponent.

Definition at line 42 of file ConfigOutput.hpp.

◆ getState() [1/2]

ModelState Nextsim::ConfigOutput::getState ( ) const
inlineoverridevirtual

Returns a ModelState from this component.

The ModelState is map between field names and ModelArray data arrays. The intention is to merge together different ModelSatates to produce a combined state. The returned ModelState will include the states of any subsidiary components held by the object. This is the default level of output and should include all and only fields to be placed in the restart file.

Implements Nextsim::ModelComponent.

Definition at line 44 of file ConfigOutput.hpp.

◆ getState() [2/2]

ModelState Nextsim::ConfigOutput::getState ( const OutputLevel & ) const
inlineoverridevirtual

Returns a ModelState from this component at a specified level.

See the zero argument version for more details. The output levels reuse those defined in the Logged class. The default level is NOTICE, and only levels such as INFO, DEBUG and TRACE should be used, and should provide extra diagnostic fields.

Implements Nextsim::ModelComponent.

Definition at line 45 of file ConfigOutput.hpp.

◆ getStateRecursive()

ModelState Nextsim::ConfigOutput::getStateRecursive ( const OutputSpec & os) const
overridevirtual

Returns the state of the ModelComponent and any ModelComponents it depends on.

Used to traverse the current tree of ModelComponents and return the overall model state for diagnostic output.

Reimplemented from Nextsim::ModelComponent.

Definition at line 148 of file ConfigOutput.cpp.

◆ outputState()

void Nextsim::ConfigOutput::outputState ( const ModelMetadata & meta)
overridevirtual

Outputs the passed ModelState.

Parameters
stateThe model state to be written out.
metaThe model metadata for the the given state.

Implements Nextsim::IDiagnosticOutput.

Definition at line 86 of file ConfigOutput.cpp.

Here is the call graph for this function:

◆ setData()

void Nextsim::ConfigOutput::setData ( const ModelState::DataMap & state)
inlineoverridevirtual

Set the initial data of the component from the passed ModelState.

Parameters
stateThe ModelState containing the data to be set.

Implements Nextsim::ModelComponent.

Definition at line 43 of file ConfigOutput.hpp.

◆ setFilenamePrefix()

void Nextsim::ConfigOutput::setFilenamePrefix ( const std::string & filePrefix)
inlineoverridevirtual

Sets the output file name.

Parameters
fileNameThe file name to be set.

Implements Nextsim::IDiagnosticOutput.

Definition at line 37 of file ConfigOutput.hpp.


The documentation for this class was generated from the following files: