MRMD 0.4.0
Multi Resolution Molecular Dynamics
Loading...
Searching...
No Matches
MultiResPeriodicGhostExchange.hpp
Go to the documentation of this file.
1// Copyright 2024 Sebastian Eibl
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include "data/Atoms.hpp"
18#include "data/Molecules.hpp"
19#include "data/Subdomain.hpp"
20#include "datatypes.hpp"
21#include "util/Kokkos_grow.hpp"
22
23namespace mrmd
24{
25namespace communication
26{
27namespace impl
28{
30{
33
34 DoubleCounter() = default;
35 KOKKOS_INLINE_FUNCTION
36 DoubleCounter(idx_t newAtoms, idx_t newMolecules) : atoms(newAtoms), molecules(newMolecules) {}
37 DoubleCounter(const DoubleCounter& rhs) = default;
38
39 KOKKOS_INLINE_FUNCTION
40 void operator=(const DoubleCounter& rhs)
41 {
42 atoms = rhs.atoms;
43 molecules = rhs.molecules;
44 }
45
46 KOKKOS_INLINE_FUNCTION
48 {
49 atoms += rhs.atoms;
50 molecules += rhs.molecules;
51 return *this;
52 }
53};
54
55KOKKOS_INLINE_FUNCTION
57{
58 return DoubleCounter(lhs.atoms + rhs.atoms, lhs.molecules + rhs.molecules);
59}
60
62{
63private:
64 struct Info
65 {
66 enum
67 {
68 POSITIVE_MOLECULE_IDX = 0,
69 POSITIVE_NUM_ATOMS = 1,
70 NEGATIVE_MOLECULE_IDX = 2,
71 NEGATIVE_NUM_ATOMS = 3
72 };
73 };
77 Kokkos::View<idx_t* [4]> communicationInfo_;
78
79 struct Item
80 {
81 enum
82 {
83 POSITIVE_MOLECULES = 0,
84 POSITIVE_ATOMS = 1,
85 NEGATIVE_MOLECULES = 2,
86 NEGATIVE_ATOMS = 3
87 };
88 };
90 Kokkos::View<idx_t[4]> numberOfCommunicationItems_;
91
93 IndexView atomsCorrespondingRealAtom_;
94
96 IndexView moleculesCorrespondingRealMolecule_;
97
98public:
100 data::Atoms& atoms,
101 const data::Subdomain& subdomain,
102 const AXIS& axis);
103
105 data::Atoms& atoms,
106 const data::Subdomain& subdomain);
107
110
111 explicit MultiResPeriodicGhostExchange(const idx_t& initialSize = 0);
112};
113} // namespace impl
114} // namespace communication
115} // namespace mrmd
Definition MultiResPeriodicGhostExchange.hpp:62
void resetCorrespondingRealMolecules(data::Molecules &molecules)
Definition MultiResPeriodicGhostExchange.cpp:273
IndexView createGhostAtoms(data::Molecules &molecules, data::Atoms &atoms, const data::Subdomain &subdomain, const AXIS &axis)
Definition MultiResPeriodicGhostExchange.cpp:60
IndexView createGhostAtomsXYZ(data::Molecules &molecules, data::Atoms &atoms, const data::Subdomain &subdomain)
Definition MultiResPeriodicGhostExchange.cpp:250
void resetCorrespondingRealAtoms(data::Atoms &atoms)
Definition MultiResPeriodicGhostExchange.cpp:267
Data structure for storing information about atoms on the host and the device.
Definition Atoms.hpp:35
Definition Molecules.hpp:29
KOKKOS_INLINE_FUNCTION DoubleCounter operator+(const DoubleCounter &lhs, const DoubleCounter &rhs)
Definition MultiResPeriodicGhostExchange.hpp:56
Definition BerendsenBarostat.cpp:18
AXIS
Definition datatypes.hpp:141
int64_t idx_t
Definition datatypes.hpp:91
Kokkos::View< idx_t * > IndexView
Definition datatypes.hpp:153
Definition MultiResPeriodicGhostExchange.hpp:30
KOKKOS_INLINE_FUNCTION DoubleCounter(idx_t newAtoms, idx_t newMolecules)
Definition MultiResPeriodicGhostExchange.hpp:36
idx_t molecules
Definition MultiResPeriodicGhostExchange.hpp:32
KOKKOS_INLINE_FUNCTION DoubleCounter & operator+=(const DoubleCounter &rhs)
Definition MultiResPeriodicGhostExchange.hpp:47
DoubleCounter(const DoubleCounter &rhs)=default
KOKKOS_INLINE_FUNCTION void operator=(const DoubleCounter &rhs)
Definition MultiResPeriodicGhostExchange.hpp:40
idx_t atoms
Definition MultiResPeriodicGhostExchange.hpp:31
|X|O|OOOOOOOOOO |X|O|OOOOOOOOOO |X|O+-------— <– minInnerCorner |X|OOOOOOOOOOOO |X+---------— <– minC...
Definition Subdomain.hpp:38