sphereParticles tested on CPU, iteration, write to file, particle deletion
This commit is contained in:
parent
c0ee29e39c
commit
182e156786
|
@ -35,20 +35,20 @@ using rpIntegration = Kokkos::RangePolicy<
|
|||
|
||||
bool intAllActive(
|
||||
real dt,
|
||||
realx3PointField_D& y,
|
||||
realx3Field_D& y,
|
||||
realx3PointField_D& dy,
|
||||
realx3PointField_D& dy1)
|
||||
{
|
||||
|
||||
auto d_dy = dy.fieldDevice();
|
||||
auto d_y = y.fieldDevice();
|
||||
auto d_dy1= dy1.fieldDevice();
|
||||
auto d_dy = dy.deviceView();
|
||||
auto d_y = y.deviceView();
|
||||
auto d_dy1= dy1.deviceView();
|
||||
auto activeRng = dy1.activeRange();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsBashforth2::correct",
|
||||
rpIntegration (activeRng.start(), activeRng.end()),
|
||||
LAMBDA_HD(int32 i){
|
||||
LAMBDA_HD(uint32 i){
|
||||
d_y[i] += dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]);
|
||||
d_dy1[i] = d_dy[i];
|
||||
});
|
||||
|
@ -60,22 +60,22 @@ bool intAllActive(
|
|||
bool intScattered
|
||||
(
|
||||
real dt,
|
||||
realx3PointField_D& y,
|
||||
realx3Field_D& y,
|
||||
realx3PointField_D& dy,
|
||||
realx3PointField_D& dy1
|
||||
)
|
||||
{
|
||||
|
||||
auto d_dy = dy.fieldDevice();
|
||||
auto d_y = y.fieldDevice();
|
||||
auto d_dy1 = dy1.fieldDevice();
|
||||
auto d_dy = dy.deviceView();
|
||||
auto d_y = y.deviceView();
|
||||
auto d_dy1 = dy1.deviceView();
|
||||
auto activeRng = dy1.activeRange();
|
||||
const auto& activeP = dy1.activePointsMaskDevice();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsBashforth2::correct",
|
||||
rpIntegration (activeRng.start(), activeRng.end()),
|
||||
LAMBDA_HD(int32 i){
|
||||
LAMBDA_HD(uint32 i){
|
||||
if( activeP(i))
|
||||
{
|
||||
d_y[i] += dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]);
|
||||
|
@ -122,16 +122,30 @@ bool pFlow::AdamsBashforth2::predict
|
|||
realx3PointField_D& UNUSED(dy)
|
||||
)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::AdamsBashforth2::predict
|
||||
(
|
||||
real dt,
|
||||
realx3Field_D &y,
|
||||
realx3PointField_D &dy
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::AdamsBashforth2::correct
|
||||
(
|
||||
real dt,
|
||||
realx3PointField_D& y,
|
||||
realx3PointField_D& dy
|
||||
)
|
||||
{
|
||||
return correct(dt, y.field(), dy);
|
||||
}
|
||||
|
||||
bool pFlow::AdamsBashforth2::correct(real dt, realx3Field_D &y, realx3PointField_D &dy)
|
||||
{
|
||||
auto& dy1l = dy1();
|
||||
|
||||
|
@ -143,8 +157,7 @@ bool pFlow::AdamsBashforth2::correct
|
|||
{
|
||||
return intScattered(dt, y, dy, dy1l);
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool pFlow::AdamsBashforth2::setInitialVals(
|
||||
|
|
|
@ -81,12 +81,23 @@ public:
|
|||
real UNUSED(dt),
|
||||
realx3PointField_D& UNUSED(y),
|
||||
realx3PointField_D& UNUSED(dy)) final;
|
||||
|
||||
bool predict(
|
||||
real dt,
|
||||
realx3Field_D& y,
|
||||
realx3PointField_D& dy) final;
|
||||
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3PointField_D& y,
|
||||
realx3PointField_D& dy) final;
|
||||
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Field_D& y,
|
||||
realx3PointField_D& dy);
|
||||
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) final;
|
||||
|
|
|
@ -89,9 +89,9 @@ bool pFlow::AdamsBashforth3::intAll(
|
|||
realx3Vector_D& dy,
|
||||
range activeRng)
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_history = history_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_history = history_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsBashforth3::correct",
|
||||
|
|
|
@ -160,9 +160,9 @@ bool pFlow::AdamsBashforth3::intRange(
|
|||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_history = history_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_history = history_.deviceViewAll();
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
|
|
|
@ -89,9 +89,9 @@ bool pFlow::AdamsBashforth4::intAll(
|
|||
realx3Vector_D& dy,
|
||||
range activeRng)
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_history = history_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_history = history_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsBashforth4::correct",
|
||||
|
|
|
@ -165,9 +165,9 @@ bool pFlow::AdamsBashforth4::intRange(
|
|||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_history = history_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_history = history_.deviceViewAll();
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
|
|
|
@ -89,9 +89,9 @@ bool pFlow::AdamsBashforth5::intAll(
|
|||
realx3Vector_D& dy,
|
||||
range activeRng)
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_history = history_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_history = history_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsBashforth5::correct",
|
||||
|
|
|
@ -165,9 +165,9 @@ bool pFlow::AdamsBashforth5::intRange(
|
|||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_history = history_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_history = history_.deviceViewAll();
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
|
|
|
@ -124,11 +124,11 @@ bool pFlow::AdamsMoulton3::predictAll(
|
|||
range activeRng)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_dy1= dy1_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_dy1= dy1_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsMoulton3::predict",
|
||||
|
@ -150,12 +150,12 @@ bool pFlow::AdamsMoulton3::intAll(
|
|||
range activeRng)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsMoulton3::correct",
|
||||
|
|
|
@ -144,11 +144,11 @@ bool AdamsMoulton3::predictRange(
|
|||
realx3Vector_D& dy,
|
||||
activeFunctor activeP)
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_dy1= dy1_.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_dy1= dy1_.deviceViewAll();
|
||||
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
|
@ -182,12 +182,12 @@ bool pFlow::AdamsMoulton3::intRange(
|
|||
activeFunctor activeP)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
|
|
|
@ -135,13 +135,13 @@ bool pFlow::AdamsMoulton4::predictAll(
|
|||
range activeRng)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsMoulton4::predict",
|
||||
|
@ -165,13 +165,13 @@ bool pFlow::AdamsMoulton4::intAll(
|
|||
range activeRng)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsMoulton4::correct",
|
||||
|
|
|
@ -147,13 +147,13 @@ bool AdamsMoulton4::predictRange(
|
|||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
|
@ -185,13 +185,13 @@ bool pFlow::AdamsMoulton4::intRange(
|
|||
activeFunctor activeP )
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
|
|
|
@ -145,14 +145,14 @@ bool pFlow::AdamsMoulton5::predictAll(
|
|||
range activeRng)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_dy3 = dy3_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
auto d_dy3 = dy3_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsMoulton5::predict",
|
||||
|
@ -178,14 +178,14 @@ bool pFlow::AdamsMoulton5::intAll(
|
|||
range activeRng)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_dy3 = dy3_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
auto d_dy3 = dy3_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsMoulton5::correct",
|
||||
|
|
|
@ -150,14 +150,14 @@ bool AdamsMoulton5::predictRange(
|
|||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_dy3 = dy3_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
auto d_dy3 = dy3_.deviceViewAll();
|
||||
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
|
@ -189,14 +189,14 @@ bool pFlow::AdamsMoulton5::intRange(
|
|||
activeFunctor activeP )
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy = dy.deviceViewAll();
|
||||
auto d_y = y.deviceViewAll();
|
||||
|
||||
auto d_dy0 = dy0_.deviceVectorAll();
|
||||
auto d_y0 = y0_.deviceVectorAll();
|
||||
auto d_dy1 = dy1_.deviceVectorAll();
|
||||
auto d_dy2 = dy2_.deviceVectorAll();
|
||||
auto d_dy3 = dy3_.deviceVectorAll();
|
||||
auto d_dy0 = dy0_.deviceViewAll();
|
||||
auto d_y0 = y0_.deviceViewAll();
|
||||
auto d_dy1 = dy1_.deviceViewAll();
|
||||
auto d_dy2 = dy2_.deviceViewAll();
|
||||
auto d_dy3 = dy3_.deviceViewAll();
|
||||
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
|
|
|
@ -139,10 +139,16 @@ public:
|
|||
virtual
|
||||
bool predict(real dt, realx3PointField_D& y, realx3PointField_D& dy) = 0;
|
||||
|
||||
virtual
|
||||
bool predict(real dt, realx3Field_D& y, realx3PointField_D& dy) = 0;
|
||||
|
||||
/// Correction/main integration step
|
||||
virtual
|
||||
bool correct(real dt, realx3PointField_D& y, realx3PointField_D& dy) = 0;
|
||||
|
||||
virtual
|
||||
bool correct(real dt, realx3Field_D& y, realx3PointField_D& dy) = 0;
|
||||
|
||||
/// Set the initial values for new indices
|
||||
virtual
|
||||
bool setInitialVals(
|
||||
|
|
|
@ -219,11 +219,11 @@ bool pFlow::sphereParticles::initInertia()
|
|||
auto aPointsMask = dynPointStruct().activePointsMaskDevice();
|
||||
auto aRange = aPointsMask.activeRange();
|
||||
|
||||
auto field_shapeIndex = shapeIndex().fieldDevice();
|
||||
auto field_diameter = diameter_.fieldDevice();
|
||||
auto field_mass = mass_.fieldDevice();
|
||||
auto field_propId = propertyId_.fieldDevice();
|
||||
auto field_I = I_.fieldDevice();
|
||||
auto field_shapeIndex = shapeIndex().deviceView();
|
||||
auto field_diameter = diameter_.deviceView();
|
||||
auto field_mass = mass_.deviceView();
|
||||
auto field_propId = propertyId_.deviceView();
|
||||
auto field_I = I_.deviceView();
|
||||
|
||||
// get info from spheres shape
|
||||
realVector_D d("diameter", spheres_.boundingDiameter());
|
||||
|
@ -231,10 +231,10 @@ bool pFlow::sphereParticles::initInertia()
|
|||
uint32Vector_D propId("propId", spheres_.shapePropertyIds());
|
||||
realVector_D I("I", spheres_.Inertia());
|
||||
|
||||
auto d_d = d.deviceVector();
|
||||
auto d_mass = mass.deviceVector();
|
||||
auto d_propId = propId.deviceVector();
|
||||
auto d_I = I.deviceVector();
|
||||
auto d_d = d.deviceView();
|
||||
auto d_mass = mass.deviceView();
|
||||
auto d_propId = propId.deviceView();
|
||||
auto d_I = I.deviceView();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"particles::initInertia",
|
||||
|
@ -385,7 +385,7 @@ pFlow::sphereParticles::sphereParticles(
|
|||
auto index = indexHD.indicesHost();
|
||||
|
||||
realx3Vector rvel(n,RESERVE());
|
||||
const auto hrVel = rVelocity_.hostVector();
|
||||
const auto hrVel = rVelocity_.hostView();
|
||||
|
||||
for(auto i=0; i<n; i++)
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ bool pFlow::sphereParticles::beforeIteration()
|
|||
rVelIntegration_().predict(dt(),rVelocity_, rAcceleration_);
|
||||
intPredictTimer_.end();
|
||||
|
||||
WARNING<<"pFlow::sphereParticles::beforeIteration()"<<END_WARNING;
|
||||
//WARNING<<"pFlow::sphereParticles::beforeIteration()"<<END_WARNING;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -475,13 +475,13 @@ bool pFlow::sphereParticles::iterate()
|
|||
accelerationTimer_.start();
|
||||
pFlow::sphereParticlesKernels::acceleration(
|
||||
control().g(),
|
||||
mass().fieldDevice(),
|
||||
contactForce().fieldDevice(),
|
||||
I().fieldDevice(),
|
||||
contactTorque().fieldDevice(),
|
||||
mass().deviceView(),
|
||||
contactForce().deviceView(),
|
||||
I().deviceView(),
|
||||
contactTorque().deviceView(),
|
||||
dynPointStruct().activePointsMaskDevice(),
|
||||
accelertion().fieldDevice(),
|
||||
rAcceleration().fieldDevice()
|
||||
accelertion().deviceView(),
|
||||
rAcceleration().deviceView()
|
||||
);
|
||||
accelerationTimer_.end();
|
||||
|
||||
|
|
|
@ -78,16 +78,28 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
|||
|
||||
}
|
||||
|
||||
bool pFlow::dynamicPointStructure::predict
|
||||
(
|
||||
real dt,
|
||||
realx3PointField_D& acceleration
|
||||
)
|
||||
/*bool pFlow::dynamicPointStructure::beforeIteration()
|
||||
{
|
||||
//auto& pos = pStruct().pointPosition();
|
||||
pointStructure::beforeIteration();
|
||||
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
||||
return predict(dt(), acc);
|
||||
}*/
|
||||
|
||||
//if(!integrationPos_().predict(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
||||
//if(!integrationVel_().predict(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
||||
/*bool pFlow::dynamicPointStructure::iterate()
|
||||
{
|
||||
pointStructure::iterate();
|
||||
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
||||
return correct(dt(), acc);
|
||||
|
||||
}*/
|
||||
|
||||
bool pFlow::dynamicPointStructure::predict(
|
||||
real dt,
|
||||
realx3PointField_D &acceleration)
|
||||
{
|
||||
|
||||
if(!integrationPos_().predict(dt, pointPosition(), velocity_ ))return false;
|
||||
if(!integrationVel_().predict(dt, velocity_, acceleration))return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -100,9 +112,9 @@ bool pFlow::dynamicPointStructure::correct
|
|||
{
|
||||
//auto& pos = pStruct().pointPosition();
|
||||
|
||||
//if(!integrationPos_().correct(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
||||
if(!integrationPos_().correct(dt, pointPosition(), velocity_) )return false;
|
||||
|
||||
//if(!integrationVel_().correct(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
||||
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -121,7 +133,7 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::dynamicPointStructure::inser
|
|||
|
||||
if(!integrationPos_().needSetInitialVals()) return newIndicesPtr;
|
||||
|
||||
auto hVel = velocity_.hostVector();
|
||||
auto hVel = velocity_.hostView();
|
||||
auto n = newIndicesPtr().size();
|
||||
auto index = newIndicesPtr().indicesHost();
|
||||
|
||||
|
@ -158,8 +170,8 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::dynamicPointStructure::inser
|
|||
|
||||
realx3Vector pos(n,RESERVE());
|
||||
realx3Vector vel(n,RESERVE());
|
||||
const auto hVel = velocity().hostVector();
|
||||
const auto hPos = pStruct().pointPosition().hostVector();
|
||||
const auto hVel = velocity().hostView();
|
||||
const auto hPos = pStruct().pointPosition().hostView();
|
||||
|
||||
for(auto i=0; i<n; i++)
|
||||
{
|
||||
|
|
|
@ -80,10 +80,14 @@ public:
|
|||
return velocity_;
|
||||
}
|
||||
|
||||
/*inline auto velocityHostAll()
|
||||
{
|
||||
return velocity_.hostVectorAll();
|
||||
}*/
|
||||
/// In the time loop before iterate
|
||||
//bool beforeIteration() override;
|
||||
|
||||
/// @brief This is called in time loop. Perform the main calculations
|
||||
/// when the component should evolve along time.
|
||||
//bool iterate() override;
|
||||
|
||||
|
||||
|
||||
bool predict(real dt, realx3PointField_D& acceleration);
|
||||
|
||||
|
|
|
@ -259,8 +259,8 @@ public:
|
|||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
||||
Kokkos::deep_copy(hostVector(), src.hostVector());
|
||||
Kokkos::deep_copy(deviceVector(), src.deviceVector());
|
||||
Kokkos::deep_copy(hostView(), src.hostView());
|
||||
Kokkos::deep_copy(deviceView(), src.deviceView());
|
||||
}
|
||||
|
||||
// copy construct with new name
|
||||
|
@ -280,8 +280,8 @@ public:
|
|||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
||||
Kokkos::deep_copy(hostVector(), src.hostVector());
|
||||
Kokkos::deep_copy(deviceVector(), src.deviceVector());
|
||||
Kokkos::deep_copy(hostView(), src.hostView());
|
||||
Kokkos::deep_copy(deviceView(), src.deviceView());
|
||||
}
|
||||
|
||||
// - copy assignment
|
||||
|
@ -332,53 +332,53 @@ public:
|
|||
}
|
||||
|
||||
// - Device vector
|
||||
INLINE_FUNCTION_H deviceViewType& deviceVectorAll(){
|
||||
INLINE_FUNCTION_H deviceViewType& deviceViewAll(){
|
||||
return dualView_.d_view;
|
||||
}
|
||||
|
||||
// - Device vector
|
||||
INLINE_FUNCTION_H const deviceViewType& deviceVectorAll() const {
|
||||
INLINE_FUNCTION_H const deviceViewType& deviceViewAll() const {
|
||||
return dualView_.d_view;
|
||||
}
|
||||
|
||||
// - Host vector
|
||||
INLINE_FUNCTION_H hostViewType& hostVectorAll(){
|
||||
INLINE_FUNCTION_H hostViewType& hostViewAll(){
|
||||
return dualView_.h_view;
|
||||
}
|
||||
|
||||
// - Host Vector
|
||||
INLINE_FUNCTION_H const hostViewType& hostVectorAll() const {
|
||||
INLINE_FUNCTION_H const hostViewType& hostViewAll() const {
|
||||
return dualView_.h_view;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H deviceViewType& deviceVector(){
|
||||
INLINE_FUNCTION_H deviceViewType& deviceView(){
|
||||
updateSubViews();
|
||||
return deviceSubView_;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H const deviceViewType& deviceVector() const{
|
||||
INLINE_FUNCTION_H const deviceViewType& deviceView() const{
|
||||
updateSubViews();
|
||||
return deviceSubView_;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H hostViewType& hostVector(){
|
||||
INLINE_FUNCTION_H hostViewType& hostView(){
|
||||
updateSubViews();
|
||||
return hostSubView_;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H const hostViewType& hostVector()const{
|
||||
INLINE_FUNCTION_H const hostViewType& hostView()const{
|
||||
updateSubViews();
|
||||
return hostSubView_;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H
|
||||
hostViewType hostVector(int32 start, int32 end)const
|
||||
hostViewType hostView(int32 start, int32 end)const
|
||||
{
|
||||
return Kokkos::subview(dualView_.h_view, Kokkos::make_pair(start,end));
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H
|
||||
deviceViewType deviceVector(int32 start, int32 end)const
|
||||
deviceViewType deviceView(int32 start, int32 end)const
|
||||
{
|
||||
return Kokkos::subview(dualView_.d_view, Kokkos::make_pair(start,end));
|
||||
}
|
||||
|
@ -455,22 +455,22 @@ public:
|
|||
INLINE_FUNCTION_H void fill(const T& val)
|
||||
{
|
||||
if(empty())return;
|
||||
Kokkos::deep_copy(deviceVector(),val);
|
||||
Kokkos::deep_copy(hostVector(),val);
|
||||
Kokkos::deep_copy(deviceView(),val);
|
||||
Kokkos::deep_copy(hostView(),val);
|
||||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H void fillHost(const T& val)
|
||||
{
|
||||
if(empty())return;
|
||||
Kokkos::deep_copy(hostVector(),val);
|
||||
Kokkos::deep_copy(hostView(),val);
|
||||
modifyOnHost();
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H void fillDevice(const T& val)
|
||||
{
|
||||
if(empty())return;
|
||||
Kokkos::deep_copy(deviceVector(),val);
|
||||
Kokkos::deep_copy(deviceView(),val);
|
||||
modifyOnDevice();
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ public:
|
|||
size_t newSize = indices.size();
|
||||
|
||||
deviceViewType sortedView("sortedView", newSize);
|
||||
auto dVec = deviceVectorAll();
|
||||
auto dVec = deviceViewAll();
|
||||
|
||||
auto d_indices = indices.deviceView();
|
||||
|
||||
|
@ -570,7 +570,7 @@ public:
|
|||
|
||||
Kokkos::fence();
|
||||
setSize(newSize);
|
||||
copy(deviceVector(), sortedView);
|
||||
copy(deviceView(), sortedView);
|
||||
modifyOnDevice();
|
||||
syncViews();
|
||||
}
|
||||
|
@ -586,10 +586,10 @@ public:
|
|||
{
|
||||
resize(maxInd+1);
|
||||
}
|
||||
fillSelected(hostVectorAll(), indices.hostView(), indices.size(), val);
|
||||
fillSelected(hostViewAll(), indices.hostView(), indices.size(), val);
|
||||
|
||||
auto dIndices = indices.deviceView();
|
||||
auto dVals = deviceVectorAll();
|
||||
auto dVals = deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"fillSelected",
|
||||
|
@ -627,10 +627,10 @@ public:
|
|||
{
|
||||
|
||||
hostViewType1D<T> hVecVals( const_cast<T*>(vals.data()), vals.size());
|
||||
//fillSelected(hostVector(), indices.hostView(), hVecVals, indices.size());
|
||||
//fillSelected(hostView(), indices.hostView(), hVecVals, indices.size());
|
||||
|
||||
pFlow::algorithms::KOKKOS::fillSelected<T, int32, DefaultHostExecutionSpace>(
|
||||
hostVectorAll().data(),
|
||||
hostViewAll().data(),
|
||||
indices.hostView().data(),
|
||||
hVecVals.data(),
|
||||
indices.size());
|
||||
|
@ -648,9 +648,9 @@ public:
|
|||
Kokkos::deep_copy(dVecVals, hVecVals);
|
||||
|
||||
|
||||
//fillSelected(deviceVector(), indices.deviceView(), dVecVals, indices.size());
|
||||
//fillSelected(deviceView(), indices.deviceView(), dVecVals, indices.size());
|
||||
pFlow::algorithms::KOKKOS::fillSelected<T, int32, execution_space>(
|
||||
deviceVectorAll().data(),
|
||||
deviceViewAll().data(),
|
||||
indices.deviceView().data(),
|
||||
dVecVals.data(),
|
||||
indices.size());
|
||||
|
@ -683,7 +683,7 @@ public:
|
|||
if constexpr (std::is_same<side,HostSide>::value )
|
||||
{
|
||||
hostViewType1D<int32> hVecInd( const_cast<int32*>(indices.data()), indices.size());
|
||||
fillSelected( hostVectorAll(), hVecInd, indices.size(), val);
|
||||
fillSelected( hostViewAll(), hVecInd, indices.size(), val);
|
||||
|
||||
modifyOnHost();
|
||||
syncViews(minInd, maxInd+1);
|
||||
|
@ -696,7 +696,7 @@ public:
|
|||
hostViewType1D<int32> hVecInd( const_cast<int32*>(indices.data()), indices.size());
|
||||
deviceViewType1D<int32> dVecInd("dVecInd", indices.size());
|
||||
Kokkos::deep_copy(dVecInd, hVecInd);
|
||||
fillSelected(deviceVectorAll(), dVecInd, indices.size(), val);
|
||||
fillSelected(deviceViewAll(), dVecInd, indices.size(), val);
|
||||
|
||||
modifyOnDevice();
|
||||
|
||||
|
@ -734,7 +734,7 @@ public:
|
|||
hostViewType1D<int32> hVecInd( const_cast<int32*>(indices.data()), indices.size());
|
||||
hostViewType1D<T> hVecVals( const_cast<T*>(vals.data()), vals.size());
|
||||
|
||||
fillSelected(hostVectorAll(), hVecInd, hVecVals, indices.size());
|
||||
fillSelected(hostViewAll(), hVecInd, hVecVals, indices.size());
|
||||
|
||||
modifyOnHost();
|
||||
|
||||
|
@ -752,7 +752,7 @@ public:
|
|||
Kokkos::deep_copy(dVecVals, hVecVals);
|
||||
Kokkos::deep_copy(dVecInd, hVecInd);
|
||||
|
||||
fillSelected(deviceVectorAll(), dVecInd, dVecVals, indices.size());
|
||||
fillSelected(deviceViewAll(), dVecInd, dVecVals, indices.size());
|
||||
|
||||
modifyOnDevice();
|
||||
|
||||
|
@ -858,7 +858,7 @@ public:
|
|||
{
|
||||
if(empty())return;
|
||||
|
||||
Kokkos::deep_copy(deviceVector(), hostVector());
|
||||
Kokkos::deep_copy(deviceView(), hostView());
|
||||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
||||
|
@ -866,7 +866,7 @@ public:
|
|||
void copyHostToDevice(int32 start, int32 end, bool setUpdated = true)
|
||||
{
|
||||
if(empty())return;
|
||||
Kokkos::deep_copy(deviceVector(start, end), hostVector(start, end));
|
||||
Kokkos::deep_copy(deviceView(start, end), hostView(start, end));
|
||||
if(setUpdated)
|
||||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
@ -876,7 +876,7 @@ public:
|
|||
INLINE_FUNCTION_H void copyDeviceToHost()
|
||||
{
|
||||
if(empty())return;
|
||||
Kokkos::deep_copy(hostVector(), deviceVector());
|
||||
Kokkos::deep_copy(hostView(), deviceView());
|
||||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
||||
|
@ -884,7 +884,7 @@ public:
|
|||
void copyDeviceToHost(int32 start, int32 end, bool setUpdated = true)
|
||||
{
|
||||
if(empty())return;
|
||||
Kokkos::deep_copy(hostVector(start, end), deviceVector(start, end));
|
||||
Kokkos::deep_copy(hostView(start, end), deviceView(start, end));
|
||||
if(setUpdated)
|
||||
dualView_.clear_sync_state();
|
||||
}
|
||||
|
@ -962,12 +962,12 @@ public:
|
|||
if(hostRequiresSync()) // device is updated
|
||||
{
|
||||
//const auto dVec = Kokkos::subview(dualView_.d_view, Kokkos::make_pair(0,int(size_)));
|
||||
Kokkos::deep_copy(mirror,deviceVector());
|
||||
Kokkos::deep_copy(mirror,deviceView());
|
||||
}
|
||||
else // either host is updated or both sides are syncronized
|
||||
{
|
||||
//const auto hVec = Kokkos::subview(dualView_.h_view, Kokkos::make_pair(0,int(size_)));
|
||||
Kokkos::deep_copy(mirror,hostVector());
|
||||
Kokkos::deep_copy(mirror,hostView());
|
||||
}
|
||||
return vecToFile.write(os);
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ int64 count(const VectorDual<T,MemorySpace>& vec, const T& val)
|
|||
{
|
||||
if constexpr (std::is_same<side,HostSide>::value)
|
||||
{
|
||||
return count( vec.hostVectorAll(), static_cast<size_t>(0), vec.size(), val);
|
||||
return count( vec.hostViewAll(), static_cast<size_t>(0), vec.size(), val);
|
||||
}
|
||||
else
|
||||
{
|
||||
return count( vec.deviceVectorAll(), static_cast<size_t>(0), vec.size(), val);
|
||||
return count( vec.deviceViewAll(), static_cast<size_t>(0), vec.size(), val);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -63,11 +63,11 @@ int64 min(const VectorDual<T,MemorySpace>& vec)
|
|||
{
|
||||
if constexpr (std::is_same<side,HostSide>::value)
|
||||
{
|
||||
return min( vec.hostVectorAll(), static_cast<size_t>(0), vec.size());
|
||||
return min( vec.hostViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
return min( vec.deviceVectorAll(), static_cast<size_t>(0), vec.size());
|
||||
return min( vec.deviceViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
|
@ -87,11 +87,11 @@ int64 max(const VectorDual<T,MemorySpace>& vec)
|
|||
{
|
||||
if constexpr (std::is_same<side,HostSide>::value)
|
||||
{
|
||||
return max( vec.hostVectorAll(), static_cast<size_t>(0), vec.size());
|
||||
return max( vec.hostViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
return max( vec.deviceVectorAll(), static_cast<size_t>(0), vec.size());
|
||||
return max( vec.deviceViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
|
|
|
@ -182,7 +182,7 @@ pFlow::VectorSingle<T,MemorySpace>::VectorSingle
|
|||
:
|
||||
VectorSingle(name, src.capacity(), src.size(), RESERVE())
|
||||
{
|
||||
copy(deviceVector(), src.deviceVector());
|
||||
copy(deviceView(), src.deviceView());
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
|
@ -213,13 +213,6 @@ pFlow::uniquePtr<pFlow::VectorSingle<T,MemorySpace>>
|
|||
return makeUnique<VectorSingle>( this->name(), *this);
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
pFlow::VectorSingle<T,MemorySpace>*
|
||||
pFlow::VectorSingle<T,MemorySpace>::clonePtr()const
|
||||
{
|
||||
return new VectorSingle(this->name(), *this);
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
|
@ -239,21 +232,23 @@ pFlow::VectorSingle<T,MemorySpace>::VectorField()const
|
|||
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::deviceVectorAll() const
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::deviceViewAll() const
|
||||
{
|
||||
return view_;
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::deviceVector()const
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::deviceView()const
|
||||
{
|
||||
return Kokkos::subview(view_, Kokkos::make_pair(0,int(size_)));
|
||||
return Kokkos::subview(
|
||||
view_,
|
||||
Kokkos::make_pair(0u,static_cast<uint32>(size_)));
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::hostVectorAll()const
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::hostViewAll()const
|
||||
{
|
||||
auto hView = Kokkos::create_mirror_view(view_);
|
||||
copy(hView, view_);
|
||||
|
@ -262,10 +257,10 @@ auto pFlow::VectorSingle<T,MemorySpace>::hostVectorAll()const
|
|||
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::hostVector()const
|
||||
auto pFlow::VectorSingle<T,MemorySpace>::hostView()const
|
||||
{
|
||||
auto hView = Kokkos::create_mirror_view(deviceVector());
|
||||
copy(hView, deviceVector());
|
||||
auto hView = Kokkos::create_mirror_view(deviceView());
|
||||
copy(hView, deviceView());
|
||||
return hView;
|
||||
}
|
||||
|
||||
|
@ -402,7 +397,7 @@ void pFlow::VectorSingle<T,MemorySpace>::assign
|
|||
|
||||
// - unmanaged view in the host
|
||||
hostViewType1D<const T> temp(src.data(), srcSize );
|
||||
copy(deviceVector(), temp);
|
||||
copy(deviceView(), temp);
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
|
@ -429,7 +424,7 @@ void pFlow::VectorSingle<T,MemorySpace>::assign(const VectorTypeHost& src)
|
|||
{
|
||||
setSize(srcSize);
|
||||
}
|
||||
copy(deviceVector(), src.hostVector());
|
||||
copy(deviceView(), src.hostView());
|
||||
}
|
||||
|
||||
template<typename T, typename MemorySpace>
|
||||
|
@ -528,7 +523,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::insertSetElement
|
|||
|
||||
Kokkos::parallel_for(
|
||||
"VectorSingle::insertSetElement",
|
||||
policy(0,indices.size()), LAMBDA_HD(int32 i){
|
||||
policy(0,indices.size()), LAMBDA_HD(uint32 i){
|
||||
dVec(ind(i))= dVals(i);});
|
||||
Kokkos::fence();
|
||||
|
||||
|
@ -540,7 +535,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::insertSetElement
|
|||
|
||||
Kokkos::parallel_for(
|
||||
"VectorSingle::insertSetElement",
|
||||
policy(0,indices.size()), LAMBDA_HD(int32 i){
|
||||
policy(0,indices.size()), LAMBDA_HD(uint32 i){
|
||||
dVec(ind(i))= hVals(i);});
|
||||
Kokkos::fence();
|
||||
|
||||
|
@ -579,7 +574,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::insertSetElement
|
|||
|
||||
Kokkos::parallel_for(
|
||||
"VectorSingle::insertSetElement",
|
||||
policy(0,indices.size()), LAMBDA_HD(int32 i){
|
||||
policy(0,indices.size()), LAMBDA_HD(uint32 i){
|
||||
dVec(ind(i))= dVals(i);});
|
||||
Kokkos::fence();
|
||||
|
||||
|
@ -592,7 +587,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::insertSetElement
|
|||
|
||||
Kokkos::parallel_for(
|
||||
"VectorSingle::insertSetElement",
|
||||
policy(0,indices.size()), LAMBDA_HD(int32 i){
|
||||
policy(0,indices.size()), LAMBDA_HD(uint32 i){
|
||||
dVec(ind(i))= hVals(i);});
|
||||
Kokkos::fence();
|
||||
|
||||
|
@ -665,7 +660,7 @@ bool pFlow::VectorSingle<T,MemorySpace>::reorderItems(uint32IndexContainer indic
|
|||
Kokkos::fence();
|
||||
}
|
||||
|
||||
copy(deviceVector(), sortedView);
|
||||
copy(deviceView(), sortedView);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -178,10 +178,7 @@ public:
|
|||
INLINE_FUNCTION_H
|
||||
uniquePtr<VectorSingle> clone() const;
|
||||
|
||||
/// Clone as a pointer (perform deep copy)
|
||||
INLINE_FUNCTION_H
|
||||
VectorSingle* clonePtr()const;
|
||||
|
||||
|
||||
//// - Methods
|
||||
|
||||
/// Return *this
|
||||
|
@ -192,22 +189,22 @@ public:
|
|||
INLINE_FUNCTION_H
|
||||
const VectorType& VectorField()const;
|
||||
|
||||
/// Device vector range [0,capcity)
|
||||
/// Device view range [0,capcity)
|
||||
INLINE_FUNCTION_H
|
||||
auto deviceVectorAll() const;
|
||||
auto deviceViewAll() const;
|
||||
|
||||
/// Device vector range [0, size)
|
||||
/// Device view range [0, size)
|
||||
INLINE_FUNCTION_H
|
||||
auto deviceVector()const;
|
||||
auto deviceView()const;
|
||||
|
||||
/// Return a vector accessible on Host in range [0,capacity)
|
||||
/// Return a view accessible on Host in range [0,capacity)
|
||||
INLINE_FUNCTION_H
|
||||
auto hostVectorAll()const;
|
||||
auto hostViewAll()const;
|
||||
|
||||
|
||||
/// Return a vector accessible on Host in range [0,size)
|
||||
/// Return a view accessible on Host in range [0,size)
|
||||
INLINE_FUNCTION_H
|
||||
auto hostVector()const;
|
||||
auto hostView()const;
|
||||
|
||||
/// Name of the vector
|
||||
INLINE_FUNCTION_H
|
||||
|
@ -403,7 +400,7 @@ public:
|
|||
FUNCTION_H
|
||||
bool write(iOstream& os, const IOPattern& iop)const
|
||||
{
|
||||
auto hVec = hostVector();
|
||||
auto hVec = hostView();
|
||||
auto sp = span<T>( const_cast<T*>(hVec.data()), hVec.size());
|
||||
|
||||
return writeSpan(os, sp, iop);
|
||||
|
@ -413,7 +410,7 @@ public:
|
|||
FUNCTION_H
|
||||
bool write(iOstream& os)const
|
||||
{
|
||||
auto hVec = hostVector();
|
||||
auto hVec = hostView();
|
||||
auto sp = span<T>( const_cast<T*>(hVec.data()), hVec.size());
|
||||
|
||||
return writeSpan(os, sp);
|
||||
|
@ -424,7 +421,7 @@ public:
|
|||
FUNCTION_H
|
||||
bool write(iOstream& os, const IOPattern& iop, const HostMask& mask)const
|
||||
{
|
||||
auto hVec = hostVector();
|
||||
auto hVec = hostView();
|
||||
|
||||
auto numActive = mask.numActive();
|
||||
std::vector<T> finalField;
|
||||
|
@ -518,5 +515,5 @@ inline iOstream& operator << (iOstream& os, const VectorSingle<T, MemorySpace>&
|
|||
INLINE_FUNCTION_H
|
||||
bool append(const VectorSingle& Vec)
|
||||
{
|
||||
return append(Vec.deviceVector(), Vec.size());
|
||||
return append(Vec.deviceView(), Vec.size());
|
||||
}*/
|
|
@ -28,14 +28,14 @@ template<typename T, typename MemorySpace>
|
|||
INLINE_FUNCTION_H
|
||||
size_t count(const VectorSingle<T,MemorySpace>& vec, const T& val)
|
||||
{
|
||||
return count( vec.deviceVectorAll(), 0, vec.size(), val);
|
||||
return count( vec.deviceViewAll(), 0, vec.size(), val);
|
||||
}
|
||||
|
||||
template<class T, class MemorySpace>
|
||||
INLINE_FUNCTION_H T min( const VectorSingle<T,MemorySpace>& vec)
|
||||
{
|
||||
return min(
|
||||
vec.deviceVectorAll(),
|
||||
vec.deviceViewAll(),
|
||||
0, vec.size()
|
||||
);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ template<class T, class MemorySpace>
|
|||
INLINE_FUNCTION_H T max( const VectorSingle<T, MemorySpace>& vec)
|
||||
{
|
||||
return min(
|
||||
vec.deviceVectorAll(),
|
||||
vec.deviceViewAll(),
|
||||
0, vec.size()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ typename pFlow::internalField<T, MemorySpace>::FieldTypeHost
|
|||
pFlow::internalField<T, MemorySpace>::activeValuesHost() const
|
||||
{
|
||||
auto maskH = internalPoints_.activePointsMaskHost();
|
||||
auto fieldH = field_.hostVector();
|
||||
auto fieldH = field_.hostView();
|
||||
|
||||
FieldTypeHost aField
|
||||
(
|
||||
|
@ -105,13 +105,6 @@ bool pFlow::internalField<T, MemorySpace>::write
|
|||
const IOPattern& iop
|
||||
)const
|
||||
{
|
||||
if( internalPoints_.isAllActive() )
|
||||
{
|
||||
return field_.write(os, iop);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto aField = activeValuesHost();
|
||||
return aField.write(os, iop);
|
||||
}
|
||||
auto aField = activeValuesHost();
|
||||
return aField.write(os, iop);
|
||||
}
|
|
@ -75,22 +75,30 @@ public:
|
|||
const internalPoints& internal,
|
||||
const T& val);
|
||||
|
||||
|
||||
auto fieldDevice()const
|
||||
inline
|
||||
auto deviceView()const
|
||||
{
|
||||
return field_.deviceVector();
|
||||
return field_.deviceView();
|
||||
}
|
||||
|
||||
auto fieldHost()const
|
||||
inline
|
||||
auto hostView()const
|
||||
{
|
||||
return field_.hostVector();
|
||||
return field_.hostView();
|
||||
}
|
||||
|
||||
inline
|
||||
const FieldType& field()const
|
||||
{
|
||||
return field_;
|
||||
}
|
||||
|
||||
inline
|
||||
FieldType& field()
|
||||
{
|
||||
return field_;
|
||||
}
|
||||
|
||||
const pFlagTypeDevice& activePointsMaskDevice()const
|
||||
{
|
||||
return internalPoints_.activePointsMaskDevice();
|
||||
|
|
|
@ -39,7 +39,7 @@ T min(const internalField<T,MemorySpace>& iField)
|
|||
// this is a device view
|
||||
auto maskD = iField.activePointsMaskDevice();
|
||||
auto aRange = maskD.activeRange();
|
||||
auto filed = iField.field().deviceVectorAll();
|
||||
auto filed = iField.field().deviceViewAll();
|
||||
|
||||
T minElement;
|
||||
|
||||
|
@ -59,7 +59,7 @@ T min(const internalField<T,MemorySpace>& iField)
|
|||
// this is a host view
|
||||
auto maskH = iField.activePointsMaskHost();
|
||||
auto aRange = maskH.activeRange();
|
||||
auto filed = iField.field().deviceVectorAll();
|
||||
auto filed = iField.field().deviceViewAll();
|
||||
T minElement;
|
||||
Kokkos::parallel_reduce(
|
||||
"min(internalField)",
|
||||
|
@ -90,7 +90,7 @@ T max(const internalField<T,MemorySpace>& iField)
|
|||
// this is a device view
|
||||
auto maskD = iField.activePointsMaskDevice();
|
||||
auto aRange = maskD.activeRange();
|
||||
auto filed = iField.field().deviceVectorAll();
|
||||
auto filed = iField.field().deviceViewAll();
|
||||
|
||||
T maxElement;
|
||||
|
||||
|
@ -110,7 +110,7 @@ T max(const internalField<T,MemorySpace>& iField)
|
|||
// this is a host view
|
||||
auto maskH = iField.activePointsMaskHost();
|
||||
auto aRange = maskH.activeRange();
|
||||
auto filed = iField.field().deviceVectorAll();
|
||||
auto filed = iField.field().deviceViewAll();
|
||||
|
||||
T maxElement;
|
||||
|
||||
|
@ -143,7 +143,7 @@ Pair<T,T> minMax(const internalField<T,MemorySpace>& iField)
|
|||
// this is a device view
|
||||
auto maskD = iField.activePointsMaskDevice();
|
||||
auto aRange = maskD.activeRange();
|
||||
auto filed = iField.field().deviceVectorAll();
|
||||
auto filed = iField.field().deviceViewAll();
|
||||
|
||||
T minElement;
|
||||
T maxElement;
|
||||
|
@ -170,7 +170,7 @@ Pair<T,T> minMax(const internalField<T,MemorySpace>& iField)
|
|||
// this is a host view
|
||||
auto maskH = iField.activePointsMaskHost();
|
||||
auto aRange = maskH.activeRange();
|
||||
auto filed = iField.field().deviceVectorAll();
|
||||
auto filed = iField.field().deviceViewAll();
|
||||
|
||||
T minElement;
|
||||
T maxElement;
|
||||
|
|
|
@ -109,15 +109,15 @@ T maxActive(const pointField<VectorSingle, T, MemorySpace>& pField)
|
|||
{
|
||||
if(len < sizeToSerial__ ) // serial execution instead of lunching parallel execution
|
||||
return maxActive_serial(
|
||||
pField.deviceVectorAll(),
|
||||
pField.pointFlag().hostVectorAll(),
|
||||
pField.deviceViewAll(),
|
||||
pField.pointFlag().hostViewAll(),
|
||||
static_cast<size_t>(0),
|
||||
len
|
||||
);
|
||||
else
|
||||
return maxActiveH(
|
||||
pField.deviceVectorAll(),
|
||||
pField.pointFlag().hostVectorAll(),
|
||||
pField.deviceViewAll(),
|
||||
pField.pointFlag().hostViewAll(),
|
||||
static_cast<size_t>(0),
|
||||
len
|
||||
);
|
||||
|
@ -125,8 +125,8 @@ T maxActive(const pointField<VectorSingle, T, MemorySpace>& pField)
|
|||
else
|
||||
{
|
||||
return maxActiveD(
|
||||
pField.deviceVectorAll(),
|
||||
pField.pointFlag().deviceVectorAll(),
|
||||
pField.deviceViewAll(),
|
||||
pField.pointFlag().deviceViewAll(),
|
||||
static_cast<size_t>(0),
|
||||
len
|
||||
);
|
||||
|
@ -148,23 +148,23 @@ T maxActive(const pointField<VectorDual, T, MemorySpace>& pField)
|
|||
{
|
||||
if( len < sizeToSerial__)
|
||||
return maxActive_serial(
|
||||
pField.hostVectorAll(),
|
||||
pField.pointFlag().hostVectorAll(),
|
||||
pField.hostViewAll(),
|
||||
pField.pointFlag().hostViewAll(),
|
||||
static_cast<size_t>(0),
|
||||
len
|
||||
);
|
||||
else
|
||||
return maxActiveH(
|
||||
pField.hostVectorAll(),
|
||||
pField.pointFlag().hostVectorAll(),
|
||||
pField.hostViewAll(),
|
||||
pField.pointFlag().hostViewAll(),
|
||||
static_cast<size_t>(0),
|
||||
len
|
||||
);
|
||||
}else
|
||||
{
|
||||
return maxActiveD(
|
||||
pField.deviceVectorAll(),
|
||||
pField.pointFlag().deviceVectorAll(),
|
||||
pField.deviceViewAll(),
|
||||
pField.pointFlag().deviceViewAll(),
|
||||
static_cast<size_t>(0),
|
||||
len
|
||||
);
|
||||
|
|
|
@ -25,6 +25,7 @@ Licence:
|
|||
#include "typeInfo.hpp"
|
||||
#include "dictionary.hpp"
|
||||
|
||||
#include "streams.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
@ -108,8 +109,9 @@ public:
|
|||
inline
|
||||
bool isMember(T val, T epsilon = 0)const
|
||||
{
|
||||
|
||||
if(!isInRange(val)) return false;
|
||||
if(abs(mod(val-begin_,stride_))<= epsilon) return true;
|
||||
if(T dist = val-begin_; abs(dist%stride_)<= epsilon) return true;
|
||||
if(equal(val,begin_))return true;
|
||||
if(equal(val,end_))return true;
|
||||
return false;
|
||||
|
@ -147,6 +149,22 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
inline
|
||||
bool stridedRange<real>::isMember(real val, real epsilon)const
|
||||
{
|
||||
|
||||
if(!isInRange(val)) return false;
|
||||
real dist = val-begin_;
|
||||
if(abs(
|
||||
(dist-(static_cast<uint64>((dist+0.01*epsilon)/stride_)*stride_))
|
||||
)<= epsilon) return true;
|
||||
if(equal(val,begin_))return true;
|
||||
if(equal(val,end_))return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif //__stridedRange_hpp__
|
||||
|
|
|
@ -21,7 +21,6 @@ Licence:
|
|||
#include "baseTimeControl.hpp"
|
||||
|
||||
|
||||
|
||||
pFlow::baseTimeControl::baseTimeControl
|
||||
(
|
||||
const dictionary &dict,
|
||||
|
@ -46,7 +45,7 @@ pFlow::baseTimeControl::baseTimeControl
|
|||
|
||||
word intervalWord = intervalPrefix.size()==0? word("interval"): intervalPrefix+"Interval";
|
||||
|
||||
if(isTimeStep_)
|
||||
if(!isTimeStep_)
|
||||
{
|
||||
auto startTime = (dict.getValOrSet<real>("startTime", defStartTime));
|
||||
auto endTime = (dict.getValOrSet<real>("endTime", largeValue));
|
||||
|
@ -72,7 +71,7 @@ bool pFlow::baseTimeControl::timeEvent(uint32 iter, real t, real dt) const
|
|||
}
|
||||
else
|
||||
{
|
||||
return rRange_.isMember(t, 0.51*dt);
|
||||
return rRange_.isMember(t, 0.55*dt);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ void pFlow::timeControl::checkForOutputToFile()
|
|||
bool pFlow::timeControl::timersReportTime()const
|
||||
{
|
||||
if(currentIter_<=1)return false;
|
||||
return timersReportInterval_.isMember(currentTime_, dt_);
|
||||
return timersReportInterval_.isMember(currentTime_, 0.55*dt_);
|
||||
}
|
||||
|
||||
bool pFlow::timeControl::sortTime()const
|
||||
|
|
|
@ -41,33 +41,39 @@ Licence:
|
|||
|
||||
}*/
|
||||
|
||||
pFlow::boundaryBase::boundaryBase
|
||||
void pFlow::boundaryBase::setNewIndices
|
||||
(
|
||||
const dictionary& dict,
|
||||
const plane& bplane,
|
||||
internalPoints& internal
|
||||
deviceViewType1D<uint32> newIndices
|
||||
)
|
||||
:
|
||||
subscriber(dict.name()),
|
||||
boundaryPlane_(bplane),
|
||||
indexList_(groupNames(dict.name(),"indexList")),
|
||||
neighborLength_(dict.getVal<real>("neighborLength")),
|
||||
internal_(internal),
|
||||
mirrorProcessoNo_(dict.getVal<uint32>("mirrorProcessorNo")),
|
||||
name_(dict.name()),
|
||||
type_(dict.getVal<word>("type"))
|
||||
{
|
||||
auto newSize = newIndices.size();
|
||||
setSize(static_cast<uint32>(newSize));
|
||||
copy(indexList_.deviceView(), newIndices);
|
||||
}
|
||||
|
||||
pFlow::boundaryBase::boundaryBase(
|
||||
const dictionary &dict,
|
||||
const plane &bplane,
|
||||
internalPoints &internal)
|
||||
: subscriber(dict.name()),
|
||||
boundaryPlane_(bplane),
|
||||
indexList_(groupNames(dict.name(), "indexList")),
|
||||
neighborLength_(dict.getVal<real>("neighborLength")),
|
||||
internal_(internal),
|
||||
mirrorProcessoNo_(dict.getVal<uint32>("mirrorProcessorNo")),
|
||||
name_(dict.name()),
|
||||
type_(dict.getVal<word>("type"))
|
||||
{
|
||||
}
|
||||
|
||||
void pFlow::boundaryBase::setSize(uint32 newSize)
|
||||
{
|
||||
indexList_.resize(newSize);
|
||||
|
||||
if( indexList_.capacity() <= newSize+1 )
|
||||
/*if( indexList_.capacity() <= newSize+1 )
|
||||
{
|
||||
indexList_.reserve(newSize+1);
|
||||
}
|
||||
}*/
|
||||
//INFORMATION<<"new size of boundary "<< name_<<" "<< indexList_.size()<<END_INFO;
|
||||
}
|
||||
|
||||
typename pFlow::boundaryBase::pointFieldAccessType
|
||||
|
@ -77,8 +83,8 @@ pFlow::boundaryBase::thisPoints()
|
|||
return pointFieldAccessType
|
||||
(
|
||||
indexList_.size(),
|
||||
indexList_.deviceVectorAll(),
|
||||
internal_.pointPosition().deviceVectorAll()
|
||||
indexList_.deviceViewAll(),
|
||||
internal_.pointPosition().deviceViewAll()
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -65,6 +65,10 @@ private:
|
|||
|
||||
word type_;
|
||||
|
||||
protected:
|
||||
|
||||
void setNewIndices(deviceViewType1D<uint32> newIndices);
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("boundaryBase");
|
||||
|
@ -164,10 +168,10 @@ public:
|
|||
return indexList_;
|
||||
}
|
||||
|
||||
auto& indexList()
|
||||
/*auto& indexList()
|
||||
{
|
||||
return indexList_;
|
||||
}
|
||||
}*/
|
||||
|
||||
pointFieldAccessType thisPoints();
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
auto points = thisPoints();
|
||||
uint32 numDeleted = 0;
|
||||
auto p = boundaryPlane().infPlane();
|
||||
|
||||
|
||||
Kokkos::parallel_reduce
|
||||
(
|
||||
|
@ -85,6 +86,7 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
numDeleted
|
||||
);
|
||||
|
||||
|
||||
// no point is deleted
|
||||
if(numDeleted == 0 )
|
||||
{
|
||||
|
@ -111,7 +113,7 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
deviceScatteredFieldAccess<uint32> deleteIndices(
|
||||
numDeleted,
|
||||
deleteList,
|
||||
indexList().deviceVectorAll());
|
||||
indexList().deviceViewAll());
|
||||
|
||||
// tell internal to remove these points from its list
|
||||
if(!internal().deletePoints(deleteIndices))
|
||||
|
@ -124,13 +126,13 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
// delete these indices from your list
|
||||
if(numDeleted == s )
|
||||
{
|
||||
indexList().resize(0u);
|
||||
setSize(0u);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint newSize = s-numDeleted;
|
||||
uint32 newSize = s-numDeleted;
|
||||
deviceViewType1D<uint32> newIndices("newIndices", newSize);
|
||||
auto oldIndices = indexList().deviceVectorAll();
|
||||
auto oldIndices = indexList().deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"fillIndices",
|
||||
|
@ -144,13 +146,10 @@ bool pFlow::boundaryExit::beforeIteration
|
|||
}
|
||||
);
|
||||
Kokkos::fence();
|
||||
copy(oldIndices, newIndices);
|
||||
indexList().resize(newSize);
|
||||
setNewIndices(newIndices);
|
||||
}
|
||||
|
||||
// notify your observers
|
||||
|
||||
WARNING<<"notify observers in boundary exit "<<END_WARNING;
|
||||
//TODO: notify observers about changes
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,12 +53,12 @@ bool pFlow::boundaryList::updateLists()
|
|||
boundary(5).setSize( maskD.frontSize() );
|
||||
|
||||
pStruct_.fillNeighborsLists(
|
||||
boundary(0).indexList().deviceVectorAll(),
|
||||
boundary(1).indexList().deviceVectorAll(),
|
||||
boundary(2).indexList().deviceVectorAll(),
|
||||
boundary(3).indexList().deviceVectorAll(),
|
||||
boundary(4).indexList().deviceVectorAll(),
|
||||
boundary(5).indexList().deviceVectorAll());
|
||||
boundary(0).indexList().deviceViewAll(),
|
||||
boundary(1).indexList().deviceViewAll(),
|
||||
boundary(2).indexList().deviceViewAll(),
|
||||
boundary(3).indexList().deviceViewAll(),
|
||||
boundary(4).indexList().deviceViewAll(),
|
||||
boundary(5).indexList().deviceViewAll());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -124,8 +124,6 @@ bool pFlow::boundaryList::beforeIteration
|
|||
fatalErrorInFunction;
|
||||
return false;
|
||||
}
|
||||
|
||||
WARNING<<"Maybe notification about the update list "<<END_WARNING;
|
||||
}
|
||||
|
||||
for(auto& bdry:*this)
|
||||
|
|
|
@ -135,8 +135,9 @@ bool pFlow::internalPoints::deletePoints
|
|||
"Error in deleting points from internal points"<<endl;
|
||||
return false;
|
||||
}
|
||||
WARNING<<"Notify the observersin in internalPoints"<<END_WARNING;
|
||||
pFlagSync_ = false;
|
||||
WARNING<<"Notify the observersin in internalPoints"<<END_WARNING;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,7 @@ pFlow::uint32 pFlow::internalPoints::updateFlag
|
|||
return pFlagsD_.markPointRegions
|
||||
(
|
||||
dm,
|
||||
pointPosition_.deviceVectorAll(),
|
||||
pointPosition_.deviceViewAll(),
|
||||
dist[0],
|
||||
dist[1],
|
||||
dist[2],
|
||||
|
@ -213,15 +214,8 @@ bool pFlow::internalPoints::write
|
|||
iOstream& os
|
||||
)const
|
||||
{
|
||||
if( pFlagsD_.isAllActive())
|
||||
{
|
||||
return pointPosition_.write(os);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto aPoints = this->activePointsHost();
|
||||
return aPoints.write(os);
|
||||
}
|
||||
auto aPoints = this->activePointsHost();
|
||||
return aPoints.write(os);
|
||||
}
|
||||
|
||||
FUNCTION_H
|
||||
|
@ -259,15 +253,8 @@ bool pFlow::internalPoints::write
|
|||
const IOPattern& iop
|
||||
)const
|
||||
{
|
||||
if( pFlagsD_.isAllActive())
|
||||
{
|
||||
return pointPosition_.write(os, iop);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto aPoints = activePointsHost();
|
||||
return aPoints.write(os,iop);
|
||||
}
|
||||
auto aPoints = activePointsHost();
|
||||
return aPoints.write(os,iop);
|
||||
}
|
||||
|
||||
|
||||
|
@ -288,7 +275,7 @@ bool pFlow::internalPoints::evaluateinternalPoints()
|
|||
0,
|
||||
numPoints_,
|
||||
static_cast<int8>(internalPoints::ACTIVE),
|
||||
pointFlag_.deviceVectorAll(),
|
||||
pointFlag_.deviceViewAll(),
|
||||
minActive,
|
||||
maxActive
|
||||
);
|
||||
|
|
|
@ -121,13 +121,13 @@ public:
|
|||
INLINE_FUNCTION_H
|
||||
auto pointPositionHost()const
|
||||
{
|
||||
return pointPosition_.hostVector();
|
||||
return pointPosition_.hostView();
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_H
|
||||
auto pointPositionDevice()const
|
||||
{
|
||||
return pointPosition_.deviceVector();
|
||||
return pointPosition_.deviceView();
|
||||
}
|
||||
|
||||
PointsTypeHost activePointsHost()const;
|
||||
|
|
|
@ -33,14 +33,14 @@ class pointFlag
|
|||
{
|
||||
enum Flag: uint8
|
||||
{
|
||||
DELETED = 1, //10000000
|
||||
INTERNAL = 2, //00000001
|
||||
LEFT = 4, //00000010
|
||||
RIGHT = 8, //00000100
|
||||
BOTTOM = 16, //00001000
|
||||
TOP = 32, //00010000
|
||||
REAR = 64, //00100000
|
||||
FRONT = 128 //01000000
|
||||
DELETED = 1, //00000001
|
||||
INTERNAL = 2, //00000010
|
||||
LEFT = 4, //00000100
|
||||
RIGHT = 8, //00001000
|
||||
BOTTOM = 16, //00010000
|
||||
TOP = 32, //00100000
|
||||
REAR = 64, //01000000
|
||||
FRONT = 128 //10000000
|
||||
};
|
||||
|
||||
using execution_space = ExecutionSpace;
|
||||
|
@ -184,12 +184,7 @@ public:
|
|||
return flags_[i] > DELETED;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isBoundary(uint32 i)const
|
||||
{
|
||||
return flags_[i] > INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isBoundary(uint8 flg)const
|
||||
{
|
||||
|
@ -200,38 +195,38 @@ public:
|
|||
INLINE_FUNCTION_HD
|
||||
bool isLeft(uint8 flg)const
|
||||
{
|
||||
return (flg&LEFT) == LEFT;
|
||||
return flg&LEFT;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isRight(uint8 flg)const
|
||||
{
|
||||
return (flg&&RIGHT) == RIGHT;
|
||||
return flg&RIGHT;
|
||||
}
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isBottom(uint8 flg)const
|
||||
{
|
||||
return (flg&&BOTTOM) == BOTTOM;
|
||||
return flg&BOTTOM;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isTop(uint8 flg)const
|
||||
{
|
||||
return (flg&&TOP) == TOP;
|
||||
return flg&TOP;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isRear(uint8 flg)const
|
||||
{
|
||||
return (flg&&REAR) == REAR;
|
||||
return flg&REAR;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool isFront(uint8 flg)const
|
||||
{
|
||||
return (flg&&FRONT) == FRONT;
|
||||
return flg&FRONT;
|
||||
}
|
||||
|
||||
template<typename ExeSpace>
|
||||
|
|
|
@ -20,6 +20,8 @@ Licence:
|
|||
#ifndef __pointFlagKernels_hpp__
|
||||
#define __pointFlagKernels_hpp__
|
||||
|
||||
#include "streams.hpp"
|
||||
|
||||
template<typename ExecutionSpace>
|
||||
pFlow::uint32 pFlow::pointFlag<ExecutionSpace>::markOutOfBoxDelete
|
||||
(
|
||||
|
@ -353,9 +355,9 @@ void pFlow::pointFlag<ExecutionSpace>::fillNeighborsLists
|
|||
uint32 end = activeRange().end();
|
||||
|
||||
ViewType1D<uint32, memory_space> nElems("nElems",6);
|
||||
|
||||
|
||||
fill(nElems, 0, 6, static_cast<uint32>(0));
|
||||
|
||||
|
||||
if(start<end)
|
||||
{
|
||||
Kokkos::parallel_for(
|
||||
|
@ -363,16 +365,15 @@ void pFlow::pointFlag<ExecutionSpace>::fillNeighborsLists
|
|||
rpMark(start,end),
|
||||
CLASS_LAMBDA_HD(uint32 i){
|
||||
|
||||
uint32 flg = flags_(i);
|
||||
|
||||
uint8 flg = flags_(i);
|
||||
if(this->isBoundary(flg))
|
||||
{
|
||||
if(this->isLeft(flg)) leftList[Kokkos::atomic_fetch_add(&nElems[0],1)] = i;
|
||||
if(this->isRight(flg)) rightList[Kokkos::atomic_fetch_add(&nElems[1],1)] = i;
|
||||
if(this->isBottom(flg)) bottomList[Kokkos::atomic_fetch_add(&nElems[2],1)] = i;
|
||||
if(this->isTop(flg)) topList[Kokkos::atomic_fetch_add(&nElems[3],1)] = i;
|
||||
if(this->isRear(flg)) rearList[Kokkos::atomic_fetch_add(&nElems[4],1)] = i;
|
||||
if(this->isFront(flg)) frontList[Kokkos::atomic_fetch_add(&nElems[5],1)] = i;
|
||||
if(this->isRight(flg))rightList[Kokkos::atomic_fetch_add(&nElems[1],1)] = i;
|
||||
if(this->isBottom(flg))bottomList[Kokkos::atomic_fetch_add(&nElems[2],1)] = i;
|
||||
if(this->isTop(flg))topList[Kokkos::atomic_fetch_add(&nElems[3],1)] = i;
|
||||
if(this->isRear(flg))rearList[Kokkos::atomic_fetch_add(&nElems[4],1)] = i;
|
||||
if(this->isFront(flg))frontList[Kokkos::atomic_fetch_add(&nElems[5],1)] = i;
|
||||
}
|
||||
});
|
||||
Kokkos::fence();
|
||||
|
|
|
@ -166,6 +166,12 @@ pFlow::pointStructure::pointStructure(
|
|||
|
||||
bool pFlow::pointStructure::beforeIteration()
|
||||
{
|
||||
if( !boundaries_.beforeIteration(currentIter(), currentTime(), dt()) )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"Unable to perform beforeIteration for boundaries"<<endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -206,5 +212,6 @@ bool pFlow::pointStructure::write
|
|||
const IOPattern& iop
|
||||
)const
|
||||
{
|
||||
output<<"bool pFlow::pointStructure::write bool pFlow::pointStructure::write bool pFlow::pointStructure::write"<<endl;
|
||||
return internalPoints::write(os, iop);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ void pFlow::selectBox::selectAllPointsInBox()
|
|||
);
|
||||
|
||||
selectedPoints_.clear();
|
||||
auto pPos = pStruct().pointPosition().hostVector();
|
||||
auto pPos = pStruct().pointPosition().hostView();
|
||||
|
||||
ForAll(i , pPos)
|
||||
{
|
||||
|
|
|
@ -115,11 +115,11 @@ bool pFlow::multiTriSurface::addTriSurface
|
|||
vertices_.resize(vNewSize);
|
||||
area_.resize(vNewSize);
|
||||
|
||||
auto verVec = vertices_.deviceVectorAll();
|
||||
auto areaVec = area_.deviceVectorAll();
|
||||
auto verVec = vertices_.deviceViewAll();
|
||||
auto areaVec = area_.deviceViewAll();
|
||||
|
||||
auto newVerVec = newVertices.deviceVectorAll();
|
||||
auto newArea = newAreas.deviceVectorAll();
|
||||
auto newVerVec = newVertices.deviceViewAll();
|
||||
auto newArea = newAreas.deviceViewAll();
|
||||
|
||||
auto maxIdx = maxIndex();
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ pFlow::int32 pFlow::triSurface::calcMaxIndex()const
|
|||
|
||||
if(vertices_.size()>0)
|
||||
{
|
||||
auto verDeviceVec = vertices_.deviceVectorAll();
|
||||
auto verDeviceVec = vertices_.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_reduce(
|
||||
"triSurface::calcMaxIndex",
|
||||
|
|
|
@ -175,9 +175,9 @@ public:
|
|||
{
|
||||
return triangleAccessor(
|
||||
numPoints(),
|
||||
points_.deviceVectorAll(),
|
||||
points_.deviceViewAll(),
|
||||
numTriangles(),
|
||||
vertices_.deviceVectorAll()
|
||||
vertices_.deviceViewAll()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -203,12 +203,12 @@ public:
|
|||
|
||||
const realx3* pointsData_D()const
|
||||
{
|
||||
return points_.deviceVectorAll().data();
|
||||
return points_.deviceViewAll().data();
|
||||
}
|
||||
|
||||
realx3* pointsData_D()
|
||||
{
|
||||
return points_.deviceVectorAll().data();
|
||||
return points_.deviceViewAll().data();
|
||||
}
|
||||
|
||||
const int32x3Vector_D& vertices() const
|
||||
|
@ -223,12 +223,12 @@ public:
|
|||
|
||||
int32x3* verticesData_D()
|
||||
{
|
||||
return vertices_.deviceVectorAll().data();
|
||||
return vertices_.deviceViewAll().data();
|
||||
}
|
||||
|
||||
const int32x3* verticesData_D()const
|
||||
{
|
||||
return vertices_.deviceVectorAll().data();
|
||||
return vertices_.deviceViewAll().data();
|
||||
}
|
||||
|
||||
void clear()
|
||||
|
|
|
@ -32,9 +32,9 @@ INLINE_FUNCTION_H
|
|||
bool calculateArea(const realx3Field_D& points, const int32x3Field_D& vertices, realField_D& area)
|
||||
{
|
||||
auto numTri = vertices.size();
|
||||
auto areaD = area.deviceVectorAll();
|
||||
auto pointsD = points.deviceVectorAll();
|
||||
auto verticesD = vertices.deviceVectorAll();
|
||||
auto areaD = area.deviceViewAll();
|
||||
auto pointsD = points.deviceViewAll();
|
||||
auto verticesD = vertices.deviceViewAll();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"pFlow::triSurfaceKernels::calculateArea",
|
||||
|
|
|
@ -18,12 +18,11 @@ Licence:
|
|||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef __setProperty_hpp__
|
||||
#define __setProperty_hpp__
|
||||
|
||||
REPORT(0)<<"\nReading proprties . . . "<<END_REPORT;
|
||||
|
||||
auto proprties = pFlow::property(Control.caseSetup().path()+pFlow::propertyFile__);
|
||||
auto proprties = property(propertyFile__, &Control.caseSetup());
|
||||
|
||||
#endif
|
||||
#endif // __setProperty_hpp__
|
||||
|
|
|
@ -174,8 +174,8 @@ int main( int argc, char* argv[] )
|
|||
|
||||
REPORT(0)<< "Converting shapeName field to shapeIndex field"<<END_REPORT;
|
||||
|
||||
auto shapeName_D = shapeName.fieldDevice();
|
||||
auto shapeIndex_D = shapeIndex.fieldDevice();
|
||||
auto shapeName_D = shapeName.deviceView();
|
||||
auto shapeIndex_D = shapeIndex.deviceView();
|
||||
|
||||
REPORT(1)<<"List of shape names in "<<shapes.globalName()<<
|
||||
" is: "<<Green_Text(shapes.shapeNameList())<<END_REPORT;
|
||||
|
|
|
@ -151,7 +151,8 @@ public:
|
|||
virtual realx3Vector getFinalPosition();
|
||||
|
||||
static
|
||||
uniquePtr<positionParticles> create(systemControl& control, const dictionary & dict);
|
||||
uniquePtr<positionParticles>
|
||||
create(systemControl& control, const dictionary & dict);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ bool pFlow::positionRandom::positionOnePass(int32 pass, int32 startNum)
|
|||
SearchType search(
|
||||
box(minP, maxP),
|
||||
diameter_,
|
||||
positionHD.deviceVectorAll(),
|
||||
diameter.deviceVectorAll());
|
||||
positionHD.deviceViewAll(),
|
||||
diameter.deviceViewAll());
|
||||
|
||||
ContainerType pairs(3*startNum);
|
||||
|
||||
|
@ -250,7 +250,7 @@ pFlow::int32 pFlow::findCollisions(
|
|||
{
|
||||
auto allPairs = pairs.getPairs();
|
||||
auto num = pairs.capacity();
|
||||
auto dFlags = flags.deviceVector();
|
||||
auto dFlags = flags.deviceView();
|
||||
|
||||
|
||||
int32 numCollisions = 0;
|
||||
|
|
Loading…
Reference in New Issue