Skip to content

Commit e372146

Browse files
committed
revert some changes
1 parent 926afa0 commit e372146

File tree

7 files changed

+17
-28
lines changed

7 files changed

+17
-28
lines changed

src/args.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub struct Args {
4949
#[clap(long, default_value_t = 0.025)]
5050
pub strain_limit_eps: f32,
5151

52-
#[clap(long, default_value_t = 1024)]
52+
#[clap(long, default_value_t = 64)]
5353
pub binary_search_max_iter: u32,
5454

5555
#[clap(long)]
@@ -76,9 +76,6 @@ pub struct Args {
7676
#[clap(long, default_value_t = 0.01)]
7777
pub ccd_reduction: f32,
7878

79-
#[clap(long, default_value_t = 0.0025)]
80-
pub ccd_reduction_eps: f32,
81-
8279
#[clap(long, default_value_t = 1e-2)]
8380
pub eiganalysis_eps: f32,
8481

src/builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ pub fn make_param(args: &Args) -> data::ParamSet {
352352
line_search_max_t: args.line_search_max_t,
353353
ccd_tol: args.contact_ghat,
354354
ccd_reduction: args.ccd_reduction,
355-
ccd_reduction_eps: args.ccd_reduction_eps,
356355
ccd_max_iters: args.ccd_max_iters,
357356
eiganalysis_eps: args.eiganalysis_eps,
358357
friction: args.friction,

src/cpp/common.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#define __host__
2626
#endif
2727

28-
#define EPSILON 1e-8f
29-
#define FLT_MAX 1e8f
30-
#define FLT_MIN -1e8f
28+
#define EPSILON 1.0e-8f
29+
#define FLT_MAX 1.0e8f
30+
#define FLT_MIN -1.0e8f
3131
#define DT_MIN 1e-5f
3232
#define PI 3.14159265358979323846f
3333
#define DEBUG_MODE 0

src/cpp/contact/accd.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ __device__ float ccd_helper(const Mat3x4f &x0, const Mat3x4f &dx, float u_max,
2323
const ParamSet &param) {
2424
float toi = 0.0f;
2525
float max_t = param.line_search_max_t;
26-
float gap = sqrtf(square_dist_func(x0)) - offset;
27-
float eps = param.ccd_reduction_eps * gap;
28-
float target = param.ccd_reduction * gap + offset;
26+
float eps = param.ccd_reduction * (sqrtf(square_dist_func(x0)) - offset);
27+
float target = 2.0f * eps + offset;
2928
float eps_sqr = eps * eps;
3029
float inv_u_max = 1.0f / u_max;
3130
for (unsigned k = 0; k < param.ccd_max_iters; ++k) {

src/cpp/data.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ struct ParamSet {
230230
float line_search_max_t;
231231
float ccd_tol;
232232
float ccd_reduction;
233-
float ccd_reduction_eps;
234233
unsigned ccd_max_iters;
235234
float eiganalysis_eps;
236235
float friction;

src/cpp/strainlimiting/strainlimiting.cu

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "../utility/dispatcher.hpp"
1111
#include "../utility/utility.hpp"
1212
#include "strainlimiting.hpp"
13-
#include <limits>
1413

1514
namespace strainlimiting {
1615

@@ -109,31 +108,28 @@ float line_search(const DataSet &data, const Kinematic &kinematic,
109108
const Mat3x2f F1 =
110109
utility::compute_deformation_grad(x1, inv_rest2x2[i]);
111110
const Mat3x2f dF = F1 - F0;
112-
float gap = max_sigma - utility::svd3x2(F0).S.maxCoeff();
113-
float target = max_sigma - param.ccd_reduction * gap;
114-
if (utility::svd3x2(F0 + t * dF).S.maxCoeff() > target) {
111+
if (utility::svd3x2(F0 + t * dF).S.maxCoeff() >= max_sigma) {
112+
float tol = param.ccd_reduction *
113+
(max_sigma - utility::svd3x2(F0).S.maxCoeff());
114+
float target = max_sigma - 2.0f * tol;
115115
float upper_t = t;
116116
float lower_t = 0.0f;
117-
unsigned iter(0);
118-
while (true) {
117+
for (unsigned k = 0; k < param.binary_search_max_iter; ++k) {
119118
t = 0.5f * (upper_t + lower_t);
120119
Svd3x2 svd = utility::svd3x2(F0 + t * dF);
121120
float diff = svd.S.maxCoeff() - target;
122-
if (diff < 0.0f) {
121+
if (fabs(diff) < tol) {
122+
break;
123+
} else if (diff < 0.0f) {
123124
lower_t = t;
124125
} else {
125126
upper_t = t;
126127
}
127-
if (lower_t > 0.0f) {
128-
if (upper_t - lower_t < param.ccd_reduction * lower_t) {
129-
break;
130-
}
131-
}
132-
assert(t > std::numeric_limits<float>::epsilon());
133128
}
134-
t = lower_t;
129+
while (utility::svd3x2(F0 + t * dF).S.maxCoeff() >= target) {
130+
t *= param.dt_decrease_factor;
131+
}
135132
}
136-
assert(utility::svd3x2(F0 + t * dF).S.maxCoeff() <= target);
137133
}
138134
toi[i] = t;
139135
} DISPATCH_END;

src/data.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ pub struct ParamSet {
304304
pub line_search_max_t: f32,
305305
pub ccd_tol: f32,
306306
pub ccd_reduction: f32,
307-
pub ccd_reduction_eps: f32,
308307
pub ccd_max_iters: u32,
309308
pub eiganalysis_eps: f32,
310309
pub friction: f32,

0 commit comments

Comments
 (0)