SpECTRE Documentation Coverage Report
Current view: top level - __w/spectre/spectre/docs/DevGuide - ImportingData.md Hit Total Coverage
Commit: f1ddee3e40d81480e49140855d2b0e66fafaa908 Lines: 0 1 0.0 %
Date: 2020-12-02 17:35:08
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : \cond NEVER
       2             : Distributed under the MIT License.
       3             : See LICENSE.txt for details.
       4             : \endcond
       5             : # Importing data {#dev_guide_importing}
       6             : 
       7             : The `importers` namespace holds functionality for importing data into SpECTRE.
       8             : We currently support loading volume data files in the same format that is
       9             : written by the `observers`.
      10             : 
      11             : ## Importing volume data
      12             : 
      13             : The `importers::ElementDataReader` parallel component is responsible for loading
      14             : volume data and distributing it to elements of one or multiple array parallel
      15             : components. As a first step, make sure you have added the
      16             : `importers::ElementDataReader` to your `Metavariables::component_list`. Also
      17             : make sure you have a `Metavariables::Phase` in which you will perform
      18             : registration with the importer, and another in which you want to load the data.
      19             : Here's an example for such `Metavariables`:
      20             : 
      21             : \snippet Test_VolumeDataReaderAlgorithm.hpp metavars
      22             : 
      23             : To load volume data from a file, invoke the `importers::Actions::ReadVolumeData`
      24             : iterable action in the `phase_dependent_action_list` of your array parallel
      25             : component. Here's an example that will be explained in more detail below:
      26             : 
      27             : \snippet Test_VolumeDataReaderAlgorithm.hpp import_actions
      28             : 
      29             : - The `importers::Actions::ReadVolumeData` action will load the volume data file
      30             :   once per node on its first invocation by dispatching to
      31             :   `importers::Actions::ReadAllVolumeDataAndDistribute` on the
      32             :   `importers::ElementDataReader` nodegroup component. Subsequent invocations of
      33             :   these actions, e.g. from all other elements on the node, will do nothing. The
      34             :   data is distributed into the inboxes of all elements on the node under the
      35             :   `importers::Tags::VolumeData` tag using `Parallel::receive_data`.
      36             : - The `importers::Actions::ReceiveVolumeData` action waits for the volume data
      37             :   to be available and directly moves it into the DataBox. If you wish to verify
      38             :   or post-process the data before populating the DataBox, use your own
      39             :   specialized action in place of `importers::Actions::ReceiveVolumeData`.
      40             : - You need to register the elements of your array parallel component for
      41             :   receiving volume data. To do so, invoke the
      42             :   `importers::Actions::RegisterWithElementDataReader` action in an earlier
      43             :   phase, as shown in the example above.
      44             : 
      45             : The template parameters to the actions in the example above specify the volume
      46             : data to load. The first template parameter is an option group that determines
      47             : the file to read and the second parameter is a typelist of the tags to import
      48             : and fill with the volume data. See the documentation of the
      49             : `importers::Actions::ReadAllVolumeDataAndDistribute` action for details on these
      50             : parameters. In the example above, the `VolumeDataOptions` is an option group
      51             : that supplies information such as the file name. You provide an option group
      52             : that represents the data you want to import. For example, we have the
      53             : `evolution::OptionTags::NumericInitialData` that represents numeric initial data
      54             : for an evolution. In our example, we created a new class like this:
      55             : 
      56             : \snippet Test_VolumeDataReaderAlgorithm.hpp option_group
      57             : 
      58             : This results in a section in the input file that may look like this:
      59             : 
      60             : \snippet Test_VolumeDataReaderAlgorithm2D.yaml importer_options

Generated by: LCOV version 1.14