Skip to content

Commit 5e866cc

Browse files
committed
1
1 parent d84f358 commit 5e866cc

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

simulators/1_mass_spring/src/MassSpringEnergy.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ SparseMatrix<T> MassSpringEnergy<T, dim>::hess()
154154
H_block << H_diff, -H_diff,
155155
-H_diff, H_diff;
156156

157-
make_PSD(H_block, H_local);
157+
//make_PSD(H_block, H_local);
158158
// add to global matrix
159159
for (int ni = 0; ni < 2; ni++)
160160
for (int nj = 0; nj < 2; nj++)

simulators/1_mass_spring/src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
int main()
44
{
5-
float rho = 1000, k = 1e5, initial_stretch = 1.4, n_seg = 4, h = 0.004, side_len = 1, tol = 0.01;
6-
// printf("Running mass-spring simulator with parameters: rho = %f, k = %f, initial_stretch = %f, n_seg = %d, h = %f, side_len = %f, tol = %f\n", rho, k, initial_stretch, n_seg, h, side_len, tol);
7-
MassSpringSimulator<float, 2> simulator(rho, side_len, initial_stretch, k, h, tol, n_seg);
8-
simulator.run();
5+
float rho = 1000, k = 1e5, initial_stretch = 1.4, n_seg = 20, h = 0.004, side_len = 2, tol = 0.01;
6+
// printf("Running mass-spring simulator with parameters: rho = %f, k = %f, initial_stretch = %f, n_seg = %d, h = %f, side_len = %f, tol = %f\n", rho, k, initial_stretch, n_seg, h, side_len, tol);
7+
MassSpringSimulator<float, 2> simulator(rho, side_len, initial_stretch, k, h, tol, n_seg);
8+
simulator.run();
99
}

simulators/1_mass_spring/src/uti.cu

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ template double max_vector<double>(const std::vector<double> &a);
7676
template <typename T>
7777
void search_dir(const std::vector<T> &grad, const SparseMatrix<T> &hess, std::vector<T> &dir)
7878
{
79-
LinearSystemContext ctx;
79+
static LinearSystemContext ctx;
8080
auto neg_grad = mult_vector<T>(grad, -1);
8181
int N = grad.size();
8282
DeviceDenseVector<T> x_device(N);
@@ -87,7 +87,8 @@ void search_dir(const std::vector<T> &grad, const SparseMatrix<T> &hess, std::ve
8787
Hess.resize_triplets(hess.get_size());
8888
Hess.row_indices().copy_from(hess.get_row_buffer().data());
8989
Hess.col_indices().copy_from(hess.get_col_buffer().data());
90-
Hess.values().copy_from(hess.get_val_buffer().data());
90+
Hess.values()
91+
.copy_from(hess.get_val_buffer().data());
9192
DeviceCOOMatrix<T> A_coo;
9293
ctx.convert(Hess, A_coo);
9394
DeviceCSRMatrix<T> A_csr;

0 commit comments

Comments
 (0)