Skip to content

Commit

Permalink
less couts during advances in release mode (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan authored Sep 5, 2024
1 parent 823b45c commit ad0537d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/amr/level_initializer/hybrid_level_initializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace solver

if (isRegridding)
{
std::cout << "regriding level " << levelNumber << "\n";
PHARE_LOG_LINE_STR("regriding level " + std::to_string(levelNumber));
PHARE_LOG_START(3, "hybridLevelInitializer::initialize : regriding block");
messenger.regrid(hierarchy, levelNumber, oldLevel, model, initDataTime);
PHARE_LOG_STOP(3, "hybridLevelInitializer::initialize : regriding block");
Expand Down
4 changes: 2 additions & 2 deletions src/amr/messengers/hybrid_hybrid_messenger_strategy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ namespace amr
PHARE_LOG_SCOPE(3, "HybridHybridMessengerStrategy::synchronize");

auto levelNumber = level.getLevelNumber();
std::cout << "synchronizing level " << levelNumber << "\n";
PHARE_LOG_LINE_STR("synchronizing level " + std::to_string(levelNumber));

// call coarsning schedules...
magnetoSynchronizers_.sync(levelNumber);
Expand All @@ -607,7 +607,7 @@ namespace amr
auto levelNumber = level.getLevelNumber();
auto& hybridModel = static_cast<HybridModel&>(model);

std::cout << "postSynchronize level " << levelNumber << "\n";
PHARE_LOG_LINE_STR("postSynchronize level " + std::to_string(levelNumber))

magSharedNodesRefiners_.fill(hybridModel.state.electromag.B, levelNumber, time);
elecSharedNodesRefiners_.fill(hybridModel.state.electromag.E, levelNumber, time);
Expand Down
13 changes: 7 additions & 6 deletions src/amr/multiphysics_integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ namespace solver
bool const isRegridding = oldLevel != nullptr;
auto level = hierarchy->getPatchLevel(levelNumber);

std::cout << "init level " << levelNumber << " with regriding = " << isRegridding
<< "\n";

PHARE_LOG_LINE_SS("init level " << levelNumber << " with regriding = " << isRegridding);

PHARE_LOG_START(3, "initializeLevelData::allocate block");
if (allocateData)
{
Expand Down Expand Up @@ -414,7 +415,7 @@ namespace solver
int const tag_index, bool const /*initialTime*/,
bool const /*usesRichardsonExtrapolationToo*/) override
{
std::cout << "apply gradient detector on level " << levelNumber << "\n";
PHARE_LOG_LINE_STR("apply gradient detector on level " + std::to_string(levelNumber));

auto level = hierarchy->getPatchLevel(levelNumber);
for (auto& patch : *level)
Expand Down Expand Up @@ -508,9 +509,9 @@ namespace solver

auto iLevel = level->getLevelNumber();

PHARE_LOG_LINE_STR("advanceLevel " << iLevel << " with dt = " << newTime - currentTime
<< " from t = " << currentTime
<< " to t = " << newTime);
PHARE_LOG_LINE_SS("advanceLevel " << iLevel << " with dt = " << newTime - currentTime
<< " from t = " << currentTime
<< " to t = " << newTime);

auto& solver = getSolver_(iLevel);
auto& model = getModel_(iLevel);
Expand Down
2 changes: 2 additions & 0 deletions src/core/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ constexpr static std::uint8_t LOG_LEVEL = PHARE_LOG_LEVEL;
#if !defined(NDEBUG) || defined(PHARE_FORCE_DEBUG_DO)
#define PHARE_LOG_LINE_STR(str) \
std::cout << __FILE__ << ":" << __LINE__ << " - " << str << std::endl;
#define PHARE_LOG_LINE_SS(s) PHARE_LOG_LINE_STR((std::stringstream{} << s).str());
#else
#define PHARE_LOG_LINE_STR(str)
#define PHARE_LOG_LINE_SS(str)
#endif
#define PHARE_LOG_LINE PHARE_LOG_LINE_STR("")

Expand Down

0 comments on commit ad0537d

Please sign in to comment.