Skip to content
Snippets Groups Projects
Commit d95325ae authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

simplify

parent 9e85af83
No related branches found
No related tags found
1 merge request!454Further changes suggested by clang-tidy
......@@ -47,6 +47,7 @@ Checks: '*,
-fuchsia-statically-constructed-objects,
-google-build-using-namespace,
-google-default-arguments,
-google-readability-casting,
-google-readability-todo,
-google-runtime-int,
-hicpp-vararg,
......
......@@ -29,16 +29,14 @@ bool BinContains(const Bin1D& bin, double value)
//! creation on Bin1DKVector from alpha and phi bins
Bin1DKVector::Bin1DKVector(double wavelength, const Bin1D& alpha_bin, const Bin1D& phi_bin)
: m_q_lower(), m_q_upper()
: m_q_lower(vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_lower, phi_bin.m_lower))
, m_q_upper(vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_upper, phi_bin.m_upper))
{
m_q_lower = vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_lower, phi_bin.m_lower);
m_q_upper = vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_upper, phi_bin.m_upper);
}
//! creation on Bin1DCVector from alpha and phi bins
Bin1DCVector::Bin1DCVector(double wavelength, const Bin1D& alpha_bin, const Bin1D& phi_bin)
: m_q_lower(), m_q_upper()
: m_q_lower(vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_lower, phi_bin.m_lower).complex())
, m_q_upper(vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_upper, phi_bin.m_upper).complex())
{
m_q_lower = vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_lower, phi_bin.m_lower).complex();
m_q_upper = vecOfLambdaAlphaPhi(wavelength, alpha_bin.m_upper, phi_bin.m_upper).complex();
}
......@@ -133,7 +133,7 @@ bool VariableBinAxis::equals(const IAxis& other) const
{
if (!IAxis::equals(other))
return false;
if (const VariableBinAxis* p_other_cast = dynamic_cast<const VariableBinAxis*>(&other)) {
if (const auto* p_other_cast = dynamic_cast<const VariableBinAxis*>(&other)) {
if (size() != p_other_cast->size())
return false;
for (size_t i = 0; i < m_bin_boundaries.size(); ++i) {
......
......@@ -71,9 +71,9 @@ std::vector<std::string> BaseUtils::Filesystem::filesInDirectory(const std::stri
std::string BaseUtils::Filesystem::jointPath(const std::string& path1, const std::string& path2)
{
ASSERT(path2 != "");
ASSERT(!path2.empty());
if (path1 == "")
if (path1.empty())
return fs::path(path2).string();
return (fs::path(path1) / fs::path(path2)).string();
......
......@@ -30,7 +30,8 @@ Geometry::Mesh Geometry::meshSphere(float cut, float baseShift, float removedTop
// 'rings' are the # of horizontal cross-sections ranging from bottom to top of the sphere
// 'slices' are the # of vertices in a given ring
int rings, slices = SLICES;
int rings;
int slices = SLICES;
float minPh, maxPh, phRge;
if (cut > 0) // South pole absent
......@@ -55,7 +56,8 @@ Geometry::Mesh Geometry::meshSphere(float cut, float baseShift, float removedTop
ASSERT(2 <= rings && 2 <= slices);
// meshes of vertices and normals, without poles, _[ring][slice]
QVector<Vertices> vs_(rings), ns_(rings);
QVector<Vertices> vs_(rings);
QVector<Vertices> ns_(rings);
for (auto& ring : vs_)
ring.resize(slices);
for (auto& ring : ns_)
......
......@@ -60,7 +60,7 @@ void Geometry::Vertices::addStrip(const Vertices& vs, const Indices& is)
void Geometry::Vertices::addFan(const Vertices& vs, const Indices& is)
{
ASSERT(is.size() >= 3); // at least one triangle
auto& ctr = vs.at(is.at(0));
const auto& ctr = vs.at(is.at(0));
for (unsigned i = 0; i + 2 < is.size(); ++i)
addTriangle(ctr, vs.at(is.at(1 + i)), vs.at(is.at(2 + i)));
}
......@@ -117,8 +117,12 @@ Geometry::Mesh Geometry::makeMesh(const Vertices& vs, Vertices const* ns)
Mesh mesh(nv);
for (int i = 0; i < nv; i += 3) {
const Vector3D &v0 = vs.at(0 + i), v1 = vs.at(1 + i), v2 = vs.at(2 + i);
const Vector3D *n0, *n1, *n2;
const Vector3D& v0 = vs.at(0 + i);
const Vector3D& v1 = vs.at(1 + i);
const Vector3D& v2 = vs.at(2 + i);
const Vector3D* n0;
const Vector3D* n1;
const Vector3D* n2;
Vector3D nm;
if (ns) {
......@@ -152,7 +156,7 @@ GeometryHandle GeometryStore::getGeometry(GeometricID::Key key)
if (auto g = it->second.lock())
return g;
}
GeometryHandle g = GeometryHandle(new Geometry(key));
GeometryHandle g(new Geometry(key));
m_geometries[key] = GeometryRef(g);
return g;
}
......
......@@ -22,12 +22,12 @@ Model::Model() : defCamPos(Vector3D::_1, Vector3D::_0, Vector3D::_z) {}
Model::~Model()
{
for (auto o : objects) {
for (auto* o : objects) {
o->model = nullptr;
delete o;
}
for (auto o : objectsBlend) {
for (auto* o : objectsBlend) {
o->model = nullptr;
delete o;
}
......@@ -145,9 +145,9 @@ void Model::rem(Object* o)
void Model::releaseGeometries()
{
for (auto o : objects)
for (auto* o : objects)
o->releaseGeometry();
for (auto o : objectsBlend)
for (auto* o : objectsBlend)
o->releaseGeometry();
}
......@@ -158,13 +158,13 @@ bool Model::modelIsEmpty()
void Model::draw(Canvas& canvas) const
{
for (auto o : objects)
for (auto* o : objects)
o->draw(canvas);
}
void Model::drawBlend(Canvas& canvas) const
{
for (auto o : objectsBlend)
for (auto* o : objectsBlend)
o->draw(canvas);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment