seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
domain.hpp
Go to the documentation of this file.
1#ifndef SEAMS_DOMAIN_HPP_
2#define SEAMS_DOMAIN_HPP_
3
4#include <cstdint>
5#include <vector>
6
7#include <mol_sys.hpp>
8
9#ifdef SEAMS_HAS_MPI
10#include <mpi.h>
11#endif
12
26
27namespace seams::domain {
28
30
32struct Share {
33 std::vector<int> local;
34 std::vector<char> owned;
35 std::vector<int> owner;
36};
37
41 std::vector<long long> sizeCount;
44 std::vector<int> atomType;
45};
46
48RingSummary summarize(const std::vector<std::vector<int>> &ringList,
49 int nAtoms, int maxDepth);
50
52std::uint64_t hilbertKey(std::uint32_t x, std::uint32_t y, std::uint32_t z,
53 int bits);
54
60inline constexpr int kRingHaloHalf = 2;
61
62inline int ringHaloBonds(int ringSize) {
63 return ringSize > 0 ? ringSize / kRingHaloHalf : 0;
64}
65
69inline int ringHops(int maxDepth) { return ringHaloBonds(maxDepth); }
70
76inline int ringRowHops(int maxDepth) { return ringHops(maxDepth); }
77
81Share decompose(const Cloud &cloud, int rank, int nRanks, double halo);
82
84constexpr int kWorkNeigh = 1;
85constexpr int kWorkChill = 2;
86constexpr int kWorkQ6 = 3;
87constexpr int kWorkRings = 4;
88
92std::vector<int> haloRanks(const Share &share);
93
96void markSources(const Cloud &cloud, const Share &share, double inner,
97 std::vector<char> &source);
98
100Cloud subCloud(const Cloud &cloud, const std::vector<int> &atoms);
101
106std::vector<std::vector<int>> rings(const Cloud &cloud, double cutoff,
107 int maxDepth, int rank, int nRanks);
108
111const std::vector<std::vector<int>> &ownedRings(const Cloud &local, double cutoff,
112 int maxDepth,
113 const std::vector<char> &owned);
114
120std::vector<std::vector<int>>
121ringsFromRows(const std::vector<int> &frame,
122 const std::vector<std::vector<int>> &neigh,
123 const std::vector<int> &sources, int maxDepth);
124
125#ifdef SEAMS_HAS_MPI
127struct Work {
128 Cloud cloud;
129 Share share;
130 double commMs = 0;
131 double haloFraction = 0;
132};
133
140Work &gatherWork(const Cloud &cloud, double halo, MPI_Comm comm, int workTag = 0);
141
145void captureLocalWork(int workTag, const double *perLocal, int nLocal, MPI_Comm comm);
146
149void setCutMode(int mode);
150
154void setHaloHook(void (*fn)(void *), void *ctx);
155
158void markInterior(const Work &work, double cutoff, std::vector<char> &interior);
159
161Work &gatheredWork();
162
168std::vector<std::vector<int>> gatherRings(const Cloud &cloud, double cutoff,
169 int maxDepth, MPI_Comm comm);
170
178RingSummary reduceRings(const Cloud &cloud, double cutoff, int maxDepth,
179 MPI_Comm comm, int root = 0);
180
185const std::vector<std::vector<int>> &distributedRings(const Cloud &cloud, double cutoff,
186 int maxDepth, MPI_Comm comm);
187
193void postBoundaryValues(double *values, int stride, MPI_Comm comm);
194void waitBoundaryValues();
195
197double takeValueCommMs();
198#endif
199
204 double rebuildMs = 0;
205 double searchMs = 0;
206 double primitiveMs = 0;
207 double reduceMs = 0;
208};
209
211
212} // namespace seams::domain
213
214#endif // SEAMS_DOMAIN_HPP_
The main molecular system handler.
const std::vector< std::vector< int > > & ownedRings(const Cloud &local, double cutoff, int maxDepth, const std::vector< char > &owned)
RingSummary summarize(const std::vector< std::vector< int > > &ringList, int nAtoms, int maxDepth)
The summary of ringList over a frame of nAtoms atoms.
int ringHaloBonds(int ringSize)
Definition domain.hpp:62
Cloud subCloud(const Cloud &cloud, const std::vector< int > &atoms)
The listed atoms of cloud, in that order, in the same box.
constexpr int kWorkQ6
Definition domain.hpp:86
RingPhases lastRingPhases()
std::vector< std::vector< int > > ringsFromRows(const std::vector< int > &frame, const std::vector< std::vector< int > > &neigh, const std::vector< int > &sources, int maxDepth)
constexpr int kWorkChill
Definition domain.hpp:85
constexpr int kRingHaloHalf
Definition domain.hpp:60
int ringHops(int maxDepth)
Definition domain.hpp:69
constexpr int kWorkNeigh
Tags for the measured cell weights. Zero keeps the point-count cut.
Definition domain.hpp:84
Share decompose(const Cloud &cloud, int rank, int nRanks, double halo)
std::vector< int > haloRanks(const Share &share)
molSys::PointCloud< molSys::Point< double >, double > Cloud
Definition domain.hpp:29
std::vector< std::vector< int > > rings(const Cloud &cloud, double cutoff, int maxDepth, int rank, int nRanks)
void markSources(const Cloud &cloud, const Share &share, double inner, std::vector< char > &source)
constexpr int kWorkRings
Definition domain.hpp:87
std::uint64_t hilbertKey(std::uint32_t x, std::uint32_t y, std::uint32_t z, int bits)
Position of cell (x, y, z) along the Hilbert curve over a 2^bits grid.
int ringRowHops(int maxDepth)
Definition domain.hpp:76
This contains a collection of points; contains information for a particular frame.
Definition mol_sys.hpp:173
What the ring analyses read off a frame's primitive rings.
Definition domain.hpp:39
std::vector< long long > sizeCount
Rings of each size, indexed by member count, 0 through maxDepth.
Definition domain.hpp:41
std::vector< int > atomType
Definition domain.hpp:44
One rank's share of a frame.
Definition domain.hpp:32
std::vector< char > owned
nonzero where local[k] belongs to this rank
Definition domain.hpp:34
std::vector< int > owner
rank owning local[k]
Definition domain.hpp:35
std::vector< int > local
owned and halo atoms by frame index, ascending
Definition domain.hpp:33