Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary Runtime Components in Particle Container #3595

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions Src/Particle/AMReX_NeighborParticles.H
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,30 @@ public:
calcCommSize();
}

/** Remove the last n Real components of the species
*
* @param n number of components to remove
*/
void RemoveRealComp (int n = 1)
{
ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>::
RemoveRealComp(n);
ghost_real_comp.pop_back();
calcCommSize();
}

/** Remove the last n Int components of the species
*
* @param n number of components to remove
*/
void RemoveIntComp (int n = 1)
{
ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>::
RemoveIntComp(n);
ghost_int_comp.pop_back();
calcCommSize();
}

void Redistribute (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0)
{
clearNeighbors();
Expand Down
32 changes: 32 additions & 0 deletions Src/Particle/AMReX_ParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,38 @@ public:
SetParticleSize();
}

/** Remove the last n Real components of the species
*
* @param n number of components to remove
*/
void RemoveRealComp (int n = 1)
{
m_num_runtime_real--;
if (m_num_runtime_real == 0 && m_num_runtime_int == 0) {
m_runtime_comps_defined = false;
}
for (int i = 0; i < n; ++i) {
h_redistribute_real_comp.pop_back();
}
SetParticleSize();
}

/** Remove the last n Int components of the species
*
* @param n number of components to remove
*/
void RemoveIntComp (int n = 1)
{
m_num_runtime_int--;
if (m_num_runtime_real == 0 && m_num_runtime_int == 0) {
m_runtime_comps_defined = false;
}
for (int i = 0; i < n; ++i) {
h_redistribute_int_comp.pop_back();
}
SetParticleSize();
}

int NumRuntimeRealComps () const { return m_num_runtime_real; }
int NumRuntimeIntComps () const { return m_num_runtime_int; }

Expand Down