Skip to content

Commit 072d721

Browse files
committed
Format files and fix --std=c++17 problem
1 parent 11d76ab commit 072d721

26 files changed

Lines changed: 581 additions & 434 deletions

src/DEM/API.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ class DEMSolver {
355355
void SetCDFutureDriftEffDriftSafetyFactor(float factor) {
356356
future_drift_eff_drift_safety_factor = clampBetween(factor, 1.0f, 10.0f);
357357
}
358-
/// @brief Set bounds (as a fraction of max drift) that clamp dT's waiting behavior before sending a new kT work order.
358+
/// @brief Set bounds (as a fraction of max drift) that clamp dT's waiting behavior before sending a new kT work
359+
/// order.
359360
/// @details Default is lower=0, upper=1 (send as late as safely possible). `upper=0` makes dT send immediately
360361
/// (close to the old behavior, but still with the safety factor). Values must satisfy 0 <= lower <= upper <= 1.
361362
void SetCDFutureDriftSendBounds(float lower_ratio, float upper_ratio) {

src/DEM/APIPrivate.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void DEMSolver::jitifyKernels() {
295295
equipIntegrationScheme(m_subs);
296296
equipKernelIncludes(m_subs);
297297

298-
// Jitify may require a defined device to derive the arch
298+
// Jitify may require a defined device to derive the arch
299299
std::thread kT_build([&]() {
300300
DEME_GPU_CALL(cudaSetDevice(kT->streamInfo.device));
301301
kT->jitifyKernels(m_subs, m_jitify_options);
@@ -326,7 +326,6 @@ void DEMSolver::jitifyKernels() {
326326
}
327327
}
328328
}
329-
330329
}
331330

332331
void DEMSolver::getContacts_impl(std::vector<bodyID_t>& idA,
@@ -1196,29 +1195,32 @@ void DEMSolver::setSimParams() {
11961195
// Silently bring down m_approx_max_vel
11971196
m_approx_max_vel = threshold_error_out_vel;
11981197
}
1199-
{ // Adaptive Timestep -- currently only Hertz const.
1198+
{ // Adaptive Timestep -- currently only Hertz const.
12001199
if (adapt_ts_type == ADAPT_TS_TYPE::HERTZ_CONST) {
12011200
auto sqr = [](double x) { return x * x; };
12021201
auto effective_E = [&](double E1, double nu1, double E2, double nu2) -> double {
1203-
if (E1 <= 0.0 || E2 <= 0.0) return 0.0;
1204-
return 1.0 / ( ((1.0 - sqr(nu1)) / E1) + ((1.0 - sqr(nu2)) / E2) );
1202+
if (E1 <= 0.0 || E2 <= 0.0)
1203+
return 0.0;
1204+
return 1.0 / (((1.0 - sqr(nu1)) / E1) + ((1.0 - sqr(nu2)) / E2));
12051205
}; // max effektive E* over all material contacts
12061206
double Eeff_max = 0.0;
12071207
for (size_t i = 0; i < m_loaded_materials.size(); ++i) {
12081208
const auto& A = m_loaded_materials[i]->mat_prop;
1209-
const double E1 = (A.count("E") ? (double)A.at("E") : 0.0);
1209+
const double E1 = (A.count("E") ? (double)A.at("E") : 0.0);
12101210
const double nu1 = (A.count("nu") ? (double)A.at("nu") : 0.3);
12111211
for (size_t j = i; j < m_loaded_materials.size(); ++j) {
12121212
const auto& B = m_loaded_materials[j]->mat_prop;
1213-
const double E2 = (B.count("E") ? (double)B.at("E") : 0.0);
1213+
const double E2 = (B.count("E") ? (double)B.at("E") : 0.0);
12141214
const double nu2 = (B.count("nu") ? (double)B.at("nu") : 0.3);
12151215
const double Ee = effective_E(E1, nu1, E2, nu2);
1216-
if (Ee > Eeff_max) Eeff_max = Ee;
1216+
if (Ee > Eeff_max)
1217+
Eeff_max = Ee;
12171218
}
1218-
} // lowest mass
1219+
} // lowest mass
12191220
double min_mass = std::numeric_limits<double>::infinity();
12201221
for (double m : m_template_clump_mass)
1221-
if (m > 0.0 && m < min_mass) min_mass = m;
1222+
if (m > 0.0 && m < min_mass)
1223+
min_mass = m;
12221224
const double r_min = (double)m_smallest_radius;
12231225
if (std::isfinite(min_mass) && r_min > 0.0 && Eeff_max > 0.0) {
12241226
const double R_eff = 0.5 * r_min;
@@ -1227,14 +1229,15 @@ void DEMSolver::setSimParams() {
12271229
const double dt_hertz = (PI / (2.0 * N_DT)) * std::sqrt(m_eff / KH);
12281230
if (dt_hertz > 0.0 && std::isfinite(dt_hertz)) {
12291231
m_ts_size = dt_hertz; // <- set const. timestep
1230-
DEME_INFO("Adaptive time step 'hertz_const': dt = %.9g (m_min=%.6g, r_min=%.6g, E*=%.6g, N_DT=%.1f)",
1231-
m_ts_size, min_mass, r_min, Eeff_max, N_DT);
1232+
DEME_INFO(
1233+
"Adaptive time step 'hertz_const': dt = %.9g (m_min=%.6g, r_min=%.6g, E*=%.6g, N_DT=%.1f)",
1234+
m_ts_size, min_mass, r_min, Eeff_max, N_DT);
12321235
} else {
12331236
DEME_WARNING("hertz_const erzeugte ungueltigen dt; behalte bisherigen Wert %.7g.", m_ts_size);
12341237
}
12351238
} else {
12361239
DEME_WARNING("hertz_const: fehlende/ungueltige Daten (m_min=%g, r_min=%g, E*=%g); dt bleibt %.7g.",
1237-
min_mass, r_min, Eeff_max, m_ts_size);
1240+
min_mass, r_min, Eeff_max, m_ts_size);
12381241
}
12391242
}
12401243
}

src/DEM/APIPublic.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ void DEMSolver::SetIntegrator(const std::string& intg) {
739739

740740
void DEMSolver::SetAdaptiveTimeStepType(const std::string& type) {
741741
DEME_WARNING(
742-
"SetAdaptiveTimeStepType is a beta feature, currently hertz_const calculates a fixed timestep based on particle size, mass and contact E-modulus.");
742+
std::string("SetAdaptiveTimeStepType is a beta feature, currently hertz_const calculates a fixed timestep "
743+
"based on particle size, mass and contact E-modulus."));
743744
switch (hash_charr(type.c_str())) {
744745
case ("none"_):
745746
adapt_ts_type = ADAPT_TS_TYPE::NONE;
@@ -748,10 +749,10 @@ void DEMSolver::SetAdaptiveTimeStepType(const std::string& type) {
748749
adapt_ts_type = ADAPT_TS_TYPE::HERTZ_CONST;
749750
break;
750751
case ("max_vel"_):
751-
adapt_ts_type = ADAPT_TS_TYPE::MAX_VEL; // Not implemented yet
752+
adapt_ts_type = ADAPT_TS_TYPE::MAX_VEL; // Not implemented yet
752753
break;
753754
case ("int_diff"_):
754-
adapt_ts_type = ADAPT_TS_TYPE::INT_DIFF; // Not implemented yet
755+
adapt_ts_type = ADAPT_TS_TYPE::INT_DIFF; // Not implemented yet
755756
break;
756757
default:
757758
DEME_ERROR("Adaptive time step type %s is unknown. Please select another via SetAdaptiveTimeStepType.",
@@ -2206,8 +2207,6 @@ void DEMSolver::Initialize(bool dry_run) {
22062207
// Always clear cache after init
22072208
ClearCache();
22082209

2209-
2210-
22112210
//// TODO: Give a warning if sys_initialized is true and the system is re-initialized: in that case, the user should
22122211
/// know what they are doing
22132212
sys_initialized = true;
@@ -2257,7 +2256,8 @@ void DEMSolver::ShowTimingStats() {
22572256
void DEMSolver::SetGPUTimersEnabled(bool enabled) {
22582257
m_gpu_timers_enabled = enabled;
22592258

2260-
// Note: SolverTimers uses cudaEventCreate/Destroy, which are device-scoped. Ensure we operate on the correct device.
2259+
// Note: SolverTimers uses cudaEventCreate/Destroy, which are device-scoped. Ensure we operate on the correct
2260+
// device.
22612261
if (enabled) {
22622262
DEME_GPU_CALL(cudaSetDevice(dT->streamInfo.device));
22632263
dT->timers.EnableGpuTimers();

src/DEM/Defines.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ namespace deme {
3636
#define DEME_BIN_ENLARGE_RATIO_FOR_FACETS 0.001
3737

3838
// A few pre-computed constants
39-
constexpr double ONE_OVER_THREE = 1. / 3.; // double for accurancy, all other consts here are used for FP32 or less critical calculations
39+
constexpr double ONE_OVER_THREE =
40+
1. / 3.; // double for accurancy, all other consts here are used for FP32 or less critical calculations
4041
constexpr float TWO_OVER_THREE = 2. / 3.;
4142
constexpr float FOUR_OVER_THREE = 4. / 3.;
4243
constexpr float FIVE_OVER_THREE = 5. / 3.;
4344
constexpr float PI = 3.1415926535897932385f;
4445
constexpr float PI_SQUARED = 9.869604401089358f;
4546
constexpr float TWO_TIMES_SQRT_FIVE_OVER_THREE = 2.58198889747161f; // 2. * std::sqrt(5. / 3.)
46-
constexpr float TWO_TIMES_SQRT_FIVE_OVER_SIX = 1.825741858350554f; // 2. * std::sqrt(5. / 6.)
47+
constexpr float TWO_TIMES_SQRT_FIVE_OVER_SIX = 1.825741858350554f; // 2. * std::sqrt(5. / 6.)
4748

4849
constexpr uint8_t VOXEL_RES_POWER2 = sizeof(subVoxelPos_t) * DEME_BITS_PER_BYTE;
4950
constexpr uint8_t VOXEL_COUNT_POWER2 = sizeof(voxelID_t) * DEME_BITS_PER_BYTE;
@@ -536,7 +537,9 @@ const float DEFAULT_BOX_DOMAIN_ENLARGE_RATIO = 0.2;
536537
// Initial contact array size; does not matter that much as they can be resized anytime in simulation
537538
const contactPairs_t INITIAL_CONTACT_ARRAY_SIZE = 1024;
538539
// For the bin collecting
539-
struct AxisBounds { int imin, imax; };
540+
struct AxisBounds {
541+
int imin, imax;
542+
};
540543

541544
// #ifndef CUB_IGNORE_DEPRECATED_API
542545
// #define CUB_IGNORE_DEPRECATED_API

0 commit comments

Comments
 (0)