-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
130 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
exclude src/springable/optimization.py | ||
exclude src/springable/optimization.py | ||
include src/springable/examples-spring-model-CSV-files/*.csv | ||
include src/springable/gallery-spring-model-CSV-files/*.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
PARAMETERS | ||
width, 8.0 | ||
triangle_height, 3.0 | ||
vertical_element_length, 8.0 | ||
triangle_side_stiffness, 9.0 | ||
vertical_element_stiffness, 1.4, [1;2.5;4] | ||
hinge_stiffness, 7.5 | ||
NODES | ||
0,0.0,0.0,1,1 | ||
1,width/2,triangle_height,1,0 | ||
2,width,0.0,1,1 | ||
3,width/2,triangle_height + vertical_element_length,1,0 | ||
SPRINGS | ||
1-2,triangle_side_stiffness | ||
1-0,triangle_side_stiffness | ||
1-3,vertical_element_stiffness | ||
ROTATION SPRINGS | ||
0-1-2, hinge_stiffness | ||
LOADING | ||
3, Y, -7.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from .simulation import simulate_model | ||
from .readwrite import fileio | ||
import os | ||
|
||
|
||
def show_examples(filename=None): | ||
save_dir = fileio.mkdir('examples_results') | ||
folder = os.path.join('src', 'examples-spring-model-CSV-files') | ||
filenames = os.listdir(folder) | ||
|
||
if filename is not None: | ||
if filename in filenames: | ||
filenames = [filename] | ||
else: | ||
print(f'The example "{filename}" is unknown.') | ||
print('Please choose one among the available examples:') | ||
print(filenames) | ||
return | ||
|
||
for i, model_filename in enumerate(filenames): | ||
model_path = os.path.join(folder, model_filename) | ||
simulate_model(model_path, os.path.join(save_dir, model_filename.split('.')[0]),print_model_file=True) | ||
|
||
if i != len(filenames) - 1: | ||
print() | ||
|
||
if len(filenames) > 1: | ||
print() | ||
print("You have seen all the basic examples.") | ||
|
||
print() | ||
print("To run your own simulation, create your own CSV file and run:") | ||
print("\timport spring.simulation as ss") | ||
print("\tss.simulate_model('my_spring_model.csv')") | ||
|
||
|
||
def show_gallery(filename): | ||
save_dir = fileio.mkdir('gallery_results') | ||
folder = os.path.join('src', 'gallery-spring-model-CSV-files') | ||
filenames = os.listdir(folder) | ||
|
||
if filename is not None: | ||
if filename in filenames: | ||
filenames = [filename] | ||
else: | ||
print(f'The example "{filename}" is unknown.') | ||
print('Please choose one among the available examples:') | ||
print(filenames) | ||
return | ||
|
||
for i, model_filename in enumerate(filenames): | ||
model_path = os.path.join(folder, model_filename) | ||
simulate_model(model_path, os.path.join(save_dir, model_filename.split('.')[0]),print_model_file=True) | ||
|
||
if i != len(filenames) - 1: | ||
print() | ||
|
||
if len(filenames) > 1: | ||
print() | ||
print("You have seen the entire gallery.") | ||
|
||
print() | ||
print("Inspired? Create your own CSV file and run:") | ||
print("\timport spring.simulation as ss") | ||
print("\tss.simulate_model('my_spring_model.csv')") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters