|
def | parse_threejs (self, threejs) |
|
def | parse_pdb (self, pdb_file, atom_names=["CA"]) |
|
def | preview_rod (self, rod) |
|
def | create_spline (self, x_points, y_points, z_points, num_samples, degree=3, smoothness=0) |
|
def | create_rod_spline (self, data, num_nodes, degree=3, smoothness=2) |
|
def | create_rod_parametric (self, x_eqn, y_eqn, z_eqn, t_max, t_min, num_nodes) |
|
def | create_material_frame (self, rod) |
|
def | rotate_material_frame (self, rod, function, material_frame, function_range=(0, 2 *np.pi)) |
|
def | set_params (self, rod, stretch_constant, torsion_constant, radius, bending_modulus=None, rod_segments=None, E=None, r=None, frames=None) |
|
def | get_connection_info (self, script, blob_no, face_no=None, element_no=None, nodes=None, use_first=True) |
|
def | get_euler_angles_from_pdb (self, surface_nodes, r0, r1) |
|
The rod_creator class is just a collection of functions that create rods,
it doesn't have any state or anything. In fact, immediately after this
script is loaded, the rod_creator class definition is replaced by an
instance of itself.
All of the creation functions here output rod frames, so in order to use
the rod creator, you'll need to initialize an empty rod object, and then
run either create_rod_spline or create_rod_parametric to create
rod.equil_r[0] and rod.current_r[0]. Then, use create_material_frame and possibly
rotate_material_frame to create rod.equil_m[0] and rod.current_m[0].
def ffeatools.modules.FFEA_rod.rod_creator.create_material_frame |
( |
|
self, |
|
|
|
rod |
|
) |
| |
For a given rod, create a material frame.
For the rod to be at equilibrium twist, all of the m and n vectors
must be pointing the same way relative to the rod segments. So, to
create an equilibrium material frame, you create a material frame
arbitrarily for one element, and then parallel transport it up the
entire length of the rod.
Params:
rod - a rod object with a current_r
Returns:
current_material_frame: material frame for the rod in its current state
equil_material_frame: material frame for the rod in its
def ffeatools.modules.FFEA_rod.rod_creator.create_rod_parametric |
( |
|
self, |
|
|
|
x_eqn, |
|
|
|
y_eqn, |
|
|
|
z_eqn, |
|
|
|
t_max, |
|
|
|
t_min, |
|
|
|
num_nodes |
|
) |
| |
Create a rod frame (a 2-d array of 3-d points) using 3 parametric
equations, one for each dimension.
Params:
x_eqn, y_eqn, z_eqn: python functions with one parameter (t)
t_max, t_min: max and min values for t (min at node 0, max at n)
num_nodes: number of nodes
Returns:
a 2-d numpy array containing the positions of the rod nodes,
that you can use as rod.current_r[0] and rod.equil_r[0]
def ffeatools.modules.FFEA_rod.rod_creator.create_rod_spline |
( |
|
self, |
|
|
|
data, |
|
|
|
num_nodes, |
|
|
|
degree = 3 , |
|
|
|
smoothness = 2 |
|
) |
| |
Given a 2-d array of spline control points (or a string containing the
output from the threejs spline creator), the number of nodes desired, the
smoothness and degree of the desired spline, return a rod frame.
Use this to fill in the current_r[0] or equil_r[0] of a object.
Params:
data: either a 2-d array containing spline control points in 3 dimensions,
or a string containing the output from this tool:
https://threejs.org/examples/?q=spline#webgl_geometry_spline_editor
num_nodes: number of times to sample the spline equation
degree: degree of the polynomial
smoothness: number of continuous derivatives of the spline function
Returns:
a rod frame, for either current_r or equil_r (a 2-d numpy array of points)
def ffeatools.modules.FFEA_rod.rod_creator.create_spline |
( |
|
self, |
|
|
|
x_points, |
|
|
|
y_points, |
|
|
|
z_points, |
|
|
|
num_samples, |
|
|
|
degree = 3 , |
|
|
|
smoothness = 0 |
|
) |
| |
Given a set of spline control points and some spline parameters, make
a spline, and sample it at a bunch of points, returning a 2-d array
containing the x, y, and z co-ordinates of the spline at those points.
Parameters:
x_points, y_points, z_points: spline control points
num_samples: number of times to sample the spline equation
degree: degree of the polynomial
smoothness: number of continuous derivatives of the spline function
Returns:
rod, a 2-d array containing the co-ordinates of the spline samples
knots_tck - a tuple (t,c,k) containing the vector of knots, b-spline
coefficients, and the degree of the spline
spline_params: an array of the values of the parameter
Referenced by ffeatools.modules.FFEA_rod.rod_creator.create_rod_spline().
def ffeatools.modules.FFEA_rod.rod_creator.set_params |
( |
|
self, |
|
|
|
rod, |
|
|
|
stretch_constant, |
|
|
|
torsion_constant, |
|
|
|
radius, |
|
|
|
bending_modulus = None , |
|
|
|
rod_segments = None , |
|
|
|
E = None , |
|
|
|
r = None , |
|
|
|
frames = None |
|
) |
| |
Set the material parameters uniformally. By default, this is for
the entire rod, although optionally you can set some sub-region of
the rod.
Params:
rod: rod object.
stretch_constant: stretch constant, in SI units (this is normally
the spring constant multiplied by the measured spring length!)
torsion_constnat: torsion constant, in SI units (this is the same deal)
radius: radius of the rod (for computing the mobility). Half of the equilibrium rod length is about right.
bending modulus: this is normally EI, the young's modulus multiplied
by the second moment of area. Optionally, you can instead supply
E, I: a young's modulus and a radius.
rod_segment (optional): a range object containing the indices
of nodes to modify.
Returns:
nothing, it modifies the rod object that's given to it.