Skip to content

Commit

Permalink
fix: add std::
Browse files Browse the repository at this point in the history
Signed-off-by: Zone.N <[email protected]>
  • Loading branch information
MRNIU committed Nov 1, 2023
1 parent d824e4d commit aece702
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/math/dtkMatrixOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dtkDouble2 operator*(const dtkMatrix22 &a, const dtkDouble2 &b) {
}

dtkMatrix22 operator*(const dtkMatrix22 &a, const dtkMatrix22 &b) {
dtkMatrix22 ret();
dtkMatrix22 ret;
return dtkMatrix22{a[0][0] * b[0][0] + a[0][1] * b[1][0],
a[0][0] * b[0][1] + a[0][1] * b[1][1],
a[1][0] * b[0][0] + a[1][1] * b[1][0],
Expand Down
10 changes: 5 additions & 5 deletions test/system_test/demo2d/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void reshape(int width, int height) {

void mouse(int button, int state, int x, int y) {}

void move(const dtk::dtkDouble2 &v) { world.move(v); }
void move_pos(const dtk::dtkDouble2 &v) { world.move(v); }

void keyboard(unsigned char key, int x, int y) {
switch (key) {
Expand Down Expand Up @@ -374,16 +374,16 @@ void keyboard(unsigned char key, int x, int y) {
test_sph();
break;
case 'w':
move(dtk::dtkDouble2(0, 1));
move_pos(dtk::dtkDouble2(0, 1));
break;
case 'a':
move(dtk::dtkDouble2(-1, 0));
move_pos(dtk::dtkDouble2(-1, 0));
break;
case 's':
move(dtk::dtkDouble2(0, -1));
move_pos(dtk::dtkDouble2(0, -1));
break;
case 'd':
move(dtk::dtkDouble2(1, 0));
move_pos(dtk::dtkDouble2(1, 0));
break;
case ' ':
world.set_pause(!world.is_pause());
Expand Down
11 changes: 7 additions & 4 deletions test/system_test/demo2d/include/dtkMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,19 @@ class dtkMesh : public dtkObject {
void updateShell();

inline int vertex(int i) {
int ret = 0;
if (i >= 0 && i < n_node_x_ - 1)
return mesh(i, 0);
ret = mesh(i, 0);
else if (i >= n_node_x_ - 1 && i < n_node_x_ + n_node_y_ - 2)
return mesh(n_node_x_ - 1, i - n_node_x_ + 1);
ret = mesh(n_node_x_ - 1, i - n_node_x_ + 1);
else if (i >= n_node_x_ + n_node_y_ - 2 &&
i < 2 * n_node_x_ + n_node_y_ - 3)
return mesh(2 * n_node_x_ + n_node_y_ - 3 - i, n_node_y_ - 1);
ret = mesh(2 * n_node_x_ + n_node_y_ - 3 - i, n_node_y_ - 1);
else if (i >= 2 * n_node_x_ + n_node_y_ - 3 &&
i < 2 * n_node_x_ + 2 * n_node_y_ - 4)
return mesh(0, 2 * n_node_x_ + 2 * n_node_y_ - 4 - i);
ret = mesh(0, 2 * n_node_x_ + 2 * n_node_y_ - 4 - i);

return ret;
}

inline int mesh(int i, int j) { return i * n_node_y_ + j; }
Expand Down
13 changes: 7 additions & 6 deletions test/system_test/demo_old/FEMsimulation/dtkFemSimulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@
#include "../../src/dtk.h"
#include "../../src/dtkGraphicsKernel.h"
#include "dtkScene.h"

#include <iostream>
#include <vector>

#include <Eigen/Dense>
using namespace std;

using namespace Eigen;
using namespace dtk;

class dtkFemSimulation : public dtkScene {

private:
/* data */
vector<Eigen::Vector2f> points; //(n_node); /**< 点的位置 */
std::vector<Eigen::Vector2f> points; //(n_node); /**< 点的位置 */

vector<Vector2f> pre_points; //(n_node); /**< 点之前的位置 */
std::vector<Vector2f> pre_points; //(n_node); /**< 点之前的位置 */

vector<Eigen::Vector2f> points_force;
std::vector<Eigen::Vector2f> points_force;

vector<Vector2f> points_v; //(n_node); /**< 点的速度 */
std::vector<Vector2f> points_v; //(n_node); /**< 点的速度 */

vector<Eigen::Matrix2f> B; //(n_fem_element); /**< 微元本身长度的逆 */
std::vector<Eigen::Matrix2f> B; //(n_fem_element); /**< 微元本身长度的逆 */

float total_energy; /** 总势能 */
float pre_total_energy; /** 之前的总势能 */
Expand Down

0 comments on commit aece702

Please sign in to comment.