Merge pull request #147 from PhasicFlow/develop
bug fix for memory error in PhasicFlowPlus-fluid interaction
This commit is contained in:
commit
f169e3fc89
|
@ -21,42 +21,46 @@ Licence:
|
|||
#include "grainFluidParticles.hpp"
|
||||
#include "grainFluidParticlesKernels.hpp"
|
||||
|
||||
void pFlow::grainFluidParticles::checkHostMemory()
|
||||
{
|
||||
if(fluidForce_.size()!=fluidForceHost_.size())
|
||||
{
|
||||
resizeNoInit(fluidForceHost_, fluidForce_.size());
|
||||
resizeNoInit(fluidTorqueHost_, fluidTorque_.size());
|
||||
}
|
||||
|
||||
// copy the data (if required) from device to host
|
||||
courseGrainFactorHost_ = coarseGrainFactor().hostView();
|
||||
}
|
||||
|
||||
pFlow::grainFluidParticles::grainFluidParticles(
|
||||
systemControl &control,
|
||||
const property& prop
|
||||
)
|
||||
:
|
||||
grainParticles(control, prop),
|
||||
fluidForce_(
|
||||
objectFile(
|
||||
"fluidForce",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
dynPointStruct(),
|
||||
zero3
|
||||
),
|
||||
fluidTorque_(
|
||||
objectFile(
|
||||
"fluidTorque",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_NEVER
|
||||
),
|
||||
dynPointStruct(),
|
||||
zero3
|
||||
)
|
||||
{}
|
||||
systemControl &control,
|
||||
const property &prop)
|
||||
: grainParticles(control, prop),
|
||||
fluidForce_(
|
||||
objectFile(
|
||||
"fluidForce",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
dynPointStruct(),
|
||||
zero3),
|
||||
fluidTorque_(
|
||||
objectFile(
|
||||
"fluidTorque",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_NEVER),
|
||||
dynPointStruct(),
|
||||
zero3)
|
||||
{
|
||||
checkHostMemory();
|
||||
}
|
||||
|
||||
bool pFlow::grainFluidParticles::beforeIteration()
|
||||
{
|
||||
grainParticles::beforeIteration();
|
||||
|
||||
// copy the data (if required) from device to host
|
||||
courseGrainFactorHost_ = coarseGrainFactor().hostView();
|
||||
|
||||
checkHostMemory();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ protected:
|
|||
|
||||
hostViewType1D<real> courseGrainFactorHost_;
|
||||
|
||||
|
||||
void checkHostMemory();
|
||||
|
||||
public:
|
||||
|
||||
/// construct from systemControl and property
|
||||
|
|
|
@ -21,38 +21,44 @@ Licence:
|
|||
#include "sphereFluidParticles.hpp"
|
||||
#include "sphereFluidParticlesKernels.hpp"
|
||||
|
||||
void pFlow::sphereFluidParticles::checkHostMemory()
|
||||
{
|
||||
if(fluidForce_.size()!=fluidForceHost_.size())
|
||||
{
|
||||
resizeNoInit(fluidForceHost_, fluidForce_.size());
|
||||
resizeNoInit(fluidTorqueHost_, fluidTorque_.size());
|
||||
}
|
||||
}
|
||||
|
||||
pFlow::sphereFluidParticles::sphereFluidParticles(
|
||||
systemControl &control,
|
||||
const property& prop
|
||||
)
|
||||
:
|
||||
sphereParticles(control, prop),
|
||||
fluidForce_(
|
||||
objectFile(
|
||||
"fluidForce",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
dynPointStruct(),
|
||||
zero3
|
||||
),
|
||||
fluidTorque_(
|
||||
objectFile(
|
||||
"fluidTorque",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_NEVER
|
||||
),
|
||||
dynPointStruct(),
|
||||
zero3
|
||||
)
|
||||
{}
|
||||
systemControl &control,
|
||||
const property &prop)
|
||||
: sphereParticles(control, prop),
|
||||
fluidForce_(
|
||||
objectFile(
|
||||
"fluidForce",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
dynPointStruct(),
|
||||
zero3),
|
||||
fluidTorque_(
|
||||
objectFile(
|
||||
"fluidTorque",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_NEVER),
|
||||
dynPointStruct(),
|
||||
zero3)
|
||||
{
|
||||
checkHostMemory();
|
||||
}
|
||||
|
||||
bool pFlow::sphereFluidParticles::beforeIteration()
|
||||
{
|
||||
sphereParticles::beforeIteration();
|
||||
checkHostMemory();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ protected:
|
|||
|
||||
hostViewType1D<realx3> fluidTorqueHost_;
|
||||
|
||||
void checkHostMemory();
|
||||
|
||||
/*void zeroFluidForce_H()
|
||||
{
|
||||
fluidForce_.fillHost(zero3);
|
||||
|
|
Loading…
Reference in New Issue