Skip to content

Commit 96ad034

Browse files
committed
RemoveRealComp/RemoveIntComp
Add new functions to remove runtime components.
1 parent ecaa144 commit 96ad034

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

Src/Particle/AMReX_NeighborParticles.H

+24
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,30 @@ public:
309309
calcCommSize();
310310
}
311311

312+
/** Remove the last n Real components of the species
313+
*
314+
* @param n number of components to remove
315+
*/
316+
void RemoveRealComp (int n = 1)
317+
{
318+
ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>::
319+
RemoveRealComp(n);
320+
ghost_real_comp.pop_back();
321+
calcCommSize();
322+
}
323+
324+
/** Remove the last n Int components of the species
325+
*
326+
* @param n number of components to remove
327+
*/
328+
void RemoveIntComp (int n = 1)
329+
{
330+
ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>::
331+
RemoveIntComp(n);
332+
ghost_int_comp.pop_back();
333+
calcCommSize();
334+
}
335+
312336
void Redistribute (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0)
313337
{
314338
clearNeighbors();

Src/Particle/AMReX_ParticleContainer.H

+28
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,34 @@ public:
12611261
SetParticleSize();
12621262
}
12631263

1264+
/** Remove the last n Real components of the species
1265+
*
1266+
* @param n number of components to remove
1267+
*/
1268+
void RemoveRealComp (int n = 1)
1269+
{
1270+
m_num_runtime_real--;
1271+
if (m_num_runtime_real == 0 && m_num_runtime_int == 0)
1272+
m_runtime_comps_defined = false;
1273+
for (int i = 0; i < n; ++i)
1274+
h_redistribute_real_comp.pop_back();
1275+
SetParticleSize();
1276+
}
1277+
1278+
/** Remove the last n Int components of the species
1279+
*
1280+
* @param n number of components to remove
1281+
*/
1282+
void RemoveIntComp (int n = 1)
1283+
{
1284+
m_num_runtime_int--;
1285+
if (m_num_runtime_real == 0 && m_num_runtime_int == 0)
1286+
m_runtime_comps_defined = false;
1287+
for (int i = 0; i < n; ++i)
1288+
h_redistribute_int_comp.pop_back();
1289+
SetParticleSize();
1290+
}
1291+
12641292
int NumRuntimeRealComps () const { return m_num_runtime_real; }
12651293
int NumRuntimeIntComps () const { return m_num_runtime_int; }
12661294

0 commit comments

Comments
 (0)