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 "grainFluidParticles.hpp"
|
||||||
#include "grainFluidParticlesKernels.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(
|
pFlow::grainFluidParticles::grainFluidParticles(
|
||||||
systemControl &control,
|
systemControl &control,
|
||||||
const property& prop
|
const property &prop)
|
||||||
)
|
: grainParticles(control, prop),
|
||||||
:
|
fluidForce_(
|
||||||
grainParticles(control, prop),
|
objectFile(
|
||||||
fluidForce_(
|
"fluidForce",
|
||||||
objectFile(
|
"",
|
||||||
"fluidForce",
|
objectFile::READ_IF_PRESENT,
|
||||||
"",
|
objectFile::WRITE_ALWAYS),
|
||||||
objectFile::READ_IF_PRESENT,
|
dynPointStruct(),
|
||||||
objectFile::WRITE_ALWAYS
|
zero3),
|
||||||
),
|
fluidTorque_(
|
||||||
dynPointStruct(),
|
objectFile(
|
||||||
zero3
|
"fluidTorque",
|
||||||
),
|
"",
|
||||||
fluidTorque_(
|
objectFile::READ_IF_PRESENT,
|
||||||
objectFile(
|
objectFile::WRITE_NEVER),
|
||||||
"fluidTorque",
|
dynPointStruct(),
|
||||||
"",
|
zero3)
|
||||||
objectFile::READ_IF_PRESENT,
|
{
|
||||||
objectFile::WRITE_NEVER
|
checkHostMemory();
|
||||||
),
|
}
|
||||||
dynPointStruct(),
|
|
||||||
zero3
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool pFlow::grainFluidParticles::beforeIteration()
|
bool pFlow::grainFluidParticles::beforeIteration()
|
||||||
{
|
{
|
||||||
grainParticles::beforeIteration();
|
grainParticles::beforeIteration();
|
||||||
|
checkHostMemory();
|
||||||
// copy the data (if required) from device to host
|
|
||||||
courseGrainFactorHost_ = coarseGrainFactor().hostView();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ protected:
|
||||||
|
|
||||||
hostViewType1D<real> courseGrainFactorHost_;
|
hostViewType1D<real> courseGrainFactorHost_;
|
||||||
|
|
||||||
|
|
||||||
|
void checkHostMemory();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// construct from systemControl and property
|
/// construct from systemControl and property
|
||||||
|
|
|
@ -21,38 +21,44 @@ Licence:
|
||||||
#include "sphereFluidParticles.hpp"
|
#include "sphereFluidParticles.hpp"
|
||||||
#include "sphereFluidParticlesKernels.hpp"
|
#include "sphereFluidParticlesKernels.hpp"
|
||||||
|
|
||||||
|
void pFlow::sphereFluidParticles::checkHostMemory()
|
||||||
|
{
|
||||||
|
if(fluidForce_.size()!=fluidForceHost_.size())
|
||||||
|
{
|
||||||
|
resizeNoInit(fluidForceHost_, fluidForce_.size());
|
||||||
|
resizeNoInit(fluidTorqueHost_, fluidTorque_.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pFlow::sphereFluidParticles::sphereFluidParticles(
|
pFlow::sphereFluidParticles::sphereFluidParticles(
|
||||||
systemControl &control,
|
systemControl &control,
|
||||||
const property& prop
|
const property &prop)
|
||||||
)
|
: sphereParticles(control, prop),
|
||||||
:
|
fluidForce_(
|
||||||
sphereParticles(control, prop),
|
objectFile(
|
||||||
fluidForce_(
|
"fluidForce",
|
||||||
objectFile(
|
"",
|
||||||
"fluidForce",
|
objectFile::READ_IF_PRESENT,
|
||||||
"",
|
objectFile::WRITE_ALWAYS),
|
||||||
objectFile::READ_IF_PRESENT,
|
dynPointStruct(),
|
||||||
objectFile::WRITE_ALWAYS
|
zero3),
|
||||||
),
|
fluidTorque_(
|
||||||
dynPointStruct(),
|
objectFile(
|
||||||
zero3
|
"fluidTorque",
|
||||||
),
|
"",
|
||||||
fluidTorque_(
|
objectFile::READ_IF_PRESENT,
|
||||||
objectFile(
|
objectFile::WRITE_NEVER),
|
||||||
"fluidTorque",
|
dynPointStruct(),
|
||||||
"",
|
zero3)
|
||||||
objectFile::READ_IF_PRESENT,
|
{
|
||||||
objectFile::WRITE_NEVER
|
checkHostMemory();
|
||||||
),
|
}
|
||||||
dynPointStruct(),
|
|
||||||
zero3
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool pFlow::sphereFluidParticles::beforeIteration()
|
bool pFlow::sphereFluidParticles::beforeIteration()
|
||||||
{
|
{
|
||||||
sphereParticles::beforeIteration();
|
sphereParticles::beforeIteration();
|
||||||
|
checkHostMemory();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ protected:
|
||||||
|
|
||||||
hostViewType1D<realx3> fluidTorqueHost_;
|
hostViewType1D<realx3> fluidTorqueHost_;
|
||||||
|
|
||||||
|
void checkHostMemory();
|
||||||
|
|
||||||
/*void zeroFluidForce_H()
|
/*void zeroFluidForce_H()
|
||||||
{
|
{
|
||||||
fluidForce_.fillHost(zero3);
|
fluidForce_.fillHost(zero3);
|
||||||
|
|
Loading…
Reference in New Issue