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
23
namespace
mrmd
24
{
25
namespace
communication
26
{
27
namespace
impl
28
{
29
struct
DoubleCounter
30
{
31
idx_t
atoms
= 0;
32
idx_t
molecules
= 0;
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
47
DoubleCounter
&
operator+=
(
const
DoubleCounter
& rhs)
48
{
49
atoms
+= rhs.
atoms
;
50
molecules
+= rhs.
molecules
;
51
return
*
this
;
52
}
53
};
54
55
KOKKOS_INLINE_FUNCTION
56
DoubleCounter
operator+
(
const
DoubleCounter
& lhs,
const
DoubleCounter
& rhs)
57
{
58
return
DoubleCounter
(lhs.
atoms
+ rhs.
atoms
, lhs.
molecules
+ rhs.
molecules
);
59
}
60
61
class
MultiResPeriodicGhostExchange
62
{
63
private
:
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
98
public
:
99
IndexView
createGhostAtoms
(
data::Molecules
& molecules,
100
data::Atoms
& atoms,
101
const
data::Subdomain
& subdomain,
102
const
AXIS
& axis);
103
104
IndexView
createGhostAtomsXYZ
(
data::Molecules
& molecules,
105
data::Atoms
& atoms,
106
const
data::Subdomain
& subdomain);
107
108
void
resetCorrespondingRealAtoms
(
data::Atoms
& atoms);
109
void
resetCorrespondingRealMolecules
(
data::Molecules
& molecules);
110
111
explicit
MultiResPeriodicGhostExchange
(
const
idx_t
& initialSize = 0);
112
};
113
}
// namespace impl
114
}
// namespace communication
115
}
// namespace mrmd
Atoms.hpp
Kokkos_grow.hpp
Molecules.hpp
Subdomain.hpp
mrmd::communication::impl::MultiResPeriodicGhostExchange
Definition
MultiResPeriodicGhostExchange.hpp:62
mrmd::communication::impl::MultiResPeriodicGhostExchange::resetCorrespondingRealMolecules
void resetCorrespondingRealMolecules(data::Molecules &molecules)
Definition
MultiResPeriodicGhostExchange.cpp:273
mrmd::communication::impl::MultiResPeriodicGhostExchange::createGhostAtoms
IndexView createGhostAtoms(data::Molecules &molecules, data::Atoms &atoms, const data::Subdomain &subdomain, const AXIS &axis)
Definition
MultiResPeriodicGhostExchange.cpp:60
mrmd::communication::impl::MultiResPeriodicGhostExchange::createGhostAtomsXYZ
IndexView createGhostAtomsXYZ(data::Molecules &molecules, data::Atoms &atoms, const data::Subdomain &subdomain)
Definition
MultiResPeriodicGhostExchange.cpp:250
mrmd::communication::impl::MultiResPeriodicGhostExchange::resetCorrespondingRealAtoms
void resetCorrespondingRealAtoms(data::Atoms &atoms)
Definition
MultiResPeriodicGhostExchange.cpp:267
mrmd::data::impl::GeneralAtoms
Data structure for storing information about atoms on the host and the device.
Definition
Atoms.hpp:35
mrmd::data::impl::GeneralMolecules
Definition
Molecules.hpp:29
datatypes.hpp
mrmd::communication::impl::operator+
KOKKOS_INLINE_FUNCTION DoubleCounter operator+(const DoubleCounter &lhs, const DoubleCounter &rhs)
Definition
MultiResPeriodicGhostExchange.hpp:56
mrmd
Definition
BerendsenBarostat.cpp:18
mrmd::AXIS
AXIS
Definition
datatypes.hpp:141
mrmd::idx_t
int64_t idx_t
Definition
datatypes.hpp:91
mrmd::IndexView
Kokkos::View< idx_t * > IndexView
Definition
datatypes.hpp:153
mrmd::communication::impl::DoubleCounter
Definition
MultiResPeriodicGhostExchange.hpp:30
mrmd::communication::impl::DoubleCounter::DoubleCounter
KOKKOS_INLINE_FUNCTION DoubleCounter(idx_t newAtoms, idx_t newMolecules)
Definition
MultiResPeriodicGhostExchange.hpp:36
mrmd::communication::impl::DoubleCounter::molecules
idx_t molecules
Definition
MultiResPeriodicGhostExchange.hpp:32
mrmd::communication::impl::DoubleCounter::operator+=
KOKKOS_INLINE_FUNCTION DoubleCounter & operator+=(const DoubleCounter &rhs)
Definition
MultiResPeriodicGhostExchange.hpp:47
mrmd::communication::impl::DoubleCounter::DoubleCounter
DoubleCounter()=default
mrmd::communication::impl::DoubleCounter::DoubleCounter
DoubleCounter(const DoubleCounter &rhs)=default
mrmd::communication::impl::DoubleCounter::operator=
KOKKOS_INLINE_FUNCTION void operator=(const DoubleCounter &rhs)
Definition
MultiResPeriodicGhostExchange.hpp:40
mrmd::communication::impl::DoubleCounter::atoms
idx_t atoms
Definition
MultiResPeriodicGhostExchange.hpp:31
mrmd::data::Subdomain
|X|O|OOOOOOOOOO |X|O|OOOOOOOOOO |X|O+-------— <– minInnerCorner |X|OOOOOOOOOOOO |X+---------— <– minC...
Definition
Subdomain.hpp:38
mrmd
communication
MultiResPeriodicGhostExchange.hpp
Generated by
1.9.8