Skip to content

Commit 08ee44b

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

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

Src/Particle/AMReX_NeighborParticles.H

Lines changed: 24 additions & 0 deletions
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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,38 @@ 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+
}
1274+
for (int i = 0; i < n; ++i) {
1275+
h_redistribute_real_comp.pop_back();
1276+
}
1277+
SetParticleSize();
1278+
}
1279+
1280+
/** Remove the last n Int components of the species
1281+
*
1282+
* @param n number of components to remove
1283+
*/
1284+
void RemoveIntComp (int n = 1)
1285+
{
1286+
m_num_runtime_int--;
1287+
if (m_num_runtime_real == 0 && m_num_runtime_int == 0) {
1288+
m_runtime_comps_defined = false;
1289+
}
1290+
for (int i = 0; i < n; ++i) {
1291+
h_redistribute_int_comp.pop_back();
1292+
}
1293+
SetParticleSize();
1294+
}
1295+
12641296
int NumRuntimeRealComps () const { return m_num_runtime_real; }
12651297
int NumRuntimeIntComps () const { return m_num_runtime_int; }
12661298

0 commit comments

Comments
 (0)