![]() |
KIDS
ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
|
DataSet class is a tree-structured container for storage of Tensor and other DataSet. More...
#include <DataSet.h>
Classes | |
class | DataSetKeyParser |
Public Types | |
using | DataType = std::map<std::string, std::shared_ptr<Node>> |
Public Member Functions | |
DataSet () | |
Constructor for DataSet. | |
kids_int * | def (VARIABLE< kids_int > &var) |
Define a variable of type kids_int. | |
kids_real * | def (VARIABLE< kids_real > &var) |
Define a variable of type kids_real. | |
kids_complex * | def (VARIABLE< kids_complex > &var) |
Define a variable of type kids_complex. | |
kids_int * | def_int (const std::string &key, Shape S=1, const std::string &info="") |
Define an integer variable with a specified key, shape, and info. | |
kids_int * | def_int (const std::string &key, kids_int *arr_in, Shape S=1, const std::string &info="") |
Define an integer variable with a specified key, array, shape, and info. | |
kids_int * | def_int (const std::string &key, const std::string &key_in, const std::string &info="") |
Define an integer variable with a specified key, reference key, and info. | |
DataSet & | _def_int (const std::string &key, Shape S=1, const std::string &info="") |
Define an integer variable with a specified key, shape, and info and update the dataset. | |
kids_real * | def_real (const std::string &key, Shape S=1, const std::string &info="") |
Define a real variable with a specified key, shape, and info. | |
kids_real * | def_real (const std::string &key, kids_real *arr_in, Shape S=1, const std::string &info="") |
Define a real variable with a specified key, array, shape, and info. | |
kids_real * | def_real (const std::string &key, const std::string &key_in, const std::string &info="") |
Define a real variable with a specified key, reference key, and info. | |
DataSet & | _def_real (const std::string &key, Shape S=1, const std::string &info="") |
Define a real variable with a specified key, shape, and info and update the dataset. | |
kids_complex * | def_complex (const std::string &key, Shape S=1, const std::string &info="") |
Define a complex variable with a specified key, shape, and info. | |
kids_complex * | def_complex (const std::string &key, kids_complex *arr_in, Shape S=1, const std::string &info="") |
Define a complex variable with a specified key, array, shape, and info. | |
kids_complex * | def_complex (const std::string &key, const std::string &key_in, const std::string &info="") |
Define a complex variable with a specified key, reference key, and info. | |
DataSet & | _def_complex (const std::string &key, Shape S=1, const std::string &info="") |
Define a complex variable with a specified key, shape, and info and update the dataset. | |
DataSet & | _def (const std::string &key, const std::string &key_in, const std::string &info="") |
Define a variable with a specified key and reference key, and info. | |
DataSet & | _undef (const std::string &key) |
Undefine a variable with a specified key. | |
std::tuple< kids_dtype, void *, Shape * > | obtain (const std::string &key) |
Obtain information about a variable with a specified key. | |
Node * | node (const std::string &key) |
Get the node corresponding to a variable with a specified key. | |
DataSet * | at (const std::string &key) |
Access the DataSet corresponding to a variable with a specified key. | |
virtual std::string | help (const std::string &name) |
Get help information for a variable with a specified name. | |
virtual std::string | repr () |
Get a string representation of the DataSet. | |
virtual void | dump (std::ostream &os) |
Dump the DataSet to an output stream. | |
virtual void | load (std::istream &is) |
Load the DataSet from an input stream. | |
kids_dtype | type () |
Public Attributes | |
std::shared_ptr< DataType > | _data |
Protected Attributes | |
kids_dtype | _type = kids_void_type |
Private Member Functions | |
DataSet & | operator= (const DataSet &)=delete |
template<typename T > | |
T * | def (const std::string &key, Shape S=1, const std::string &info="") |
Define a variable of type T with a specified key, shape, and info. | |
using PROJECT_NS::DataSet::DataType = std::map<std::string, std::shared_ptr<Node>> |
PROJECT_NS::DataSet::DataSet | ( | ) |
Constructor for DataSet.
Definition at line 22 of file DataSet.cpp.
References _data, PROJECT_NS::Node::_type, and PROJECT_NS::kids_dataset_type.
Referenced by def().
DataSet & PROJECT_NS::DataSet::_def | ( | const std::string & | key, |
const std::string & | key_in, | ||
const std::string & | info = "" ) |
Define a variable with a specified key and reference key, and info.
key | The key for the variable. |
key_in | The key of the variable to reference. |
info | Additional information about the variable. |
Definition at line 122 of file DataSet.cpp.
References def_complex(), def_int(), def_real(), PROJECT_NS::kids_complex_type, PROJECT_NS::kids_int_type, PROJECT_NS::kids_real_type, and node().
DataSet & PROJECT_NS::DataSet::_def_complex | ( | const std::string & | key, |
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define a complex variable with a specified key, shape, and info and update the dataset.
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 116 of file DataSet.cpp.
References def_complex().
DataSet & PROJECT_NS::DataSet::_def_int | ( | const std::string & | key, |
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define an integer variable with a specified key, shape, and info and update the dataset.
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 74 of file DataSet.cpp.
References def_int().
DataSet & PROJECT_NS::DataSet::_def_real | ( | const std::string & | key, |
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define a real variable with a specified key, shape, and info and update the dataset.
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 95 of file DataSet.cpp.
References def_real().
DataSet & PROJECT_NS::DataSet::_undef | ( | const std::string & | key | ) |
Undefine a variable with a specified key.
key | The key for the variable to undefine. |
Definition at line 140 of file DataSet.cpp.
References _data, node(), and PROJECT_NS::DataSet::DataSetKeyParser::terms.
DataSet * PROJECT_NS::DataSet::at | ( | const std::string & | key | ) |
Access the DataSet corresponding to a variable with a specified key.
key | The key for the variable. |
Definition at line 203 of file DataSet.cpp.
References PROJECT_NS::kids_dataset_type, and node().
|
private |
Define a variable of type T with a specified key, shape, and info.
T | The type of variable to define. |
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 28 of file DataSet.cpp.
References _data, DataSet(), node(), and PROJECT_NS::DataSet::DataSetKeyParser::terms.
kids_complex * PROJECT_NS::DataSet::def | ( | VARIABLE< kids_complex > & | var | ) |
Define a variable of type kids_complex.
var | The variable to define. |
Definition at line 55 of file DataSet.cpp.
References def_complex().
Define a variable of type kids_int.
var | The variable to define. |
Definition at line 53 of file DataSet.cpp.
References def_int().
Define a variable of type kids_real.
var | The variable to define. |
Definition at line 54 of file DataSet.cpp.
References def_real().
kids_complex * PROJECT_NS::DataSet::def_complex | ( | const std::string & | key, |
const std::string & | key_in, | ||
const std::string & | info = "" ) |
Define a complex variable with a specified key, reference key, and info.
key | The key for the variable. |
key_in | The key of the variable to reference. |
info | Additional information about the variable. |
Definition at line 108 of file DataSet.cpp.
References def_complex(), PROJECT_NS::kids_dataset_type, and node().
kids_complex * PROJECT_NS::DataSet::def_complex | ( | const std::string & | key, |
kids_complex * | arr_in, | ||
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define a complex variable with a specified key, array, shape, and info.
key | The key for the variable. |
arr_in | Pointer to the input array. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 103 of file DataSet.cpp.
References def_complex().
kids_complex * PROJECT_NS::DataSet::def_complex | ( | const std::string & | key, |
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define a complex variable with a specified key, shape, and info.
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 100 of file DataSet.cpp.
Referenced by _def(), _def_complex(), def(), def_complex(), and def_complex().
kids_int * PROJECT_NS::DataSet::def_int | ( | const std::string & | key, |
const std::string & | key_in, | ||
const std::string & | info = "" ) |
Define an integer variable with a specified key, reference key, and info.
key | The key for the variable. |
key_in | The key of the variable to reference. |
info | Additional information about the variable. |
Definition at line 66 of file DataSet.cpp.
References def_int(), PROJECT_NS::kids_dataset_type, and node().
kids_int * PROJECT_NS::DataSet::def_int | ( | const std::string & | key, |
kids_int * | arr_in, | ||
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define an integer variable with a specified key, array, shape, and info.
key | The key for the variable. |
arr_in | Pointer to the input array. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 61 of file DataSet.cpp.
References def_int().
kids_int * PROJECT_NS::DataSet::def_int | ( | const std::string & | key, |
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define an integer variable with a specified key, shape, and info.
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 58 of file DataSet.cpp.
Referenced by _def(), _def_int(), def(), def_int(), and def_int().
kids_real * PROJECT_NS::DataSet::def_real | ( | const std::string & | key, |
const std::string & | key_in, | ||
const std::string & | info = "" ) |
Define a real variable with a specified key, reference key, and info.
key | The key for the variable. |
key_in | The key of the variable to reference. |
info | Additional information about the variable. |
Definition at line 87 of file DataSet.cpp.
References def_real(), PROJECT_NS::kids_dataset_type, and node().
kids_real * PROJECT_NS::DataSet::def_real | ( | const std::string & | key, |
kids_real * | arr_in, | ||
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define a real variable with a specified key, array, shape, and info.
key | The key for the variable. |
arr_in | Pointer to the input array. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 82 of file DataSet.cpp.
References def_real().
kids_real * PROJECT_NS::DataSet::def_real | ( | const std::string & | key, |
Shape | S = 1, | ||
const std::string & | info = "" ) |
Define a real variable with a specified key, shape, and info.
key | The key for the variable. |
S | The shape of the variable. |
info | Additional information about the variable. |
Definition at line 79 of file DataSet.cpp.
Referenced by _def(), _def_real(), def(), def_real(), def_real(), PROJECT_NS::Model_HO::setInputDataSet_impl(), and PROJECT_NS::MODEL_MD1D::setInputDataSet_impl().
|
virtual |
Dump the DataSet to an output stream.
os | The output stream to dump the DataSet to. |
Definition at line 265 of file DataSet.cpp.
References repr().
|
virtual |
Get help information for a variable with a specified name.
name | The name of the variable. |
Implements PROJECT_NS::Node.
Definition at line 213 of file DataSet.cpp.
References _data, PROJECT_NS::Node::help(), PROJECT_NS::kids_dataset_type, node(), and PROJECT_NS::Node::type().
|
virtual |
Load the DataSet from an input stream.
is | The input stream to load the DataSet from. |
Definition at line 267 of file DataSet.cpp.
Node * PROJECT_NS::DataSet::node | ( | const std::string & | key | ) |
Get the node corresponding to a variable with a specified key.
key | The key for the variable. |
Definition at line 185 of file DataSet.cpp.
References _data, node(), and PROJECT_NS::DataSet::DataSetKeyParser::terms.
Referenced by _def(), _undef(), at(), def(), def_complex(), def_int(), def_real(), help(), node(), and obtain().
std::tuple< kids_dtype, void *, Shape * > PROJECT_NS::DataSet::obtain | ( | const std::string & | key | ) |
Obtain information about a variable with a specified key.
key | The key for the variable. |
Definition at line 160 of file DataSet.cpp.
References PROJECT_NS::kids_complex_type, PROJECT_NS::kids_int_type, PROJECT_NS::kids_real_type, and node().
|
virtual |
Get a string representation of the DataSet.
Implements PROJECT_NS::Node.
Definition at line 240 of file DataSet.cpp.
References _data, PROJECT_NS::kids_dataset_type, PROJECT_NS::Node::repr(), and PROJECT_NS::Node::type().
Referenced by dump().
|
inlineinherited |
Definition at line 45 of file Node.h.
References PROJECT_NS::Node::_type.
Referenced by help(), and repr().
std::shared_ptr<DataType> PROJECT_NS::DataSet::_data |
|
protectedinherited |
Definition at line 50 of file Node.h.
Referenced by DataSet(), PROJECT_NS::Tensor< T >::Tensor(), and PROJECT_NS::Node::type().