NetSci
Loading...
Searching...
No Matches
node.h
1/**
2 * \file node.h
3 * \brief Defines the Node class representing a node in a graph.
4 */
5
6#ifndef CURVA_NODE_H
7#define CURVA_NODE_H
8
9#include "atoms.h"
10#include "cuarray.h"
11
12/**
13 * \class Node
14 * \brief Represents a node in a graph.
15 */
16class Node {
17public:
18 /**
19 * \brief Default constructor for Node.
20 */
22
23 /**
24 * \brief Destructor for Node.
25 */
27
28 /**
29 * \brief Constructor for Node with specified number of frames and index.
30 *
31 * \param numFrames Number of frames.
32 * \param index_ Index of the node.
33 */
34 Node(unsigned int numFrames, unsigned int index_);
35
36 /**
37 * \brief Add an Atom to the Node.
38 *
39 * Adds the specified Atom to the Node along with its corresponding coordinates.
40 *
41 * \param atom Pointer to the Atom object.
42 * \param coordinates Pointer to the coordinates array.
43 * \param nodeCoordinates Pointer to the node coordinates array.
44 */
45 void addAtom(Atom* atom, CuArray<float>* coordinates, CuArray<float>* nodeCoordinates);
46
47 /**
48 * \brief Get the tag of the Node.
49 *
50 * Returns the tag of the Node, which represents its unique identifier.
51 *
52 * \return The tag of the Node.
53 *
54 * @PythonExample{NetChem_Node_tag.py}
55 */
56 std::string tag();
57
58 /**
59 * \brief Get the number of Atoms in the Node.
60 *
61 * Returns the number of Atoms contained in the Node.
62 *
63 * \return The number of Atoms in the Node.
64 *
65 * @PythonExample{NetChem_Node_numAtoms.py}
66 */
67 unsigned int numAtoms() const;
68
69 /**
70 * \brief Get the index of the Node.
71 *
72 * Returns the index of the Node.
73 *
74 * \return The index of the Node.
75 *
76 * @PythonExample{NetChem_Node_index.py}
77 */
78 unsigned int index() const;
79
80 /**
81 * \brief Get the total mass of the Node.
82 *
83 * Returns the total mass of the Node, calculated as the sum of the masses
84 * of all the Atoms in the Node.
85 *
86 * \return The total mass of the Node.
87 *
88 * @PythonExample{NetChem_Node_totalMass.py}
89 */
90 float totalMass() const;
91
92 /**
93 * \brief Get the hash value of the Node.
94 *
95 * Returns the hash value of the Node, which is a unique identifier
96 * based on its tag and index.
97 *
98 * \return The hash value of the Node.
99 */
100 unsigned int hash() const;
101
102 /**
103 * \brief Get a vector of pointers to the Atoms in the Node.
104 *
105 * Returns a vector of pointers to the Atoms contained in the Node.
106 *
107 * \return A vector of pointers to the Atoms in the Node.
108 *
109 * @PythonExample{NetChem_Node_atoms.py}
110 */
111 std::vector<Atom*> atoms() const;
112
113private:
114 friend nlohmann::adl_serializer<Node*>;
115
116 friend class Network;
117
118 unsigned int _numAtoms; // Number of Atoms in the Node.
119 std::vector<int> atomIndices_; // Indices of the Atoms in the Node.
120 unsigned int _index; // Index of the Node.
121 float _totalMass; // Total mass of the Node.
122 std::string _tag; // Tag of the Node.
123 std::vector<Atom*> atoms_; // Pointers to the Atoms in the Node.
124 unsigned int _hash = 0; // Hash value of the Node.
125 unsigned int _numFrames; // Number of frames.
126};
127
128#endif // CURVA_NODE_H
Definition atom.h:12
Manages CUDA-supported arrays, offering initialization, memory management, and data manipulation....
Definition cuarray.h:24
Definition network.h:12
Represents a node in a graph.
Definition node.h:16
unsigned int numAtoms() const
Get the number of Atoms in the Node.
void addAtom(Atom *atom, CuArray< float > *coordinates, CuArray< float > *nodeCoordinates)
Add an Atom to the Node.
unsigned int index() const
Get the index of the Node.
unsigned int hash() const
Get the hash value of the Node.
float totalMass() const
Get the total mass of the Node.
std::string tag()
Get the tag of the Node.
~Node()
Destructor for Node.
Node()
Default constructor for Node.
Node(unsigned int numFrames, unsigned int index_)
Constructor for Node with specified number of frames and index.
std::vector< Atom * > atoms() const
Get a vector of pointers to the Atoms in the Node.