Skip to content

Commit

Permalink
remove duplicated calculation and cell wise owned state
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenSeckler committed Jun 5, 2020
1 parent edb14d2 commit 3ad1e4b
Show file tree
Hide file tree
Showing 29 changed files with 256 additions and 506 deletions.
3 changes: 1 addition & 2 deletions src/autopas/containers/linkedCells/traversals/C01Traversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ inline void C01Traversal<ParticleCell, PairwiseFunctor, dataLayout, useNewton3,
auto startIndex = baseCell.numParticles();
auto endIndex = combinationSlice[slice]._particleSoABuffer.getNumParticles();
_pairwiseFunctor->SoAFunctorPair(baseCell._particleSoABuffer,
{&(combinationSlice[slice]._particleSoABuffer), startIndex, endIndex}, false,
true);
{&(combinationSlice[slice]._particleSoABuffer), startIndex, endIndex}, false);
// compute base cell
this->_cellFunctor.processCell(baseCell);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,14 @@ inline void C04SoACellHandler<ParticleCell, PairwiseFunctor, dataLayout, useNewt
cell1 = &combinationSlice[currentSlice];
auto stripeView = cell1->_particleSoABuffer.constructView(0, numParticlesBaseCell);
if (slice == currentSlice) {
// Process stripe with itself, this contains particles of a single cell, so all particles have the same owned
// state.
_pairwiseFunctor->SoAFunctorSingle(stripeView, useNewton3, true);
// Process stripe with itself
_pairwiseFunctor->SoAFunctorSingle(stripeView, useNewton3);

auto restView = cell1->_particleSoABuffer.constructView(numParticlesBaseCell,
cell1->_particleSoABuffer.getNumParticles());
_pairwiseFunctor->SoAFunctorPair(stripeView, restView, useNewton3, false);
_pairwiseFunctor->SoAFunctorPair(stripeView, restView, useNewton3);
if (not useNewton3) {
_pairwiseFunctor->SoAFunctorPair(restView, stripeView, useNewton3, false);
_pairwiseFunctor->SoAFunctorPair(restView, stripeView, useNewton3);
}
cell1ViewEnd = cell1->_particleSoABuffer.getNumParticles();
continue;
Expand Down Expand Up @@ -250,9 +249,9 @@ inline void C04SoACellHandler<ParticleCell, PairwiseFunctor, dataLayout, useNewt

auto cell1View = cell1->_particleSoABuffer.constructView(cell1ViewStart, cell1ViewEnd);
auto currentCSView = currentCS._particleSoABuffer.constructView(currentCSViewStart, currentCSViewEnd);
_pairwiseFunctor->SoAFunctorPair(cell1View, currentCSView, useNewton3, false);
_pairwiseFunctor->SoAFunctorPair(cell1View, currentCSView, useNewton3);
if (not useNewton3) {
_pairwiseFunctor->SoAFunctorPair(currentCSView, cell1View, useNewton3, false);
_pairwiseFunctor->SoAFunctorPair(currentCSView, cell1View, useNewton3);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class VerletClusterCells : public ParticleContainer<FullParticleCell<Particle>>,
cell.deleteDummyParticles();
}


// next find invalid particles
std::vector<Particle> invalidParticles;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,12 @@ class VerletClusterCellsTraversal : public CellPairTraversal<ParticleCell>,
const size_t c2start = clusterSize * neighbor.second;
SoAView cluster2(&(*cells)[neighbor.first]._particleSoABuffer, c2start, c2start + clusterSize);

// assumptions for owned state can probably not be made here, therefore false
_functor->SoAFunctorPair(cluster1, cluster2, useNewton3, false);
_functor->SoAFunctorPair(cluster1, cluster2, useNewton3);
}
// same cluster
SoAView clusterSelf(&(*cells)[i]._particleSoABuffer, clusterId * clusterSize,
clusterId * clusterSize + clusterSize);
// assumptions for owned state can probably not be made here, therefore false
_functor->SoAFunctorSingle(clusterSelf, useNewton3, false);
_functor->SoAFunctorSingle(clusterSelf, useNewton3);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class ClusterFunctor {
}
}
} else {
// assumptions for owned state can probably not be made here, therefore false
_functor->SoAFunctorSingle(cluster.getSoAView(), useNewton3, false);
_functor->SoAFunctorSingle(cluster.getSoAView(), useNewton3);
}
}

Expand All @@ -67,8 +66,7 @@ class ClusterFunctor {
}
}
} else {
// assumptions for owned state can probably not be made here, therefore false
_functor->SoAFunctorPair(cluster.getSoAView(), neighborCluster.getSoAView(), useNewton3, false);
_functor->SoAFunctorPair(cluster.getSoAView(), neighborCluster.getSoAView(), useNewton3);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class VerletListHelpers {
* @param soa the soa
* @param newton3 whether to use newton 3
*/
void SoAFunctorSingle(SoAView<SoAArraysType> soa, bool newton3, bool /*cellWiseOwnedstate*/) override {
void SoAFunctorSingle(SoAView<SoAArraysType> soa, bool newton3) override {
if (soa.getNumParticles() == 0) return;

auto **const __restrict__ ptrptr = soa.template begin<AttributeNames::ptr>();
Expand Down Expand Up @@ -128,10 +128,8 @@ class VerletListHelpers {
* @param soa1 soa of first cell
* @param soa2 soa of second cell
* @note newton3 is ignored here, as for newton3=false SoAFunctorPair(soa2, soa1) will also be called.
* @note cellWiseOwnedState is ignored.
*/
void SoAFunctorPair(SoAView<SoAArraysType> soa1, SoAView<SoAArraysType> soa2, bool /*newton3*/,
bool /*cellWiseOwnedState*/) override {
void SoAFunctorPair(SoAView<SoAArraysType> soa1, SoAView<SoAArraysType> soa2, bool /*newton3*/) override {
if (soa1.getNumParticles() == 0 || soa2.getNumParticles() == 0) return;

auto **const __restrict__ ptr1ptr = soa1.template begin<AttributeNames::ptr>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AsBuildPairGeneratorFunctor
* @param soa The SoA to add.
* @param newton3 Whether to use newton 3 or not.
*/
void SoAFunctorSingle(SoAView<SoAArraysType> soa, bool newton3, bool /*cellWiseOwnedState*/) override {
void SoAFunctorSingle(SoAView<SoAArraysType> soa, bool newton3) override {
if (soa.getNumParticles() == 0) return;

auto **const __restrict__ ptrptr = soa.template begin<AttributeNames::ptr>();
Expand Down Expand Up @@ -113,8 +113,7 @@ class AsBuildPairGeneratorFunctor
* @param soa1
* @param soa2
*/
void SoAFunctorPair(SoAView<SoAArraysType> soa1, SoAView<SoAArraysType> soa2, bool /*newton3*/,
bool /*cellWiseOwnedState*/) override {
void SoAFunctorPair(SoAView<SoAArraysType> soa1, SoAView<SoAArraysType> soa2, bool /*newton3*/) override {
if (soa1.getNumParticles() == 0 || soa2.getNumParticles() == 0) return;

auto **const __restrict__ ptrptr1 = soa1.template begin<AttributeNames::ptr>();
Expand Down
Loading

0 comments on commit 3ad1e4b

Please sign in to comment.