Skip to content

Commit

Permalink
[Example] Fix the ti example problems of sparse matrix demos (#3215)
Browse files Browse the repository at this point in the history
* a quick solve

* fix mass spring

* remove sys

* add todo and issue

* fix typo
  • Loading branch information
Hanke98 committed Oct 18, 2021
1 parent a866aad commit 88923ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/simulation/implicit_mass_spring.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def displayGGUI(self, canvas, radius=0.01, color=(1.0, 1.0, 1.0)):
'--use-ggui',
action='store_true',
help='Display with GGUI')
args = parser.parse_args()
args, unknowns = parser.parse_known_args()
use_ggui = False
use_ggui = args.use_ggui

Expand Down
6 changes: 3 additions & 3 deletions examples/simulation/stable_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

# How to run:
# `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.
# `python stable_fluid.py -S`: use a sparse matrix to do so.
parser = argparse.ArgumentParser()
parser.add_argument('-s',
parser.add_argument('-S',
'--use-sp-mat',
action='store_true',
help='Solve Poisson\'s equation by using a sparse matrix')
args = parser.parse_args()
args, unknowns = parser.parse_known_args()

res = 512
dt = 0.03
Expand Down
2 changes: 2 additions & 0 deletions python/taichi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def example(self, arguments: list = sys.argv[2:]):
dest='save',
action='store_true',
help="Save source code to current directory instead of running it")

# TODO: Pass the arguments to downstream correctly(#3216).
args = parser.parse_args(arguments)

examples_dir = TaichiMain._get_examples_dir()
Expand Down

0 comments on commit 88923ba

Please sign in to comment.