Commit 347d5b87 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

Update arranger class in order to remove particles that go from one leaf to another

parent db0c2164
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
const MortonIndex particuleIndex = tree->getMortonFromPosition(partPos); const MortonIndex particuleIndex = tree->getMortonFromPosition(partPos);
if(particuleIndex != currentIndex){ if(particuleIndex != currentIndex){
tomove.push(ConverterClass::GetParticle(particles,idxPart)); tomove.push(ConverterClass::GetParticleAndRemove(particles,idxPart));
} }
} }
} while(octreeIterator.moveRight()); } while(octreeIterator.moveRight());
......
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
if(particuleIndex != currentIndex){ if(particuleIndex != currentIndex){
// find the right interval // find the right interval
const int procConcerned = getInterval( particuleIndex, comm.processCount(), intervals); const int procConcerned = getInterval( particuleIndex, comm.processCount(), intervals);
toMove[procConcerned].push(ConverterClass::GetParticle(particles,idxPart)); toMove[procConcerned].push(ConverterClass::GetParticleAndRemove(particles,idxPart));
indexesToExtract.push(idxPart); indexesToExtract.push(idxPart);
} }
} }
......
...@@ -99,7 +99,7 @@ template <class ParticleClass> ...@@ -99,7 +99,7 @@ template <class ParticleClass>
class Converter { class Converter {
public: public:
template <class ContainerClass> template <class ContainerClass>
static ParticleClass GetParticle(ContainerClass* containers, const int idxExtract){ static ParticleClass GetParticleAndRemove(ContainerClass* containers, const int idxExtract){
const FReal*const positionsX = containers->getPositions()[0]; const FReal*const positionsX = containers->getPositions()[0];
const FReal*const positionsY = containers->getPositions()[1]; const FReal*const positionsY = containers->getPositions()[1];
const FReal*const positionsZ = containers->getPositions()[2]; const FReal*const positionsZ = containers->getPositions()[2];
...@@ -119,6 +119,8 @@ public: ...@@ -119,6 +119,8 @@ public:
part.potential = potentials[idxExtract]; part.potential = potentials[idxExtract];
part.velocity = velocites[idxExtract]; part.velocity = velocites[idxExtract];
containers->removeParticles(&idxExtract, 1);
return part; return part;
} }
......
...@@ -47,12 +47,13 @@ template <class ParticleClass> ...@@ -47,12 +47,13 @@ template <class ParticleClass>
class Converter { class Converter {
public: public:
template <class ContainerClass> template <class ContainerClass>
static ParticleClass GetParticle(ContainerClass* container, const int idxExtract){ static ParticleClass GetParticleAndRemove(ContainerClass* container, const int idxExtract){
TestParticle part; TestParticle part;
part.position.setPosition( part.position.setPosition(
container->getPositions()[0][idxExtract], container->getPositions()[0][idxExtract],
container->getPositions()[1][idxExtract], container->getPositions()[1][idxExtract],
container->getPositions()[2][idxExtract]); container->getPositions()[2][idxExtract]);
container->removeParticles(&idxExtract, 1);
return part; return part;
} }
......
...@@ -55,12 +55,13 @@ template <class ParticleClass> ...@@ -55,12 +55,13 @@ template <class ParticleClass>
class Converter { class Converter {
public: public:
template <class ContainerClass> template <class ContainerClass>
static ParticleClass GetParticle(ContainerClass* container, const int idxExtract){ static ParticleClass GetParticleAndRemove(ContainerClass* container, const int idxExtract){
TestParticle part; TestParticle part;
part.position.setPosition( part.position.setPosition(
container->getPositions()[0][idxExtract], container->getPositions()[0][idxExtract],
container->getPositions()[1][idxExtract], container->getPositions()[1][idxExtract],
container->getPositions()[2][idxExtract]); container->getPositions()[2][idxExtract]);
container->removeParticles(&idxExtract, 1);
return part; return part;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment