Skip to content

Commit 04f3c12

Browse files
committed
Add fiber helpers
1 parent 3e6a8c7 commit 04f3c12

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

vfo/internal_plotting_functions.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,3 +579,65 @@ def _setStandardViewport(fig, ax, nodeCords, ndm, Disp = np.array([])):
579579
ax.set_zlabel('Z')
580580

581581
return fig, ax
582+
583+
584+
585+
586+
# =============================================================================
587+
# Fiber Helpers
588+
# =============================================================================
589+
590+
def _getAxisInfo(LocalAxis):
591+
592+
if LocalAxis == 'z':
593+
axisIndex = 1
594+
axisXlabel = "Local z value"
595+
if LocalAxis == 'y':
596+
axisIndex = 0
597+
axisXlabel = "Local y value"
598+
599+
return axisIndex, axisXlabel
600+
601+
602+
def _getResponseInfo(InputType):
603+
if InputType == 'stress':
604+
responseIndex = 3
605+
axisYlabel = "Fiber Stress"
606+
if InputType == 'strain':
607+
responseIndex = 4
608+
axisYlabel = "Fiber Strain"
609+
610+
return responseIndex, axisYlabel
611+
612+
613+
614+
def _getFiberBounds(fibrePositionSorted, fibreResponseSorted, Xbound, Ybound):
615+
# Set up bounds based on data from
616+
if Xbound == []:
617+
xmin = 1.1*np.min(fibrePositionSorted)
618+
xmax = 1.1*np.max(fibrePositionSorted)
619+
else:
620+
xmin = Xbound[0]
621+
xmax = Xbound[1]
622+
623+
if Ybound == []:
624+
ymin = 1.1*np.min(fibreResponseSorted)
625+
ymax = 1.1*np.max(fibreResponseSorted)
626+
else:
627+
ymin = Ybound[0]
628+
ymax = Ybound[1]
629+
630+
return xmin, xmax, ymin, ymax
631+
632+
633+
634+
def _skipFiberData(fibrePositionSorted, fibreResponseSorted, fiberYPosition, skipStart, skipEnd):
635+
# If end data is not being skipped, use the full vector length.
636+
if skipEnd ==0:
637+
skipEnd = len(fiberYPosition)
638+
639+
# Remove unecessary data
640+
xinputs = fibrePositionSorted[skipStart:skipEnd, :]
641+
yinputs = fibreResponseSorted[skipStart:skipEnd, :]
642+
643+
return xinputs, yinputs

0 commit comments

Comments
 (0)