11 using namespace OpenMPCD;
15 const unsigned int numberOfConstituents)
16 : simulation(sim), deviceMemoryManager(devMemMgr), mpcFluid(mpcFluid_),
17 realBuffer(NULL), imagBuffer(NULL)
33 saveFourierTransformedVelocities(rundir+
"/fourierTransformedVelocities");
44 void Base::readConfig()
50 for(
unsigned int i=0; i<k_n_config.
getSize(); ++i)
54 std::vector<MPCParticlePositionType> n;
66 void Base::saveFourierTransformedVelocities(
const std::string& datadir)
const
70 for(
unsigned int i=0; i<
k_n.size(); ++i)
72 std::stringstream path;
73 path<<datadir<<
"/"<<i<<
".data";
75 std::ofstream file(path.str().c_str(), std::ios::trunc);
76 file.precision(std::numeric_limits<FP>::digits10 + 2);
78 saveFourierTransformedVelocities(i, file);
82 void Base::saveFourierTransformedVelocities(
const unsigned int index, std::ostream& stream)
const
84 if(index >=
k_n.size())
91 stream<<
"#k_n:\t"<<current.
read<
FP>(0)<<
"\t"<<current.
read<
FP>(1)<<
"\t"<<current.
read<
FP>(2)<<
"\n";
101 <<value.
getX().real()<<
"\t"<<value.
getX().imag()<<
"\t"
102 <<value.
getY().real()<<
"\t"<<value.
getY().imag()<<
"\t"
103 <<value.
getZ().real()<<
"\t"<<value.
getZ().imag()<<
"\n";
Base class for MPC fluids.
bool has(const std::string &setting) const
Returns whether a setting with the given name exists.
const List getList(const std::string &name) const
Returns the list with the given name.
Represents the configuration of the simulation.
OPENMPCD_CUDA_HOST_AND_DEVICE T getZ() const
Returns the z coordinate.
unsigned int getSize() const
Returns the number of elements in the list.
#define OPENMPCD_THROW(ExceptionType, message)
Throws the given ExceptionType, passing the given message along with file and line number information...
Class for managing memory on the CUDA Device.
static void ensureDirectory(const std::string &path)
Ensures that the given directory exists, creating it and its parents if necessary.
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coordinate.
FP MPCParticlePositionType
The data type for the positions of MPC particles.
void read(const unsigned int index, ValueType *const value) const
Reads the specified setting and stores them in the given location.
OPENMPCD_CUDA_HOST_AND_DEVICE T getY() const
Returns the y coordinate.
const Configuration & getConfiguration() const
Returns the configuration.
Represents a list, or an array, of values.
MPCD simulation with Molecular Dynamics on CUDA-capable GPUs.
double FP
Default floating point type.
void freeMemory(void *const pointer)
Frees the Device memory pointed to by the given pointer.
Pointee * allocateMemory(const unsigned int instanceCount)
Allocates Device memory for the given number of instances of the supplied type.
Exception for out-of-bounds access.
const List getList(const unsigned int index) const
Returns the list with the given index.