MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / flushCPC

Method flushCPC

Src/Base/AMReX_FabArrayBase.cpp:512–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512void
513FabArrayBase::flushCPC (bool no_assertion) const
514{
515 amrex::ignore_unused(no_assertion);
516 BL_ASSERT(no_assertion || getBDKey() == m_bdkey);
517
518 std::vector<CPCacheIter> others;
519
520 std::pair<CPCacheIter,CPCacheIter> er_it = m_TheCPCache.equal_range(m_bdkey);
521
522 for (auto it = er_it.first; it != er_it.second; ++it)
523 {
524 const BDKey& srckey = it->second->m_srcbdk;
525 const BDKey& dstkey = it->second->m_dstbdk;
526
527 BL_ASSERT((srckey==dstkey && srckey==m_bdkey) ||
528 (m_bdkey==srckey) || (m_bdkey==dstkey));
529
530 if (srckey != dstkey) {
531 const BDKey& otherkey = (m_bdkey == srckey) ? dstkey : srckey;
532 std::pair<CPCacheIter,CPCacheIter> o_er_it = m_TheCPCache.equal_range(otherkey);
533 for (auto oit = o_er_it.first; oit != o_er_it.second; ++oit)
534 {
535 if (it->second == oit->second) {
536 others.push_back(oit);
537 }
538 }
539 }
540
541#ifdef AMREX_MEM_PROFILING
542 m_CPC_stats.bytes -= it->second->bytes();
543#endif
544 m_CPC_stats.recordErase(it->second->m_nuse);
545 delete it->second;
546 }
547
548 m_TheCPCache.erase(er_it.first, er_it.second);
549
550 for (auto const& it : others) {
551 m_TheCPCache.erase(it);
552 }
553}
554
555void
556FabArrayBase::flushCPCache ()

Callers

nothing calls this directly

Calls 4

bytesMethod · 0.80
recordEraseMethod · 0.80
push_backMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected