16 std::vector<double> weights;
24 weights[0] =
dt_ / 2.;
25 weights[weights.size() - 1] =
dt_ / 2.;
29 weights[0] =
dt_ / 3.;
30 weights[weights.size() - 1] =
dt_ / 3.;
31 for (
int i = 1; i < weights.size() - 1; i++)
34 weights[i] =
dt_ * 4. / 3.;
36 weights[i] =
dt_ * 2. / 4.;
47 for (
const int step :
steps_)
49 assert(step > 0 && step < weights.size());
50 weights[step] += 1. /
steps_.size();
68 const double tmp =
obj_->value_unweighted_step(i,
x);
69 value += (weights[i] *
obj_->weight()) * tmp;
76 Eigen::MatrixXd terms;
84 terms.col(i) = weights[i] *
obj_->compute_adjoint_rhs_step(i,
x, state, diff_cache);
85 if (
obj_->depends_on_step_prev() && i > 0)
86 terms.col(i - 1) = weights[i] *
obj_->compute_adjoint_rhs_step_prev(i,
x, state, diff_cache);
93 gradv.setZero(
x.size());
101 obj_->compute_partial_gradient_step(i,
x, tmp);
102 gradv += weights[i] * tmp;
115 return obj_->is_step_valid(x0, x1);
120 return obj_->max_step_size(x0, x1);
125 obj_->line_search_begin(x0, x1);
130 obj_->line_search_end();
135 obj_->post_step(data);
147 obj_->solution_changed_step(i, new_x);
152 return obj_->is_step_collision_free(x0, x1);
161 vals(j++) =
obj_->value_unweighted_step(i,
x);
169 Eigen::MatrixXd terms;
175 vals(j) =
obj_->value_unweighted_step(i,
x);
176 terms.col(j++) =
obj_->compute_adjoint_rhs_step(i,
x, state, diff_cache);
185 out.col(i) = terms.col(j) * (g(j) *
weight());
194 Eigen::MatrixXd terms;
195 terms.setZero(
x.size(),
steps_.size());
201 vals(j) =
obj_->value_unweighted_step(i,
x);
202 obj_->compute_partial_gradient_step(i,
x, tmp);
203 terms.col(j++) = tmp;
211 return 1. /
y.array().inverse().sum();
216 return y.array().pow(-2.0) * pow(
eval(
y), 2);
ElementAssemblyValues vals
Storage for additional data required by differntial code.
main class that contains the polyfem solver and all its state