STORMM Source Documentation
Loading...
Searching...
No Matches
mesh_foundation.h
1// -*-c++-*-
2#ifndef STORMM_MESH_FOUNDATION_H
3#define STORMM_MESH_FOUNDATION_H
4
5#include "copyright.h"
6#include "Accelerator/gpu_details.h"
7#include "Accelerator/hybrid.h"
8#include "Accelerator/mesh_kernel_manager.h"
9#include "Constants/behavior.h"
10#include "Topology/atomgraph.h"
11#include "Trajectory/coordinateframe.h"
12#include "Trajectory/coordinate_series.h"
13#include "mesh_parameters.h"
14#include "mesh_rulers.h"
15
16namespace stormm {
17namespace structure {
18
19using card::Hybrid;
20using card::HybridTargetLevel;
21using card::MeshKlManager;
22using constants::PrecisionModel;
23using topology::AtomGraph;
24using trajectory::CoordinateFrame;
25using trajectory::CoordinateSeries;
26
30
32 MeshBasicsKit(const int* ngbr_in, const size_t* ngbr_bounds_in, const uint* frozen_atoms_in);
33
38 MeshBasicsKit(const MeshBasicsKit &original) = default;
39 MeshBasicsKit(MeshBasicsKit &&original) = default;
41
42 // Member variables
43 const int* ngbr;
44 const size_t* ngbr_bounds;
45 const uint* frozen_atoms;
47};
48
51public:
52
56 MeshFoundation(const CoordinateFrame *cf_in = nullptr, const AtomGraph *ag_in = nullptr,
57 const std::vector<std::string> &comments = {1, "Generated by STORMM"});
58
59 MeshFoundation(const CoordinateFrame &cf, const AtomGraph &ag_in,
60 const std::vector<std::string> &comments = {1, "Generated by STORMM"});
61
62 template <typename T>
63 MeshFoundation(const CoordinateSeries<T> *cs, const AtomGraph *ag_in = nullptr,
64 const std::vector<std::string> &comments = {1, "Generated by STORMM"});
65
66 template <typename T>
67 MeshFoundation(const CoordinateSeries<T> &cs, const AtomGraph &ag_in,
68 const std::vector<std::string> &comments = {1, "Generated by STORMM"});
70
73 int getReadyFrameCount() const;
74
76 const AtomGraph* getTopologyPointer() const;
77
80
83 template <typename Tcoord>
85
87 size_t getEnsembleTypeCode() const;
88
90 std::vector<uint> getFrozenAtomMask() const;
91
93 int getCommentCount() const;
94
98 const std::string& getComment(int comm_index) const;
99
103 MeshBasicsKit data(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
104
105#ifdef STORMM_USE_HPC
107 void upload();
108
110 void download();
111
112# ifdef STORMM_USE_CUDA
114 MeshBasicsKit deviceViewToHostData(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
115# endif
116#endif
117
123 void setTopology(const AtomGraph *ag_in);
124
133 void setCoordinates(const CoordinateFrame *cf_in);
134 void setCoordinates(const CoordinateFrame &cf_in);
136
145 template <typename Tcoord> void setEnsemble(const CoordinateSeries<Tcoord> *cs_in);
146 template <typename Tcoord> void setEnsemble(const CoordinateSeries<Tcoord> &cs_in);
148
158 void computeNeighborLists(const MeshParameters &mps, const MeshRulers &rlrs,
159 const MeshKlManager &launcher = MeshKlManager(),
160 PrecisionModel prec = PrecisionModel::SINGLE,
161 HybridTargetLevel availability = HybridTargetLevel::HOST);
162
166 void addComment(const std::string &verbiage);
167
169 void clearComments();
170
171private:
172
174 int frames_ready;
175
177 CoordinateFrame *cf_pointer;
178
183 CoordinateSeries<void> *cf_ensemble;
184
187 size_t ensemble_data_type;
188
190 AtomGraph *ag_pointer;
191
193 Hybrid<int> neighbor_list;
194
196 Hybrid<size_t> neighbor_list_bounds;
197
201 Hybrid<uint> frozen_atoms;
202
205 std::vector<std::string> comments;
206
212 int validateAtomCounts() const;
213
215 void testReadiness();
216};
217
218} // namespace structure
219} // namespace stormm
220
221#include "mesh_foundation.tpp"
222
223#endif
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
Collect and dispense the launch parameters for various mesh-based kernels. The launches for these ker...
Definition mesh_kernel_manager.h:29
MeshFoundation(const CoordinateFrame *cf_in=nullptr, const AtomGraph *ag_in=nullptr, const std::vector< std::string > &comments={1, "Generated by STORMM"})
The constructor accepts a topology some form of coordinates. It is overloaded to accept various valid...
Definition mesh_foundation.cpp:18
const AtomGraph * getTopologyPointer() const
Get a const pointer to the topology responsible for creating the associated mesh.
Definition mesh_foundation.cpp:71
const std::string & getComment(int comm_index) const
Get a comment from the list in the mesh.
Definition mesh_foundation.cpp:96
const CoordinateFrame * getCoordinatePointer() const
Get a const pointer to the coordinates responsible for creating the associated mesh.
Definition mesh_foundation.cpp:76
std::vector< uint > getFrozenAtomMask() const
Get the frozen atom mask.
Definition mesh_foundation.cpp:86
int getReadyFrameCount() const
Get an indication of whether the object has enough information to direct the construction of a mesh.
Definition mesh_foundation.cpp:66
void setEnsemble(const CoordinateSeries< Tcoord > *cs_in)
Set the series of coordinates that the mesh shall use.
void clearComments()
Clear the list of comments in the mesh.
Definition mesh_foundation.cpp:187
void addComment(const std::string &verbiage)
Add a comment to the mesh.
Definition mesh_foundation.cpp:182
int getCommentCount() const
Get the number of comments appended to the mesh.
Definition mesh_foundation.cpp:91
void computeNeighborLists(const MeshParameters &mps, const MeshRulers &rlrs, const MeshKlManager &launcher=MeshKlManager(), PrecisionModel prec=PrecisionModel::SINGLE, HybridTargetLevel availability=HybridTargetLevel::HOST)
Compute neighbor lists for each mesh element, if appropriate for the mesh type.
Definition mesh_foundation.cpp:176
const CoordinateSeries< Tcoord > * getEnsemblePointer() const
Get a const reference to the array of structures (each stored as a CoordinateFrame) reponsible for cr...
MeshFoundation(const CoordinateFrame *cf_in=nullptr, const AtomGraph *ag_in=nullptr, const std::vector< std::string > &comments={1, "Generated by STORMM"})
The constructor accepts a topology some form of coordinates. It is overloaded to accept various valid...
Definition mesh_foundation.cpp:18
void setCoordinates(const CoordinateFrame *cf_in)
Set the coordinates that the mesh shall use.
Definition mesh_foundation.cpp:164
void setTopology(const AtomGraph *ag_in)
Set the topology that the mesh shall use. This will allocate and populate the Hybrid array pertaining...
Definition mesh_foundation.cpp:143
MeshBasicsKit data(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the object's abstract.
Definition mesh_foundation.cpp:108
size_t getEnsembleTypeCode() const
Get the codified data type of the ensemble.
Definition mesh_foundation.cpp:81
Encode the critical dimensions of a regular, rectilinear mesh. The locations of mesh points as well a...
Definition mesh_parameters.h:121
A collection of coordinate vectors describing each axis of a mesh. If the mesh axes track Cartesian a...
Definition mesh_rulers.h:75
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
Store the coordinates and box information for a frame, only. This abridged struct can serve when the ...
Definition coordinateframe.h:111
Store the coordinates and box information for a series of frames, in one of several levels of precisi...
Definition coordinate_series.h:137
Abstract for the MeshFoundation object to encapsulate pointers to its data on the host or the device.
Definition mesh_foundation.h:29
MeshBasicsKit(const MeshBasicsKit &original)=default
As with most abstracts, the presence of const members implies that the copy and move assignment opera...
const int * ngbr
Concatenated lists of neighbor atoms.
Definition mesh_foundation.h:43
const uint * frozen_atoms
Definition mesh_foundation.h:45
MeshBasicsKit(const int *ngbr_in, const size_t *ngbr_bounds_in, const uint *frozen_atoms_in)
The constructor takes arguments for each of the handful of member variables.
Definition mesh_foundation.cpp:12
const size_t * ngbr_bounds
Bounds array for the neighbor lists in ngbr.
Definition mesh_foundation.h:44