Skip to content

Commit

Permalink
Fix warnings (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Jul 25, 2024
1 parent f11ab91 commit 9aea4d6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Checks: 'bugprone-*,
-readability-isolate-declaration,
-readability-avoid-const-params-in-decls,
-readability-identifier-length,
-readability-convert-member-functions-to-static,
-readability-function-cognitive-complexity'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
Expand Down
7 changes: 3 additions & 4 deletions src/CartBlock.C
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void CartBlock::insertInInterpList(
rst[n] = (xtmp[n] - xlo[n] - ix[n] * dx[n]) / dx[n];
}
}
if (!(ix[n] >= 0 && ix[n] < dims[n])) {
if (ix[n] < 0 || ix[n] >= dims[n]) {
TRACEI(procid);
TRACEI(global_id);
TRACEI(local_id);
Expand Down Expand Up @@ -311,7 +311,7 @@ void CartBlock::insertInDonorList(
(j - nf) * (dims[0] + 1) + (i - nf) + ncell;
}

if (!(pointid >= 0 && pointid < ncell + nnode)) {
if (pointid < 0 || pointid >= ncell + nnode) {
TRACEI(index);
TRACEI(nf);
TRACEI(dims[0]);
Expand Down Expand Up @@ -739,7 +739,7 @@ void CartBlock::writeCellFile(int bid)
}
if (bid == 0) {
fprintf(fp, "TITLE =\"Tioga output\"\n");
fprintf(fp, "VARIABLES=\"X\",\"Y\",\"Z\",\"IBLANK_CELL\" ");
fprintf(fp, R"(VARIABLES="X","Y","Z","IBLANK_CELL" )");
fprintf(fp, "\n");
}
fprintf(
Expand Down Expand Up @@ -798,5 +798,4 @@ void CartBlock::writeCellFile(int bid)
}

fclose(fp);
return;
}
4 changes: 2 additions & 2 deletions src/CartGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ class CartGrid
CartGrid() = default;
~CartGrid();

void registerData(TIOGA::AMRMeshInfo* m_info);
void registerData(TIOGA::AMRMeshInfo* minfo);
void
registerData(int nf, const int* idata, const double* rdata, int ngridsin);
void preprocess();
void search(double* x, int* donorid, int nsearch);
void search(double* x, int* donorid, int npts);
void setcallback(void (*f1)(int*, double*, int*, double*))
{
donor_frac = f1;
Expand Down
15 changes: 6 additions & 9 deletions src/MeshBlock.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <vector>
#include <stdexcept>
#include <algorithm>
#include <unordered_set>
#include "mpi.h"
#include "codetypes.h"
#include "MeshBlock.h"
#include "TiogaMeshInfo.h"
#include "tioga_gpu.h"
#include "linklist.h"
#include "tioga_math.h"
Expand Down Expand Up @@ -830,7 +829,7 @@ void MeshBlock::writeCellFile(int bid)
snprintf(fname, sizeof(fname), "cell%s.dat", &(intstring[1]));
fp = fopen(fname, "w");
fprintf(fp, "TITLE =\"Tioga output\"\n");
fprintf(fp, "VARIABLES=\"X\",\"Y\",\"Z\",\"IBLANK\",\"IBLANK_CELL\" ");
fprintf(fp, R"(VARIABLES="X","Y","Z","IBLANK","IBLANK_CELL" )");
fprintf(fp, "\n");
fprintf(
fp, "ZONE T=\"VOL_MIXED\",N=%d E=%d ET=BRICK, F=FEBLOCK\n", nnodes,
Expand Down Expand Up @@ -917,7 +916,7 @@ void MeshBlock::writeFlowFile(int bid, double* q, int nvar, int type)
snprintf(fname, sizeof(fname), "flow%s.tec", &(intstring[1]));
fp = fopen(fname, "w");
fprintf(fp, "TITLE =\"Tioga output\"\n");
fprintf(fp, "VARIABLES=\"X\",\"Y\",\"Z\",\"IBLANK\",\"BTAG\"");
fprintf(fp, R"(VARIABLES="X","Y","Z","IBLANK","BTAG")");
for (i = 0; i < nvar; i++) {
snprintf(qstr, sizeof(qstr), "Q%d", i);
fprintf(fp, ",\"%s\"", qstr);
Expand Down Expand Up @@ -1120,12 +1119,12 @@ void MeshBlock::writeBCnodes(char nodetype2tag, int bodyid)
char filename[100];
FILE* fp;

int sbuffer = 1;
const int sbuffer = 1;
int rbuffer;
int i, ii, i3;

// set node type data
int nbc = (nodetype2tag == WALLNODETYPE) ? nwbc : nobc;
const int nbc = (nodetype2tag == WALLNODETYPE) ? nwbc : nobc;
int* bcnode = (nodetype2tag == WALLNODETYPE) ? wbcnode : obcnode;

int allnbc = 0;
Expand Down Expand Up @@ -1948,9 +1947,7 @@ MeshBlock::~MeshBlock()
if (nodeRes != nullptr) TIOGA_FREE(nodeRes);
if (elementBbox != nullptr) TIOGA_FREE(elementBbox);
if (elementList != nullptr) TIOGA_FREE(elementList);
if (adt != nullptr) {
delete[] adt;
}
delete[] adt;
if (donorList != nullptr) {
for (i = 0; i < nnodes; i++) {
deallocateLinkList(donorList[i]);
Expand Down
4 changes: 2 additions & 2 deletions src/MeshBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ class MeshBlock
uint8_t* tagList);

void getQueryPoints(
OBB* obb, int* nints, int** intData, int* nreals, double** realData);
OBB* obc, int* nints, int** intData, int* nreals, double** realData);

void getQueryPoints2(
OBB* obb, int* nints, int** intData, int* nreals, double** realData);
OBB* obc, int* nints, int** intData, int* nreals, double** realData);

/** routines that do book keeping */

Expand Down

0 comments on commit 9aea4d6

Please sign in to comment.