Repository navigation
Description
Severity: low · Category: build-config
Locations: Source/CAMR_initial_redist.cpp:1-67, Source/Make.package:1-11, Source/CAMR.H (no declaration)
Based on commit 17997db (line numbers refer to that tree).
The defect
Commit 5c4cd61 ("fixes issue 78 and 80 (#104)") added
Source/CAMR_initial_redist.cpp, defining
CAMR::ApplyInitialMLRedistribution(Box, Geometry, EBFArrayBoxFactory*, ...).
The file cannot compile and is not compiled:
- It is not listed in
Source/Make.package(which names onlymain.cpp,
CAMR.cpp,CAMR_advance.cpp,CAMR_react.cpp,CAMR_sources.cpp,
GravitySrc.cpp), and there is no other build file that picks it up. CAMR.Hdeclares no member namedApplyInitialMLRedistribution, so the
out-of-class definition at line 15 would be rejected by the compiler.- The body uses identifiers that exist only in
Hydro_umdrv_eb.cpp's scope
and are undeclared here:bxg_i(line 31),mfi(lines 34-40),
divc_arr,redistwgt_arr(line 52),dt(line 57),
l_redistribution_type(line 58). - The call at line 51 is a recursive call of the same name with a different
argument list that matches no overload. - No caller exists anywhere (
grep -rn ApplyInitialMLRedist Source Exechits
only this file).
It is a partial extraction of the StateRedist branch of
hydro_umdrv_eb that was left behind when #104 reorganised that code.
Why it matters
Zero effect on today's binaries, but it is a trap: the next person who adds
the file to Make.package, or moves to a glob-based CMake source list (the
Exec/CMakeLists.txt remnant already references source lists by directory),
gets a wall of undeclared identifier errors. It also misleads a reader into
thinking an "initial ML redistribution" step exists in the algorithm; there is
none -- CAMR_advance.cpp and Hydro_umdrv_eb.cpp never perform one.
How to reach it
Not reachable at runtime. echo 'CEXE_sources += CAMR_initial_redist.cpp' >> Source/Make.package && make in Exec/SodPlusSphere (USE_EB=TRUE) fails at
compile time with the errors listed above.
Suggested fix
Delete the file. If an initial-redistribution step is actually intended it
needs to be written against hydro_umdrv_eb's local variables and declared in
CAMR.H; nothing in the current tree calls for it. git apply --check
passes on 17997db.
--- a/Source/CAMR_initial_redist.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "CAMR.H"
-#include "CAMR_hydro.H"
-#include "CAMR_utils_K.H"
-#include "Godunov.H"
-#include "MOL_umeth.H"
-#include "CAMR_Constants.H"
-
-#include <AMReX_EB_Redistribution.H>
-#include <AMReX_EBMultiFabUtil.H>
-
-using namespace amrex;
-
-#ifdef AMREX_USE_EB
-void
-CAMR::ApplyInitialMLRedistribution( Box const& bx,
- Geometry const& geom,
- const EBFArrayBoxFactory* ebfact,
- const int* bclo, const int* bchi,
- Array4<const Real> const& uin_arr,
- Array4< Real> const& dsdt_arr,
- Array4<const Real> const& vf_arr,
- Array4<EBCellFlag const> const& flag_arr,
- int as_crse, Array4<Real> const& drho_as_crse,
- Array4<int const> const& rrflag_as_crse,
- int as_fine, Array4<Real> const& dm_as_fine,
- Array4<int const> const& lev_mask,
- const BCRec* bcs_d_ptr)
-{
- BL_PROFILE_VAR("ApplyInitialMLRedist()", ApplyInitialMLRedist);
-
- const Box& bxg_ii = grow(bxg_i,1);
-
- Array4<Real const> AMREX_D_DECL(fcx, fcy, fcz), AMREX_D_DECL(apx, apy, apz), ccc;
- AMREX_D_TERM(fcx = ebfact->getFaceCent()[0]->const_array(mfi);,
- fcy = ebfact->getFaceCent()[1]->const_array(mfi);,
- fcz = ebfact->getFaceCent()[2]->const_array(mfi););
- AMREX_D_TERM(apx = ebfact->getAreaFrac()[0]->const_array(mfi);,
- apy = ebfact->getAreaFrac()[1]->const_array(mfi);,
- apz = ebfact->getAreaFrac()[2]->const_array(mfi););
- ccc = ebfact->getCentroid().const_array(mfi);
-
- int l_ncomp = dsdt_arr.nComp();
- int level_mask_not_covered = CAMRConstants::level_mask_notcovered;
- bool use_wts_in_divnc = false;
-
- // We need to set fac_for_redist to 1/2 for MOL because we will
- // compute this twice per time step, so the contribution of
- // each needs to be weighted by 1/2
- Real fac_for_redist = (do_mol) ? Real(0.5) : Real(1.0);
- if (redistribution_type == "StateRedist") {
- ApplyInitialMLRedistribution(bx, l_ncomp,
- dsdt_arr, divc_arr, uin_arr, redistwgt_arr,
- flag_arr,
- AMREX_D_DECL(apx, apy, apz),
- vf_arr,
- AMREX_D_DECL(fcx, fcy, fcz),
- ccc, bcs_d_ptr, geom, dt,
- l_redistribution_type,
- as_crse, drho_as_crse, rrflag_as_crse,
- as_fine, dm_as_fine, lev_mask,
- level_mask_not_covered,
- fac_for_redist);
- }
-
- BL_PROFILE_VAR_STOP(ApplyInitialMLRedist);
-}
-#endif
Activity
fix issues 111 112 113 114 115 116 (AMReX-Fluids#123)