Go to the documentation of this file.
6 #ifndef OPENMPCD_CUDA_MPCFLUID_BASE_HPP
7 #define OPENMPCD_CUDA_MPCFLUID_BASE_HPP
56 const CUDA::Simulation*
const sim,
const unsigned int count,
const FP streamingTimestep_,
212 #ifdef OPENMPCD_DEBUG
251 std::vector<unsigned int>*
const matches,
252 unsigned int*
const matchCount
282 virtual void stream() = 0;
301 const unsigned int particleCount);
310 const unsigned int particleCount);
319 const unsigned int particleCount);
327 const unsigned int particleCount);
336 const unsigned int particleCount)
345 void readConfiguration();
MPCParticleVelocityType * d_mpcParticleVelocities
Device pointer for the MPC particle positions.
static FP getKineticEnergy(const MPCParticleVelocityType *const velocities, const unsigned int particleCount)
Returns the total kinetic energy of the MPC fluid.
Base class for MPC fluids.
DeviceMemoryManager *const deviceMemoryManager
The Device memory manager.
Represents a vector whose data is stored elsewhere.
const FP streamingTimestep
The timestep for a streaming step.
static unsigned int getParticleMass()
Returns the MPC fluid particle mass.
#define OPENMPCD_THROW(ExceptionType, message)
Throws the given ExceptionType, passing the given message along with file and line number information...
static const Vector3D< MPCParticleVelocityType > getTotalMomentum(const MPCParticleVelocityType *const velocities, const unsigned int particleCount)
Returns the total momentum of the given MPC fluid particles.
static void globalUnbiasedThermostat(const FP kT, MPCParticleVelocityType *const velocities, const unsigned int particleCount)
Scales all MPC fluid particle velocities so that the global temperature matches the given target.
virtual void stream()=0
Performs a streaming step.
void setPositionsAndVelocities(const MPCParticlePositionType *const positions, const MPCParticleVelocityType *const velocities)
Sets the positions and velocities of the particles on the Device.
Class for managing memory on the CUDA Device.
MPCParticlePositionType * mpcParticlePositions
Host pointer for the MPC particle positions.
void writeToSnapshot(VTFSnapshotFile *const snapshot) const
Writes the particle positions and velocities to the given snapshot file.
void saveLogicalEntityCentersOfMassToDeviceMemory(MPCParticlePositionType *const buffer) const
Computes the center of mass for each logical entity, and saves their coordinates in the given Device ...
void pushToDevice()
Copies the MPC fluid particles from the Host to the CUDA Device.
static const Vector3D< MPCParticleVelocityType > getMeanMomentum(const MPCParticleVelocityType *const velocities, const unsigned int particleCount)
Returns the mean momentum of the given MPC fluid particles.
const MPCParticlePositionType * getDevicePositions() const
Returns a const pointer to the MPC fluid positions on the Device.
FP MPCParticlePositionType
The data type for the positions of MPC particles.
Base(const CUDA::Simulation *const sim, const unsigned int count, const FP streamingTimestep_, RNG &rng_, DeviceMemoryManager *const devMemMgr)
The constructor.
MPCParticleVelocityType * getHostVelocities()
Returns a pointer to the MPC fluid velocities on the Host.
void findMatchingParticlesOnHost(bool(*func)(const RemotelyStoredVector< const MPCParticlePositionType > &, const RemotelyStoredVector< const MPCParticleVelocityType > &), std::vector< unsigned int > *const matches, unsigned int *const matchCount) const
Computes, on the Host, which MPC particles match the criterion represented by func.
void initializeVelocitiesOnHost() const
Initializes the fluid particles velocities in Host memory.
static const unsigned int mpcParticleMass
The mass of each MPC particle.
RNG rng
The random number generator.
Instrumentation::Base & getInstrumentation() const
Returns the fluid instrumentation.
const unsigned int numberOfParticles
The number of fluid particles.
void fetchFromDevice() const
Copies the MPC fluid particles from the CUDA Device to the Host.
MPCD simulation with Molecular Dynamics on CUDA-capable GPUs.
boost::mt11213b RNG
The random number generator type.
const MPCParticleVelocityType * getDeviceVelocities() const
Returns a const pointer to the MPC fluid velocities on the Device.
const RemotelyStoredVector< const MPCParticleVelocityType > getVelocity(const unsigned int particleID) const
Returns a MPC fluid particle's velocity vector.
unsigned int getParticleCount() const
Returns the number of MPC fluid particles.
double FP
Default floating point type.
Base class for MPC fluids instrumentation.
FP MPCParticleVelocityType
The data type for the velocities of MPC particles.
MPCParticlePositionType * getDevicePositions()
Returns a pointer to the MPC fluid positions on the Device.
MPCParticlePositionType * d_mpcParticlePositions
Device pointer for the MPC particle positions.
const CUDA::Simulation *const simulation
The simulation instance.
virtual unsigned int getNumberOfParticlesPerLogicalEntity() const
Returns the number of MPC particles per logical entity.
static FP getkTViaKineticEnergy(const MPCParticleVelocityType *const velocities, const unsigned int particleCount)
Returns the product of Boltzmann's constant with the MPC fluid temperature, as measured by the total ...
Representation of a simulation snapshot file in the VTF format.
virtual ~Base()
The destructor.
MPCParticleVelocityType * mpcParticleVelocities
Host pointer for the MPC particle positions.
MPCParticlePositionType * getHostPositions()
Returns a pointer to the MPC fluid positions on the Host.
Instrumentation::Base * instrumentation
The fluid instrumentation.
MPCParticleVelocityType * getDeviceVelocities()
Returns a pointer to the MPC fluid velocities on the Device.
const RemotelyStoredVector< const MPCParticlePositionType > getPosition(const unsigned int particleID) const
Returns a MPC fluid particle's position vector.
virtual unsigned int getNumberOfLogicalEntities() const =0
Returns the number of logical entities in the fluid.
virtual bool numberOfParticlesPerLogicalEntityIsConstant() const =0
Returns whether all logical entities consist of the same number of MPC particles.