Skip to content

Commit

Permalink
Replacing macros with enum definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
itopcuoglu committed Dec 16, 2024
1 parent 100eb70 commit 7deb9fb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
6 changes: 4 additions & 2 deletions src/ADT.C
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "ADT.h"
#include "buildADTrecursion.h"
#include <limits>
#include <cstddef>

void ADT::buildADT(int d, int nelements, double* elementBbox)
{
Expand Down Expand Up @@ -74,7 +75,8 @@ void ADT::buildADT(int d, int nelements, double* elementBbox)
}
for (i = 0; i < ndim / 2; i++) {
i2 = 2 * i + 1;
adtExtents[i2] = std::max(adtExtents[i2], coord[j6 + i + ndim / 2]);
adtExtents[i2] =
std::max(adtExtents[i2], coord[j6 + i + (ndim / 2)]);
}
}
//
Expand Down Expand Up @@ -112,7 +114,7 @@ void ADT::buildADT(int d, int nelements, double* elementBbox)
// fp=fopen("adtReals.dat","w");
// fp1=fopen("adtInts.dat","w");
for (i = 0; i < nelem; i++) {
i4 = 4 * adtIntegers[static_cast<int>(4 * i)];
i4 = 4 * adtIntegers[static_cast<ptrdiff_t>(4 * i)];
adtIntegers[i4 + 3] = i;
}
// for(i=0;i<nelem;i++)
Expand Down
4 changes: 1 addition & 3 deletions src/MeshBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ class CartGrid;
* 02/20/2014
*/

#define FRINGE (-1)
#define HOLE 0
#define FIELD 1
enum : int8_t { FRINGE = -1, HOLE = 0, FIELD = 1 };

class MeshBlock
{
Expand Down
42 changes: 21 additions & 21 deletions src/codetypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ typedef int32_t qcoord_t;
/*====================================================================*/
/* Base for indexing (0 or 1) */
/*====================================================================*/
#define BASE 1

enum : uint8_t { BASE = 1 };
/*====================================================================*/
/* Define arithmetic constants */
/*====================================================================*/
Expand All @@ -55,22 +54,23 @@ typedef int32_t qcoord_t;
// #define RAD2DEG (180.0/PI)
// #define DEG2RAD (PI/180.0)
#define TOL 1.0e-10
#define HOLEMAPSIZE 192
// #define HOLEMAPSIZE 192

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
enum : uint8_t { HOLEMAPSIZE = 192 };
// #define NFRINGE 3
// #define NVAR 6
#define WALLNODETYPE 0
#define OUTERNODETYPE 1
// #define WALLNODETYPE 0
// #define OUTERNODETYPE 1
enum : uint8_t { WALLNODETYPE = 0, OUTERNODETYPE = 1 };
/*==================================================================*/
/* ADAPTIVE HOLE MAP OCTANT INFO */
/*==================================================================*/
#define INTERSECT_ALG \
1 // [0] point-box inclusion only
// [1] face-box intersection (water-tight)

#define NON_UNIQUE_NODES \
1 // [0] wbc nodes are NOT listed as obc nodes
// [1] wbc nodes may also be listed as obc nodes
// 1 // [0] point-box inclusion only
// // [1] face-box intersection (water-tight)
enum : uint8_t { INTERSECT_ALG = 1 };

// 1 // [0] wbc nodes are NOT listed as obc nodes
// // [1] wbc nodes may also be listed as obc nodes
enum : uint8_t { NON_UNIQUE_NODES };
/* Fixed Octree Constraints: Do Not Change */
#define OCTANT_MAXLEVEL 30 // 32-bit integer
#define OCTANT_CHILDREN 8
Expand All @@ -82,9 +82,7 @@ typedef int32_t qcoord_t;
/** Conversion from integer coordinates to double coordinates */
#define INT2DBL ((double)1.0 / (double)OCTANT_ROOT_LEN)

#define OUTSIDE_SB 0
#define INSIDE_SB 1
#define WALL_SB 2
enum : uint8_t { OUTSIDE_SB = 0, INSIDE_SB = 1, WALL_SB = 2 };
/*==================================================================*/
/* inline debugging tools */
/*==================================================================*/
Expand All @@ -109,12 +107,14 @@ typedef int32_t qcoord_t;
/*===================================================================*/
/* Code specific types */
/*===================================================================*/
#define XLO 0
#define XHI 1
#define YLO 2
#define YHI 3
#define ZLO 4
#define ZHI 5
// #define XLO 0
// #define XHI 1
// #define YLO 2
// #define YHI 3
// #define ZLO 4
// #define ZHI 5

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

enum : uint8_t { XLO = 0, XHI = 1, YLO = 2, YHI = 3, ZLO = 4, ZHI = 5 };

/* Mesh Block Complement/Composite Rank Data */
class meshblockCompInfo
Expand Down

0 comments on commit 7deb9fb

Please sign in to comment.