-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feature/sina/hdf5 output support #1480
base: develop
Are you sure you want to change the base?
Changes from 14 commits
3f09c5e
e0cd5bf
d2f38ac
6c32398
31242a6
aa9073d
b553c44
c5c0cb4
8dd8a84
8e6afc1
247591f
703dbd1
e1d7631
0df65b3
e118d24
0f5851e
1168000
429d9ce
b71b05d
0b689db
ccfa513
c05979d
7c5d7cc
d036b67
79f3729
f92080d
4310ee1
0fd3a35
1145c29
4043d3e
3ccfbb3
9429b60
45ee75b
0f016bb
4a2cf7e
2499896
209ee7d
35bf45b
64e5026
a0341da
baf2492
3e03355
8370a21
50f17e1
6160d87
fb3554d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,17 @@ blt_list_append( TO sina_headers ELEMENTS core/AdiakWriter.hpp IF AXOM_USE_ADIAK | |
blt_list_append( TO sina_sources ELEMENTS core/AdiakWriter.cpp IF AXOM_USE_ADIAK ) | ||
|
||
# Add fortran interface for Sina | ||
if(AXOM_USE_HDF5 AND ENABLE_FORTRAN) | ||
set(AXOM_USE_HDF5_FORTRAN ".true.") | ||
else() | ||
set(AXOM_USE_HDF5_FORTRAN ".false.") | ||
endif() | ||
|
||
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.f) | ||
ELEMENTS interface/sina_fortran_interface.cpp interface/sina_fortran_interface.f.in) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we want to include the template file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to remove .f.in's inclusion |
||
configure_file(interface/sina_fortran_interface.f.in interface/sina_fortran_interface.f @ONLY) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll likely also need to install the generated file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .f file is now explicitly installed. |
||
endif() | ||
|
||
#------------------------------------------------------------------------------ | ||
|
@@ -87,4 +94,4 @@ endif() | |
|
||
if(AXOM_ENABLE_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ | |
* | ||
****************************************************************************** | ||
*/ | ||
|
||
#include "axom/sina/core/Document.hpp" | ||
|
||
#include "axom/config.hpp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: We need to I updated the includes in this branch to bring in |
||
|
@@ -66,6 +65,21 @@ void protocolWarn(std::string const protocol, std::string const &name) | |
} | ||
} | ||
|
||
std::string get_supported_file_types() | ||
{ | ||
std::string types = "["; | ||
for(size_t i = 0; i < supported_types.size(); ++i) | ||
{ | ||
types += supported_types[i]; | ||
if(i < supported_types.size() - 1) | ||
{ | ||
types += ", "; | ||
} | ||
} | ||
types += "]"; | ||
return types; | ||
} | ||
|
||
void Document::add(std::unique_ptr<Record> record) | ||
{ | ||
records.emplace_back(std::move(record)); | ||
|
@@ -313,8 +327,11 @@ void saveDocument(Document const &document, | |
#endif | ||
else | ||
{ | ||
throw std::invalid_argument( | ||
"Invalid format choice. Please enter 'json' or 'hdf5'."); | ||
std::ostringstream message; | ||
message << "Invalid format choice. Please choose from one of the supported " | ||
"protocols: " | ||
<< get_supported_file_types(); | ||
throw std::invalid_argument(message.str()); | ||
} | ||
|
||
if(rename(tmpFileName.c_str(), fileName.c_str()) != 0) | ||
|
@@ -347,16 +364,19 @@ Document loadDocument(std::string const &path, | |
file_in.close(); | ||
node.parse(file_contents.str(), "json"); | ||
return Document {node, recordLoader}; | ||
|
||
#ifdef AXOM_USE_HDF5 | ||
case Protocol::HDF5: | ||
file_in.close(); | ||
conduit::relay::io::load(path, "hdf5", node); | ||
restoreSlashes(node, modifiedNode); | ||
return Document {modifiedNode, recordLoader}; | ||
#endif | ||
|
||
default: | ||
std::ostringstream message; | ||
message << "Invalid format choice. Please choose from one of the supported " | ||
"protocols: " | ||
<< get_supported_file_types(); | ||
throw std::invalid_argument(message.str()); | ||
break; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -27,7 +27,7 @@ set(sina_example_sources | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sina_view_datum_values.cpp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
set(sina_example_depends sina conduit slic) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
set(sina_example_depends sina conduit::conduit slic) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (ENABLE_FORTRAN) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
blt_list_append( TO sina_example_sources ELEMENTS sina_fortran.f) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -38,16 +38,26 @@ endif() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
foreach(src ${sina_example_sources}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get_filename_component(exe_name ${src} NAME_WE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (exe_name STREQUAL "sina_fortran") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
set(sina_mod_src ${CMAKE_CURRENT_BINARY_DIR}/../interface/sina_fortran_interface.f) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
set(sina_mod_src "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
axom_add_executable( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
NAME ${exe_name}_ex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SOURCES ${src} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SOURCES ${src} ${sina_mod_src} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OUTPUT_DIR ${EXAMPLE_OUTPUT_DIRECTORY} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DEPENDS_ON ${sina_example_depends} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FOLDER axom/sina/examples | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (exe_name STREQUAL "sina_fortran") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
target_include_directories(${exe_name}_ex PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../interface) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Need to add this flag so XL will ignore trailing underscores in fortran function names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (${exe_name}_ex STREQUAL "sina_fortran_ex" AND CMAKE_Fortran_COMPILER_ID STREQUAL "XL") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
target_compile_options(${exe_name}_ex PRIVATE -qextname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endforeach() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
endforeach() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
38
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @white238 -- is there a better way in axom/blt to point to the Fortran module? Our axom_install_component macro already has logic to install the Fortran module. axom/src/cmake/AxomMacros.cmake Lines 436 to 473 in 44562f9
|
kennyweiss marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an aside, exposing the enum values will be a lot cleaner w/
shroud
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennyweiss yes at some point we should convert to shroud as a separate PR. But it's kind of "if it's ain't broken why fix it?" at the moment 😉