-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a quick hack, but it demonstrates that complex attribute types are no problem, just as in ADIOS1.
- Loading branch information
Showing
5 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* adiosYAML.h basic YAML parsing functionality for ADIOS config file schema | ||
* | ||
* Created on: Dec 19, 2019 | ||
* Author: Axel Huebl <[email protected]> | ||
*/ | ||
|
||
#ifndef ADIOS2_HELPER_ADIOSJSONCOMPLEX_H_ | ||
#define ADIOS2_HELPER_ADIOSJSONCOMPLEX_H_ | ||
|
||
#include "nlohmann/json.hpp" | ||
#include <complex> | ||
|
||
// JSON std::complex handling | ||
namespace std | ||
{ | ||
template <class T> | ||
inline void to_json(nlohmann::json &j, const std::complex<T> &p) | ||
{ | ||
j = nlohmann::json{p.real(), p.imag()}; | ||
} | ||
|
||
template <class T> | ||
inline void from_json(const nlohmann::json &j, std::complex<T> &p) | ||
{ | ||
p.real(j.at(0)); | ||
p.imag(j.at(1)); | ||
} | ||
} // end namespace std | ||
|
||
#endif /* ADIOS2_HELPER_ADIOSJSONCOMPLEX_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters