Skip to content
Snippets Groups Projects
Commit d7d712ea authored by Ernesto Oquelis's avatar Ernesto Oquelis
Browse files

update

parent 483d49bc
No related branches found
No related tags found
No related merge requests found
......@@ -269,22 +269,26 @@ def load_model(model_name):
"""
This loads models from csv files and returns structure.
"""
import os
import pandas as pd
import numpy as np
from fem import Constraint, Force, Structure
constraints_data = pd.read_csv('models_data\\' + model_name +
'_constraints_data.csv', sep=';',
cwd = os.getcwd()
path = cwd + '/models_data'
os.chdir(path)
constraints_data = pd.read_csv(model_name + '_constraints_data.csv',
sep=';',
decimal=',').values
elements_data = pd.read_csv('models_data\\' + model_name +
'_elements_data.csv', sep=';',
elements_data = pd.read_csv(model_name + '_elements_data.csv', sep=';',
decimal=',').values
forces_data = pd.read_csv('models_data\\' + model_name +
'_forces_data.csv', sep=';',
forces_data = pd.read_csv(model_name + '_forces_data.csv', sep=';',
decimal=',').values
nodes_data = pd.read_csv('models_data\\' + model_name +
'_nodes_data.csv', sep=';',
nodes_data = pd.read_csv(model_name + '_nodes_data.csv', sep=';',
decimal=',').values
os.chdir(cwd)
struct = Structure()
number_nodes = nodes_data.shape[0]
......
......@@ -4,7 +4,7 @@ This is an empty docstring
"""
from fem import Constraint, Force, Node, Element
from models import first_tetraeder, small_tetraeder
from models import first_tetraeder, small_tetraeder, load_model
from fem import Visualizer
from pview3d.src.pview3d import Viewer
......@@ -71,8 +71,9 @@ for element_id in range(STRUCT.get_number_elements()):
print('{:>5}'.format(int(dof)), end='')
print('')
'''
# TEST 5 - Full moedl execution with small tetraeder model
# Gets the structure object from the models module.
'''
# TEST 5 - Full model execution with small tetraeder model
# Gets the structure object from the models modcule.
STRUCT = small_tetraeder()
# Solves the system of equations.
......@@ -98,4 +99,20 @@ VIZ.draw_displaced_forces()
VIZ.draw_normal_forces()
# Runs the visualizer.
VIEWER.run()
sh
\ No newline at end of file
'''
# TEST 6 - Importing model from csv files
STRUCT = load_model('small_bridge')
STRUCT.print_details()
# Instantiates a viewer object
VIEWER = Viewer()
# Gives the structure and the viewer instances to the visualizer object.
VIZ = Visualizer(STRUCT, VIEWER)
# Draws all desired objects to visualize.
VIZ.draw_elements()
VIZ.draw_constraints()
VIZ.draw_element_forces()
# Runs the visualizer.
VIEWER.run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment