Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sina as Axom component #1378

Merged
merged 81 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
89413c6
establish directory structure and copy/paste headers/sources
bgunnar5 Apr 24, 2024
c8bdb57
add doxygen mainpage for sina
bgunnar5 Apr 24, 2024
4455cc7
first pass at the cmake file for sina component
bgunnar5 Apr 24, 2024
857a449
Merge branch 'LLNL:develop' into feature/bgunnar5/sina-integration
bgunnar5 Apr 29, 2024
d8d7a49
move sina to axom and add cmake files so it can be built
bgunnar5 May 8, 2024
39e5a2e
add doxygen mainpage for sina
bgunnar5 May 8, 2024
a370f6f
merge prior changes to this branch made on diff computer
bgunnar5 May 8, 2024
3c40f1a
Merge branch 'develop' of https://github.com/bgunnar5/axom into featu…
bgunnar5 May 8, 2024
a5fba8b
remove extra adiak list append and uncomment test addition
bgunnar5 May 29, 2024
44e6f74
add tests for sina
bgunnar5 May 29, 2024
f212627
initial add of examples
bgunnar5 May 30, 2024
45628bf
get doxygen docs up and running
bgunnar5 Jun 21, 2024
234e1eb
start work on sphinx docs
bgunnar5 Jun 21, 2024
c9b9cca
finish creating sina docs
bgunnar5 Jun 27, 2024
76c7c86
fix references to sina namespace in doxygen
bgunnar5 Jun 27, 2024
7d78852
add sina fortran interface
bgunnar5 Jul 3, 2024
2fbb425
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Jul 3, 2024
b23292f
fix small issues with docs
bgunnar5 Jul 9, 2024
d9de3ef
make ordering alphabetical for cmakedefines
bgunnar5 Jul 9, 2024
7bf7fc8
fix indentation on doxygen page
bgunnar5 Jul 9, 2024
f15a501
protect against GMOCK not available
bgunnar5 Jul 9, 2024
46d0fcd
move document examples to actual examples
bgunnar5 Jul 10, 2024
5c181c7
add copyright header to sina files
bgunnar5 Jul 10, 2024
4a635bf
move cpp/hpp files to same directory for core and tests
bgunnar5 Jul 11, 2024
820ce9f
remove CppBridge for C++<14
bgunnar5 Jul 11, 2024
10dccf7
replace AXOM_SINA_USE_ADIAK with AXOM_USE_ADIAK
bgunnar5 Jul 11, 2024
d998fac
change doxygen syntax to match axom's standard
bgunnar5 Jul 12, 2024
4d7c8c2
remove unused config file and reference to msub job in docs
bgunnar5 Jul 16, 2024
2860e09
fix issue with Maestro link
bgunnar5 Jul 16, 2024
c8e1f39
convert Datum to pass by reference
bgunnar5 Jul 16, 2024
6f271a3
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Jul 16, 2024
a57111a
run make style
bgunnar5 Jul 17, 2024
66c3163
Merge branch 'develop' into pr-from-fork/1376
bgunnar5 Jul 17, 2024
917aa27
disable sina for osx_gcc and windows azure tests
bgunnar5 Aug 1, 2024
b9b415b
add custom sina matchers so that blueos will build
bgunnar5 Aug 1, 2024
a516da9
Merge branch 'pr-from-fork/1376' of https://github.com/LLNL/axom into…
bgunnar5 Aug 1, 2024
48b311f
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Aug 1, 2024
3ef59eb
remove code check call from Sina CMake and run make style
bgunnar5 Aug 5, 2024
5856843
add compiler flag for xl fortran builds
bgunnar5 Aug 7, 2024
5d39439
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Aug 7, 2024
70b4716
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Aug 7, 2024
f9285ca
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Aug 8, 2024
64ce0ec
update sina description in doxygen mainpage
bgunnar5 Aug 8, 2024
0ee8cf9
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Aug 12, 2024
4552083
add version for sina
bgunnar5 Aug 12, 2024
0c279e3
Merge branch 'develop' into pr-from-fork/1376
rhornung67 Aug 15, 2024
caab17d
Update src/axom/sina/core/ID.hpp
bgunnar5 Aug 30, 2024
bce3aaa
implementation -> header in hpp file brief statements
bgunnar5 Aug 30, 2024
274851f
make docs suggestions from PR
bgunnar5 Aug 30, 2024
528d0d9
modify code block comments for docs
bgunnar5 Aug 30, 2024
6246b2d
some final fixes for sina docs
bgunnar5 Aug 30, 2024
dbf9d5a
fix python interpreter package find to not use deprecated call
bgunnar5 Aug 30, 2024
ae026bf
move custom XL flag to just be used for sina fortran example executable
bgunnar5 Aug 30, 2024
cbcbce0
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Aug 30, 2024
03aca6d
Merge branch 'pr-from-fork/1376' of https://github.com/LLNL/axom into…
bgunnar5 Aug 30, 2024
7289033
fix python executable variable name
bgunnar5 Sep 4, 2024
5ff841b
fix code example for AdiakWriter
bgunnar5 Oct 21, 2024
a9e6a78
change sina version to sina file format version
bgunnar5 Oct 21, 2024
3a791d3
Merge remote-tracking branch 'upstream/develop' into feature/bgunnar5…
bgunnar5 Oct 21, 2024
adcaa27
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Oct 29, 2024
159ca6d
change common file format to Sina acronym
bgunnar5 Oct 29, 2024
22ee4ec
renamed fortran file to use .f extension instead of .f90
bgunnar5 Oct 29, 2024
1aadbf7
SINA_VERSION -> SINA_FILE_FORMAT_VERSION
bgunnar5 Oct 29, 2024
146b364
update check_datum_type example to use SLIC_ASSERT
bgunnar5 Oct 29, 2024
2b748d1
Fix typo in fortran test docstring
bgunnar5 Oct 29, 2024
b099712
remove 'using namespace std'
bgunnar5 Oct 30, 2024
6025629
add SLIC_ASSERT messages to examples where necessary
bgunnar5 Oct 30, 2024
2ed4fef
Merge branch 'pr-from-fork/1376' of https://github.com/LLNL/axom into…
bgunnar5 Oct 30, 2024
0db396b
use axom utility to remove file rather than std::remove
bgunnar5 Oct 30, 2024
db04e53
make long_json string a raw string literal
bgunnar5 Oct 30, 2024
3faf719
rename sina_fortran example to use .f extension instead of .f90
bgunnar5 Oct 30, 2024
f39a41e
use PYTHON_EXECUTABLE from host-config instead of setting up own Python
bgunnar5 Oct 30, 2024
483c750
remove call to make sina_fortran_ex and use os.path.join for file paths
bgunnar5 Oct 30, 2024
e67cf68
run make style
bgunnar5 Oct 30, 2024
1bce8b3
move sina version into API
bgunnar5 Nov 5, 2024
0ac2358
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Nov 6, 2024
641a88e
Merge branch 'develop' of https://github.com/LLNL/axom into feature/b…
bgunnar5 Nov 6, 2024
af8bccc
fix style, attempt to fix python issue w/ fortran test, and update RE…
bgunnar5 Nov 7, 2024
2ed2d1c
resolve merge conflicts
bgunnar5 Nov 7, 2024
0f131df
change getType to printType in check_datum_type example
bgunnar5 Nov 7, 2024
c1daa71
fix style
bgunnar5 Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/axom/sina/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
axom_component_requires(NAME Sina
TPLS Conduit )

#------------------------------------------------------------------------------
# Set sina version
#------------------------------------------------------------------------------
set(SINA_VERSION_MAJOR 1)
set(SINA_VERSION_MINOR 14)
set(SINA_VERSION_PATCH 0)
axom_configure_file ( config.hpp.in
${PROJECT_BINARY_DIR}/include/axom/sina/config.hpp )

#------------------------------------------------------------------------------
# Specify the sina headers/sources
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -62,7 +53,7 @@ blt_list_append( TO sina_sources ELEMENTS core/AdiakWriter.cpp IF AXOM_USE_ADIAK
if (ENABLE_FORTRAN)
blt_list_append( TO sina_headers ELEMENTS interface/sina_fortran_interface.h)
blt_list_append( TO sina_sources
ELEMENTS interface/sina_fortran_interface.cpp interface/sina_fortran_interface.f90)
ELEMENTS interface/sina_fortran_interface.cpp interface/sina_fortran_interface.f)
endif()

#------------------------------------------------------------------------------
Expand Down
13 changes: 0 additions & 13 deletions src/axom/sina/config.hpp.in

This file was deleted.

18 changes: 18 additions & 0 deletions src/axom/sina/core/Document.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include "axom/sina/core/Record.hpp"
#include "axom/sina/core/Relationship.hpp"

#define SINA_FILE_FORMAT_VERSION_MAJOR 1
#define SINA_FILE_FORMAT_VERSION_MINOR 0

namespace axom
{
namespace sina
Expand Down Expand Up @@ -73,6 +76,11 @@ namespace sina
* axom::sina::saveDocument(myDocument, "path/to/outfile.json")
* \endcode
*
* Check the Sina file format version with:
* \code
* axom::sina::getSinaFileFormatVersion();
* \endcode
*
*/
class Document
{
Expand Down Expand Up @@ -199,6 +207,16 @@ class Document
*/
void saveDocument(Document const &document, std::string const &fileName);

/**
* \brief Get the current file format version.
*
* \return A string representing the file format version.
*/
inline std::string getSinaFileFormatVersion() {
return std::to_string(SINA_FILE_FORMAT_VERSION_MAJOR) + "." +
std::to_string(SINA_FILE_FORMAT_VERSION_MINOR);
}

/**
* \brief Load a document from the given path. Only records which this library
* knows about will be able to be loaded.
Expand Down
4 changes: 2 additions & 2 deletions src/axom/sina/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ set(sina_example_sources
sina_view_datum_values.cpp
)

set(sina_example_depends sina conduit::conduit)
set(sina_example_depends sina conduit slic)

if (ENABLE_FORTRAN)
blt_list_append( TO sina_example_sources ELEMENTS sina_fortran.f90)
blt_list_append( TO sina_example_sources ELEMENTS sina_fortran.f)
endif()

#------------------------------------------------------------------------------
Expand Down
47 changes: 35 additions & 12 deletions src/axom/sina/examples/sina_check_datum_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,51 @@
// SPDX-License-Identifier: (BSD-3-Clause)

#include "axom/sina.hpp"
#include "axom/slic.hpp"

using ValueTypeUnderlying =
typename std::underlying_type<axom::sina::ValueType>::type;

void getType(axom::sina::Datum datum, std::string datumName, std::string errMsg)
{
auto datumType = static_cast<ValueTypeUnderlying>(datum.getType());
SLIC_ASSERT_MSG(
static_cast<bool>(
std::is_same<decltype(datumType), ValueTypeUnderlying>::value),
errMsg);
std::cout << datumName << " type: " << datumType << std::endl;
}

int main(void)
{
// Initialize slic
axom::slic::initialize();

// Define 3 different datums
axom::sina::Datum myDatum {12.34};
std::string value = "foobar";
axom::sina::Datum myOtherDatum {value};
std::vector<double> scalars = {1, 2, 20.0};
axom::sina::Datum myArrayDatum {scalars};

// Prints 0, corresponding to string
std::cout << static_cast<std::underlying_type<axom::sina::ValueType>::type>(
myDatum.getType())
<< std::endl;
// Prints 1, corresponding to Scalar
getType(myDatum,
"myDatum",
"myDatumType did not match the expected type 'Scalar' (numerically "
"represented as 1).");

// Prints 0, corresponding to String
getType(myOtherDatum,
"myOtherDatum",
"myDatumType did not match the expected type 'String' (numerically "
"represented as 0).");

// Prints 1, corresponding to scalar
std::cout << static_cast<std::underlying_type<axom::sina::ValueType>::type>(
myOtherDatum.getType())
<< std::endl;
// Prints 3, corresponding to ScalarArray
getType(myArrayDatum,
"myArrayDatum",
"myArrayDatum did not match the expected type 'ScalarArray' "
"(numerically represented as 3).");

// Prints 3, corresponding to scalar array
std::cout << static_cast<std::underlying_type<axom::sina::ValueType>::type>(
myArrayDatum.getType())
<< std::endl;
// Finalize slic
axom::slic::finalize();
}
29 changes: 28 additions & 1 deletion src/axom/sina/examples/sina_create_datum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
// SPDX-License-Identifier: (BSD-3-Clause)

#include "axom/sina.hpp"
#include "axom/slic.hpp"

int main(void)
{
// Initialize slic
axom::slic::initialize();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:
slic::SimpleLogger is an RAII wrapper around slic::initialize and slic::finalize that can be used for simple examples like this,
See:
https://github.com/LLNL/axom/blob/develop/src/axom/slic/core/SimpleLogger.hpp

(No need to change these examples, just wanted to let you know about it in case you didn't)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of this so thanks for the heads up! :)


// Create the record
axom::sina::ID myID {"my_record", axom::sina::IDType::Local};
std::unique_ptr<axom::sina::Record> myRecord {
Expand All @@ -18,5 +22,28 @@ int main(void)

// Add the datum to the record
myRecord->add("my_scalar", std::move(myDatum));
std::cout << myRecord->toNode().to_json() << std::endl;

// Compare the actual output to the expected JSON output, then print it to console
std::string actualJsonString = myRecord->toNode().to_json();
std::string expectedJsonString = R"(
{
"data":
{
"my_scalar":
{
"value":
[
"input"
]
}
},
"type": "my_type",
"local_id": "my_record"
})";
SLIC_ASSERT_MSG(actualJsonString.compare(expectedJsonString) == 0,
"JSON output does not match expected structure.");
std::cout << actualJsonString << std::endl;

// Finalize slic
axom::slic::finalize();
}
18 changes: 9 additions & 9 deletions src/axom/sina/examples/sina_curve_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
#include <cmath>
#include <vector>

using namespace std;

struct BounceData
{
vector<double> time;
vector<double> xPosition;
vector<double> yPosition;
vector<double> xVelocity;
vector<double> yVelocity;
std::vector<double> time;
std::vector<double> xPosition;
std::vector<double> yPosition;
std::vector<double> xVelocity;
std::vector<double> yVelocity;
};

BounceData generateBounceData(double initialY,
Expand Down Expand Up @@ -67,7 +65,9 @@ BounceData generateBounceData(double initialY,
return data;
}

void addCurveSet(axom::sina::Record &record, BounceData bounceData, string curveName)
void addCurveSet(axom::sina::Record &record,
BounceData bounceData,
std::string curveName)
{
// Create the curve set object
axom::sina::CurveSet bounceCurveSet {curveName};
Expand Down Expand Up @@ -112,7 +112,7 @@ int main()
axom::sina::Document doc;

axom::sina::ID id {"ball_bounce_run", axom::sina::IDType::Global};
unique_ptr<axom::sina::Record> study {
std::unique_ptr<axom::sina::Record> study {
new axom::sina::Record {id, "ball bounce study"}};

addCurveSet(*study, bounceData, "ball_bounce");
Expand Down
34 changes: 33 additions & 1 deletion src/axom/sina/examples/sina_file_object_creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
// SPDX-License-Identifier: (BSD-3-Clause)

#include "axom/sina.hpp"
#include "axom/slic.hpp"

int main(void)
{
// Initialize slic
axom::slic::initialize();

// Create 2 different files
axom::sina::File myFile {"/path/to/file.png"};
myFile.setMimeType("image/png");
Expand All @@ -22,5 +26,33 @@ int main(void)
myRecord->add(myFile);
myRecord->add(myOtherFile);

std::cout << myRecord->toNode().to_json() << std::endl;
// Compare the actual output to the expected JSON output, then print it to console
std::string actualJsonString = myRecord->toNode().to_json();
std::string expectedJsonString = R"(
{
"type": "my_type",
"local_id": "my_record",
"files":
{
"/path/to/other/file.txt":
{
"tags":
[
"these",
"are",
"tags"
]
},
"/path/to/file.png":
{
"mimetype": "image/png"
}
}
})";
SLIC_ASSERT_MSG(actualJsonString.compare(expectedJsonString) == 0,
"JSON output does not match expected structure.");
std::cout << actualJsonString << std::endl;

// Finalize slic
axom::slic::finalize();
}
30 changes: 29 additions & 1 deletion src/axom/sina/examples/sina_file_object_removal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
// SPDX-License-Identifier: (BSD-3-Clause)

#include "axom/sina.hpp"
#include "axom/slic.hpp"

int main(void)
{
// Initialize slic
axom::slic::initialize();

// Create 2 different files
axom::sina::File myFile {"/path/to/file.png"};
myFile.setMimeType("image/png");
Expand All @@ -25,5 +29,29 @@ int main(void)
// Remove a file from the record
myRecord->remove(myFile);

std::cout << myRecord->toNode().to_json() << std::endl;
// Compare the actual output to the expected JSON output, then print it to console
std::string actualJsonString = myRecord->toNode().to_json();
std::string expectedJsonString = R"(
{
"type": "my_type",
"local_id": "my_record",
"files":
{
"/path/to/other/file.txt":
{
"tags":
[
"these",
"are",
"tags"
]
}
}
})";
SLIC_ASSERT_MSG(actualJsonString.compare(expectedJsonString) == 0,
"JSON output does not match expected structure.");
std::cout << actualJsonString << std::endl;

// Finalize slic
axom::slic::finalize();
}
10 changes: 10 additions & 0 deletions src/axom/sina/examples/sina_query_records_relationships.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
// SPDX-License-Identifier: (BSD-3-Clause)

#include "axom/sina.hpp"
#include "axom/slic.hpp"

int main(void)
{
// Initialize slic
axom::slic::initialize();

// Create a new document
axom::sina::Document document;

Expand Down Expand Up @@ -35,6 +39,12 @@ int main(void)
auto &records = document.getRecords();
auto &relationships = document.getRelationships();

SLIC_ASSERT_MSG(records.size() == 2, "Unexpected number of records found.");
std::cout << "Number of Records: " << records.size() << std::endl;
SLIC_ASSERT_MSG(relationships.size() == 1,
"Unexpected number of relationships found.");
std::cout << "Number of Relationships: " << relationships.size() << std::endl;

// Finalize slic
axom::slic::finalize();
}
Loading
Loading