Skip to content

Commit

Permalink
Auto Format
Browse files Browse the repository at this point in the history
  • Loading branch information
taichi-gardener committed Jun 18, 2021
1 parent 2b92337 commit 65e8ec4
Show file tree
Hide file tree
Showing 105 changed files with 17,129 additions and 14,561 deletions.
3 changes: 2 additions & 1 deletion examples/autodiff_minimization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import random

import taichi as ti

n = 8
x = ti.field(dtype=ti.f32, shape=n, needs_grad=True)
y = ti.field(dtype=ti.f32, shape=n)
Expand Down
8 changes: 5 additions & 3 deletions examples/autodiff_regression.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import taichi as ti
import taichi as tc
import matplotlib.pyplot as plt
import random

import matplotlib.pyplot as plt
import numpy as np

import taichi as ti
import taichi as tc

tc.set_gdb_trigger(True)

number_coeffs = 4
Expand Down
4 changes: 3 additions & 1 deletion examples/cg_possion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import taichi as ti
import math

import taichi as ti

ti.init(arch=ti.cuda)

n = 512
Expand Down
4 changes: 3 additions & 1 deletion examples/comet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import taichi as ti
import taichi_glsl as tl

import taichi as ti

ti.init(arch=[ti.cuda, ti.metal])

dim = 3
Expand Down
4 changes: 3 additions & 1 deletion examples/euler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import taichi as ti
import matplotlib.cm as cm

import taichi as ti

# A compressible euler equation solver using two methods
# 1: 2nd order muscl
# 2: thinc BVD, ref: "Limiter-free discontinuity-capturing scheme
Expand Down
7 changes: 5 additions & 2 deletions examples/export_mesh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import taichi as ti
import numpy as np
import os

import numpy as np

import taichi as ti

# A 2D grid with quad faces
# y
# |
Expand Down
8 changes: 5 additions & 3 deletions examples/export_ply.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import taichi as ti
import numpy as np
import random
import os
import random

import numpy as np

import taichi as ti

ti.init(arch=ti.cpu)

Expand Down
3 changes: 2 additions & 1 deletion examples/fullscreen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import numpy as np

import taichi as ti

ti.init(ti.gpu)

res = (1920, 1080)
Expand Down
3 changes: 2 additions & 1 deletion examples/game_of_life.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Game of Life written in 100 lines of Taichi
# In memory of John Horton Conway (1937 - 2020)

import taichi as ti
import numpy as np

import taichi as ti

ti.init()

n = 64
Expand Down
3 changes: 2 additions & 1 deletion examples/gui_image_io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import os

import taichi as ti

pixel = ti.field(ti.u8, shape=(512, 512, 3))


Expand Down
4 changes: 3 additions & 1 deletion examples/mciso.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import taichi as ti
import numpy as np

import taichi as ti

ti.init()

N = 128
Expand Down
3 changes: 2 additions & 1 deletion examples/mciso_advanced.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import numpy as np

import taichi as ti


@ti.data_oriented
class MCISO:
Expand Down
1 change: 1 addition & 0 deletions examples/mgpcg.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Solve Poisson's equation on an NxN grid using MGPCG
import numpy as np

import taichi as ti

real = ti.f32
Expand Down
6 changes: 4 additions & 2 deletions examples/mgpcg_advanced.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import math
import time

import numpy as np

import taichi as ti
import time
import math


@ti.data_oriented
Expand Down
6 changes: 4 additions & 2 deletions examples/mnist.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import numpy as np
import pickle
import random

import numpy as np

import taichi as ti
import pickle

# ti.runtime.print_preprocessed = True
# ti.cfg.print_ir = True
Expand Down
5 changes: 3 additions & 2 deletions examples/mnist_download_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# https://github.com/hsjeong5/MNIST-for-Numpy

import numpy as np
from urllib import request
import gzip
import pickle
from urllib import request

import numpy as np

filename = [["training_images", "train-images-idx3-ubyte.gz"],
["test_images", "t10k-images-idx3-ubyte.gz"],
Expand Down
3 changes: 2 additions & 1 deletion examples/mpm3d.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export_file = '' # use '/tmp/mpm3d.ply' for exporting result to disk

import taichi as ti
import numpy as np

import taichi as ti

ti.init(arch=ti.gpu)

#dim, n_grid, steps, dt = 2, 128, 20, 2e-4
Expand Down
3 changes: 2 additions & 1 deletion examples/nbody_oscillator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import math

import taichi as ti

ti.init(arch=ti.gpu)

N = 1600
Expand Down
3 changes: 2 additions & 1 deletion examples/odop_solar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import math

import taichi as ti

ti.init()


Expand Down
11 changes: 7 additions & 4 deletions examples/particle_renderer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import taichi as ti
import numpy as np
import math
import time
from renderer_utils import out_dir, ray_aabb_intersection, inf, eps, \
intersect_sphere, sphere_aabb_intersect_motion, inside_taichi

import numpy as np
from renderer_utils import (eps, inf, inside_taichi, intersect_sphere, out_dir,
ray_aabb_intersection,
sphere_aabb_intersect_motion)

import taichi as ti

ti.init(arch=ti.cuda, device_memory_GB=4)

Expand Down
6 changes: 4 additions & 2 deletions examples/pbf2d.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Macklin, M. and Müller, M., 2013. Position based fluids. ACM Transactions on Graphics (TOG), 32(4), p.104.
# Taichi implementation by Ye Kuang (k-ye)

import taichi as ti
import numpy as np
import math

import numpy as np

import taichi as ti

ti.init(arch=ti.gpu)

screen_res = (800, 400)
Expand Down
2 changes: 2 additions & 0 deletions examples/physarum.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
See https://sagejenson.com/physarum for the details.'''

import numpy as np

import taichi as ti

ti.init(arch=ti.gpu)

PARTICLE_N = 1024
Expand Down
3 changes: 2 additions & 1 deletion examples/quadtree.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import numpy as np

import taichi as ti

ti.init(arch=ti.cpu)

RES = 1024
Expand Down
3 changes: 2 additions & 1 deletion examples/renderer_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import math

import taichi as ti

eps = 1e-4
inf = 1e10

Expand Down
1 change: 1 addition & 0 deletions examples/revert_image_color.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import taichi as ti

ti.init()

## Load the image:
Expand Down
5 changes: 4 additions & 1 deletion examples/sdf2d.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import taichi as ti
from math import tau

from renderer_utils import reflect, refract

import taichi as ti

ti.init(arch=ti.opengl)

N = 512
Expand Down
6 changes: 4 additions & 2 deletions examples/sdf_renderer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import taichi as ti
import time
import math
import time

import numpy as np

import taichi as ti

ti.init(arch=ti.gpu)
res = 1280, 720
color_buffer = ti.Vector.field(3, dtype=ti.f32, shape=res)
Expand Down
3 changes: 2 additions & 1 deletion examples/simple_uv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import numpy as np

import taichi as ti

ti.init()

res = (512, 512)
Expand Down
3 changes: 2 additions & 1 deletion examples/taichi_autodiff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import matplotlib.pyplot as plt

import taichi as ti

N = 2048
x, y = ti.field(ti.f32), ti.field(ti.f32)

Expand Down
3 changes: 2 additions & 1 deletion examples/taichi_bitmasked.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import math

import taichi as ti

ti.init(arch=ti.gpu)

n = 256
Expand Down
4 changes: 3 additions & 1 deletion examples/tree_gravity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# N-body gravity simulation in 300 lines of Taichi, tree method, no multipole, O(N log N)
# Author: archibate <1931127624@qq.com>, all left reserved
import taichi as ti
import taichi_glsl as tl

import taichi as ti

ti.init()
if not hasattr(ti, 'jkl'):
ti.jkl = ti.indices(1, 2, 3)
Expand Down
6 changes: 4 additions & 2 deletions examples/vortex_rings.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# C++ reference and tutorial (Chinese): https://zhuanlan.zhihu.com/p/26882619
import taichi as ti
import numpy as np
import math

import numpy as np

import taichi as ti

ti.init(arch=ti.gpu)

eps = 0.01
Expand Down
3 changes: 2 additions & 1 deletion examples/waterwave.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import taichi as ti
import numpy as np

import taichi as ti

ti.init(arch=ti.gpu)

light_color = 1
Expand Down
Loading

0 comments on commit 65e8ec4

Please sign in to comment.