Skip to content

Commit d7b195f

Browse files
authored
WarpX.cpp: move free function TagWithLevelSuffix inside WarpX::AllocInitMultiFab (#5582)
`TagWithLevelSuffix` is used only once inside `WarpX::AllocInitMultiFab`, and it can be replaced with a one-liner. For this reason, in order to simplify the WarpX class, I would suggest implementing the functionality directly inside `WarpX::AllocInitMultiFab`
1 parent bc0ad18 commit d7b195f

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Source/WarpX.cpp

+2-9
Original file line numberDiff line numberDiff line change
@@ -3343,14 +3343,6 @@ WarpX::isAnyParticleBoundaryThermal ()
33433343
return false;
33443344
}
33453345

3346-
std::string
3347-
TagWithLevelSuffix (std::string name, int const level)
3348-
{
3349-
// Add the suffix "[level=level]"
3350-
name.append("[level=").append(std::to_string(level)).append("]");
3351-
return name;
3352-
}
3353-
33543346
void
33553347
WarpX::AllocInitMultiFab (
33563348
std::unique_ptr<amrex::iMultiFab>& mf,
@@ -3362,7 +3354,8 @@ WarpX::AllocInitMultiFab (
33623354
const std::string& name,
33633355
std::optional<const int> initial_value)
33643356
{
3365-
const auto name_with_suffix = TagWithLevelSuffix(name, level);
3357+
// Add the suffix "[level=level]"
3358+
const auto name_with_suffix = name + "[level=" + std::to_string(level) + "]";
33663359
const auto tag = amrex::MFInfo().SetTag(name_with_suffix);
33673360
mf = std::make_unique<amrex::iMultiFab>(ba, dm, ncomp, ngrow, tag);
33683361
if (initial_value) {

0 commit comments

Comments
 (0)