Skip to content

Commit

Permalink
Add more const (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Jul 25, 2024
1 parent 1d8550c commit 6d0a5f4
Show file tree
Hide file tree
Showing 25 changed files with 148 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/CartBlock.C
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void CartBlock::getInterpolatedData(
}
}

void CartBlock::update(double* qval, int index)
void CartBlock::update(const double* qval, int index)
{
if (index >= ncell_nf) {
if (nvar_node == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/CartBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class CartBlock
void preprocess(CartGrid* cg);
void getInterpolatedData(
int* nints, int* nreals, int** intData, double** realData);
void update(double* qval, int index);
void update(const double* qval, int index);
void getCancellationData(int* cancelledData, int* ncancel);
void processDonors(HOLEMAP* holemap, int nmesh);
void processDonors(ADAPTIVE_HOLEMAP* holemap, int nmesh);
Expand Down
3 changes: 2 additions & 1 deletion src/CartGrid.C
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void CartGrid::registerData(TIOGA::AMRMeshInfo* minfo)
m_info_device, m_info, sizeof(TIOGA::AMRMeshInfo));
}

void CartGrid::registerData(int nfin, int* idata, double* rdata, int ngridsin)
void CartGrid::registerData(
int nfin, const int* idata, const double* rdata, int ngridsin)
{
int i, i3, i6, iloc, n;
FILE* fp;
Expand Down
3 changes: 2 additions & 1 deletion src/CartGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class CartGrid
~CartGrid();

void registerData(TIOGA::AMRMeshInfo* m_info);
void registerData(int nf, int* idata, double* rdata, int ngridsin);
void
registerData(int nf, const int* idata, const double* rdata, int ngridsin);
void preprocess();
void search(double* x, int* donorid, int nsearch);
void setcallback(void (*f1)(int*, double*, int*, double*))
Expand Down
20 changes: 10 additions & 10 deletions src/MeshBlock.C
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ void MeshBlock::getWallBounds(int* mtag, int* existWall, double wbox[6])
}
}

void MeshBlock::markWallBoundary(int* sam, int nx[3], double extents[6])
void MeshBlock::markWallBoundary(int* sam, int nx[3], const double extents[6])
{
int i, j, k, m, n;
int nvert;
Expand Down Expand Up @@ -1180,10 +1180,10 @@ void MeshBlock::writeBCnodes(char nodetype2tag, int bodyid)

void MeshBlock::markBoundaryAdaptiveMap(
char nodetype2tag,
double extents_lo[3],
double extents_hi[3],
const double extents_lo[3],
const double extents_hi[3],
level_octant_t* level,
uint8_t* taggedList,
const uint8_t* taggedList,
uint8_t* tagList)
{
int i, j;
Expand Down Expand Up @@ -1267,10 +1267,10 @@ void MeshBlock::markBoundaryAdaptiveMap(

void MeshBlock::markBoundaryAdaptiveMapSurfaceIntersect(
char nodetype2tag,
double extents_lo[3],
double extents_hi[3],
const double extents_lo[3],
const double extents_hi[3],
level_octant_t* level,
uint8_t* taggedList,
const uint8_t* taggedList,
uint8_t* tagList)
{
int* inode;
Expand Down Expand Up @@ -1385,12 +1385,12 @@ void MeshBlock::markBoundaryAdaptiveMapSurfaceIntersect(

void MeshBlock::markBoundaryAdaptiveMapSurfaceIntersect(
char nodetype2tag,
double extents_lo[3],
double extents_hi[3],
const double extents_lo[3],
const double extents_hi[3],
uint8_t level_id,
uint32_t noctants,
octant_coordinates_t* octants,
uint8_t* taggedList,
const uint8_t* taggedList,
uint8_t* tagList)
{
int* inode;
Expand Down
32 changes: 16 additions & 16 deletions src/MeshBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class MeshBlock

void writeOBB2(OBB* obc, int bid);

void updateSolnData(int inode, double* qvar, double* q) const;
void updateSolnData(int inode, const double* qvar, double* q) const;

int getNinterp() const { return ninterp; };

Expand All @@ -322,7 +322,7 @@ class MeshBlock
int* nreals,
int** intData,
double** realData,
double* q,
const double* q,
int nvar,
int interptype);

Expand All @@ -331,39 +331,39 @@ class MeshBlock
int* nreals,
int** intData,
double** realData,
double* q,
int*);
const double* q,
const int*);

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

void getWallBounds(int* mtag, int* existWall, double wbox[6]);

void markWallBoundary(int* sam, int nx[3], double extents[6]);
void markWallBoundary(int* sam, int nx[3], const double extents[6]);

void markBoundaryAdaptiveMap(
char nodetype2tag,
double extents_lo[3],
double extents_hi[3],
const double extents_lo[3],
const double extents_hi[3],
level_octant_t* level,
uint8_t* taggedList,
const uint8_t* taggedList,
uint8_t* tagList);

void markBoundaryAdaptiveMapSurfaceIntersect(
char nodetype2tag,
double extents_lo[3],
double extents_hi[3],
const double extents_lo[3],
const double extents_hi[3],
level_octant_t* level,
uint8_t* taggedList,
const uint8_t* taggedList,
uint8_t* tagList);

void markBoundaryAdaptiveMapSurfaceIntersect(
char nodetype2tag,
double extents_lo[3],
double extents_hi[3],
const double extents_lo[3],
const double extents_hi[3],
uint8_t level_id,
uint32_t noctants,
octant_coordinates_t* octants,
uint8_t* taggedList,
const uint8_t* taggedList,
uint8_t* tagList);

void markBoundaryMapSurface(
Expand Down Expand Up @@ -486,7 +486,7 @@ class MeshBlock
int* nreals,
int** intData,
double** realData,
double* q,
const double* q,
int nvar,
int interptype) const;
void updatePointData(double* q, double* qtmp, int nvar, int interptype);
Expand All @@ -495,7 +495,7 @@ class MeshBlock
fprintf(
fp, "%f %f %f\n", rxyz[3 * i], rxyz[3 * i + 1], rxyz[3 * i + 2]);
}
void clearOrphans(HOLEMAP* holemap, int nmesh, int* itmp);
void clearOrphans(HOLEMAP* holemap, int nmesh, const int* itmp);
void clearOrphans(ADAPTIVE_HOLEMAP* holemap, int nmesh, int* itmp);
void getUnresolvedMandatoryReceptors();
void getCartReceptors(CartGrid* cg, parallelComm* pc);
Expand Down
4 changes: 2 additions & 2 deletions src/cartOps.C
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ void MeshBlock::getInterpolatedSolutionAMR(
int* nreals,
int** intData,
double** realData,
double* q,
int* sndMap)
const double* q,
const int* sndMap)
{
int i;
int k, m, inode;
Expand Down
2 changes: 1 addition & 1 deletion src/cellVolume.C
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ double scalarProduct(
void cellVolume(
double* vol,
double xc[8][3],
int numverts[6],
const int numverts[6],
int fconn[6][4],
int nfaces,
int nvert)
Expand Down
2 changes: 1 addition & 1 deletion src/cellVolume.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef CELLVOLUME_H
#define CELLVOLUME_H
void cellVolume(double*, double[8][3], int[6], int[6][4], int, int);
void cellVolume(double*, double[8][3], const int[6], int[6][4], int, int);
#endif
4 changes: 2 additions & 2 deletions src/dataUpdate.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void MeshBlock::getInterpolatedSolution(
int* nreals,
int** intData,
double** realData,
double* q,
const double* q,
int nvar,
int interptype)
{
Expand Down Expand Up @@ -110,7 +110,7 @@ void MeshBlock::getInterpolatedSolution(
if (qq != nullptr) TIOGA_FREE(qq);
}

void MeshBlock::updateSolnData(int inode, double* qvar, double* q) const
void MeshBlock::updateSolnData(int inode, const double* qvar, double* q) const
{
int k;

Expand Down
4 changes: 2 additions & 2 deletions src/exchangeBoxes.C
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ void tioga::exchangeBoxes()
myOBBdata[m++] = i[j];
}
}
for (double i : mblocks[ib]->obb->xc) {
for (double const i : mblocks[ib]->obb->xc) {
myOBBdata[m++] = i;
}
for (double i : mblocks[ib]->obb->dxc) {
for (double const i : mblocks[ib]->obb->dxc) {
myOBBdata[m++] = i;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/highOrder.C
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void MeshBlock::getCellIblanks()
}
}

void MeshBlock::clearOrphans(HOLEMAP* holemap, int nmesh, int* itmp)
void MeshBlock::clearOrphans(HOLEMAP* holemap, int nmesh, const int* itmp)
{
int i, j, k, m;
int reject;
Expand Down Expand Up @@ -407,7 +407,7 @@ void MeshBlock::getInterpolatedSolutionAtPoints(
int* nreals,
int** intData,
double** realData,
double* q,
const double* q,
int nvar,
int interptype) const
{
Expand Down
12 changes: 7 additions & 5 deletions src/linCartInterp.C
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ void compute_weights(const std::vector<double>& ref_coord, double* weights)
}
}

void compute_ref_coords_cell(double* ref_ratio, std::vector<double>& ref_coord)
void compute_ref_coords_cell(
const double* ref_ratio, std::vector<double>& ref_coord)
{
static constexpr int p = 1;
// reference coordinates in -1 to 1. Assumes cells of uniform sizes
Expand All @@ -76,7 +77,8 @@ void compute_ref_coords_cell(double* ref_ratio, std::vector<double>& ref_coord)
: ((ref_ratio[2] + 0.5 * (2 * p - 1)) / p * 2 - 1);
}

void compute_ref_coords_node(double* ref_ratio, std::vector<double>& ref_coord)
void compute_ref_coords_node(
const double* ref_ratio, std::vector<double>& ref_coord)
{
static constexpr int p = 1;
// reference coordinates in -1 to 1. Assumes cells of uniform sizes
Expand All @@ -87,9 +89,9 @@ void compute_ref_coords_node(double* ref_ratio, std::vector<double>& ref_coord)

void create_donor_stencil(
const int nf,
int* ijk_cell,
int* dims,
double* ref_ratio,
const int* ijk_cell,
const int* dims,
const double* ref_ratio,
int* ijk_stencil,
bool isNodal)
{
Expand Down
12 changes: 7 additions & 5 deletions src/linCartInterp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ void compute_1d_bases(
void compute_linear_weights(
const std::vector<double>& ref_coord, double* weights);

void compute_ref_coords_cell(double* ref_ratio, std::vector<double>& ref_coord);
void compute_ref_coords_cell(
const double* ref_ratio, std::vector<double>& ref_coord);

void compute_ref_coords_node(double* ref_ratio, std::vector<double>& ref_coord);
void compute_ref_coords_node(
const double* ref_ratio, std::vector<double>& ref_coord);

void create_donor_stencil(
const int nf,
int* ijk_cell,
int* dims,
double* ref_ratio,
const int* ijk_cell,
const int* dims,
const double* ref_ratio,
int* ijk_stencil,
bool isNodal);

Expand Down
2 changes: 1 addition & 1 deletion src/linklist.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ void deallocateLinkList2(INTEGERLIST* temp);
void deallocateLinkList3(INTEGERLIST2* temp);
void deallocateLinkList4(INTERPLIST2* temp);
void insertInList(DONORLIST** donorList, DONORLIST* temp1);
int checkHoleMap(double* x, int* nx, int* sam, double* extents);
// int checkHoleMap(double* x, int* nx, int* sam, double* extents);
#endif
2 changes: 1 addition & 1 deletion src/parallelComm.C
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void parallelComm::sendRecvPacketsCheck(PACKET* sndPack, PACKET* rcvPack)
TIOGA_FREE(status);
}

void parallelComm::setMap(int ns, int nr, int* snd, int* rcv)
void parallelComm::setMap(int ns, int nr, const int* snd, const int* rcv)
{
int i;
//
Expand Down
2 changes: 1 addition & 1 deletion src/parallelComm.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class parallelComm

void sendRecvPacketsCheck(PACKET* sndPack, PACKET* rcvPack);

void setMap(int ns, int nr, int* snd, int* rcv);
void setMap(int ns, int nr, const int* snd, const int* rcv);

void getMap(int* ns, int* nr, int** snd, int** rcv);

Expand Down
6 changes: 3 additions & 3 deletions src/tioga.C
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void tioga::setNumCompositeBodies(int ncomp)
void tioga::registerCompositeBody(
int compbodytag,
int nbodytags,
int* meshtags,
int* dominancetags,
const int* meshtags,
const int* dominancetags,
double searchTol)
{
// resize and fill composite body tag IDs
Expand Down Expand Up @@ -1034,7 +1034,7 @@ void tioga::getDonorCount(int btag, int* dcount, int* fcount)
}

void tioga::getDonorInfo(
int btag, int* receptors, int* indices, double* frac, int* dcount)
int btag, int* receptors, int* indices, double* frac, const int* dcount)
{
int nsend, nrecv;
int *sndMap, *rcvMap;
Expand Down
14 changes: 9 additions & 5 deletions src/tioga.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ class tioga
void registerCompositeBody(
int compbodytag,
int nbodytags,
int* meshtags,
int* dominancetags,
const int* meshtags,
const int* dominancetags,
double searchTol);

/** registerGrid data */
Expand Down Expand Up @@ -235,7 +235,11 @@ class tioga
void getDonorCount(int btag, int* dcount, int* fcount);

void getDonorInfo(
int btag, int* receptors, int* indices, double* frac, int* dcount);
int btag,
int* receptors,
int* indices,
double* frac,
const int* dcount);

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

Expand All @@ -259,9 +263,9 @@ class tioga
mb->setResolutions(nres, cres);
}

void setMexclude(int* mexclude_input) { mexclude = *mexclude_input; }
void setMexclude(const int* mexclude_input) { mexclude = *mexclude_input; }

void setNfringe(int* nfringe_input) { nfringe = *nfringe_input; }
void setNfringe(const int* nfringe_input) { nfringe = *nfringe_input; }

void set_cell_iblank(int* iblank_cell)
{
Expand Down
Loading

0 comments on commit 6d0a5f4

Please sign in to comment.