Skip to content

Commit

Permalink
some clang-tidy on radiation
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Aug 28, 2024
1 parent 2b3c853 commit 7351ada
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void problem_initialize_state_data (int i, int j, int k,
// Provides the simulation to be run in the x,y,or z direction
// where length direction is the length side in a square prism

Real length_cell;
Real length_cell{};
if (problem::idir == 1) {
length_cell = problo[0] + dx[0] * (static_cast<Real>(i) + 0.5_rt);
} else if (problem::idir == 2) {
Expand Down
8 changes: 6 additions & 2 deletions Source/radiation/HypreABec.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class HypreABec {

~HypreABec();

HypreABec(const HypreABec& a) = delete;
HypreABec(const HypreABec&& a) = delete;
HypreABec& operator= (const HypreABec& a) = delete;
HypreABec& operator= (const HypreABec&& a) = delete;

///
/// @param v
Expand All @@ -48,10 +52,10 @@ class HypreABec {
///
void setScalars(amrex::Real alpha, amrex::Real beta);

amrex::Real getAlpha() const {
[[nodiscard]] amrex::Real getAlpha() const {
return alpha;
}
amrex::Real getBeta() const {
[[nodiscard]] amrex::Real getBeta() const {
return beta;
}

Expand Down
14 changes: 9 additions & 5 deletions Source/radiation/HypreExtMultiABec.H
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ class HypreExtMultiABec : public HypreMultiABec {
a2coefs(fine_level+1),
ccoefs( fine_level+1),
d1coefs(fine_level+1),
d2coefs(fine_level+1),
alpha2(0.0), gamma(0.0), delta1(0.0), delta2(0.0)
{
}
d2coefs(fine_level+1)
{}

~HypreExtMultiABec();

HypreExtMultiABec(const HypreExtMultiABec& src) = delete;
HypreExtMultiABec(const HypreExtMultiABec&& src) = delete;

HypreExtMultiABec& operator= (const HypreExtMultiABec& src) = delete;
HypreExtMultiABec& operator= (const HypreExtMultiABec&& src) = delete;

amrex::Real& a2Multiplier() {
return alpha2;
}
Expand Down Expand Up @@ -134,7 +138,7 @@ class HypreExtMultiABec : public HypreMultiABec {
amrex::Vector<std::unique_ptr<amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> > > ccoefs; ///< face-based, 2 component
amrex::Vector<std::unique_ptr<amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> > > d1coefs; ///< cell-based but directional
amrex::Vector<std::unique_ptr<amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> > > d2coefs; ///< face-based
amrex::Real alpha2, gamma, delta1, delta2; ///< multipliers for the above
amrex::Real alpha2{}, gamma{}, delta1{}, delta2{}; ///< multipliers for the above
};

#endif
53 changes: 24 additions & 29 deletions Source/radiation/HypreMultiABec.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,34 @@ class AuxVar {

class Connex {
public:
Connex() {
other = NULL;
}
Connex() :
other(nullptr)
{}

///
/// @param p
/// @param r
///
Connex(AuxVar* p, amrex::Real r) {
val = r;
other = p;
}
Connex(AuxVar* p, amrex::Real r) :
val(r), other(p)
{}

///
/// @param lev
/// @param iv
/// @param r
///
Connex(int lev, const amrex::IntVect& iv, amrex::Real r) {
val = r;
index = iv;
level = lev;
other = NULL;
}
Connex(int lev, const amrex::IntVect& iv, amrex::Real r) :
val(r), index(iv), level(lev), other(nullptr)
{}

///
/// @param c
///
bool same_target(const Connex& c) {
return ((other != NULL)
[[nodiscard]] bool same_target(const Connex& c) const {
return ((other != nullptr)
? (other == c.other)
: (c.other == NULL && level == c.level && index == c.index));
: (c.other == nullptr && level == c.level && index == c.index));
}

amrex::Real val;
Expand All @@ -63,16 +59,15 @@ class AuxVar {

public:

AuxVar() : secondary_flag(0) {
}
AuxVar() = default;


///
/// @param p
/// @param r
///
void push(AuxVar* p, amrex::Real r) {
a.push_back(Connex(p,r));
a.emplace_back(p, r);
}


Expand All @@ -82,7 +77,7 @@ class AuxVar {
/// @param r
///
void push(int lev, const amrex::IntVect& iv, amrex::Real r) {
a.push_back(Connex(lev,iv,r));
a.emplace_back(lev, iv, r);
}


Expand All @@ -95,7 +90,7 @@ class AuxVar {
/// @param p->secondary_flag
///
if (p->secondary_flag == 0) { // don't count the same secondary twice
a.push_back(Connex(p,1.0));
a.emplace_back(p, 1.0);
p->secondary_flag = 1;
}
}
Expand All @@ -104,7 +99,7 @@ class AuxVar {
return a.empty();
}

bool secondary() {
[[nodiscard]] bool secondary() const {
return secondary_flag;
}

Expand All @@ -128,7 +123,7 @@ class AuxVar {
protected:

std::list<Connex> a;
int secondary_flag;
int secondary_flag{};
};

///
Expand All @@ -149,7 +144,7 @@ class AuxVarBox {
/// @param bx
///
AuxVarBox(const amrex::Box& bx) : domain(bx) {
int numpts = domain.numPts();
auto numpts = domain.numPts();
dptr = new AuxVar[numpts];
}

Expand All @@ -163,7 +158,7 @@ class AuxVarBox {
return dptr[domain.index(p)];
}

const amrex::Box& box() const {
[[nodiscard]] const amrex::Box& box() const {
return domain;
}

Expand Down Expand Up @@ -422,10 +417,10 @@ class HypreMultiABec {
const amrex::DistributionMapping& _dmap,
amrex::IntVect _crse_ratio);

int crseLevel() {
[[nodiscard]] int crseLevel() const {
return crse_level;
}
int fineLevel() {
[[nodiscard]] int fineLevel() const {
return fine_level;
}

Expand Down Expand Up @@ -501,10 +496,10 @@ class HypreMultiABec {
///
void setScalars(amrex::Real alpha, amrex::Real beta);

amrex::Real getAlpha() const {
[[nodiscard]] amrex::Real getAlpha() const {
return alpha;
}
amrex::Real getBeta() const {
[[nodiscard]] amrex::Real getBeta() const {
return beta;
}

Expand Down
17 changes: 2 additions & 15 deletions Source/radiation/NGBndry.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ class NGBndry : public RadInterpBndryData
public:
NGBndry(const amrex::BoxArray& _grids, const amrex::DistributionMapping& _dmap,
int _ncomp, const amrex::Geometry& _geom) :

///
/// @param _grids
/// @param _dmap
/// @param _ncomp
/// @param _geom
///
RadInterpBndryData(_grids,_dmap,_ncomp,_geom) { }



///
/// @param bc
/// @param phys_bc_mode
Expand All @@ -51,7 +45,7 @@ public:
///
/// @param _face
///
virtual int mixedBndry(const amrex::Orientation& _face) const {
virtual int mixedBndry(const amrex::Orientation& /* _face */) const {
return 0;
}

Expand All @@ -62,13 +56,6 @@ protected:
///
amrex::Vector< std::unique_ptr<amrex::BaseFab<int> > > bctypearray[2*AMREX_SPACEDIM];


///
/// @param src
///
private:
NGBndry(const NGBndry& src);
NGBndry& operator=(const NGBndry& src);
};

///
Expand Down
2 changes: 1 addition & 1 deletion Source/radiation/RadBndry.H
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public:
///
NGBndry* operator()(const amrex::BoxArray& _grids,
const amrex::DistributionMapping& _dmap,
int _ncomp,
int /* _ncomp */,
const amrex::Geometry& _geom) const {
return new RadBndry(_grids, _dmap, _geom);
}
Expand Down
1 change: 0 additions & 1 deletion Source/radiation/RadSolve.H
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class RadSolve {
RadSolve (amrex::Amr* Parent, int level,
const amrex::BoxArray& grids,
const amrex::DistributionMapping& dmap);
~RadSolve () {}

///
/// query runtime parameters
Expand Down
2 changes: 0 additions & 2 deletions Source/radiation/Radiation.H
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ public:
/// @param restart
///
Radiation(amrex::Amr* Parent, class Castro* castro, int restart = 0);
~Radiation() { }


///
/// @param level
Expand Down
4 changes: 1 addition & 3 deletions Source/radiation/_interpbndry/RadBndryData.H
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ public:
//@ManDoc: constructor specifying number of components and box of physical domain (cell-centered)
RadBndryData(const amrex::BoxArray& _grids, const amrex::DistributionMapping& _dmap,
int _ncomp, const ProxyGeometry& geom);
//@ManDoc: destructor
virtual ~RadBndryData();

//@ManDoc: allocate bndry fabs along given face
void define(const amrex::BoxArray& _grids, const amrex::DistributionMapping& _dmap,
int _ncomp, const ProxyGeometry& geom);
Expand Down Expand Up @@ -179,4 +178,3 @@ private:
};

#endif

5 changes: 0 additions & 5 deletions Source/radiation/_interpbndry/RadBndryData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ RadBndryData::RadBndryData(const BoxArray& _grids, const DistributionMapping& _d
// (*this) = src;
// }

RadBndryData::~RadBndryData()
{
}

std::ostream& operator << (std::ostream& os, const RadBndryData &mgb)
{
const BoxArray& grds = mgb.boxes();
Expand Down Expand Up @@ -129,4 +125,3 @@ RadBndryData::define(const BoxArray& _grids, const DistributionMapping& _dmap,
}
}
}

0 comments on commit 7351ada

Please sign in to comment.