-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2465 from dmitry-ganyushin/hierarchical_reading
Hierarchical reading implementation
- Loading branch information
Showing
17 changed files
with
827 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* Group.cpp : | ||
* | ||
* Created on: August 25, 2020 | ||
* Author: Dmitry Ganyushin [email protected] | ||
*/ | ||
|
||
#include "Group.h" | ||
#include "Group.tcc" | ||
#include "adios2/core/Group.h" | ||
|
||
namespace adios2 | ||
{ | ||
Group::Group(core::Group *group) : m_Group(group) {} | ||
|
||
Group Group::OpenGroup(std::string group_name) | ||
{ | ||
auto m = m_Group->OpenGroup(group_name); | ||
return Group(m); | ||
} | ||
void Group::PrintTree() | ||
{ | ||
m_Group->PrintTree(); | ||
return; | ||
} | ||
|
||
void Group::BuildTree() | ||
{ | ||
m_Group->BuildTree(); | ||
return; | ||
} | ||
std::vector<std::string> Group::AvailableVariables() | ||
{ | ||
return m_Group->AvailableVariables(); | ||
} | ||
std::vector<std::string> Group::AvailableAttributes() | ||
{ | ||
return m_Group->AvailableAttributes(); | ||
} | ||
std::vector<std::string> Group::AvailableGroups() | ||
{ | ||
return m_Group->AvailableGroups(); | ||
} | ||
|
||
std::map<std::string, std::set<std::string>> &Group::getTreeMap() | ||
{ | ||
return m_Group->getTreeMap(); | ||
} | ||
|
||
std::string Group::InquirePath() { return m_Group->InquirePath(); } | ||
|
||
void Group::setPath(std::string path) { m_Group->setPath(path); } | ||
DataType Group::VariableType(const std::string &name) const | ||
{ | ||
helper::CheckForNullptr(m_Group, "in call to IO::VariableType"); | ||
return m_Group->InquireVariableType(name); | ||
} | ||
|
||
DataType Group::AttributeType(const std::string &name) const | ||
{ | ||
helper::CheckForNullptr(m_Group, "in call to IO::AttributeType"); | ||
return m_Group->InquireAttributeType(name); | ||
} | ||
Group::~Group(){}; | ||
// Explicit declaration of the public template methods | ||
// Limits the types | ||
#define declare_template_instantiation(T) \ | ||
template Variable<T> Group::InquireVariable<T>(const std::string &); | ||
|
||
ADIOS2_FOREACH_TYPE_1ARG(declare_template_instantiation) | ||
#undef declare_template_instantiation | ||
} // end of namespace |
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,146 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* Group.h : | ||
* | ||
* Created on: August 25, 2020 | ||
* Author: Dmitry Ganyushin [email protected] | ||
*/ | ||
#ifndef ADIOS2_BINDINGS_CXX11_CXX11_GROUP_H_ | ||
|
||
#define ADIOS2_BINDINGS_CXX11_CXX11_GROUP_H_ | ||
|
||
#include "Attribute.h" | ||
#include "Variable.h" | ||
#include <iostream> | ||
#include <map> | ||
#include <set> | ||
#include <string> | ||
#include <vector> | ||
|
||
#if ADIOS2_USE_MPI | ||
#include <mpi.h> | ||
#endif | ||
|
||
#include "Group.h" | ||
#include "adios2/common/ADIOSMacros.h" | ||
#include "adios2/common/ADIOSTypes.h" | ||
|
||
namespace adios2 | ||
{ | ||
class IO; | ||
|
||
namespace core | ||
{ | ||
class Group; // private implementation | ||
} | ||
class Group | ||
{ | ||
friend class IO; | ||
|
||
private: | ||
Group(core::Group *group); | ||
core::Group *m_Group = nullptr; | ||
|
||
public: | ||
~Group(); | ||
/** | ||
* @brief Builds map that represents tree structure from m_Variable and | ||
* m_Attributes from IO class | ||
* @param | ||
*/ | ||
void BuildTree(); | ||
/** | ||
* @brief Prints map that represents tree structure | ||
* @param | ||
*/ | ||
void PrintTree(); | ||
/** | ||
* @brief returns available groups on the path set | ||
* @param | ||
* @return vector of strings | ||
*/ | ||
std::vector<std::string> AvailableGroups(); | ||
/** | ||
* @brief returns available variables on the path set | ||
* @param | ||
* @return vector of strings | ||
*/ | ||
std::vector<std::string> AvailableVariables(); | ||
/** | ||
* @brief returns available attributes on the path set | ||
* @param | ||
* @return vector of strings | ||
*/ | ||
std::vector<std::string> AvailableAttributes(); | ||
/** | ||
* @brief returns the current path | ||
* @param | ||
* @return current path as a string | ||
*/ | ||
std::string InquirePath(); | ||
/** | ||
* @brief set the path, points to a particular node on the tree | ||
* @param next possible path extension | ||
*/ | ||
void setPath(std::string path); | ||
/** | ||
* @brief returns a new group object | ||
* @param name of the group | ||
* @return new group object | ||
*/ | ||
Group OpenGroup(std::string group_name); | ||
/** | ||
* @brief returns a reference to the map representing the tree stucture | ||
* @param delimiter symbol | ||
*/ | ||
std::map<std::string, std::set<std::string>> &getTreeMap(); | ||
/** | ||
* @brief Gets an existing variable of primitive type by name. A wrapper for | ||
* the corresponding function of the IO class | ||
* @param name of variable to be retrieved | ||
* @return pointer to an existing variable in current IO, nullptr if not | ||
* found | ||
*/ | ||
template <class T> | ||
Variable<T> InquireVariable(const std::string &name); | ||
/** | ||
* Gets an existing attribute of primitive type by name. A wrapper for | ||
* the corresponding function of the IO class | ||
* @param name of attribute to be retrieved | ||
* @return pointer to an existing attribute in current IO, nullptr if not | ||
* found | ||
*/ | ||
template <class T> | ||
Attribute<T> InquireAttribute(const std::string &name, | ||
const std::string &variableName = "", | ||
const std::string separator = "/"); | ||
|
||
/** | ||
* Inspects variable type. This function can be used in conjunction with | ||
* MACROS in an else if (type == adios2::GetType<T>() ) {} loop | ||
* @param name unique variable name identifier in current IO | ||
* @return type as in adios2::GetType<T>() (e.g. "double", "float"), | ||
* empty std::string if variable not found | ||
*/ | ||
DataType VariableType(const std::string &name) const; | ||
|
||
/** | ||
* Inspects attribute type. This function can be used in conjunction with | ||
* MACROS in an else if (type == adios2::GetType<T>() ) {} loop | ||
* @param name unique attribute name identifier in current IO | ||
* @return type as in adios2::GetType<T>() (e.g. "double", "float"), empty | ||
* std::string if attribute not found | ||
*/ | ||
DataType AttributeType(const std::string &name) const; | ||
}; | ||
// Explicit declaration of the public template methods | ||
// Limits the types | ||
#define declare_template_instantiation(T) \ | ||
extern template Variable<T> Group::InquireVariable<T>(const std::string &); | ||
ADIOS2_FOREACH_TYPE_1ARG(declare_template_instantiation) | ||
#undef declare_template_instantiation | ||
|
||
} | ||
#endif // ADIOS2_BINDINGS_CXX11_CXX11_GROUP_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* Group.tcc : | ||
* | ||
* Created on: August 25, 2020 | ||
* Author: Dmitry Ganyushin [email protected] | ||
*/ | ||
#ifndef ADIOS2_BINDINGS_CXX11_CXX11_GROUP_TCC_ | ||
#define ADIOS2_BINDINGS_CXX11_CXX11_GROUP_TCC_ | ||
|
||
#include "Group.h" | ||
|
||
#include "adios2/core/Group.h" | ||
|
||
namespace adios2 | ||
{ | ||
template <class T> | ||
Variable<T> Group::InquireVariable(const std::string &name) | ||
{ | ||
helper::CheckForNullptr(m_Group, "for variable name " + name + | ||
", in call to Group::InquireVariable"); | ||
return Variable<T>( | ||
m_Group->InquireVariable<typename TypeInfo<T>::IOType>(name)); | ||
} | ||
|
||
template <class T> | ||
Attribute<T> Group::InquireAttribute(const std::string &name, | ||
const std::string &variableName, | ||
const std::string separator) | ||
{ | ||
using IOType = typename TypeInfo<T>::IOType; | ||
helper::CheckForNullptr(m_Group, "for attribute name " + name + | ||
", in call to IO::InquireAttribute"); | ||
return Attribute<T>( | ||
m_Group->InquireAttribute<IOType>(name, variableName, separator)); | ||
} | ||
|
||
} // end namespace adios2 | ||
|
||
#endif /* ADIOS2_BINDINGS_CXX11_CXX11_GROUP_TCC_ */ |
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
Oops, something went wrong.