Skip to content

Commit

Permalink
Auto Format
Browse files Browse the repository at this point in the history
  • Loading branch information
taichi-gardener committed Oct 5, 2021
1 parent f0342e7 commit 9634819
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
7 changes: 5 additions & 2 deletions examples/simulation/stable_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://github.com/ShaneFX/GAMES201/tree/master/HW01

import argparse

import numpy as np

import taichi as ti
Expand All @@ -13,7 +14,10 @@
# `python stable_fluid.py`: use the jacobi iteration to solve the linear system.
# `python stable_fluid.py -s`: use a sparse matrix to do so.
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--use-sp-mat', action='store_true', help='Solve Poisson\'s equation by using a sparse matrix')
parser.add_argument('-s',
'--use-sp-mat',
action='store_true',
help='Solve Poisson\'s equation by using a sparse matrix')
args = parser.parse_args()

res = 512
Expand All @@ -30,7 +34,6 @@
paused = False
use_sparse_matrix = False


use_sparse_matrix = args.use_sp_mat

if use_sparse_matrix:
Expand Down
10 changes: 6 additions & 4 deletions taichi/math/linalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,9 @@ template <typename T, int dim, InstSetExt ISE = default_instruction_set>
using TVector = VectorND<dim, T, ISE>;

template <int dim, typename T, InstSetExt ISE>
TI_FORCE_INLINE VectorND<dim, T, ISE> operator
*(T a, const VectorND<dim, T, ISE> &v) {
TI_FORCE_INLINE VectorND<dim, T, ISE> operator*(
T a,
const VectorND<dim, T, ISE> &v) {
return VectorND<dim, T, ISE>(a) * v;
}

Expand Down Expand Up @@ -891,8 +892,9 @@ struct MatrixND {
};

template <int dim, typename T, InstSetExt ISE>
TI_FORCE_INLINE MatrixND<dim, T, ISE> operator
*(const T a, const MatrixND<dim, T, ISE> &M) {
TI_FORCE_INLINE MatrixND<dim, T, ISE> operator*(
const T a,
const MatrixND<dim, T, ISE> &M) {
MatrixND<dim, T, ISE> ret;
for (int i = 0; i < dim; i++) {
ret[i] = a * M[i];
Expand Down
8 changes: 4 additions & 4 deletions taichi/runtime/llvm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ DEFINE_ATOMIC_OP_INTRINSIC(or, i32)
DEFINE_ATOMIC_OP_INTRINSIC(or, i64)
DEFINE_ATOMIC_OP_INTRINSIC(or, u32)
DEFINE_ATOMIC_OP_INTRINSIC(or, u64)
DEFINE_ATOMIC_OP_INTRINSIC (xor, i32)
DEFINE_ATOMIC_OP_INTRINSIC (xor, i64)
DEFINE_ATOMIC_OP_INTRINSIC (xor, u32)
DEFINE_ATOMIC_OP_INTRINSIC (xor, u64)
DEFINE_ATOMIC_OP_INTRINSIC(xor, i32)
DEFINE_ATOMIC_OP_INTRINSIC(xor, i64)
DEFINE_ATOMIC_OP_INTRINSIC(xor, u32)
DEFINE_ATOMIC_OP_INTRINSIC(xor, u64)

inline f32 add_f32(f32 a, f32 b) {
return a + b;
Expand Down

0 comments on commit 9634819

Please sign in to comment.