Sina C++ User Guide

The Sina ([S]imulation [In]sight and [A]nalysis) C++ library can read and write JSON files in the Sina schema. It can be used by simulation applications to summarize run data to be ingested into a database using the Sina tool suite.

The top-level object in the Sina schema is the Document. It contains lists of Record and Relationship objects. The example below shows the basics. For more details, see the Tutorial.

// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and
// other Axom Project Developers. See the top-level LICENSE file for details.
//
// SPDX-License-Identifier: (BSD-3-Clause)

#include "axom/sina.hpp"

int main(void)
{
  // Create a new document
  axom::sina::Document document;
  // Create a run of "My Sim Code" version "1.2.3", which was run by "jdoe".
  // The run has an ID of "run1", which has to be unique to this file.
  axom::sina::ID runID {"run1", axom::sina::IDType::Local};
  std::unique_ptr<axom::sina::Record> run {
    new axom::sina::Run {runID, "My Sim Code", "1.2.3", "jdoe"}};
  // Add the run to the document
  document.add(std::move(run));
  // Save the document directly to a file.
  axom::sina::saveDocument(document, "MySinaData.json");
}

After running the above, the file “MySinaData.json” will contain the following:

{
    "records": [
        {
            "application": "My Sim Code",
            "local_id": "run1",
            "type": "run",
            "user": "jdoe",
            "version": "1.2.3"
        }
    ],
    "relationships": []
}