OpenMPCD
CUDA/MPCFluid/DeviceCode/Base.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines CUDA Device code for OpenMPCD::CUDA::MPCFluid::Base
4  */
5 
6 #ifndef OPENMPCD_CUDA_MPCFLUID_DEVICECODE_BASE_HPP
7 #define OPENMPCD_CUDA_MPCFLUID_DEVICECODE_BASE_HPP
8 
9 #include <OpenMPCD/Types.hpp>
10 
11 namespace OpenMPCD
12 {
13 namespace CUDA
14 {
15 namespace MPCFluid
16 {
17 /**
18  * Contains CUDA Device code.
19  */
20 namespace DeviceCode
21 {
22  /**
23  * Sets the symbol mpcParticleCount.
24  * @param[in] count The number of MPC fluid particles.
25  */
26  void setMPCParticleCountSymbol(const unsigned int count);
27 
28  /**
29  * Computes the center of mass of logical entities, where each logical
30  * entity has a common number of constituent particles, each having the same
31  * mass.
32  *
33  * Each thread of this kernel computes one center of mass.
34  *
35  * @param[in] workUnitOffset
36  * The number of entities to skip; this is useful in case all
37  * entities cannot fit in one single kernel call.
38  * @param[in] positions
39  * The positions of the individual constituent particles, stored
40  * on the CUDA Device.
41  * It is assumed that first, the `x` coordinate of the first
42  * constituent particle of the first logical entity is stored,
43  * then its `y` and `z` coordinates; after that, the coordinates
44  * of the second constituent of the first logical entity,
45  * and so forth; after the last constituent of the first logical
46  * entity, the constituents of the second logical entity follow.
47  * In total, `positions` must hold at least
48  * `3 * particlesPerLogicalEntity * numberOfLogicalEntities`
49  * elements.
50  * @param[in] numberOfLogicalEntities
51  * The number of logical entities to treat.
52  * @param[in] particlesPerLogicalEntity
53  * The number of MPC particles per logical entity, which must
54  * not be `0`.
55  * @param[out] output
56  * The CUDA Device buffer to save the coordinates to. It must be
57  * able to hold at least `3 * numberOfLogicalEntities` elements.
58  * The first element in the buffer will be the `x`
59  * coordinate of the center of mass of the first logical entity,
60  * followed by the `y` and `z` coordinates. After that, the
61  * second entity's coordinates follow, and so on.
62  */
63  __global__ void computeLogicalEntityCentersOfMass(
64  const unsigned int workUnitOffset,
65  const MPCParticlePositionType* const positions,
66  const unsigned int numberOfLogicalEntities,
67  const unsigned int particlesPerLogicalEntity,
68  MPCParticlePositionType* const output);
69 } //namespace DeviceCode
70 } //namespace MPCFluid
71 } //namespace CUDA
72 } //namespace OpenMPCD
73 
74 #endif
OpenMPCD::MPCParticlePositionType
FP MPCParticlePositionType
The data type for the positions of MPC particles.
Definition: Types.hpp:15
OpenMPCD::CUDA::MPCFluid::DeviceCode::computeLogicalEntityCentersOfMass
__global__ void computeLogicalEntityCentersOfMass(const unsigned int workUnitOffset, const MPCParticlePositionType *const positions, const unsigned int numberOfLogicalEntities, const unsigned int particlesPerLogicalEntity, MPCParticlePositionType *const output)
Computes the center of mass of logical entities, where each logical entity has a common number of con...
Types.hpp
OpenMPCD::CUDA::MPCFluid::DeviceCode::setMPCParticleCountSymbol
void setMPCParticleCountSymbol(const unsigned int count)
Sets the symbol mpcParticleCount.