Move to use postfix increment only

This commit is contained in:
Alexander Bock
2025-09-07 16:56:59 +02:00
parent 0e72a2cb0d
commit ff72e47f7b
49 changed files with 94 additions and 94 deletions

View File

@@ -329,7 +329,7 @@ bool SearchProxyModel::acceptIndex(const QModelIndex& idx) const {
if (matchIt.hasNext()) {
return true;
}
for (int row = 0; row < idx.model()->rowCount(idx); ++row) {
for (int row = 0; row < idx.model()->rowCount(idx); row++) {
const bool accept = acceptIndex(idx.model()->index(row, 0, idx));
if (accept) {
return true;

View File

@@ -120,7 +120,7 @@ bool AssetTreeItem::insertChildren(int position, int count, int columns) {
return false;
}
for (int row = 0; row < count; ++row) {
for (int row = 0; row < count; row++) {
std::vector<QVariant> data = std::vector<QVariant>(columns);
AssetTreeItem* item = new AssetTreeItem(std::move(data), this);
_childItems.insert(_childItems.begin() + position, item);
@@ -134,7 +134,7 @@ bool AssetTreeItem::removeChildren(int position, int count) {
return false;
}
for (int row = 0; row < count; ++row) {
for (int row = 0; row < count; row++) {
delete _childItems[position];
_childItems.erase(_childItems.begin() + position);
}
@@ -147,7 +147,7 @@ bool AssetTreeItem::insertColumns(int position, int columns) {
return false;
}
for (int column = 0; column < columns; ++column) {
for (int column = 0; column < columns; column++) {
_itemData.insert(_itemData.begin() + position, QVariant());
}

View File

@@ -90,7 +90,7 @@ DeltaTimesDialog::DeltaTimesDialog(QWidget* parent, std::vector<double>* deltaTi
setWindowTitle("Simulation Time Increments");
createWidgets();
for (size_t d = 0; d < _deltaTimesData.size(); ++d) {
for (size_t d = 0; d < _deltaTimesData.size(); d++) {
const std::string summary = createSummaryForDeltaTime(d, true);
_listWidget->addItem(new QListWidgetItem(QString::fromStdString(summary)));
}

View File

@@ -461,7 +461,7 @@ struct ScriptMessage {
}
std::string tmpReadbackScript;
_script.erase();
for (int i = 0; i < numScriptLines; ++i) {
for (int i = 0; i < numScriptLines; i++) {
ghoul::getline(iss, tmpReadbackScript);
size_t start = tmpReadbackScript.find_first_not_of(" ");
tmpReadbackScript = tmpReadbackScript.substr(start);

View File

@@ -694,7 +694,7 @@ std::pair<GLuint, GLuint> AtmosphereDeferredcaster::calculateDeltaS() {
program->setUniform("ozoneLayerEnabled", _ozoneEnabled);
program->setUniform("HO", _ozoneHeightScale);
glClear(GL_COLOR_BUFFER_BIT);
for (int layer = 0; layer < _rSamples; ++layer) {
for (int layer = 0; layer < _rSamples; layer++) {
program->setUniform("layer", layer);
step3DTexture(*program, layer);
glDrawArrays(GL_TRIANGLES, 0, 6);
@@ -777,7 +777,7 @@ void AtmosphereDeferredcaster::calculateInscattering(GLuint deltaSRayleigh,
program->setUniform("SAMPLES_MU", _muSamples);
program->setUniform("SAMPLES_R", _rSamples);
glClear(GL_COLOR_BUFFER_BIT);
for (int layer = 0; layer < _rSamples; ++layer) {
for (int layer = 0; layer < _rSamples; layer++) {
program->setUniform("layer", layer);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@@ -831,7 +831,7 @@ void AtmosphereDeferredcaster::calculateDeltaJ(int scatteringOrder,
program.setUniform("SAMPLES_NU", _nuSamples);
program.setUniform("SAMPLES_MU", _muSamples);
program.setUniform("SAMPLES_R", _rSamples);
for (int layer = 0; layer < _rSamples; ++layer) {
for (int layer = 0; layer < _rSamples; layer++) {
program.setUniform("layer", layer);
step3DTexture(program, layer);
glDrawArrays(GL_TRIANGLES, 0, 6);
@@ -911,7 +911,7 @@ void AtmosphereDeferredcaster::calculateDeltaS(int scatteringOrder,
program.setUniform("SAMPLES_NU", _nuSamples);
program.setUniform("SAMPLES_MU", _muSamples);
program.setUniform("SAMPLES_R", _rSamples);
for (int layer = 0; layer < _rSamples; ++layer) {
for (int layer = 0; layer < _rSamples; layer++) {
program.setUniform("layer", layer);
step3DTexture(program, layer);
glDrawArrays(GL_TRIANGLES, 0, 6);
@@ -980,7 +980,7 @@ void AtmosphereDeferredcaster::calculateInscattering(int scatteringOrder,
program.setUniform("SAMPLES_NU", _nuSamples);
program.setUniform("SAMPLES_MU", _muSamples);
program.setUniform("SAMPLES_R", _rSamples);
for (int layer = 0; layer < _rSamples; ++layer) {
for (int layer = 0; layer < _rSamples; layer++) {
program.setUniform("layer", layer);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@@ -1085,7 +1085,7 @@ void AtmosphereDeferredcaster::calculateAtmosphereParameters() {
const GLuint deltaJTable = createTexture(_textureSize, "DeltaJ", 3);
// loop in line 6 in algorithm 4.1
for (int scatteringOrder = 2; scatteringOrder <= 4; ++scatteringOrder) {
for (int scatteringOrder = 2; scatteringOrder <= 4; scatteringOrder++) {
// line 7 in algorithm 4.1
calculateDeltaJ(
scatteringOrder,

View File

@@ -32,7 +32,7 @@ uniform int layer;
void main() {
for (int n = 0; n < gl_in.length(); ++n) {
for (int n = 0; n < gl_in.length(); n++) {
gl_Position = gl_in[n].gl_Position;
gl_Layer = layer;
EmitVertex();

View File

@@ -162,7 +162,7 @@ vec3 inscatter(float r, float mu, float muSun, float nu) {
groundTransmittance = transmittance(transmittanceTexture, Rg, muGround, distanceToGround, Rg, Rt);
}
for (int phi_i = 0; phi_i < INSCATTER_SPHERICAL_INTEGRAL_SAMPLES; ++phi_i) {
for (int phi_i = 0; phi_i < INSCATTER_SPHERICAL_INTEGRAL_SAMPLES; phi_i++) {
float phi = (float(phi_i) + 0.5) * stepPhi;
// spherical coordinates: dw = dtheta*dphi*sin(theta)*rho^2
// rho = 1, we are integrating over a unit sphere

View File

@@ -293,7 +293,7 @@ void RenderableSphericalGrid::update(const UpdateData&) {
int nr = 0;
for (int lat = 0; lat <= _latSegments; ++lat) {
for (int lat = 0; lat <= _latSegments; lat++) {
// define an extra vertex around the y-axis due to texture mapping
for (int lng = 0; lng <= _longSegments; lng++) {
// inclination angle (north to south)

View File

@@ -395,11 +395,11 @@ void RenderableInterpolatedPoints::addPositionDataForPoint(unsigned int index,
const double r = glm::max(glm::length(position0), glm::length(position1));
maxRadius = glm::max(maxRadius, r);
for (int j = 0; j < 3; ++j) {
for (int j = 0; j < 3; j++) {
result.push_back(static_cast<float>(position0[j]));
}
for (int j = 0; j < 3; ++j) {
for (int j = 0; j < 3; j++) {
result.push_back(static_cast<float>(position1[j]));
}
@@ -419,11 +419,11 @@ void RenderableInterpolatedPoints::addPositionDataForPoint(unsigned int index,
glm::dvec3 positionBefore = transformedPosition(e00);
glm::dvec3 positionAfter = transformedPosition(e11);
for (int j = 0; j < 3; ++j) {
for (int j = 0; j < 3; j++) {
result.push_back(static_cast<float>(positionBefore[j]));
}
for (int j = 0; j < 3; ++j) {
for (int j = 0; j < 3; j++) {
result.push_back(static_cast<float>(positionAfter[j]));
}
}

View File

@@ -1623,7 +1623,7 @@ void RenderablePointCloud::addPositionDataForPoint(unsigned int index,
const double r = glm::length(position);
// Add values to result
for (int j = 0; j < 3; ++j) {
for (int j = 0; j < 3; j++) {
result.push_back(static_cast<float>(position[j]));
}
@@ -1727,7 +1727,7 @@ std::vector<float> RenderablePointCloud::createDataSlice() {
std::vector<float> result;
result.reserve(nAttributesPerPoint() * _dataset.entries.size());
size_t vertexCount = 0;
for (size_t i = 0; i < subResults.size(); ++i) {
for (size_t i = 0; i < subResults.size(); i++) {
result.insert(result.end(), subResults[i].begin(), subResults[i].end());
int nVertices = static_cast<int>(subResults[i].size()) / nAttributesPerPoint();
if (!_textureArrays.empty()) {

View File

@@ -142,7 +142,7 @@ SizeMappingComponent::SizeMappingComponent(const ghoul::Dictionary& dictionary)
if (p.parameterOptions.has_value()) {
std::vector<std::string> opts = *p.parameterOptions;
for (size_t i = 0; i < opts.size(); ++i) {
for (size_t i = 0; i < opts.size(); i++) {
// Note that options are added in order
parameterOption.addOption(static_cast<int>(i), opts[i]);

View File

@@ -104,7 +104,7 @@ namespace {
}
std::string str = std::format("{} = {{ ", id);
for (size_t i = 0; i < data.size(); ++i) {
for (size_t i = 0; i < data.size(); i++) {
std::string xVal = std::format("{}", data[i].x);
std::string yVal = std::format("{}", data[i].y);
xVal += (xVal.find(".") == std::string::npos) ? ".0" : "";

View File

@@ -543,7 +543,7 @@ bool RenderableDUMeshes::readSpeckFile() {
dim >> mesh.numU >> mesh.numV;
// We can now read the vertices data:
for (int l = 0; l < mesh.numU * mesh.numV; ++l) {
for (int l = 0; l < mesh.numU * mesh.numV; l++) {
ghoul::getline(file, line);
if (line.substr(0, 1) == "}") {
break;

View File

@@ -1036,7 +1036,7 @@ void RenderableFieldlinesSequence::firstUpdate() {
const std::vector<std::string>& extraNamesVec =
file->state.extraQuantityNames();
for (size_t i = 0; i < quantities.size(); ++i) {
for (size_t i = 0; i < quantities.size(); i++) {
_colorQuantity.addOption(static_cast<int>(i), extraNamesVec[i]);
_maskingQuantity.addOption(static_cast<int>(i), extraNamesVec[i]);
}

View File

@@ -201,7 +201,7 @@ bool FieldlinesState::loadStateFromJson(const std::string& pathToJsonFile,
size_t lineStartIdx = 0;
// Loop through all fieldlines
for (json::iterator lineIter = jFile.begin(); lineIter != jFile.end(); ++lineIter) {
for (json::iterator lineIter = jFile.begin(); lineIter != jFile.end(); lineIter++) {
// The 'data' field in the 'trace' variable contains all vertex positions and the
// extra quantities. Each element is an array related to one vertex point.
const std::vector<std::vector<float>>& jData =
@@ -369,13 +369,13 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const size_t nExtras = _extraQuantities.size();
size_t pointIndex = 0;
for (size_t lineIndex = 0; lineIndex < nLines; ++lineIndex) {
for (size_t lineIndex = 0; lineIndex < nLines; lineIndex++) {
json jData = json::array();
for (GLsizei i = 0; i < _lineCount[lineIndex]; i++, ++pointIndex) {
const glm::vec3 pos = _vertexPositions[pointIndex];
json jDataElement = { pos.x, pos.y, pos.z };
for (size_t extraIndex = 0; extraIndex < nExtras; ++extraIndex) {
for (size_t extraIndex = 0; extraIndex < nExtras; extraIndex++) {
jDataElement.push_back(_extraQuantities[extraIndex][pointIndex]);
}
jData.push_back(jDataElement);

View File

@@ -318,7 +318,7 @@ void addExtraQuantities(ccmc::Kameleon* kameleon,
{
int nVariableAttributes = kameleon->getNumberOfVariableAttributes();
std::vector<std::string> variablesAttributeNames;
for (int i = 0; i < nVariableAttributes; ++i) {
for (int i = 0; i < nVariableAttributes; i++) {
std::string varname = kameleon->getVariableAttributeName(i);
std::string varunit = kameleon->getNativeUnit(varname);
std::string varVisualizationUnit = kameleon->getVisUnit(varname);

View File

@@ -342,7 +342,7 @@ std::vector<float> FitsFileReader::readFitsFile(std::filesystem::path filePath,
values[idx++] = tycho_v_err[i % nStars];
// Read extra columns, if any. This will slow down the sorting tremendously!
for (int col = defaultCols; col < nColumnsRead; ++col) {
for (int col = defaultCols; col < nColumnsRead; col++) {
std::vector<float> vecData = std::move(tableContent[allColumnNames[col]]);
values[idx++] = vecData[i];
}

View File

@@ -447,8 +447,8 @@ glm::vec2 RenderableTimeVaryingFitsSphere::minMaxTextureDataValues(
std::vector<float> pixelValues;
pixelValues.reserve(width * height * 4);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
glm::vec4 texel = t->texelAsFloat(x, y);
pixelValues.push_back(texel.r);
pixelValues.push_back(texel.g);

View File

@@ -421,7 +421,7 @@ std::map<int, std::vector<float>> OctreeManager::traverseData(const glm::dmat4&
// Reclaim indices from previous render call
for (auto removedKey = _removedKeysInPrevCall.rbegin();
removedKey != _removedKeysInPrevCall.rend(); ++removedKey) {
removedKey != _removedKeysInPrevCall.rend(); removedKey++) {
// Uses a reverse loop to try to decrease the biggest chunk
if (*removedKey == static_cast<int>(_biggestChunkIndexInUse) - 1) {
@@ -762,7 +762,7 @@ void OctreeManager::writeNodeToMultipleFiles(const std::string& outFilePrefix,
}
if (threadWrites) {
// Make sure all threads are done.
for (int thread = 0; thread < 8; ++thread) {
for (int thread = 0; thread < 8; thread++) {
writeThreads[thread].join();
}
}
@@ -974,7 +974,7 @@ bool OctreeManager::insertInNode(OctreeNode& node, const std::vector<float>& sta
createNodeChildren(node);
// Distribute stars from parent node into children
for (size_t n = 0; n < MAX_STARS_PER_NODE; ++n) {
for (size_t n = 0; n < MAX_STARS_PER_NODE; n++) {
// Position data.
auto posBegin = node.posData.begin() + n * POS_SIZE;
auto posEnd = posBegin + POS_SIZE;

View File

@@ -241,7 +241,7 @@ void ReadFileJob::execute() {
values[idx++] = std::isnan(radial_vel_err[i]) ? 0.f : radial_vel_err[i];
// Read extra columns, if any. This will slow down the sorting tremendously!
for (size_t col = _nDefaultCols; col < nColumnsRead; ++col) {
for (size_t col = _nDefaultCols; col < nColumnsRead; col++) {
std::vector<float> vecData = std::move(tableContent[_allColumns[col]]);
values[idx++] = std::isnan(vecData[col]) ? 0.f : vecData[col];
}

View File

@@ -532,7 +532,7 @@ void GeoJsonComponent::render(const RenderData& data) {
};
// Do two render passes, to properly render opacity of overlaying objects
for (int renderPass = 0; renderPass < 2; ++renderPass) {
for (int renderPass = 0; renderPass < 2; renderPass++) {
for (size_t i = 0; i < _geometryFeatures.size(); i++) {
if (_features[i]->enabled && _features[i]->isVisible()) {
_geometryFeatures[i].render(

View File

@@ -597,7 +597,7 @@ std::vector<std::vector<glm::vec3>> GlobeGeometryFeature::createLineGeometry() {
);
// Don't add the first position. Has been added as last in previous step
for (size_t si = 1; si < subdividedPositions.size(); ++si) {
for (size_t si = 1; si < subdividedPositions.size(); si++) {
const geometryhelper::PosHeightPair& pair = subdividedPositions[si];
addLinePos(glm::vec3(pair.position));
}

View File

@@ -103,7 +103,7 @@ createExtrudedGeometryVertices(const std::vector<std::vector<glm::vec3>>& edgeVe
vertices.reserve(nVerts * 3);
// Extrude polygon
for (size_t nBound = 0; nBound < edgeVertices.size(); ++nBound) {
for (size_t nBound = 0; nBound < edgeVertices.size(); nBound++) {
const std::vector<glm::vec3>& boundary = edgeVertices[nBound];
for (size_t i = 1; i < boundary.size(); i++) {
const glm::vec3& v0 = boundary[i - 1];
@@ -190,7 +190,7 @@ std::vector<PosHeightPair> subdivideLine(const glm::dvec3& v0, const glm::dvec3&
positions.push_back({ glm::vec3(v0), h0 });
}
for (int seg = 0; seg < nSegments; ++seg) {
for (int seg = 0; seg < nSegments; seg++) {
const double t = static_cast<double>(seg) / static_cast<double>(nSegments);
// Interpolate both position and height value

View File

@@ -683,12 +683,12 @@ TileMetaData RawTileDataReader::tileMetaData(RawTile& rawTile,
std::fill(ppData.hasMissingData.begin(), ppData.hasMissingData.end(), false);
bool allIsMissing = true;
for (int y = 0; y < region.numPixels.y; ++y) {
for (int y = 0; y < region.numPixels.y; y++) {
const size_t yi =
(static_cast<unsigned long long>(region.numPixels.y) - 1 - y) * bytesPerLine;
size_t i = 0;
for (int x = 0; x < region.numPixels.x; ++x) {
for (size_t raster = 0; raster < _initData.nRasters; ++raster) {
for (int x = 0; x < region.numPixels.x; x++) {
for (size_t raster = 0; raster < _initData.nRasters; raster++) {
const float noDataValue = noDataValueAsFloat();
const float val = interpretFloat(
_initData.glType,

View File

@@ -79,11 +79,11 @@ void DataProcessorJson::addDataValues(const std::string& data,
const json& row = variables[options[i]];
// int rowsize = row.size();
for (size_t y = 0; y < row.size(); ++y) {
for (size_t y = 0; y < row.size(); y++) {
const json& col = row.at(y);
const int colsize = static_cast<int>(col.size());
for (int x = 0; x < colsize; ++x) {
for (int x = 0; x < colsize; x++) {
const float value = col.at(x).get<float>();
optionValues[i].push_back(value);
_min[i] = std::min(_min[i], value);
@@ -126,11 +126,11 @@ std::vector<float*> DataProcessorJson::processData(const std::string& data,
json row = variables[options[option]];
const int rowsize = static_cast<int>(row.size());
for (int y = 0; y < rowsize; ++y) {
for (int y = 0; y < rowsize; y++) {
json col = row.at(y);
const int colsize = static_cast<int>(col.size());
for (int x = 0; x < colsize; ++x) {
for (int x = 0; x < colsize; x++) {
const float value = col.at(x).get<float>();
const int i = x + y * colsize;

View File

@@ -201,9 +201,9 @@ float* KameleonWrapper::uniformSampledValues(const std::string& var,
};
// ProgressBar pb(static_cast<int>(outDimensions.x));
for (size_t x = 0; x < outDimensions.x; ++x) {
for (size_t y = 0; y < outDimensions.y; ++y) {
for (size_t z = 0; z < outDimensions.z; ++z) {
for (size_t x = 0; x < outDimensions.x; x++) {
for (size_t y = 0; y < outDimensions.y; y++) {
for (size_t z = 0; z < outDimensions.z; z++) {
const size_t index = x + y * outDimensions.x +
z * outDimensions.x * outDimensions.y;
@@ -359,9 +359,9 @@ float* KameleonWrapper::uniformSliceValues(const std::string& var,
float missingValue = _model->getMissingValue();
for (size_t x = 0; x < outDimensions.x; ++x) {
for (size_t y = 0; y < outDimensions.y; ++y) {
for (size_t z = 0; z < outDimensions.z; ++z) {
for (size_t x = 0; x < outDimensions.x; x++) {
for (size_t y = 0; y < outDimensions.y; y++) {
for (size_t z = 0; z < outDimensions.z; z++) {
const float xi = (hasXSlice) ? slice : x;
const float yi = (hasYSlice) ? slice : y;
@@ -484,10 +484,10 @@ float* KameleonWrapper::uniformSampledVectorValues(const std::string& xVar,
//LDEBUG(zVar << "Max: " << varZMax);
//ProgressBar pb(static_cast<int>(outDimensions.x));
for (size_t x = 0; x < outDimensions.x; ++x) {
for (size_t x = 0; x < outDimensions.x; x++) {
//pb.print(x);
for (size_t y = 0; y < outDimensions.y; ++y) {
for (size_t z = 0; z < outDimensions.z; ++z) {
for (size_t y = 0; y < outDimensions.y; y++) {
for (size_t z = 0; z < outDimensions.z; z++) {
const size_t index = x * NumChannels + y * NumChannels * outDimensions.x +
z * NumChannels * outDimensions.x * outDimensions.y;

View File

@@ -220,9 +220,9 @@ void AtlasManager::fillVolume(float* in, float* out, unsigned int linearAtlasCoo
unsigned int zMax = zMin + _paddedBrickDim;
unsigned int from = 0;
for (unsigned int zValCoord = zMin; zValCoord<zMax; ++zValCoord) {
for (unsigned int yValCoord = yMin; yValCoord<yMax; ++yValCoord) {
for (unsigned int xValCoord = xMin; xValCoord<xMax; ++xValCoord) {
for (unsigned int zValCoord = zMin; zValCoord<zMax; zValCoord++) {
for (unsigned int yValCoord = yMin; yValCoord<yMax; yValCoord++) {
for (unsigned int xValCoord = xMin; xValCoord<xMax; xValCoord++) {
unsigned int idx = xValCoord + yValCoord * _atlasDim +
zValCoord * _atlasDim * _atlasDim;

View File

@@ -239,9 +239,9 @@ bool BrickManager::fillVolume(float* in, float* out, unsigned int x, unsigned in
// Loop over the brick using three loops
unsigned int from = 0;
for (unsigned int zValCoord = zMin; zValCoord < zMax; ++zValCoord) {
for (unsigned int yValCoord = yMin; yValCoord < yMax; ++yValCoord) {
for (unsigned int xValCoord = xMin; xValCoord < xMax; ++xValCoord) {
for (unsigned int zValCoord = zMin; zValCoord < zMax; zValCoord++) {
for (unsigned int yValCoord = yMin; yValCoord < yMax; yValCoord++) {
for (unsigned int xValCoord = xMin; xValCoord < xMax; xValCoord++) {
unsigned int idx = xValCoord + yValCoord * _atlasDim +
zValCoord * _atlasDim * _atlasDim;

View File

@@ -61,7 +61,7 @@ bool HistogramManager::buildHistogram(TSP* tsp, unsigned int brickIndex) {
std::vector<float> voxelValues = readValues(tsp, brickIndex);
size_t numVoxels = voxelValues.size();
for (size_t v = 0; v < numVoxels; ++v) {
for (size_t v = 0; v < numVoxels; v++) {
histogram.add(voxelValues[v], 1.0);
}
}

View File

@@ -135,7 +135,7 @@ bool TSP::construct() {
LDEBUG("Constructing TSP tree");
// Loop over the OTs (one per BST node)
for (unsigned int OT = 0; OT < _numBSTNodes; ++OT) {
for (unsigned int OT = 0; OT < _numBSTNodes; OT++) {
// Start at the root of each OT
unsigned int OTNode = OT * _numOTNodes;
@@ -279,7 +279,7 @@ bool TSP::calculateSpatialError() {
// First pass: Calculate average color for each brick
LDEBUG("Calculating spatial error, first pass");
for (unsigned int brick = 0; brick<_numTotalNodes; ++brick) {
for (unsigned int brick = 0; brick<_numTotalNodes; brick++) {
// Offset in file
std::streampos offset = dataPosition() +
static_cast<long long>(brick*numBrickVals*sizeof(float));
@@ -307,7 +307,7 @@ bool TSP::calculateSpatialError() {
// Second pass: For each brick, compare the covered leaf voxels with
// the brick average
LDEBUG("Calculating spatial error, second pass");
for (unsigned int brick = 0; brick < _numTotalNodes; ++brick) {
for (unsigned int brick = 0; brick < _numTotalNodes; brick++) {
// Fetch mean intensity
float brickAvg = averages[brick];
@@ -326,7 +326,7 @@ bool TSP::calculateSpatialError() {
else {
// Calculate "standard deviation" corresponding to leaves
for (auto lb = leafBricksCovered.begin(); lb != leafBricksCovered.end(); ++lb)
for (auto lb = leafBricksCovered.begin(); lb != leafBricksCovered.end(); lb++)
{
// Read brick
std::streampos offset = dataPosition() +
@@ -337,7 +337,7 @@ bool TSP::calculateSpatialError() {
static_cast<size_t>(numBrickVals)*sizeof(float));
// Add to sum
for (auto v = buffer.begin(); v != buffer.end(); ++v) {
for (auto v = buffer.begin(); v != buffer.end(); v++) {
stdDev += pow(*v - brickAvg, 2.f);
}
}
@@ -408,7 +408,7 @@ bool TSP::calculateTemporalError() {
std::vector<float> errors(_numTotalNodes);
// Calculate temporal error for one brick at a time
for (unsigned int brick = 0; brick<_numTotalNodes; ++brick) {
for (unsigned int brick = 0; brick<_numTotalNodes; brick++) {
unsigned int numBrickVals = _paddedBrickDim * _paddedBrickDim * _paddedBrickDim;
// Save the individual voxel's average over timesteps. Because the
@@ -441,10 +441,10 @@ bool TSP::calculateTemporalError() {
else {
// Calculate standard deviation per voxel, average over brick
float avgStdDev = 0.f;
for (unsigned int voxel = 0; voxel<numBrickVals; ++voxel) {
for (unsigned int voxel = 0; voxel<numBrickVals; voxel++) {
float stdDev = 0.f;
for (auto leaf = coveredBricks.begin();
leaf != coveredBricks.end(); ++leaf)
leaf != coveredBricks.end(); leaf++)
{
// Sample the leaves at the corresponding voxel position
_file.seekg(dataPosition() +

View File

@@ -150,7 +150,7 @@ namespace {
const bool isInLeapYear =
std::find(LeapYears.begin(), LeapYears.end(), year) != LeapYears.end();
for (int m = 0; m < month; ++m) {
for (int m = 0; m < month; m++) {
dayCount += DaysOfMonths[m];
if (m == February && isInLeapYear) {
dayCount += 1;

View File

@@ -416,7 +416,7 @@ void RenderableConstellationLines::loadData() {
dim >> constellationLine.numV;
// We can now read the vertices data:
for (int l = 0; l < constellationLine.numV; ++l) {
for (int l = 0; l < constellationLine.numV; l++) {
ghoul::getline(file, line);
if (line.substr(0, 1) == "}") {
break;

View File

@@ -637,7 +637,7 @@ void RenderableOrbitalKepler::updateBuffers() {
_vertexBufferData.resize(nVerticesTotal);
size_t vertexBufIdx = 0;
for (int orbitIdx = 0; orbitIdx < numOrbits; ++orbitIdx) {
for (int orbitIdx = 0; orbitIdx < numOrbits; orbitIdx++) {
const kepler::Parameters& orbit = _parameters[orbitIdx];
ghoul::Dictionary d;

View File

@@ -652,7 +652,7 @@ void RenderableFov::computeIntercepts(double time, const std::string& target,
return r.surfaceVector * 1000.0 * _standOffDistance.value();
};
for (size_t m = 0; m < InterpolationSteps; ++m) {
for (size_t m = 0; m < InterpolationSteps; m++) {
const double t = static_cast<double>(m) / (InterpolationSteps);
const glm::dvec3 tBound = glm::mix(iBound, jBound, t);

View File

@@ -86,7 +86,7 @@ LabelParser::LabelParser(std::filesystem::path fileName,
const Dictionary specsOfInterestDict = typeDict.value<Dictionary>(KeySpecs);
_specsOfInterest.resize(specsOfInterestDict.size());
for (size_t n = 0; n < _specsOfInterest.size(); ++n) {
for (size_t n = 0; n < _specsOfInterest.size(); n++) {
const std::string key = std::to_string(n + 1);
if (specsOfInterestDict.hasValue<std::string>(key)) {
std::string readMe = specsOfInterestDict.value<std::string>(key);

View File

@@ -97,7 +97,7 @@ CameraTelemetry::CameraTelemetry(const std::string& ip, int port)
, _cameraSpeedDistanceUnitOption(CameraSpeedDistanceUnitInfo)
, _precisionProperties(CameraTelemetry::PrecisionProperties(PrecisionInfo))
{
for (int i = 0; i < DistanceUnitNames.size(); ++i) {
for (int i = 0; i < DistanceUnitNames.size(); i++) {
_cameraSpeedDistanceUnitOption.addOption(i, DistanceUnitNames[i].singular.data());
}

View File

@@ -113,7 +113,7 @@ NodesTelemetry::NodesTelemetry(const std::string& ip, int port)
, _distanceUnitOption(DistanceUnitInfo)
, _precisionProperties(NodesTelemetry::PrecisionProperties(PrecisionInfo))
{
for (int i = 0; i < DistanceUnitNames.size(); ++i) {
for (int i = 0; i < DistanceUnitNames.size(); i++) {
_distanceUnitOption.addOption(i, DistanceUnitNames[i].singular.data());
}
@@ -168,7 +168,7 @@ void NodesTelemetry::update(const Camera* camera) {
bool includeElevation = module->includeElevationAngle();
// Update data for all nodes
for (int i = 0; i < _nodes.size(); ++i) {
for (int i = 0; i < _nodes.size(); i++) {
// Increase precision if the node is in focus
if (focusNode->identifier() == _nodes[i].identifier) {
_anglePrecision = _precisionProperties.highAnglePrecision;

View File

@@ -74,7 +74,7 @@ TimeTelemetry::TimeTelemetry(const std::string& ip, int port)
, _timeUnitOption(TimeUnitOptionInfo)
, _precisionProperties(TimeTelemetry::PrecisionProperties(PrecisionInfo))
{
for (size_t i = 0; i < TimeUnitNames.size(); ++i) {
for (size_t i = 0; i < TimeUnitNames.size(); i++) {
_timeUnitOption.addOption(static_cast<int>(i), TimeUnitNames[i].singular.data());
}

View File

@@ -171,7 +171,7 @@ PlanetsCompareSonification::PlanetsCompareSonification(const std::string& ip, in
addProperty(_selectedScaleInterpolationTime);
// Planet selection properties
for (int i = 0; i < PlanetsOptions.size(); ++i) {
for (int i = 0; i < PlanetsOptions.size(); i++) {
_firstPlanet.addOption(i, PlanetsOptions[i].data());
_secondPlanet.addOption(i, PlanetsOptions[i].data());
}

View File

@@ -432,7 +432,7 @@ void PlanetsSonification::update(const Camera* camera) {
}
// Update data for all planets
for (int i = 0; i < _planets.size(); ++i) {
for (int i = 0; i < _planets.size(); i++) {
// Increase presision if the planet is in focus
if (focusNode->identifier() == _planets[i].name) {
_anglePrecision = _precisionProperties.highAnglePrecision;

View File

@@ -184,7 +184,7 @@ std::string TransferFunction::serializedToString() const {
return "";
}
json j;
for (auto envIter = _envelopes.begin(); envIter != _envelopes.end(); ++envIter) {
for (auto envIter = _envelopes.begin(); envIter != _envelopes.end(); envIter++) {
j[std::distance(_envelopes.begin(), envIter)] = { envIter->jsonEnvelope() };
}
return j.dump();
@@ -216,7 +216,7 @@ bool TransferFunction::createTexture(ghoul::opengl::Texture& ptr) {
rgbFromEnvelopes /= (count == 0) ? 1.f : static_cast<float>(count);
rgbFromEnvelopes.w = alpha;
for (int channel = 0; channel < 4; ++channel) {
for (int channel = 0; channel < 4; channel++) {
const int p = 4 * i + channel;
const float value = rgbFromEnvelopes[channel];
transferFunction[p] = value;

View File

@@ -93,7 +93,7 @@ void WebRenderHandler::OnPaint(CefRefPtr<CefBrowser>, CefRenderHandler::PaintEle
}
// Copy the updated rectangle line by line.
for (int y = lowerUpdatingRectBound.y; y < upperUpdatingRectBound.y; ++y) {
for (int y = lowerUpdatingRectBound.y; y < upperUpdatingRectBound.y; y++) {
const int lineOffset = y * w + lowerUpdatingRectBound.x;
// Chromium stores image upside down compared to OpenGL, so we flip it:
const int invLineOffset = (h - y - 1) * w + lowerUpdatingRectBound.x;

View File

@@ -177,7 +177,7 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional<DataMapping> s
std::set<int> uniqueTextureIndicesInData;
// Skip first row (column names)
for (size_t rowIdx = 1; rowIdx < rows.size(); ++rowIdx) {
for (size_t rowIdx = 1; rowIdx < rows.size(); rowIdx++) {
const std::vector<std::string>& row = rows[rowIdx];
Dataset::Entry entry;

View File

@@ -108,13 +108,13 @@ void ModuleEngine::deinitialize() {
LDEBUG("Deinitializing modules");
for (auto mIt = _modules.rbegin(); mIt != _modules.rend(); ++mIt) {
for (auto mIt = _modules.rbegin(); mIt != _modules.rend(); mIt++) {
LDEBUG(std::format("Deinitializing module '{}'", (*mIt)->identifier()));
(*mIt)->deinitialize();
}
LDEBUG("Finished deinitializing modules");
for (auto mIt = _modules.rbegin(); mIt != _modules.rend(); ++mIt) {
for (auto mIt = _modules.rbegin(); mIt != _modules.rend(); mIt++) {
LDEBUG(std::format("Destroying module '{}'", (*mIt)->identifier()));
(*mIt) = nullptr;
}
@@ -127,7 +127,7 @@ void ModuleEngine::deinitializeGL() {
ZoneScoped;
LDEBUG("Deinitializing OpenGL of modules");
for (auto mIt = _modules.rbegin(); mIt != _modules.rend(); ++mIt) {
for (auto mIt = _modules.rbegin(); mIt != _modules.rend(); mIt++) {
LDEBUG(std::format("Deinitializing OpenGL of module '{}'", (*mIt)->identifier()));
(*mIt)->deinitializeGL();

View File

@@ -179,7 +179,7 @@ void TransferFunction::setTextureFromTxt() {
const float dist = fpos - prevKey->position;
const float weight = dist / (currentKey->position - prevKey->position);
for (int channel = 0; channel < 4; ++channel) {
for (int channel = 0; channel < 4; channel++) {
const size_t position = 4 * i + channel;
// Interpolate linearly between prev and next mapping key
float value = (prevKey->color[channel] * (1.f - weight) +

View File

@@ -527,7 +527,7 @@ void ScriptEngine::decode(SyncBuffer* syncBuffer) {
size_t nScripts;
syncBuffer->decode(nScripts);
for (size_t i = 0; i < nScripts; ++i) {
for (size_t i = 0; i < nScripts; i++) {
std::string script;
syncBuffer->decode(script);
_clientScriptQueue.push(std::move(script));

View File

@@ -395,7 +395,7 @@ void DynamicFileSequenceDownloader::checkForFinishedDownloads() {
std::vector<File*>::iterator currentIt = _filesCurrentlyDownloading.begin();
// Since size of filesCurrentlyDownloading can change per iteration, keep size-call
for (size_t i = 0; i != _filesCurrentlyDownloading.size(); ++i) {
for (size_t i = 0; i != _filesCurrentlyDownloading.size(); i++) {
File* file = *currentIt;
HttpFileDownload* dl = file->download.get();