KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
PROJECT_NS::DataSet Class Referencefinal

DataSet class is a tree-structured container for storage of Tensor and other DataSet. More...

#include <DataSet.h>

Inheritance diagram for PROJECT_NS::DataSet:
Inheritance graph
Collaboration diagram for PROJECT_NS::DataSet:
Collaboration graph

Classes

class  DataSetKeyParser
 

Public Types

using DataType = std::map<std::string, std::shared_ptr<Node>>
 

Public Member Functions

 DataSet ()
 Constructor for DataSet.
 
kids_intdef (VARIABLE< kids_int > &var)
 Define a variable of type kids_int.
 
kids_realdef (VARIABLE< kids_real > &var)
 Define a variable of type kids_real.
 
kids_complexdef (VARIABLE< kids_complex > &var)
 Define a variable of type kids_complex.
 
kids_intdef_int (const std::string &key, Shape S=1, const std::string &info="")
 Define an integer variable with a specified key, shape, and info.
 
kids_intdef_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_intdef_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_realdef_real (const std::string &key, Shape S=1, const std::string &info="")
 Define a real variable with a specified key, shape, and info.
 
kids_realdef_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_realdef_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_complexdef_complex (const std::string &key, Shape S=1, const std::string &info="")
 Define a complex variable with a specified key, shape, and info.
 
kids_complexdef_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_complexdef_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.
 
Nodenode (const std::string &key)
 Get the node corresponding to a variable with a specified key.
 
DataSetat (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

DataSetoperator= (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.
 

Detailed Description

DataSet class is a tree-structured container for storage of Tensor and other DataSet.

Definition at line 74 of file DataSet.h.

Member Typedef Documentation

◆ DataType

using PROJECT_NS::DataSet::DataType = std::map<std::string, std::shared_ptr<Node>>

Definition at line 79 of file DataSet.h.

Constructor & Destructor Documentation

◆ DataSet()

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().

Here is the caller graph for this function:

Member Function Documentation

◆ _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.

Parameters
keyThe key for the variable.
key_inThe key of the variable to reference.
infoAdditional information about the variable.
Returns
Reference to the updated DataSet.

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().

Here is the call graph for this function:

◆ _def_complex()

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.

Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Reference to the updated DataSet.

Definition at line 116 of file DataSet.cpp.

References def_complex().

Here is the call graph for this function:

◆ _def_int()

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.

Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Reference to the updated DataSet.

Definition at line 74 of file DataSet.cpp.

References def_int().

Here is the call graph for this function:

◆ _def_real()

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.

Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Reference to the updated DataSet.

Definition at line 95 of file DataSet.cpp.

References def_real().

Here is the call graph for this function:

◆ _undef()

DataSet & PROJECT_NS::DataSet::_undef ( const std::string & key)

Undefine a variable with a specified key.

Parameters
keyThe key for the variable to undefine.
Returns
Reference to the updated DataSet.

Definition at line 140 of file DataSet.cpp.

References _data, node(), and PROJECT_NS::DataSet::DataSetKeyParser::terms.

Here is the call graph for this function:

◆ at()

DataSet * PROJECT_NS::DataSet::at ( const std::string & key)

Access the DataSet corresponding to a variable with a specified key.

Parameters
keyThe key for the variable.
Returns
Pointer to the corresponding DataSet.

Definition at line 203 of file DataSet.cpp.

References PROJECT_NS::kids_dataset_type, and node().

Here is the call graph for this function:

◆ def() [1/4]

template<typename T >
T * PROJECT_NS::DataSet::def ( const std::string & key,
Shape S = 1,
const std::string & info = "" )
private

Define a variable of type T with a specified key, shape, and info.

Template Parameters
TThe type of variable to define.
Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 28 of file DataSet.cpp.

References _data, DataSet(), node(), and PROJECT_NS::DataSet::DataSetKeyParser::terms.

Here is the call graph for this function:

◆ def() [2/4]

kids_complex * PROJECT_NS::DataSet::def ( VARIABLE< kids_complex > & var)

Define a variable of type kids_complex.

Parameters
varThe variable to define.
Returns
Pointer to the defined variable.

Definition at line 55 of file DataSet.cpp.

References def_complex().

Here is the call graph for this function:

◆ def() [3/4]

kids_int * PROJECT_NS::DataSet::def ( VARIABLE< kids_int > & var)

Define a variable of type kids_int.

Parameters
varThe variable to define.
Returns
Pointer to the defined variable.

Definition at line 53 of file DataSet.cpp.

References def_int().

Here is the call graph for this function:

◆ def() [4/4]

kids_real * PROJECT_NS::DataSet::def ( VARIABLE< kids_real > & var)

Define a variable of type kids_real.

Parameters
varThe variable to define.
Returns
Pointer to the defined variable.

Definition at line 54 of file DataSet.cpp.

References def_real().

Here is the call graph for this function:

◆ def_complex() [1/3]

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.

Parameters
keyThe key for the variable.
key_inThe key of the variable to reference.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 108 of file DataSet.cpp.

References def_complex(), PROJECT_NS::kids_dataset_type, and node().

Here is the call graph for this function:

◆ def_complex() [2/3]

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.

Parameters
keyThe key for the variable.
arr_inPointer to the input array.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 103 of file DataSet.cpp.

References def_complex().

Here is the call graph for this function:

◆ def_complex() [3/3]

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.

Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 100 of file DataSet.cpp.

Referenced by _def(), _def_complex(), def(), def_complex(), and def_complex().

Here is the caller graph for this function:

◆ def_int() [1/3]

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.

Parameters
keyThe key for the variable.
key_inThe key of the variable to reference.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 66 of file DataSet.cpp.

References def_int(), PROJECT_NS::kids_dataset_type, and node().

Here is the call graph for this function:

◆ def_int() [2/3]

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.

Parameters
keyThe key for the variable.
arr_inPointer to the input array.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 61 of file DataSet.cpp.

References def_int().

Here is the call graph for this function:

◆ def_int() [3/3]

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.

Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 58 of file DataSet.cpp.

Referenced by _def(), _def_int(), def(), def_int(), and def_int().

Here is the caller graph for this function:

◆ def_real() [1/3]

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.

Parameters
keyThe key for the variable.
key_inThe key of the variable to reference.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 87 of file DataSet.cpp.

References def_real(), PROJECT_NS::kids_dataset_type, and node().

Here is the call graph for this function:

◆ def_real() [2/3]

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.

Parameters
keyThe key for the variable.
arr_inPointer to the input array.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined variable.

Definition at line 82 of file DataSet.cpp.

References def_real().

Here is the call graph for this function:

◆ def_real() [3/3]

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.

Parameters
keyThe key for the variable.
SThe shape of the variable.
infoAdditional information about the variable.
Returns
Pointer to the defined 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().

Here is the caller graph for this function:

◆ dump()

void PROJECT_NS::DataSet::dump ( std::ostream & os)
virtual

Dump the DataSet to an output stream.

Parameters
osThe output stream to dump the DataSet to.

Definition at line 265 of file DataSet.cpp.

References repr().

Here is the call graph for this function:

◆ help()

std::string PROJECT_NS::DataSet::help ( const std::string & name)
virtual

Get help information for a variable with a specified name.

Parameters
nameThe name of the variable.
Returns
Help information as a string.

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().

Here is the call graph for this function:

◆ load()

void PROJECT_NS::DataSet::load ( std::istream & is)
virtual

Load the DataSet from an input stream.

Parameters
isThe input stream to load the DataSet from.

Definition at line 267 of file DataSet.cpp.

◆ node()

Node * PROJECT_NS::DataSet::node ( const std::string & key)

Get the node corresponding to a variable with a specified key.

Parameters
keyThe key for the variable.
Returns
Pointer to the corresponding Node.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ obtain()

std::tuple< kids_dtype, void *, Shape * > PROJECT_NS::DataSet::obtain ( const std::string & key)

Obtain information about a variable with a specified key.

Parameters
keyThe key for the variable.
Returns
A tuple containing the data type, pointer to data, and shape of 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().

Here is the call graph for this function:

◆ operator=()

DataSet & PROJECT_NS::DataSet::operator= ( const DataSet & )
privatedelete

◆ repr()

std::string PROJECT_NS::DataSet::repr ( )
virtual

Get a string representation of the DataSet.

Returns
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ type()

kids_dtype PROJECT_NS::Node::type ( )
inlineinherited

Definition at line 45 of file Node.h.

References PROJECT_NS::Node::_type.

Referenced by help(), and repr().

Here is the caller graph for this function:

Member Data Documentation

◆ _data

std::shared_ptr<DataType> PROJECT_NS::DataSet::_data

Definition at line 80 of file DataSet.h.

Referenced by _undef(), DataSet(), def(), help(), node(), and repr().

◆ _type

kids_dtype PROJECT_NS::Node::_type = kids_void_type
protectedinherited

Definition at line 50 of file Node.h.

Referenced by DataSet(), PROJECT_NS::Tensor< T >::Tensor(), and PROJECT_NS::Node::type().


The documentation for this class was generated from the following files: