Skip to content

Commit

Permalink
Fix more warnings (#50)
Browse files Browse the repository at this point in the history
* Fix more warnings.

* Remove return.
  • Loading branch information
jrood-nrel authored Jul 25, 2024
1 parent 6d0a5f4 commit f11ab91
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 65 deletions.
10 changes: 2 additions & 8 deletions src/MeshBlock.C
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,6 @@ void MeshBlock::writeGridFile(int bid)
}
}
fclose(fp);
return;
}

void MeshBlock::writeCellFile(int bid)
Expand Down Expand Up @@ -890,7 +889,6 @@ void MeshBlock::writeCellFile(int bid)
}
}
fclose(fp);
return;
}

void MeshBlock::writeFlowFile(int bid, double* q, int nvar, int type)
Expand Down Expand Up @@ -994,7 +992,6 @@ void MeshBlock::writeFlowFile(int bid, double* q, int nvar, int type)
// for(i=0;i<nobc;i++)
// fprintf(fp,"%d\n",obcnode[i]);
fclose(fp);
return;
}

void MeshBlock::getWallBounds(int* mtag, int* existWall, double wbox[6])
Expand Down Expand Up @@ -1602,7 +1599,6 @@ void MeshBlock::getReducedOBB(OBB* obc, double* realData)
}
realData[j + 3] = (bbox[j + 3] - bbox[j]) * 0.51;
}
return;
}

void MeshBlock::getReducedOBB2(OBB* obc, double* realData)
Expand Down Expand Up @@ -1665,7 +1661,6 @@ void MeshBlock::getReducedOBB2(OBB* obc, double* realData)
}
realData[j + 3] = (bbox[j + 3] - bbox[j]) * 0.5;
}
return;
}

void MeshBlock::getQueryPoints(
Expand Down Expand Up @@ -2138,8 +2133,8 @@ void MeshBlock::check_for_uniform_hex()
if (obh != nullptr) TIOGA_FREE(obh);
obh = (OBB*)malloc(sizeof(OBB));
for (auto& j : obh->vec) {
for (int k = 0; k < 3; k++) {
j[k] = 0;
for (double& k : j) {
k = 0;
}
}
for (int k = 0; k < 3; k++) {
Expand Down Expand Up @@ -2198,7 +2193,6 @@ void MeshBlock::check_for_uniform_hex()
}
}
}
return;
}

void MeshBlock::create_hex_cell_map()
Expand Down
18 changes: 11 additions & 7 deletions src/MeshBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class MeshBlock
int** intData,
double** realData,
const double* q,
const int*);
const int* /*sndMap*/);

void checkContainment(int* cellIndex, int adtElement, double* xsearch);

Expand Down Expand Up @@ -414,7 +414,7 @@ class MeshBlock

void findInterpListCart();

void set_ninterp(int);
void set_ninterp(int /*ninterp_input*/);

void getCancellationData(int* nints, int** intData);

Expand All @@ -434,8 +434,8 @@ class MeshBlock

void getReceptorInfo(int* receptors);

void getReducedOBB(OBB*, double*);
void getReducedOBB2(OBB*, double*);
void getReducedOBB(OBB* /*obc*/, double* /*realData*/);
void getReducedOBB2(OBB* /*obc*/, double* /*realData*/);

void resetCoincident();
//
Expand Down Expand Up @@ -475,7 +475,7 @@ class MeshBlock
dominanceFlag = dominanceflag;
}

void writeCellFile(int);
void writeCellFile(int /*bid*/);
void writeBCnodes(char nodetype2tag, int bodyid);
void getInternalNodes();
void getExtraQueryPoints(
Expand Down Expand Up @@ -521,9 +521,13 @@ class MeshBlock
* Get donor packet for multi-block/partition setups
*
*/
void getMBDonorPktSizes(std::vector<int>&, std::vector<int>&) const;
void getMBDonorPktSizes(
std::vector<int>& /*nints*/, std::vector<int>& /*nreals*/) const;

void getMBDonorPackets(std::vector<int>&, std::vector<int>&, PACKET*) const;
void getMBDonorPackets(
std::vector<int>& /*ixOffset*/,
std::vector<int>& /*rxOffset*/,
PACKET* /*sndPack*/) const;

/** Reset interpolation list data structure
*
Expand Down
2 changes: 1 addition & 1 deletion src/cellVolume.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void cellVolume(
const int numverts[6],
int fconn[6][4],
int nfaces,
int nvert)
int /*nvert*/)
{
*vol = 0.0;
for (int iface = 1; iface <= nfaces; iface++) {
Expand Down
8 changes: 7 additions & 1 deletion src/cellVolume.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#ifndef CELLVOLUME_H
#define CELLVOLUME_H
void cellVolume(double*, double[8][3], const int[6], int[6][4], int, int);
void cellVolume(
double* /*vol*/,
double /*xc*/[8][3],
const int /*numverts*/[6],
int /*fconn*/[6][4],
int /*nfaces*/,
int /*nvert*/);
#endif
2 changes: 1 addition & 1 deletion src/codetypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enum { OUTSIDE_SB = 0, INSIDE_SB = 1, WALL_SB = 2 };
#define TIOGA_FREE(a1) \
{ \
free(a1); \
a1 = NULL; \
(a1) = NULL; \
}
// # define debug(x,y) printf("#tioga:\t"#x"=%d,"#y"=%d\n",x,y);
// # define stdwrite(x) if (myid==0) printf("#tioga:\t"#x"\n");
Expand Down
8 changes: 4 additions & 4 deletions src/exchangeBoxes.C
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void tioga::exchangeBoxes()
for (int ib = 0; ib < nblocks; ib++) {
myOBBdata[m++] = (double)mytag[ib];
for (auto& i : mblocks[ib]->obb->vec) {
for (int j = 0; j < 3; j++) {
myOBBdata[m++] = i[j];
for (double j : i) {
myOBBdata[m++] = j;
}
}
for (double const i : mblocks[ib]->obb->xc) {
Expand Down Expand Up @@ -120,8 +120,8 @@ void tioga::exchangeBoxes()
obbProc[ix] = k;
obbID[ix] = (int)(allOBBdata[m++] + 0.5);
for (auto& i : obbRecv[ix].vec) {
for (int j = 0; j < 3; j++) {
i[j] = allOBBdata[m++];
for (double& j : i) {
j = allOBBdata[m++];
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/getCartReceptors.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ void MeshBlock::getCartReceptors(CartGrid* cg, parallelComm* pc)
//
OBB* obcart = (OBB*)malloc(sizeof(OBB));
for (auto& j : obcart->vec) {
for (int k = 0; k < 3; k++) {
j[k] = 0;
for (double& k : j) {
k = 0;
}
}
obcart->vec[0][0] = obcart->vec[1][1] = obcart->vec[2][2] = 1.0;
Expand Down Expand Up @@ -170,7 +170,7 @@ void MeshBlock::getCartReceptors(CartGrid* cg, parallelComm* pc)

void MeshBlock::fillReceptorDataPtr(
CartGrid* cg,
int cell_count,
int /*cell_count*/,
int c,
int j,
int k,
Expand Down
2 changes: 1 addition & 1 deletion src/linCartInterp.C
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void linear_interpolation(
int* ijk_cell,
int* dims,
double* ref_ratio,
int* nw,
int* /*nw*/,
int* ijk_stencil,
double* weights,
bool isNodal)
Expand Down
2 changes: 1 addition & 1 deletion src/tioga.C
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ void tioga::register_amr_solution(
#ifdef TIOGA_ENABLE_TIMERS
void tioga::myTimer(char const* info, int type)
#else
void tioga::myTimer(char const*, int)
void tioga::myTimer(char const* /*unused*/, int /*unused*/)
#endif
{
#ifdef TIOGA_ENABLE_TIMERS
Expand Down
15 changes: 9 additions & 6 deletions src/tioga.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class tioga
double* frac,
const int* dcount);

void getReceptorInfo(std::vector<int>&);
void getReceptorInfo(std::vector<int>& /*receptors*/);

/** set hole map algorithm: [0] original hole map, [1] adaptive hole map */
void setHoleMapAlgorithm(int alg) { USE_ADAPTIVE_HOLEMAP = alg; };
Expand Down Expand Up @@ -327,14 +327,17 @@ class tioga
cg->setcallback(f1);
}

void register_amr_global_data(int, int*, double*, int);
void set_amr_patch_count(int);
void register_amr_local_data(int, int, int*, int*);
void register_amr_solution(int, double*, int, int);
void register_amr_global_data(
int /*nf*/, int* /*idata*/, double* /*rdata*/, int /*ngridsin*/);
void set_amr_patch_count(int /*npatchesin*/);
void register_amr_local_data(
int /*ipatch*/, int /*global_id*/, int* /*iblank*/, int* /*iblankn*/);
void register_amr_solution(
int /*ipatch*/, double* /*q*/, int /*nvar_cell*/, int /*nvar_node*/);
void exchangeAMRDonors();
void checkComm();
void outputStatistics();
void myTimer(char const*, int);
void myTimer(char const* /*unused*/, int /*unused*/);
void reduce_fringes();
};
} // namespace TIOGA
Expand Down
2 changes: 1 addition & 1 deletion src/tioga_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace gpu {
#define TIOGA_GPU_CHECK_ERROR(call) (call)
#endif

#define TIOGA_FREE_DEVICE(dptr) TIOGA::gpu::deallocate_device(&dptr)
#define TIOGA_FREE_DEVICE(dptr) TIOGA::gpu::deallocate_device(&(dptr))

} // namespace gpu
} // namespace TIOGA
Expand Down
2 changes: 1 addition & 1 deletion src/tioga_nogpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using gpuError_t = int;
constexpr gpuError_t gpuSuccess = 0;

inline gpuError_t gpuGetLastError() { return gpuSuccess; }
inline const char* gpuGetErrorString(gpuError_t err) { return "Success"; }
inline const char* gpuGetErrorString(gpuError_t /*err*/) { return "Success"; }

template <typename T>
inline T* allocate_on_device(const size_t size)
Expand Down
60 changes: 30 additions & 30 deletions src/tioga_triBox.C
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define Z 2

#define CROSS(dest, v1, v2) \
dest[0] = v1[1] * v2[2] - v1[2] * v2[1]; \
dest[1] = v1[2] * v2[0] - v1[0] * v2[2]; \
dest[2] = v1[0] * v2[1] - v1[1] * v2[0];
dest[0] = (v1)[1] * (v2)[2] - (v1)[2] * (v2)[1]; \
(dest)[1] = (v1)[2] * (v2)[0] - (v1)[0] * (v2)[2]; \
(dest)[2] = (v1)[0] * (v2)[1] - (v1)[1] * (v2)[0];

#define DOT(v1, v2) (v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2])
#define DOT(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])

#define SUB(dest, v1, v2) \
dest[0] = v1[0] - v2[0]; \
dest[1] = v1[1] - v2[1]; \
dest[2] = v1[2] - v2[2];
dest[0] = (v1)[0] - (v2)[0]; \
(dest)[1] = (v1)[1] - (v2)[1]; \
(dest)[2] = (v1)[2] - (v2)[2];

#define FINDMINMAX(x0, x1, x2, min, max) \
min = max = x0; \
if (x1 < min) min = x1; \
if (x1 > max) max = x1; \
if (x2 < min) min = x2; \
if (x2 > max) max = x2;
min = (max) = x0; \
if ((x1) < (min)) (min) = x1; \
if ((x1) > (max)) (max) = x1; \
if ((x2) < (min)) (min) = x2; \
if ((x2) > (max)) (max) = x2;

int planeBoxOverlap(
const double normal[3], const double vert[3], const double maxbox[3])
Expand Down Expand Up @@ -90,83 +90,83 @@ int planeBoxOverlap(

/*======================== X-tests ========================*/
#define AXISTEST_X01(a, b, fa, fb) \
p0 = a * v0[Y] - b * v0[Z]; \
p2 = a * v2[Y] - b * v2[Z]; \
p0 = (a) * v0[Y] - (b) * v0[Z]; \
p2 = (a) * v2[Y] - (b) * v2[Z]; \
if (p0 < p2) { \
min = p0; \
max = p2; \
} else { \
min = p2; \
max = p0; \
} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
rad = (fa) * boxhalfsize[Y] + (fb) * boxhalfsize[Z]; \
if (min > rad || max < -rad) return 0;

#define AXISTEST_X2(a, b, fa, fb) \
p0 = a * v0[Y] - b * v0[Z]; \
p1 = a * v1[Y] - b * v1[Z]; \
p0 = (a) * v0[Y] - (b) * v0[Z]; \
p1 = (a) * v1[Y] - (b) * v1[Z]; \
if (p0 < p1) { \
min = p0; \
max = p1; \
} else { \
min = p1; \
max = p0; \
} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
rad = (fa) * boxhalfsize[Y] + (fb) * boxhalfsize[Z]; \
if (min > rad || max < -rad) return 0;

/*======================== Y-tests ========================*/
#define AXISTEST_Y02(a, b, fa, fb) \
p0 = -a * v0[X] + b * v0[Z]; \
p2 = -a * v2[X] + b * v2[Z]; \
p0 = -(a) * v0[X] + (b) * v0[Z]; \
p2 = -(a) * v2[X] + (b) * v2[Z]; \
if (p0 < p2) { \
min = p0; \
max = p2; \
} else { \
min = p2; \
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
rad = (fa) * boxhalfsize[X] + (fb) * boxhalfsize[Z]; \
if (min > rad || max < -rad) return 0;

#define AXISTEST_Y1(a, b, fa, fb) \
p0 = -a * v0[X] + b * v0[Z]; \
p1 = -a * v1[X] + b * v1[Z]; \
p0 = -(a) * v0[X] + (b) * v0[Z]; \
p1 = -(a) * v1[X] + (b) * v1[Z]; \
if (p0 < p1) { \
min = p0; \
max = p1; \
} else { \
min = p1; \
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
rad = (fa) * boxhalfsize[X] + (fb) * boxhalfsize[Z]; \
if (min > rad || max < -rad) return 0;

/*======================== Z-tests ========================*/
#define AXISTEST_Z12(a, b, fa, fb) \
p1 = a * v1[X] - b * v1[Y]; \
p2 = a * v2[X] - b * v2[Y]; \
p1 = (a) * v1[X] - (b) * v1[Y]; \
p2 = (a) * v2[X] - (b) * v2[Y]; \
if (p2 < p1) { \
min = p2; \
max = p1; \
} else { \
min = p1; \
max = p2; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
rad = (fa) * boxhalfsize[X] + (fb) * boxhalfsize[Y]; \
if (min > rad || max < -rad) return 0;

#define AXISTEST_Z0(a, b, fa, fb) \
p0 = a * v0[X] - b * v0[Y]; \
p1 = a * v1[X] - b * v1[Y]; \
p0 = (a) * v0[X] - (b) * v0[Y]; \
p1 = (a) * v1[X] - (b) * v1[Y]; \
if (p0 < p1) { \
min = p0; \
max = p1; \
} else { \
min = p1; \
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
rad = (fa) * boxhalfsize[X] + (fb) * boxhalfsize[Y]; \
if (min > rad || max < -rad) return 0;

int triBoxOverlap(
Expand Down

0 comments on commit f11ab91

Please sign in to comment.