{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "using LinearAlgebra\n",
    "using Plots\n",
    "import JSON\n",
    "# using Quaternions\n",
    "using StaticArrays, Rotations\n",
    "using Distributed\n",
    "using StaticArrays, BenchmarkTools\n",
    "using Base.Threads\n",
    "using CUDAnative\n",
    "using CuArrays,CUDAdrv \n",
    "using Test\n",
    "import Base: +, * , -, ^"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Todo\n",
    "- create struct for material and get for each edge its properties\n",
    "- implement getTimestep\n",
    "- implement on single voxel\n",
    "- get reat E and L\n",
    "- compare to Frame3dd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "struct Vector3\n",
    "    x::Float64\n",
    "    y::Float64\n",
    "    z::Float64\n",
    "    function Vector3()\n",
    "        x=0.0\n",
    "        y=0.0\n",
    "        z=0.0\n",
    "        new(x,y,z)\n",
    "    end\n",
    "    function Vector3(x,y,z)\n",
    "       new(x,y,z)\n",
    "    end\n",
    "end\n",
    "struct Quaternion\n",
    "    x::Float64\n",
    "    y::Float64\n",
    "    z::Float64\n",
    "    w::Float64\n",
    "    function Quaternion()\n",
    "        x=0.0\n",
    "        y=0.0\n",
    "        z=0.0\n",
    "        w=1.0\n",
    "        new(x,y,z,w)\n",
    "    end\n",
    "    function Quaternion(x,y,z,w)\n",
    "        new(x,y,z,w)\n",
    "    end\n",
    "end\n",
    "struct RotationMatrix\n",
    "    te1::Float64\n",
    "    te2::Float64\n",
    "    te3::Float64\n",
    "    te4::Float64\n",
    "    te5::Float64\n",
    "    te6::Float64\n",
    "    te7::Float64\n",
    "    te8::Float64\n",
    "    te9::Float64\n",
    "    te10::Float64\n",
    "    te11::Float64\n",
    "    te12::Float64\n",
    "    te13::Float64\n",
    "    te14::Float64\n",
    "    te15::Float64\n",
    "    te16::Float64\n",
    "    function RotationMatrix()\n",
    "        te1 =0.0\n",
    "        te2 =0.0\n",
    "        te3 =0.0\n",
    "        te4 =0.0\n",
    "        te5 =0.0\n",
    "        te6 =0.0\n",
    "        te7 =0.0\n",
    "        te8 =0.0\n",
    "        te9 =0.0\n",
    "        te10=0.0\n",
    "        te11=0.0\n",
    "        te12=0.0\n",
    "        te13=0.0\n",
    "        te14=0.0\n",
    "        te15=0.0\n",
    "        te16=0.0\n",
    "        new(te1,te2,te3,te4,te5,te6,te7,te8,te9,te10,te11,te12,te13,te14,te15,te16)\n",
    "    end\n",
    "    function RotationMatrix(te1,te2,te3,te4,te5,te6,te7,te8,te9,te10,te11,te12,te13,te14,te15,te16)\n",
    "        new(te1,te2,te3,te4,te5,te6,te7,te8,te9,te10,te11,te12,te13,te14,te15,te16)\n",
    "    end\n",
    "end\n",
    "\n",
    "+(f::Vector3, g::Vector3)=Vector3(f.x+g.x , f.y+g.y,f.z+g.z )\n",
    "-(f::Vector3, g::Vector3)=Vector3(f.x-g.x , f.y-g.y,f.z-g.z )\n",
    "*(f::Vector3, g::Vector3)=Vector3(f.x*g.x , f.y*g.y,f.z*g.z )\n",
    "\n",
    "+(f::Vector3, g::Number)=Vector3(f.x+g , f.y+g,f.z+g )\n",
    "-(f::Vector3, g::Number)=Vector3(f.x-g , f.y-g,f.z-g )\n",
    "*(f::Vector3, g::Number)=Vector3(f.x*g , f.y*g,f.z*g )\n",
    "\n",
    "+(g::Vector3, f::Number)=Vector3(f.x+g , f.y+g,f.z+g )\n",
    "-(g::Vector3, f::Number)=Vector3(g-f.x , g-f.y,g-f.z )\n",
    "*(g::Vector3, f::Number)=Vector3(f.x*g , f.y*g,f.z*g )\n",
    "\n",
    "addX(f::Vector3, g::Number)=Vector3(f.x+g , f.y,f.z)\n",
    "addY(f::Vector3, g::Number)=Vector3(f.x , f.y+g,f.z )\n",
    "addZ(f::Vector3, g::Number)=Vector3(f.x , f.y,f.z+g )\n",
    "\n",
    "function normalizeVector3(f::Vector3)\n",
    "    leng=sqrt((f.x * f.x) + (f.y * f.y) + (f.z * f.z))\n",
    "    return Vector3(f.x/leng,f.y/leng,f.z/leng)\n",
    "    \n",
    "end\n",
    "function normalizeQuaternion(f::Quaternion)\n",
    "    l = sqrt((f.x * f.x) + (f.y * f.y) + (f.z * f.z)+ (f.w * f.w))\n",
    "    if l === 0 \n",
    "        qx = 0\n",
    "        qy = 0\n",
    "        qz = 0\n",
    "        qw = 1\n",
    "    else \n",
    "        l = 1 / l\n",
    "        qx = f.x * l\n",
    "        qy = f.y * l\n",
    "        qz = f.z * l\n",
    "        qw = f.w * l\n",
    "    end\n",
    "    return Quaternion(qx,qy,qz,qw)\n",
    "end\n",
    "\n",
    "function normalizeQuaternion1!(fx::Float64,fy::Float64,fz::Float64,fw::Float64)\n",
    "    l = sqrt((fx * fx) + (fy * fy) + (fz * fz)+ (fw * fw))\n",
    "    if l === 0 \n",
    "        qx = 0.0\n",
    "        qy = 0.0\n",
    "        qz = 0.0\n",
    "        qw = 1.0\n",
    "    else \n",
    "        l = 1.0 / l\n",
    "        qx = fx * l\n",
    "        qy = fy * l\n",
    "        qz = fz * l\n",
    "        qw = fw * l\n",
    "    end\n",
    "    return qx,qy,qz,qw\n",
    "end\n",
    "\n",
    "\n",
    "function dotVector3(f::Vector3, g::Vector3)\n",
    "    return (f.x * g.x) + (f.y * g.y) + (f.z * g.z)\n",
    "end\n",
    "\n",
    "function Base.show(io::IO, v::Vector3)\n",
    "    print(io, \"x:$(v.x), y:$(v.y), z:$(v.z)\")\n",
    "end\n",
    "\n",
    "function Base.show(io::IO, v::Quaternion)\n",
    "    print(io, \"x:$(v.x), y:$(v.y), z:$(v.z), w:$(v.z)\")\n",
    "end\n",
    "\n",
    "Base.Broadcast.broadcastable(q::Vector3) = Ref(q)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "simulateParallel (generic function with 2 methods)"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function simulateParallel(numTimeSteps,dt)\n",
    "    # initialize(setup)\n",
    "    \n",
    "    for i in 1:numTimeSteps\n",
    "        #println(\"Timestep:\",i)\n",
    "        doTimeStep(dt,i)\n",
    "    end\n",
    "end\n",
    "\n",
    "function simulateParallel(metavoxel,numTimeSteps,dt)\n",
    "    # initialize(setup)\n",
    "    \n",
    "    for i in 1:numTimeSteps\n",
    "        #println(\"Timestep:\",i)\n",
    "        doTimeStep(metavoxel,dt,i)\n",
    "    end\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "initialize (generic function with 1 method)"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function initialize(setup)\n",
    "    nodes      = setup[\"nodes\"]\n",
    "    edges      = setup[\"edges\"]\n",
    "\n",
    "    i=1\n",
    "    # pre-calculate current position\n",
    "    for node in nodes\n",
    "        # element=parse(Int,node[\"id\"][2:end])\n",
    "        N_position[i]=Vector3(node[\"position\"][\"x\"],node[\"position\"][\"y\"],node[\"position\"][\"z\"])\n",
    "        N_restrained[i]=node[\"restrained_degrees_of_freedom\"][1] ## todo later consider other degrees of freedom\n",
    "        N_displacement[i]=Vector3(node[\"displacement\"][\"x\"],node[\"displacement\"][\"y\"],node[\"displacement\"][\"z\"])\n",
    "        N_angle[i]=Vector3(node[\"angle\"][\"x\"],node[\"angle\"][\"y\"],node[\"angle\"][\"z\"])\n",
    "        N_force[i]=Vector3(node[\"force\"][\"x\"]/10,node[\"force\"][\"y\"]/10,node[\"force\"][\"z\"]/10)\n",
    "        N_currPosition[i]=Vector3(node[\"position\"][\"x\"],node[\"position\"][\"y\"],node[\"position\"][\"z\"])\n",
    "\n",
    "        # for dynamic simulations\n",
    "        # append!(N_posTimeSteps,[[]])\n",
    "        # append!(N_angTimeSteps,[[]])\n",
    "\n",
    "        i=i+1\n",
    "    end \n",
    "\n",
    "    i=1\n",
    "    # pre-calculate the axis\n",
    "    for edge in edges\n",
    "        # element=parse(Int,edge[\"id\"][2:end])\n",
    "\n",
    "        # find the nodes that the lements connects\n",
    "        fromNode = nodes[edge[\"source\"]+1]\n",
    "        toNode = nodes[edge[\"target\"]+1]\n",
    "\n",
    "\n",
    "        node1 = [fromNode[\"position\"][\"x\"] fromNode[\"position\"][\"y\"] fromNode[\"position\"][\"z\"]]\n",
    "        node2 = [toNode[\"position\"][\"x\"] toNode[\"position\"][\"y\"] toNode[\"position\"][\"z\"]]\n",
    "\n",
    "        length=norm(node2-node1)\n",
    "        axis=normalize(collect(Iterators.flatten(node2-node1)))\n",
    "\n",
    "        E_source[i]=edge[\"source\"]+1\n",
    "        E_target[i]=edge[\"target\"]+1\n",
    "        E_area[i]=edge[\"area\"]\n",
    "        E_density[i]=edge[\"density\"]\n",
    "        E_stiffness[i]=edge[\"stiffness\"]\n",
    "        E_axis[i]=Vector3(axis[1],axis[2],axis[3])\n",
    "        E_currentRestLength[i]=length\n",
    "\n",
    "        N_edgeID[E_source[i],N_currEdge[E_source[i]]]=i\n",
    "        N_edgeFirst[E_source[i],N_currEdge[E_source[i]]]=true\n",
    "        N_currEdge[E_source[i]]+=1\n",
    "\n",
    "        N_edgeID[E_target[i],N_currEdge[E_target[i]]]=i\n",
    "        N_edgeFirst[E_target[i],N_currEdge[E_target[i]]]=false\n",
    "        N_currEdge[E_target[i]]+=1\n",
    "\n",
    "\n",
    "        # for dynamic simulations\n",
    "        # append!(E_stressTimeSteps,[[]])\n",
    "\n",
    "        i=i+1\n",
    "    end \n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "doTimeStep! (generic function with 1 method)"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function doTimeStep(dt,currentTimeStep)\n",
    "    # update forces: go through edges, get currentposition from nodes, calc pos2 and update stresses and interior forces of nodes\n",
    "    run_updateEdges!(\n",
    "        E_sourceGPU, \n",
    "        E_targetGPU,\n",
    "        E_areaGPU,\n",
    "        E_densityGPU,\n",
    "        E_stiffnessGPU,\n",
    "        E_stressGPU,\n",
    "        E_axisGPU,\n",
    "        E_currentRestLengthGPU,\n",
    "        E_pos2GPU,\n",
    "        E_angle1vGPU,\n",
    "        E_angle2vGPU,\n",
    "        E_angle1GPU,\n",
    "        E_angle2GPU,\n",
    "        E_intForce1GPU,\n",
    "        E_intMoment1GPU,\n",
    "        E_intForce2GPU,\n",
    "        E_intMoment2GPU,\n",
    "        E_dampGPU,\n",
    "        N_currPositionGPU,\n",
    "        N_orientGPU)\n",
    "    \n",
    "    # update forces: go through nodes and update interior force (according to int forces from edges), integrate and update currpos\n",
    "    run_updateNodes!(dt,currentTimeStep,\n",
    "        N_positionGPU, \n",
    "        N_restrainedGPU,\n",
    "        N_displacementGPU,\n",
    "        N_angleGPU,\n",
    "        N_currPositionGPU,\n",
    "        N_linMomGPU,\n",
    "        N_angMomGPU,\n",
    "        N_intForceGPU,\n",
    "        N_intMomentGPU,\n",
    "        N_forceGPU,\n",
    "        N_momentGPU,\n",
    "        N_orientGPU,\n",
    "        N_edgeIDGPU, \n",
    "        N_edgeFirstGPU, \n",
    "        E_intForce1GPU,\n",
    "        E_intMoment1GPU,\n",
    "        E_intForce2GPU,\n",
    "        E_intMoment2GPU)\n",
    "    \n",
    "end\n",
    "\n",
    "function doTimeStep!(metavoxel,dt,currentTimeStep)\n",
    "    # update forces: go through edges, get currentposition from nodes, calc pos2 and update stresses and interior forces of nodes\n",
    "    run_updateEdges!(\n",
    "        metavoxel[\"E_sourceGPU\"], \n",
    "        metavoxel[\"E_targetGPU\"],\n",
    "        metavoxel[\"E_areaGPU\"],\n",
    "        metavoxel[\"E_densityGPU\"],\n",
    "        metavoxel[\"E_stiffnessGPU\"],\n",
    "        metavoxel[\"E_stressGPU\"],\n",
    "        metavoxel[\"E_axisGPU\"],\n",
    "        metavoxel[\"E_currentRestLengthGPU\"],\n",
    "        metavoxel[\"E_pos2GPU\"],\n",
    "        metavoxel[\"E_angle1vGPU\"],\n",
    "        metavoxel[\"E_angle2vGPU\"],\n",
    "        metavoxel[\"E_angle1GPU\"],\n",
    "        metavoxel[\"E_angle2GPU\"],\n",
    "        metavoxel[\"E_intForce1GPU\"],\n",
    "        metavoxel[\"E_intMoment1GPU\"],\n",
    "        metavoxel[\"E_intForce2GPU\"],\n",
    "        metavoxel[\"E_intMoment2GPU\"],\n",
    "        metavoxel[\"E_dampGPU\"],\n",
    "        metavoxel[\"N_currPositionGPU\"],\n",
    "        metavoxel[\"N_orientGPU\"])\n",
    "    \n",
    "    # update forces: go through nodes and update interior force (according to int forces from edges), integrate and update currpos\n",
    "    run_updateNodes!(dt,currentTimeStep,\n",
    "        metavoxel[\"N_positionGPU\"], \n",
    "        metavoxel[\"N_restrainedGPU\"],\n",
    "        metavoxel[\"N_displacementGPU\"],\n",
    "        metavoxel[\"N_angleGPU\"],\n",
    "        metavoxel[\"N_currPositionGPU\"],\n",
    "        metavoxel[\"N_linMomGPU\"],\n",
    "        metavoxel[\"N_angMomGPU\"],\n",
    "        metavoxel[\"N_intForceGPU\"],\n",
    "        metavoxel[\"N_intMomentGPU\"],\n",
    "        metavoxel[\"N_forceGPU\"],\n",
    "        metavoxel[\"N_momentGPU\"],\n",
    "        metavoxel[\"N_orientGPU\"],\n",
    "        metavoxel[\"N_edgeIDGPU\"], \n",
    "        metavoxel[\"N_edgeFirstGPU\"], \n",
    "        metavoxel[\"E_intForce1GPU\"],\n",
    "        metavoxel[\"E_intMoment1GPU\"],\n",
    "        metavoxel[\"E_intForce2GPU\"],\n",
    "        metavoxel[\"E_intMoment2GPU\"])\n",
    "    \n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "run_updateEdges! (generic function with 1 method)"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function updateEdges!(E_source,E_target,E_area,E_density,E_stiffness,E_stress,E_axis,\n",
    "        E_currentRestLength,E_pos2,E_angle1v,E_angle2v,\n",
    "        E_angle1,E_angle2,E_intForce1,E_intMoment1,E_intForce2,E_intMoment2,E_damp,\n",
    "        N_currPosition,N_orient)\n",
    "\n",
    "    index = (blockIdx().x - 1) * blockDim().x + threadIdx().x\n",
    "    stride = blockDim().x * gridDim().x\n",
    "    ## @cuprintln(\"thread $index, block $stride\")\n",
    "    N=length(E_source)\n",
    "    for i = index:stride:N\n",
    "        \n",
    "        @inbounds pVNeg=N_currPosition[E_source[i]]\n",
    "        @inbounds pVPos=N_currPosition[E_target[i]]\n",
    "        \n",
    "        @inbounds oVNeg=N_orient[E_source[i]]\n",
    "        @inbounds oVPos=N_orient[E_target[i]]\n",
    "        \n",
    "        @inbounds oldPos2=Vector3(E_pos2[i].x,E_pos2[i].y,E_pos2[i].z) #?copy?\n",
    "        @inbounds oldAngle1v = Vector3(E_angle1v[i].x,E_angle1v[i].y,E_angle1v[i].z)\n",
    "        @inbounds oldAngle2v = Vector3(E_angle2v[i].x,E_angle2v[i].y,E_angle2v[i].z)# remember the positions/angles from last timestep to calculate velocity\n",
    "        \n",
    "        \n",
    "        @inbounds E_pos2[i],E_angle1v[i],E_angle2v[i],E_angle1[i],E_angle2[i],totalRot= orientLink!(E_currentRestLength[i],pVNeg,pVPos,oVNeg,oVPos,E_axis[i])\n",
    "        \n",
    "        @inbounds dPos2   = Vector3(0.5,0.5,0.5) * (E_pos2[i]-oldPos2)  #deltas for local damping. velocity at center is half the total velocity\n",
    "        @inbounds dAngle1 = Vector3(0.5,0.5,0.5) *(E_angle1v[i]-oldAngle1v)\n",
    "        @inbounds dAngle2 = Vector3(0.5,0.5,0.5) *(E_angle2v[i]-oldAngle2v)\n",
    "        \n",
    "        \n",
    "        @inbounds strain=(E_pos2[i].x/E_currentRestLength[i])\n",
    "        \n",
    "        positiveEnd=true\n",
    "        if axialStrain( positiveEnd,strain)>100.0\n",
    "            diverged=true\n",
    "            @cuprintln(\"DIVERGED!!!!!!!!!!\")\n",
    "            return \n",
    "        end\n",
    "        \n",
    "        @inbounds E = E_stiffness[i]\n",
    "        \n",
    "        \n",
    "        \n",
    "        @inbounds l   = E_currentRestLength[i]\n",
    "        \n",
    "        \n",
    "        nu=0\n",
    "#         L = 5.0 #?? change!!!!!!\n",
    "        L=l\n",
    "        a1 = E*L # EA/L : Units of N/m\n",
    "        a2 = E * L*L*L / (12.0*(1+nu)) # GJ/L : Units of N-m\n",
    "        b1 = E*L # 12EI/L^3 : Units of N/m\n",
    "        b2 = E*L*L/2.0 # 6EI/L^2 : Units of N (or N-m/m: torque related to linear distance)\n",
    "        b3 = E*L*L*L/6.0 # 2EI/L : Units of N-m\n",
    "        \n",
    "        nu=0.3\n",
    "        W = 75\n",
    "        L = W/sqrt(2)\n",
    "        l=L\n",
    "        n_min = 1\n",
    "        n_max = 7\n",
    "        # Cross Section inputs, must be floats\n",
    "        mass=125000 #before for voxel\n",
    "        mass=0.1\n",
    "        E = 3000.0  # MPa\n",
    "        G = E * 1 / 3  # MPa\n",
    "        h = 2.38  # mm\n",
    "        b = 2.38  # mm\n",
    "        rho = 7.85e-9 / 3  # kg/mm^3\n",
    "        S = h * b\n",
    "        Sy = (S * (6 + 12 * nu + 6 * nu^2)/ (7 + 12 * nu + 4 * nu^2))\n",
    "        # For solid rectangular cross section (width=b, depth=d & ( b < d )):\n",
    "        Q = 1 / 3 - 0.2244 / (min(h / b, b / h) + 0.1607)\n",
    "        Jxx = Q * min(h * b^3, b * h^3)\n",
    "        s=b\n",
    "    \n",
    "        MaxFreq2=E*s/mass\n",
    "        dt= 1/(6.283185*sqrt(MaxFreq2))\n",
    "\n",
    "\n",
    "        ##if voxels\n",
    "        #nu=0\n",
    "        #L=l\n",
    "        #a1 = E*L # EA/L : Units of N/m\n",
    "        #a2 = E * L*L*L / (12.0*(1+nu)) # GJ/L : Units of N-m\n",
    "        #b1 = E*L # 12EI/L^3 : Units of N/m\n",
    "        #b2 = E*L*L/2.0 # 6EI/L^2 : Units of N (or N-m/m: torque related to linear distance)\n",
    "        #b3 = E*L*L*L/6.0 # 2EI/L : Units of N-m\n",
    "\n",
    "        I= b*h^3/12\n",
    "        J=b*h*(b*b+h*h)/12\n",
    "        a1=E*b*h/L\n",
    "        a2=G*J/L\n",
    "        b1=12*E*I/(L^3)\n",
    "        b2=6*E*I/(L^2)\n",
    "        b3=2*E*I/(L)\n",
    "        \n",
    "        \n",
    "\n",
    "        \n",
    "        #inbounds currentTransverseArea=25.0 #?? change!!!!!! E_area[i]\n",
    "        @inbounds currentTransverseArea= b*h\n",
    "        @inbounds _stress=updateStrain(strain,E)\n",
    "        \n",
    "        #@inbounds currentTransverseArea= E_area[i]\n",
    "        #@inbounds _stress=updateStrain(strain,E_stiffness[i])\n",
    "        \n",
    "        @inbounds E_stress[i]=_stress\n",
    "        \n",
    "        #@cuprintln(\"_stress $_stress\")\n",
    "        x=(_stress*currentTransverseArea)\n",
    "        @inbounds y=(b1*E_pos2[i].y-b2*(E_angle1v[i].z + E_angle2v[i].z))\n",
    "        @inbounds z=(b1*E_pos2[i].z + b2*(E_angle1v[i].y + E_angle2v[i].y))\n",
    "        \n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    "        \n",
    "        # Use Curstress instead of -a1*Pos2.x to account for non-linear deformation \n",
    "        forceNeg = Vector3(x,y,z)\n",
    "        \n",
    "        forcePos = Vector3(-x,-y,-z)\n",
    "        \n",
    "        @inbounds x= (a2*(E_angle2v[i].x-E_angle1v[i].x))\n",
    "        @inbounds y= (-b2*E_pos2[i].z-b3*(2.0*E_angle1v[i].y+E_angle2v[i].y))\n",
    "        @inbounds z=(b2*E_pos2[i].y - b3*(2.0*E_angle1v[i].z + E_angle2v[i].z))  \n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    "        momentNeg = Vector3(x,y,z)\n",
    "        \n",
    "\n",
    "        @inbounds x= (a2*(E_angle1v[i].x-E_angle2v[i].x))\n",
    "        @inbounds y= (-b2*E_pos2[i].z- b3*(E_angle1v[i].y+2.0*E_angle2v[i].y))\n",
    "        @inbounds z=(b2*E_pos2[i].y - b3*(E_angle1v[i].z + 2.0*E_angle2v[i].z))\n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    "        momentPos = Vector3(x,y,z)\n",
    "        \n",
    "        \n",
    "        ### damping\n",
    "        @inbounds if E_damp[i] #first pass no damping\n",
    "            sqA1=CUDAnative.sqrt(a1) \n",
    "            sqA2xIp=CUDAnative.sqrt(a2*L*L/6.0) \n",
    "            sqB1=CUDAnative.sqrt(b1) \n",
    "            sqB2xFMp=CUDAnative.sqrt(b2*L/2) \n",
    "            sqB3xIp=CUDAnative.sqrt(b3*L*L/6.0)\n",
    "            \n",
    "            dampingMultiplier=Vector3(28099.3,28099.3,28099.3) # 2*mat->_sqrtMass*mat->zetaInternal/previousDt;?? todo link to material\n",
    "            \n",
    "            zeta=1\n",
    "            dampingM= 2*sqrt(mass)*zeta/dt\n",
    "            dampingMultiplier=Vector3(dampingM,dampingM,dampingM)\n",
    "            \n",
    "            posCalc=Vector3(sqA1*dPos2.x, sqB1*dPos2.y - sqB2xFMp*(dAngle1.z+dAngle2.z),sqB1*dPos2.z + sqB2xFMp*(dAngle1.y+dAngle2.y))\n",
    "            \n",
    "            \n",
    "            forceNeg =forceNeg + (dampingMultiplier*posCalc);\n",
    "            forcePos =forcePos - (dampingMultiplier*posCalc);\n",
    "\n",
    "            momentNeg -= Vector3(0.5,0.5,0.5)*dampingMultiplier*Vector3(-sqA2xIp*(dAngle2.x - dAngle1.x),\n",
    "                                                                    sqB2xFMp*dPos2.z + sqB3xIp*(2*dAngle1.y + dAngle2.y),\n",
    "                                                                    -sqB2xFMp*dPos2.y + sqB3xIp*(2*dAngle1.z + dAngle2.z));\n",
    "            momentPos -= Vector3(0.5,0.5,0.5)*dampingMultiplier*Vector3(sqA2xIp*(dAngle2.x - dAngle1.x),\n",
    "                                                                sqB2xFMp*dPos2.z + sqB3xIp*(dAngle1.y + 2*dAngle2.y),\n",
    "                                                                -sqB2xFMp*dPos2.y + sqB3xIp*(dAngle1.z + 2*dAngle2.z));\n",
    "\n",
    "        else\n",
    "           @inbounds E_damp[i]=true \n",
    "        end\n",
    "\n",
    "        smallAngle=true\n",
    "        if !smallAngle # ?? check\n",
    "            @inbounds forceNeg = RotateVec3DInv(E_angle1[i],forceNeg)\n",
    "            @inbounds momentNeg = RotateVec3DInv(E_angle1[i],momentNeg)\n",
    "        end\n",
    "        \n",
    "        @inbounds forcePos = RotateVec3DInv(E_angle2[i],forcePos)\n",
    "        @inbounds momentPos = RotateVec3DInv(E_angle2[i],momentPos)\n",
    "\n",
    "        @inbounds forceNeg =toAxisOriginalVector3(forceNeg,E_axis[i])\n",
    "        @inbounds forcePos =toAxisOriginalVector3(forcePos,E_axis[i])\n",
    "\n",
    "        @inbounds momentNeg=toAxisOriginalQuat(momentNeg,E_axis[i])# TODOO CHECKKKKKK\n",
    "        @inbounds momentPos=toAxisOriginalQuat(momentPos,E_axis[i])\n",
    "\n",
    "\n",
    "        @inbounds E_intForce1[i] =forceNeg\n",
    "        @inbounds E_intForce2[i] =forcePos\n",
    "        \n",
    "\n",
    "\n",
    "        @inbounds x= momentNeg.x\n",
    "        @inbounds y= momentNeg.y\n",
    "        @inbounds z= momentNeg.z  \n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    "        \n",
    "        @inbounds E_intMoment1[i]=Vector3(x,y,z)\n",
    "\n",
    "        @inbounds x= momentNeg.x\n",
    "        @inbounds y= momentNeg.y\n",
    "        @inbounds z= momentNeg.z\n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    "        \n",
    "        @inbounds E_intMoment2[i]=Vector3(x,y,z)\n",
    "        \n",
    "        #x=E_pos2[i].x*10000000000\n",
    "        #y=E_pos2[i].y*10000000000\n",
    "        #z=E_pos2[i].z*10000000000\n",
    "        #@cuprintln(\"pos2 x $x, y $y, z $z \")\n",
    "        ##x=E_intMoment2[i].x*10000000000\n",
    "        #y=E_intMoment2[i].y*10000000000\n",
    "        #z=E_intMoment2[i].z*10000000000\n",
    "        #@cuprintln(\"E_intMoment2 x $x, y $y, z $z \")\n",
    "\n",
    "        \n",
    "        \n",
    "    end\n",
    "    return\n",
    "end\n",
    "\n",
    "function run_updateEdges!(E_source,E_target,E_area,E_density,E_stiffness,\n",
    "        E_stress,E_axis,E_currentRestLength,E_pos2,E_angle1v,E_angle2v,\n",
    "        E_angle1,E_angle2,E_intForce1,E_intMoment1,E_intForce2,E_intMoment2,\n",
    "        E_damp,N_currPosition,N_orient)\n",
    "    N=length(E_source)\n",
    "    numblocks = ceil(Int, N/256)\n",
    "    CuArrays.@sync begin\n",
    "        @cuda threads=256 blocks=numblocks updateEdges!(E_source,E_target,E_area,E_density,\n",
    "            E_stiffness,E_stress,E_axis,E_currentRestLength,E_pos2,E_angle1v,\n",
    "            E_angle2v,E_angle1,E_angle2,E_intForce1,E_intMoment1,E_intForce2,\n",
    "            E_intMoment2,E_damp,N_currPosition,N_orient)\n",
    "    end\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "run_updateNodes! (generic function with 1 method)"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function updateNodes!(dt,currentTimeStep,N_position, N_restrained,N_displacement,N_angle,N_currPosition,N_linMom,N_angMom,N_intForce,N_intMoment,N_force,N_moment,N_orient,N_edgeID,N_edgeFirst,E_intForce1,E_intMoment1,E_intForce2,E_intMoment2)\n",
    "\n",
    "    index = (blockIdx().x - 1) * blockDim().x + threadIdx().x\n",
    "    stride = blockDim().x * gridDim().x\n",
    "    ## @cuprintln(\"thread $index, block $stride\")\n",
    "    N,M=size(N_edgeID)\n",
    "    for i = index:stride:N\n",
    "        @inbounds if N_restrained[i]\n",
    "            return\n",
    "        else\n",
    "            for j in 1:M\n",
    "                temp=N_edgeID[i,j]\n",
    "                @inbounds if (N_edgeID[i,j]!=-1)\n",
    "                    #@cuprintln(\"i $i, j $j, N_edgeID[i,j] $temp\")\n",
    "                    @inbounds N_intForce[i]=ifelse(N_edgeFirst[i,j], N_intForce[i]+E_intForce1[N_edgeID[i,j]], N_intForce[i]+E_intForce2[N_edgeID[i,j]] )\n",
    "                    @inbounds N_intMoment[i]=ifelse(N_edgeFirst[i,j], N_intMoment[i]+E_intMoment1[N_edgeID[i,j]], N_intMoment[i]+E_intMoment2[N_edgeID[i,j]] )\n",
    "                end\n",
    "            end\n",
    "            @inbounds curForce = force(N_intForce[i],N_orient[i],N_force[i],true,currentTimeStep)\n",
    "            \n",
    "            #@inbounds N_force[i]=Vector3(0,0,0) ##????\n",
    "            \n",
    "            @inbounds N_intForce[i]=Vector3(0,0,0)\n",
    "        \n",
    "            #x=curForce.x\n",
    "            #y=curForce.y\n",
    "            #z=curForce.z\n",
    "            #@cuprintln(\"curForce x $x, y $y, z $z \")\n",
    "            \n",
    "            #x=N_linMom[i].x*10000000000\n",
    "            #y=N_linMom[i].y*10000000000\n",
    "            #z=N_linMom[i].z*10000000000\n",
    "            #@cuprintln(\"N_linMom[i] x $x, y $y, z $z \")\n",
    "            \n",
    "            \n",
    "            @inbounds N_linMom[i]=N_linMom[i]+curForce*Vector3(dt,dt,dt) #todo make sure right\n",
    "            massInverse=8e-6 # todo ?? later change //8e-6\n",
    "            massInverse=10\n",
    "            @inbounds translate=N_linMom[i]*Vector3((dt*massInverse),(dt*massInverse),(dt*massInverse)) # ??massInverse\n",
    "            \n",
    "            #x=translate.x*10000000000\n",
    "            #y=translate.y*10000000000\n",
    "            #z=translate.z*10000000000\n",
    "            #@cuprintln(\"translate x $x, y $y, z $z \")\n",
    "            \n",
    "            @inbounds N_currPosition[i]=N_currPosition[i]+translate\n",
    "            @inbounds N_displacement[i]=N_displacement[i]+translate\n",
    "            \n",
    "            \n",
    "            \n",
    "            # Rotation\n",
    "            @inbounds curMoment = moment(N_intMoment[i],N_orient[i],N_moment[i]) \n",
    "            \n",
    "            \n",
    "            \n",
    "            @inbounds N_intMoment[i]=Vector3(0,0,0) # do i really need it?\n",
    "            \n",
    "            @inbounds N_angMom[i]=N_angMom[i]+curMoment*Vector3(dt,dt,dt)\n",
    "            \n",
    "            \n",
    "            \n",
    "            \n",
    "            momentInertiaInverse=1.92e-6 # todo ?? later change 1/Inertia (1/(kg*m^2))\n",
    "            \n",
    "            \n",
    "            @inbounds temp=FromRotationVector(N_angMom[i]*Vector3((dt*momentInertiaInverse),(dt*momentInertiaInverse),(dt*momentInertiaInverse)))\n",
    "            \n",
    "            \n",
    "            #x=temp.x*10000000000\n",
    "            #y=temp.y*10000000000\n",
    "            #z=temp.z*10000000000\n",
    "            #@cuprintln(\"temp x $x, y $y, z $z \")\n",
    "            \n",
    "            @inbounds N_orient[i]=multiplyQuaternions(temp,N_orient[i])\n",
    "            \n",
    "            #@inbounds x= N_orient[i].x*temp.x\n",
    "            #@inbounds y= N_orient[i].y*temp.y\n",
    "            #@inbounds z= N_orient[i].z*temp.z\n",
    "            #@inbounds w= N_orient[i].w*temp.w\n",
    "            #x=convert(Float64,x)\n",
    "            #y=convert(Float64,y)\n",
    "            #z=convert(Float64,z)\n",
    "            #w=convert(Float64,w)\n",
    "            \n",
    "            #@inbounds N_orient[i]=Quaternion(x,y,z,w)\n",
    "            \n",
    "            #x=N_orient[i].x*10000000000\n",
    "            #y=N_orient[i].y*10000000000\n",
    "            #z=N_orient[i].z*10000000000\n",
    "            #w=N_orient[i].w\n",
    "            #@cuprintln(\"N_orient x $x, y $y, z $z, w $w \")\n",
    "            \n",
    "            \n",
    "        end\n",
    "    end\n",
    "    return\n",
    "end\n",
    "\n",
    "\n",
    "function run_updateNodes!(dt,currentTimeStep,N_position, N_restrained,N_displacement, N_angle,N_currPosition,N_linMom,N_angMom,N_intForce,N_intMoment,N_force,N_moment,N_orient,N_edgeID,N_edgeFirst,E_intForce1,E_intMoment1,E_intForce2,E_intMoment2)\n",
    "    N=length(N_intForce)\n",
    "    numblocks = ceil(Int, N/256)\n",
    "    CuArrays.@sync begin\n",
    "        @cuda threads=256 blocks=numblocks updateNodes!(dt,currentTimeStep,N_position, N_restrained,N_displacement, N_angle,N_currPosition,N_linMom,N_angMom,N_intForce,N_intMoment,N_force,N_moment,N_orient,N_edgeID,N_edgeFirst,E_intForce1,E_intMoment1,E_intForce2,E_intMoment2)\n",
    "    end\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "orientLink! (generic function with 1 method)"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function orientLink!(currentRestLength,pVNeg,pVPos,oVNeg,oVPos,axis)  # updates pos2, angle1, angle2, and smallAngle //Quat3D<double> /*double restLength*/\n",
    "        \n",
    "    pos2 = toAxisXVector3(pVPos-pVNeg,axis) # digit truncation happens here...\n",
    "    angle1 = toAxisXQuat(oVNeg,axis)\n",
    "    angle2 = toAxisXQuat(oVPos,axis)\n",
    "    \n",
    "    #x=pos2.x*10000000000\n",
    "    #y=pos2.y*10000000000\n",
    "    #z=pos2.z*10000000000\n",
    "    #@cuprintln(\"pos2 x $x, y $y, z $z \")\n",
    "    \n",
    "    #x=angle1.x*10000000000\n",
    "    #y=angle1.y*10000000000\n",
    "    #z=angle1.z*10000000000\n",
    "    #@cuprintln(\"angle1 x $x, y $y, z $z \")\n",
    "    #x=oVNeg.x*10000000000\n",
    "    #y=oVNeg.y*10000000000\n",
    "    #z=oVNeg.z*10000000000\n",
    "    #@cuprintln(\"oVNeg x $x, y $y, z $z \")\n",
    "    \n",
    "    \n",
    "    \n",
    "    totalRot = conjugate(angle1) #keep track of the total rotation of this bond (after toAxisX()) # Quat3D<double>\n",
    "    pos2 = RotateVec3D(totalRot,pos2)\n",
    "    \n",
    "    #x=pos2.x*10000000000\n",
    "    #y=pos2.y*10000000000\n",
    "    #z=pos2.z*10000000000\n",
    "    #@cuprintln(\"pos2 2 x $x, y $y, z $z \")\n",
    "    \n",
    "    \n",
    "    #x=totalRot.x*10000000000\n",
    "    #y=totalRot.y*10000000000\n",
    "    #z=totalRot.z*10000000000\n",
    "    #@cuprintln(\"totalRot x $x, y $y, z $z \")\n",
    "    \n",
    "    \n",
    "#     x=pos2.x*10000000000\n",
    "#     y=pos2.y*10000000000\n",
    "#     z=pos2.z*10000000000\n",
    "#     @cuprintln(\"pos2 x $x, y $y, z $z \")\n",
    "    \n",
    "    angle2 = Quaternion(angle2.x*totalRot.x,angle2.y*totalRot.y,angle2.z*totalRot.z,angle2.w*totalRot.w)\n",
    "    angle1 = Quaternion(0.0,0.0,0.0,1.0)#new THREE.Quaternion() #zero for now...\n",
    "\n",
    "    smallAngle=true #todo later remove\n",
    "    \n",
    "    \n",
    "    if (smallAngle)\t #Align so Angle1 is all zeros\n",
    "        #pos2[1] =pos2[1]- currentRestLength #only valid for small angles\n",
    "        pos2=Vector3(pos2.x-currentRestLength,pos2.y,pos2.z)\n",
    "    else  #Large angle. Align so that Pos2.y, Pos2.z are zero.\n",
    "        # FromAngleToPosX(angle1,pos2) #get the angle to align Pos2 with the X axis\n",
    "        # totalRot = angle1.clone().multiply(totalRot)  #update our total rotation to reflect this\n",
    "        # angle2 = angle1.clone().multiply(  angle2) #rotate angle2\n",
    "        # pos2 = new THREE.Vector3(pos2.length() - currentRestLength, 0, 0);\n",
    "    end\n",
    "    \n",
    "    angle1v = ToRotationVector(angle1)\n",
    "    angle2v = ToRotationVector(angle2)\n",
    "    \n",
    "    \n",
    "    \n",
    "    \n",
    "#     pos2,angle1v,angle2v,angle1,angle2,\n",
    "    return pos2,angle1v,angle2v,angle1,angle2,totalRot\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "toAxisOriginalQuat (generic function with 1 method)"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function toAxisXVector3(pV::Vector3,axis::Vector3) #TODO CHANGE\n",
    "\n",
    "    xaxis=Vector3(1.0,0.0,0.0)\n",
    "\n",
    "    vector=normalizeVector3(axis)\n",
    "    q=setFromUnitVectors(vector,xaxis)\n",
    "    \n",
    "    \n",
    " \n",
    "#     rot=setFromRotationMatrix(quatToMatrix( q  ))\n",
    "    \n",
    "    \n",
    "#     v= applyQuaternion1( pV ,setQuaternionFromEuler(rot) )\n",
    "    v=applyQuaternion1( pV ,q )\n",
    "    \n",
    "    #d=15\n",
    "    #vx=round(v.x, digits=d)\n",
    "    #vy=round(v.y, digits=d)\n",
    "    #vz=round(v.z, digits=d)\n",
    "    \n",
    "    \n",
    "    return Vector3(v.x,v.y,v.z)\n",
    "end\n",
    "\n",
    "function toAxisOriginalVector3(pV::Vector3,axis::Vector3)\n",
    "    \n",
    "    xaxis=Vector3(1.0,0.0,0.0)\n",
    "\n",
    "    vector=normalizeVector3(axis)\n",
    "\n",
    "    q=setFromUnitVectors(xaxis,vector)\n",
    "    \n",
    "\n",
    "#     rot=setFromRotationMatrix(quatToMatrix( q  ))\n",
    "\n",
    "#     v= applyQuaternion1( pV ,setQuaternionFromEuler(rot) )\n",
    "    v=applyQuaternion1( pV ,q )\n",
    "    \n",
    "    #d=15\n",
    "    #vx=round(v.x, digits=d)\n",
    "    #vy=round(v.y, digits=d)\n",
    "    #vz=round(v.z, digits=d)\n",
    "    \n",
    "    \n",
    "    return Vector3(v.x,v.y,v.z)\n",
    "end\n",
    "\n",
    "function  toAxisXQuat(pQ::Quaternion,axis::Vector3)\n",
    "    \n",
    "    xaxis=Vector3(1.0,0.0,0.0)\n",
    "\n",
    "    vector=normalizeVector3(axis)\n",
    "\n",
    "\n",
    "    q=setFromUnitVectors(vector,xaxis)\n",
    "        \n",
    "    #d=17\n",
    "    #qw=round(q[1], digits=d)\n",
    "    #qx=round(q[2], digits=d)\n",
    "    #qy=round(q[3], digits=d)\n",
    "    #qz=round(q[4], digits=d)\n",
    "    #\n",
    "\n",
    "#     rot=setFromRotationMatrix(quatToMatrix( q  ))\n",
    "    \n",
    "    pV=Vector3(pQ.x,pQ.y,pQ.z)\n",
    "    \n",
    "#     v=applyQuaternion1( pV ,setQuaternionFromEuler(rot) )\n",
    "    v=applyQuaternion1( pV ,q )\n",
    "    \n",
    "    #d=15\n",
    "    #vx=round(v.x, digits=d)\n",
    "    #vy=round(v.y, digits=d)\n",
    "    #vz=round(v.z, digits=d)\n",
    "    \n",
    "    return Quaternion(v.x,v.y,v.z,1.0)\n",
    "    \n",
    "    # return [1.0 v[1] v[2] v[3]]\n",
    "end\n",
    "\n",
    "function toAxisOriginalQuat(pQ::Vector3,axis::Vector3)\n",
    "    xaxis=Vector3(1.0,0.0,0.0)\n",
    "\n",
    "    vector=normalizeVector3(axis)\n",
    "    \n",
    "    q=setFromUnitVectors(xaxis,vector)\n",
    "    \n",
    "\n",
    "#     rot=setFromRotationMatrix(quatToMatrix( q  ))\n",
    "    \n",
    "    pV=Vector3(pQ.x,pQ.y,pQ.z)\n",
    "#     v=applyQuaternion1( pV ,setQuaternionFromEuler(rot) )\n",
    "    v=applyQuaternion1( pV ,q )\n",
    "    \n",
    "    #d=15\n",
    "    #vx=round(v.x, digits=d)\n",
    "    #vy=round(v.y, digits=d)\n",
    "    #vz=round(v.z, digits=d)\n",
    "    \n",
    "    return Quaternion(v.x,v.y,v.z,1.0)\n",
    "    \n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "applyQuaternion1 (generic function with 1 method)"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function setFromUnitVectors(vFrom::Vector3, vTo::Vector3)\n",
    "    # assumes direction vectors vFrom and vTo are normalized\n",
    "    EPS = 0.000000001;\n",
    "    r= dotVector3(vFrom,vTo)+1.0\n",
    "    # r =  dot(vFrom,vTo)+1\n",
    "\n",
    "    if r < EPS\n",
    "        r = 0;\n",
    "        if abs( vFrom.x ) > abs( vFrom.z ) \n",
    "            qx = - vFrom.y\n",
    "            qy = vFrom.x\n",
    "            qz = 0.0\n",
    "            qw = r\n",
    "        else \n",
    "            qx = 0.0\n",
    "            qy = -(vFrom.z)\n",
    "            qz = vFrom.y\n",
    "            qw = r\n",
    "        end\n",
    "   else \n",
    "        # crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n",
    "        qx = vFrom.y * vTo.z - vFrom.z * vTo.y\n",
    "        qy = vFrom.z * vTo.x - vFrom.x * vTo.z\n",
    "        qz = vFrom.x * vTo.y - vFrom.y * vTo.x\n",
    "        qw = r\n",
    "\n",
    "    end\n",
    "    qx= (qx==-0.0) ? 0.0 : qx\n",
    "    qy= (qy==-0.0) ? 0.0 : qy\n",
    "    qz= (qz==-0.0) ? 0.0 : qz\n",
    "    qw= (qw==-0.0) ? 0.0 : qw\n",
    "        \n",
    "    \n",
    "    mx=qx*qx\n",
    "    my=qy*qy\n",
    "    mz=qz*qz\n",
    "    mw=qw*qw\n",
    "    mm=mx+my\n",
    "    mm=mm+mz\n",
    "    mm=mm+mw\n",
    "    mm=convert(Float64,mm)#??????????????????? todo check later\n",
    "    \n",
    "    l=CUDAnative.sqrt(mm)\n",
    "    \n",
    "    #l = sqrt((qx * qx) + (qy * qy) + (qz * qz)+ (qw * qw))\n",
    "    if l === 0 \n",
    "        qx = 0.0\n",
    "        qy = 0.0\n",
    "        qz = 0.0\n",
    "        qw = 1.0\n",
    "    else \n",
    "        l = 1.0 / l\n",
    "        qx = qx * l\n",
    "        qy = qy * l\n",
    "        qz = qz * l\n",
    "        qw = qw * l\n",
    "    end\n",
    "    \n",
    "    \n",
    "\n",
    "    # return qx,qy,qz,qw\n",
    "    return Quaternion(qx,qy,qz,qw)\n",
    "    \n",
    "    # return normalizeQ(Quat(qw,qx,qy,qz))\n",
    "    # return Quat(nn[1], nn[2], nn[3], nn[4])\n",
    "\n",
    "end\n",
    "\n",
    "function quatToMatrix( quaternion::Quaternion)\n",
    "\n",
    "    #te = RotationMatrix()\n",
    "    \n",
    "    x = quaternion.x\n",
    "    y = quaternion.y\n",
    "    z = quaternion.z\n",
    "    w = quaternion.w\n",
    "    \n",
    "    x2 = x + x\n",
    "    y2 = y + y\n",
    "    z2 = z + z\n",
    "    xx = x * x2\n",
    "    xy = x * y2\n",
    "    xz = x * z2\n",
    "    yy = y * y2\n",
    "    yz = y * z2\n",
    "    zz = z * z2\n",
    "    wx = w * x2\n",
    "    wy = w * y2\n",
    "    wz = w * z2\n",
    "\n",
    "    sx = 1.0\n",
    "    sy = 1.0\n",
    "    sz = 1.0\n",
    "\n",
    "    te1 = ( 1.0 - ( yy + zz ) ) * sx\n",
    "    te2 = ( xy + wz ) * sx\n",
    "    te3 = ( xz - wy ) * sx\n",
    "    te4 = 0.0\n",
    "\n",
    "    te5 = ( xy - wz ) * sy\n",
    "    te6 = ( 1.0 - ( xx + zz ) ) * sy\n",
    "    te7 = ( yz + wx ) * sy\n",
    "    te8 = 0.0\n",
    "\n",
    "    te9 = ( xz + wy ) * sz\n",
    "    te10 = ( yz - wx ) * sz\n",
    "    te11 = ( 1.0 - ( xx + yy ) ) * sz\n",
    "    te12 = 0.0\n",
    "\n",
    "    te13 = 0.0 #position.x;\n",
    "    te14 = 0.0 #position.y;\n",
    "    te15 = 0.0 #position.z;\n",
    "    te16 = 1.0\n",
    "    \n",
    "        \n",
    "    te= RotationMatrix(te1,te2,te3,te4,te5,te6,te7,te8,te9,te10,te11,te12,te13,te14,te15,te16)\n",
    "\n",
    "    return te\n",
    "\n",
    "end\n",
    "\n",
    "function  setFromRotationMatrix(m::RotationMatrix)\n",
    "    #te = m\n",
    "    #m11 = (te[ 1 ]== -0.0) ? 0.0 : te[ 1 ]\n",
    "    #m12 = (te[ 5 ]== -0.0) ? 0.0 : te[ 5 ]\n",
    "    #m13 = (te[ 9 ]== -0.0) ? 0.0 : te[ 9 ]\n",
    "    #m21 = (te[ 2 ]== -0.0) ? 0.0 : te[ 2 ]\n",
    "    #m22 = (te[ 6 ]== -0.0) ? 0.0 : te[ 6 ]\n",
    "    #m23 = (te[ 10]== -0.0) ? 0.0 : te[ 10]\n",
    "    #m31 = (te[ 3 ]== -0.0) ? 0.0 : te[ 3 ]\n",
    "    #m32 = (te[ 7 ]== -0.0) ? 0.0 : te[ 7 ]\n",
    "    #m33 = (te[ 11]== -0.0) ? 0.0 : te[ 11]\n",
    "\n",
    "    m11 = convert(Float64,m.te1 )\n",
    "    m12 = convert(Float64,m.te5 )\n",
    "    m13 = convert(Float64,m.te9 )\n",
    "    m21 = convert(Float64,m.te2 )\n",
    "    m22 = convert(Float64,m.te6 )\n",
    "    m23 = convert(Float64,m.te10)\n",
    "    m31 = convert(Float64,m.te3 )\n",
    "    m32 = convert(Float64,m.te7 )\n",
    "    m33 = convert(Float64,m.te11)\n",
    "    \n",
    "\n",
    "    y = CUDAnative.asin( clamp( m13, -1.0, 1.0 ) ) ##check if has to be changed to cuda\n",
    "\n",
    "    if ( abs( m13 ) < 0.9999999999 ) \n",
    "        \n",
    "        x = CUDAnative.atan2( - m23, m33 )\n",
    "        z = CUDAnative.atan2( - m12, m11 )#-m12, m11\n",
    "        # if(m23==0.0)\n",
    "        #     x = atan( m23, m33 )\n",
    "        # end\n",
    "        # if(m12==0.0)\n",
    "        #     z = atan( m12, m11 )\n",
    "        # end\n",
    "\n",
    "    else\n",
    "\n",
    "        x = CUDAnative.atan2( m32, m22 )\n",
    "        z = 0.0;\n",
    "\n",
    "    end\n",
    "    \n",
    "    \n",
    "    return Vector3(x,y,z)\n",
    "    \n",
    "end\n",
    "\n",
    "function setQuaternionFromEuler(euler::Vector3)\n",
    "    x=euler.x\n",
    "    y=euler.y\n",
    "    z=euler.z\n",
    "    \n",
    "    \n",
    "    c1 = CUDAnative.cos( x / 2.0 )\n",
    "    c2 = CUDAnative.cos( y / 2.0 )\n",
    "    c3 = CUDAnative.cos( z / 2.0 )\n",
    "\n",
    "    s1 = CUDAnative.sin( x / 2.0 )\n",
    "    s2 = CUDAnative.sin( y / 2.0 )\n",
    "    s3 = CUDAnative.sin( z / 2.0 )\n",
    "    \n",
    "   \n",
    "    x = s1 * c2 * c3 + c1 * s2 * s3\n",
    "    y = c1 * s2 * c3 - s1 * c2 * s3\n",
    "    z = c1 * c2 * s3 + s1 * s2 * c3\n",
    "    w = c1 * c2 * c3 - s1 * s2 * s3\n",
    "        \n",
    "    return Quaternion(x,y,z,w)\n",
    "end\n",
    "\n",
    "function applyQuaternion1(e::Vector3,q2::Quaternion)\n",
    "    x = e.x\n",
    "    y = e.y\n",
    "    z = e.z\n",
    "\n",
    "    qx = q2.x\n",
    "    qy = q2.y\n",
    "    qz = q2.z\n",
    "    qw = q2.w\n",
    "\n",
    "    # calculate quat * vector\n",
    "\n",
    "    ix = qw * x + qy * z - qz * y\n",
    "    iy = qw * y + qz * x - qx * z\n",
    "    iz = qw * z + qx * y - qy * x\n",
    "    iw = - qx * x - qy * y - qz * z\n",
    "\n",
    "    # calculate result * inverse quat\n",
    "\n",
    "    xx = ix * qw + iw * - qx + iy * - qz - iz * - qy\n",
    "    yy = iy * qw + iw * - qy + iz * - qx - ix * - qz\n",
    "    zz = iz * qw + iw * - qz + ix * - qy - iy * - qx\n",
    "    \n",
    "    d=15\n",
    "\n",
    "    return Vector3(xx,yy,zz)\n",
    "end\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "multiplyQuaternions (generic function with 1 method)"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function conjugate(q::Quaternion)\n",
    "    x= (-q.x==-0) ? 0.0 : -q.x\n",
    "    y= (-q.y==-0) ? 0.0 : -q.y\n",
    "    z= (-q.z==-0) ? 0.0 : -q.z\n",
    "    w=q.w\n",
    "    x=convert(Float64,x)\n",
    "    y=convert(Float64,y)\n",
    "    z=convert(Float64,z)\n",
    "    w=convert(Float64,w)\n",
    "    return Quaternion(x,y,z,w)\n",
    "end\n",
    "\n",
    "function RotateVec3D(a::Quaternion, f::Vector3)   \n",
    "    fx= (f.x==-0) ? 0 : f.x\n",
    "    fy= (f.y==-0) ? 0 : f.y\n",
    "    fz= (f.z==-0) ? 0 : f.z\n",
    "    # fx= f.x\n",
    "    # fy= f.y\n",
    "    # fz= f.z\n",
    "    tw = fx*a.x + fy*a.y + fz*a.z\n",
    "    tx = fx*a.w - fy*a.z + fz*a.y\n",
    "    ty = fx*a.z + fy*a.w - fz*a.x\n",
    "    tz = -fx*a.y + fy*a.x + fz*a.w\n",
    "\n",
    "    return Vector3((a.w*tx+a.x*tw+a.y*tz-a.z*ty),(a.w*ty-a.x*tz+a.y*tw+a.z*tx),(a.w*tz+a.x*ty-a.y*tx+a.z*tw))\n",
    "end\n",
    "#!< Returns a vector representing the specified vector \"f\" rotated by this quaternion. @param[in] f The vector to transform.\n",
    "\n",
    "function RotateVec3DInv(a::Quaternion, f::Vector3)  \n",
    "    fx=f.x\n",
    "    fy=f.y\n",
    "    fz=f.z\n",
    "    tw = a.x*fx + a.y*fy + a.z*fz\n",
    "    tx = a.w*fx - a.y*fz + a.z*fy\n",
    "    ty = a.w*fy + a.x*fz - a.z*fx\n",
    "    tz = a.w*fz - a.x*fy + a.y*fx\n",
    "    return Vector3((tw*a.x + tx*a.w + ty*a.z - tz*a.y),(tw*a.y - tx*a.z + ty*a.w + tz*a.x),(tw*a.z + tx*a.y - ty*a.x + tz*a.w))\n",
    "end\n",
    "#!< Returns a vector representing the specified vector \"f\" rotated by the inverse of this quaternion. This is the opposite of RotateVec3D. @param[in] f The vector to transform.\n",
    "\n",
    "function ToRotationVector(a::Quaternion)  \n",
    "    if (a.w >= 1.0 || a.w <= -1.0) \n",
    "        return Vector3(0.0,0.0,0.0)\n",
    "    end\n",
    "    squareLength = 1.0-a.w*a.w; # because x*x + y*y + z*z + w*w = 1.0, but more susceptible to w noise (when \n",
    "    SLTHRESH_ACOS2SQRT= 2.4e-3; # SquareLength threshhold for when we can use square root optimization for acos. From SquareLength = 1-w*w. (calculate according to 1.0-W_THRESH_ACOS2SQRT*W_THRESH_ACOS2SQRT\n",
    "\n",
    "    if (squareLength < SLTHRESH_ACOS2SQRT) # ???????\n",
    "        x=a.x*(2.0*CUDAnative.sqrt((2-2*a.w)/squareLength))\n",
    "        y=a.y*(2.0*CUDAnative.sqrt((2-2*a.w)/squareLength))\n",
    "        z=a.z*(2.0*CUDAnative.sqrt((2-2*a.w)/squareLength))\n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    " \n",
    "        return Vector3(x,y,z) ; # acos(w) = sqrt(2*(1-x)) for w close to 1. for w=0.001, error is 1.317e-6\n",
    "    else \n",
    "        x=a.x*(2.0*CUDAnative.acos(a.w)/CUDAnative.sqrt(squareLength))\n",
    "        y=a.y*(2.0*CUDAnative.acos(a.w)/CUDAnative.sqrt(squareLength))\n",
    "        z=a.z*(2.0*CUDAnative.acos(a.w)/CUDAnative.sqrt(squareLength))\n",
    "        x=convert(Float64,x)\n",
    "        y=convert(Float64,y)\n",
    "        z=convert(Float64,z)\n",
    "\n",
    "        return Vector3(x,y,z)\n",
    "    end                                    \n",
    "end \n",
    "# !< Returns a rotation vector representing this quaternion rotation. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/\n",
    "\n",
    "function FromRotationVector(VecIn::Vector3)\n",
    "    theta=VecIn*Vector3(0.5,0.5,0.5)\n",
    "    ntheta=CUDAnative.sqrt((theta.x * theta.x) + (theta.y * theta.y) + (theta.z * theta.z))\n",
    "    thetaMag2=ntheta*ntheta\n",
    "    \n",
    "    DBL_EPSILONx24 =5.328e-15\n",
    "    if thetaMag2*thetaMag2 < DBL_EPSILONx24\n",
    "        qw=1.0 - 0.5*thetaMag2\n",
    "\t\ts=1.0 - thetaMag2 / 6.0\n",
    "    else\n",
    "        thetaMag = CUDAnative.sqrt(thetaMag2)\n",
    "\t\tqw=CUDAnative.cos(thetaMag)\n",
    "\t\ts=CUDAnative.sin(thetaMag) / thetaMag\n",
    "    end\n",
    "    qx=theta.x*s\n",
    "    qy=theta.y*s\n",
    "    qz=theta.z*s\n",
    "    \n",
    "    qx=convert(Float64,qx)\n",
    "    qy=convert(Float64,qy)\n",
    "    qz=convert(Float64,qz)\n",
    "    qw=convert(Float64,qw)\n",
    "    \n",
    "    return Quaternion(qx,qy,qz,qw)\n",
    "end\n",
    "\n",
    "function multiplyQuaternions(q::Quaternion,f::Quaternion)\n",
    "    x=q.x\n",
    "    y=q.y\n",
    "    z=q.z\n",
    "    w=q.w\n",
    "    x1=w*f.x + x*f.w + y*f.z - z*f.y \n",
    "    y1=w*f.y - x*f.z + y*f.w + z*f.x\n",
    "    z1=w*f.z + x*f.y - y*f.x + z*f.w\n",
    "    w1=w*f.w - x*f.x - y*f.y - z*f.z\n",
    "#     x1=convert(Float64,x1)\n",
    "#     y1=convert(Float64,y1)\n",
    "#     z1=convert(Float64,z1)\n",
    "#     w1=convert(Float64,w1)\n",
    "\treturn Quaternion(x1,y1,z1,w1 ); #!< overload quaternion multiplication.\n",
    "end\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "axialStrain (generic function with 1 method)"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function updateStrain( axialStrain,E) # ?from where strain\n",
    "    strain = axialStrain # redundant?\n",
    "    currentTransverseStrainSum=0.0 # ??? todo\n",
    "    linear=true\n",
    "    maxStrain=1000000000000000;# ?? todo later change\n",
    "    if linear\n",
    "        if axialStrain > maxStrain\n",
    "            maxStrain = axialStrain # remember this maximum for easy reference\n",
    "        end\n",
    "        return stress(axialStrain,E)\n",
    "    else \n",
    "        if (axialStrain > maxStrain) # if new territory on the stress/strain curve\n",
    "            maxStrain = axialStrain # remember this maximum for easy reference\n",
    "            returnStress = stress(axialStrain,E) # ??currentTransverseStrainSum\n",
    "            if (nu != 0.0) \n",
    "                strainOffset = maxStrain-stress(axialStrain,E)/(_eHat*(1.0-nu)) # precalculate strain offset for when we back off\n",
    "            else \n",
    "                strainOffset = maxStrain-returnStress/E # precalculate strain offset for when we back off\n",
    "            end\n",
    "        else  # backed off a non-linear material, therefore in linear region.\n",
    "            relativeStrain = axialStrain-strainOffset #  treat the material as linear with a strain offset according to the maximum plastic deformation\n",
    "            if (nu != 0.0) \n",
    "                returnStress = stress(relativeStrain,E)\n",
    "            else \n",
    "                returnStress = E*relativeStrain\n",
    "            end\n",
    "        end\n",
    "        return returnStress\n",
    "    end\n",
    "end\n",
    "\n",
    "function stress( strain , E ) #end,transverseStrainSum, forceLinear){\n",
    "    #  reference: http://www.colorado.edu/engineering/CAS/courses.d/Structures.d/IAST.Lect05.d/IAST.Lect05.pdf page 10\n",
    "    #  if (isFailed(strain)) return 0.0f; //if a failure point is set and exceeded, we've broken!\n",
    "    #   var E =setup.edges[0].stiffness; //todo change later to material ??\n",
    "    #   var E=1000000;//todo change later to material ??\n",
    "    #   var scaleFactor=1;\n",
    "    return E*strain;\n",
    "\n",
    "    #  #   if (strain <= strainData[1] || linear || forceLinear){ //for compression/first segment and linear materials (forced or otherwise), simple calculation\n",
    "\n",
    "        #   if (nu==0.0) return E*strain;\n",
    "        #   else return _eHat*((1-nu)*strain + nu*transverseStrainSum); \n",
    "        #  else return eHat()*((1-nu)*strain + nu*transverseStrainSum); \n",
    "    #  #  }\n",
    "\n",
    "      #//the non-linear feature with non-zero poissons ratio is currently experimental\n",
    "      #int DataCount = modelDataPoints();\n",
    "      #for (int i=2; i<DataCount; i++){ //go through each segment in the material model (skipping the first segment because it has already been handled.\n",
    "      #  if (strain <= strainData[i] || i==DataCount-1){ //if in the segment ending with this point (or if this is the last point extrapolate out) \n",
    "      #      float Perc = (strain-strainData[i-1])/(strainData[i]-strainData[i-1]);\n",
    "      #      float basicStress = stressData[i-1] + Perc*(stressData[i]-stressData[i-1]);\n",
    "      #      if (nu==0.0f) return basicStress;\n",
    "      #      else { //accounting for volumetric effects\n",
    "      #          float modulus = (stressData[i]-stressData[i-1])/(strainData[i]-strainData[i-1]);\n",
    "      #          float modulusHat = modulus/((1-2*nu)*(1+nu));\n",
    "      #          float effectiveStrain = basicStress/modulus; //this is the strain at which a simple linear stress strain line would hit this point at the definied modulus\n",
    "      #          float effectiveTransverseStrainSum = transverseStrainSum*(effectiveStrain/strain);\n",
    "      #          return modulusHat*((1-nu)*effectiveStrain + nu*effectiveTransverseStrainSum);\n",
    "      #      }\n",
    "      #  }\n",
    "      #}\n",
    "\n",
    "    #  assert(false); //should never reach this point\n",
    "    #  return 0.0f;\n",
    "end \n",
    "\n",
    "function axialStrain( positiveEnd,strain)\n",
    "\t#strainRatio = pVPos->material()->E/pVNeg->material()->E;\n",
    "\tstrainRatio=1.0;\n",
    "\treturn positiveEnd ? 2.0 *strain*strainRatio/(1.0+strainRatio) : 2.0*strain/(1.0+strainRatio)\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "moment (generic function with 1 method)"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function force(N_intForce,N_orient,N_force,static,currentTimeStep) \n",
    "    # forces from internal bonds\n",
    "    totalForce=Vector3(0,0,0)\n",
    "    # new THREE.Vector3(node.force.x,node.force.y,node.force.z);\n",
    "    #  todo \n",
    "\n",
    "\n",
    "    totalForce=totalForce+N_intForce\n",
    "\n",
    "    #  for (int i=0; i<6; i++){ \n",
    "    #  \tif (links[i]) totalForce += links[i]->force(isNegative((linkDirection)i)); # total force in LCS\n",
    "    #  }\n",
    "    totalForce = RotateVec3D(N_orient,totalForce); # from local to global coordinates\n",
    "\n",
    "\n",
    "    # assert(!(totalForce.x != totalForce.x) || !(totalForce.y != totalForce.y) || !(totalForce.z != totalForce.z)); //assert non QNAN\n",
    "\n",
    "    # other forces\n",
    "    if(static)\n",
    "        totalForce=totalForce+N_force\n",
    "    #  }else if(currentTimeStep<50){\n",
    "    #  \ttotalForce.add(new THREE.Vector3(node.force.x,node.force.y,node.force.z));\n",
    "    else\n",
    "        #  var ex=0.1;\n",
    "        #  if(node.force.y!=0){\n",
    "        #  \tvar f=400*Math.sin(currentTimeStep*ex);\n",
    "        #  \ttotalForce.add(new THREE.Vector3(0,f,0));\n",
    "\n",
    "        #  }\n",
    "        #x=N_position[node][3]\n",
    "        #t=currentTimeStep\n",
    "        #wave=getForce(x,t)\n",
    "        #totalForce=totalForce+[0 wave 0]\n",
    "    end\n",
    "\n",
    "\n",
    "    #  if (externalExists()) totalForce += external()->force(); //external forces\n",
    "    #  totalForce -= velocity()*mat->globalDampingTranslateC(); //global damping f-cv\n",
    "    #  totalForce.z += mat->gravityForce(); //gravity, according to f=mg\n",
    "\n",
    "    #  if (isCollisionsEnabled()){\n",
    "    #  \tfor (std::vector<CVX_Collision*>::iterator it=colWatch->begin(); it!=colWatch->end(); it++){\n",
    "    #  \t\ttotalForce -= (*it)->contactForce(this);\n",
    "    #  \t}\n",
    "    #  }\n",
    "    # todo make internal forces 0 again\n",
    "    # N_intForce[node]=[0 0 0] # do i really need it?\n",
    "\n",
    "    #  node.force.x=0;\n",
    "    #  node.force.y=0;\n",
    "    #  node.force.z=0;\n",
    "\n",
    "\n",
    "    return totalForce\n",
    "end\n",
    "\n",
    "\n",
    "function moment(intMoment,orient,moment) \n",
    "    #moments from internal bonds\n",
    "    totalMoment=Vector3(0,0,0)\n",
    "    # for (int i=0; i<6; i++){ \n",
    "    # \tif (links[i]) totalMoment += links[i]->moment(isNegative((linkDirection)i)); //total force in LCS\n",
    "    # }\n",
    "\n",
    "    totalMoment=totalMoment+intMoment\n",
    "    \n",
    "    \n",
    "\n",
    "    totalMoment = RotateVec3D(orient,totalMoment);\n",
    "    \n",
    "    \n",
    "\n",
    "    totalMoment=totalMoment+moment\n",
    "\n",
    "\n",
    "    #other moments\n",
    "    # if (externalExists()) totalMoment += external()->moment(); //external moments\n",
    "    # totalMoment -= angularVelocity()*mat->globalDampingRotateC(); //global damping\n",
    "\n",
    "    return totalMoment\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "updateDataAndSave! (generic function with 1 method)"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function updateDataAndSave!(metavoxel,setup,fileName)\n",
    "    nodes      = setup[\"nodes\"]\n",
    "    edges      = setup[\"edges\"]\n",
    "    \n",
    "    setup[\"animation\"][\"showDisplacement\"]=false\n",
    "    voxCount=size(nodes)[1]\n",
    "    linkCount=size(edges)[1]\n",
    "    \n",
    "    N_displacement=Array(metavoxel[\"N_displacementGPU\"])\n",
    "    N_angle=Array(metavoxel[\"N_angleGPU\"])\n",
    "    E_stress=Array(metavoxel[\"E_stressGPU\"])\n",
    "    \n",
    "    setup[\"viz\"][\"maxStress\"]=maximum(E_stress)\n",
    "    setup[\"viz\"][\"minStress\"]=minimum(E_stress)  \n",
    "\n",
    "    i=1\n",
    "\tfor edge in edges\n",
    "        edge[\"stress\"]=E_stress[i]\n",
    "        i=i+1\n",
    "\n",
    "    end\n",
    "    \n",
    " \n",
    "    i=1          \n",
    "\tfor node in nodes\n",
    "        node[\"displacement\"][\"x\"]=N_displacement[i].x\n",
    "        node[\"displacement\"][\"y\"]=N_displacement[i].y\n",
    "        node[\"displacement\"][\"z\"]=N_displacement[i].z\n",
    "        \n",
    "        node[\"angle\"][\"x\"]=N_angle[i].x\n",
    "        node[\"angle\"][\"y\"]=N_angle[i].y\n",
    "        node[\"angle\"][\"z\"]=N_angle[i].z\n",
    "        i=i+1\n",
    "\n",
    "    end\n",
    "    \n",
    "    # pass data as a json string (how it shall be displayed in a file)\n",
    "    stringdata = JSON.json(setup)\n",
    "\n",
    "    # write the file with the stringdata variable information\n",
    "    open(fileName, \"w\") do f\n",
    "            write(f, stringdata)\n",
    "         end\n",
    "    \n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "runMetavoxelGPU! (generic function with 1 method)"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function runMetavoxelGPU!(setup,numTimeSteps,latticeSize,displacements,returnEvery,save)\n",
    "    function initialize!(setup)\n",
    "        nodes      = setup[\"nodes\"]\n",
    "        edges      = setup[\"edges\"]\n",
    "\n",
    "        i=1\n",
    "        # pre-calculate current position\n",
    "        for node in nodes\n",
    "            # element=parse(Int,node[\"id\"][2:end])\n",
    "            N_position[i]=Vector3(node[\"position\"][\"x\"],node[\"position\"][\"y\"],node[\"position\"][\"z\"])\n",
    "            N_restrained[i]=node[\"restrained_degrees_of_freedom\"][1] ## todo later consider other degrees of freedom\n",
    "            N_displacement[i]=Vector3(node[\"displacement\"][\"x\"],node[\"displacement\"][\"y\"],node[\"displacement\"][\"z\"])\n",
    "            N_angle[i]=Vector3(node[\"angle\"][\"x\"],node[\"angle\"][\"y\"],node[\"angle\"][\"z\"])\n",
    "            N_force[i]=Vector3(node[\"force\"][\"x\"],node[\"force\"][\"y\"]/10,node[\"force\"][\"z\"])\n",
    "            N_currPosition[i]=Vector3(node[\"position\"][\"x\"],node[\"position\"][\"y\"],node[\"position\"][\"z\"])\n",
    "\n",
    "            # for dynamic simulations\n",
    "            # append!(N_posTimeSteps,[[]])\n",
    "            # append!(N_angTimeSteps,[[]])\n",
    "\n",
    "            i=i+1\n",
    "        end \n",
    "\n",
    "        i=1\n",
    "        # pre-calculate the axis\n",
    "        for edge in edges\n",
    "            # element=parse(Int,edge[\"id\"][2:end])\n",
    "\n",
    "            # find the nodes that the lements connects\n",
    "            fromNode = nodes[edge[\"source\"]+1]\n",
    "            toNode = nodes[edge[\"target\"]+1]\n",
    "\n",
    "\n",
    "            node1 = [fromNode[\"position\"][\"x\"] fromNode[\"position\"][\"y\"] fromNode[\"position\"][\"z\"]]\n",
    "            node2 = [toNode[\"position\"][\"x\"] toNode[\"position\"][\"y\"] toNode[\"position\"][\"z\"]]\n",
    "\n",
    "            length=norm(node2-node1)\n",
    "            axis=normalize(collect(Iterators.flatten(node2-node1)))\n",
    "\n",
    "            E_source[i]=edge[\"source\"]+1\n",
    "            E_target[i]=edge[\"target\"]+1\n",
    "            E_area[i]=edge[\"area\"]\n",
    "            E_density[i]=edge[\"density\"]\n",
    "            E_stiffness[i]=edge[\"stiffness\"]\n",
    "            E_axis[i]=Vector3(axis[1],axis[2],axis[3])\n",
    "            E_currentRestLength[i]=length\n",
    "\n",
    "            N_edgeID[E_source[i],N_currEdge[E_source[i]]]=i\n",
    "            N_edgeFirst[E_source[i],N_currEdge[E_source[i]]]=true\n",
    "            N_currEdge[E_source[i]]+=1\n",
    "\n",
    "            N_edgeID[E_target[i],N_currEdge[E_target[i]]]=i\n",
    "            N_edgeFirst[E_target[i],N_currEdge[E_target[i]]]=false\n",
    "            N_currEdge[E_target[i]]+=1\n",
    "\n",
    "\n",
    "            # for dynamic simulations\n",
    "            # append!(E_stressTimeSteps,[[]])\n",
    "\n",
    "            i=i+1\n",
    "        end \n",
    "    end\n",
    "    function simulateParallel!(metavoxel,numTimeSteps,dt,returnEvery)\n",
    "        # initialize(setup)\n",
    "\n",
    "        for i in 1:numTimeSteps\n",
    "            #println(\"Timestep:\",i)\n",
    "            doTimeStep!(metavoxel,dt,i)\n",
    "            if(mod(i,returnEvery)==0)\n",
    "                append!(displacements,[Array(metavoxel[\"N_displacementGPU\"])])\n",
    "            end\n",
    "        end\n",
    "    end\n",
    "    \n",
    "    ########\n",
    "    voxCount=0\n",
    "    linkCount=0\n",
    "    nodes      = setup[\"nodes\"]\n",
    "    edges      = setup[\"edges\"]\n",
    "    voxCount=size(nodes)[1]\n",
    "    linkCount=size(edges)[1]\n",
    "    strain =0 #todooo moveeee\n",
    "    maxNumEdges=10\n",
    "\n",
    "    ########\n",
    "    voxCount=0\n",
    "    linkCount=0\n",
    "    nodes      = setup[\"nodes\"]\n",
    "    edges      = setup[\"edges\"]\n",
    "    voxCount=size(nodes)[1]\n",
    "    linkCount=size(edges)[1]\n",
    "    strain =0 #todooo moveeee\n",
    "\n",
    "    ############# nodes\n",
    "    N_position=fill(Vector3(),voxCount)\n",
    "    N_restrained=zeros(Bool, voxCount)\n",
    "    N_displacement=fill(Vector3(),voxCount)\n",
    "    N_angle=fill(Vector3(),voxCount)\n",
    "    N_currPosition=fill(Vector3(),voxCount)\n",
    "    N_linMom=fill(Vector3(),voxCount)\n",
    "    N_angMom=fill(Vector3(),voxCount)\n",
    "    N_intForce=fill(Vector3(),voxCount)\n",
    "    N_intMoment=fill(Vector3(),voxCount)\n",
    "    N_moment=fill(Vector3(),voxCount)\n",
    "    # N_posTimeSteps=[]\n",
    "    # N_angTimeSteps=[]\n",
    "    N_force=fill(Vector3(),voxCount)\n",
    "    N_orient=fill(Quaternion(),voxCount)\n",
    "    N_edgeID=fill(-1,(voxCount,maxNumEdges))\n",
    "    N_edgeFirst=fill(true,(voxCount,maxNumEdges))\n",
    "    N_currEdge=fill(1,voxCount)\n",
    "\n",
    "    ############# edges\n",
    "    E_source=fill(0,linkCount)\n",
    "    E_target=fill(0,linkCount)\n",
    "    E_area=fill(0.0f0,linkCount)\n",
    "    E_density=fill(0.0f0,linkCount)\n",
    "    E_stiffness=fill(0.0f0,linkCount)\n",
    "    E_stress=fill(0.0f0,linkCount)\n",
    "    E_axis=fill(Vector3(1.0,0.0,0.0),linkCount)\n",
    "    E_currentRestLength=fill(0.0f0,linkCount)\n",
    "    E_pos2=fill(Vector3(),linkCount)\n",
    "    E_angle1v=fill(Vector3(),linkCount)\n",
    "    E_angle2v=fill(Vector3(),linkCount)\n",
    "    E_angle1=fill(Quaternion(),linkCount)\n",
    "    E_angle2=fill(Quaternion(),linkCount)\n",
    "\n",
    "    E_intForce1=fill(Vector3(),linkCount)\n",
    "    E_intMoment1=fill(Vector3(),linkCount) \n",
    "\n",
    "    E_intForce2=fill(Vector3(),linkCount)\n",
    "    E_intMoment2=fill(Vector3(),linkCount)\n",
    "    E_damp=fill(false,linkCount)\n",
    "\n",
    "    E_currentTransverseStrainSum=fill(0.0f0,linkCount)# TODO remove ot incorporate\n",
    "    # E_stressTimeSteps=[]\n",
    "\n",
    "\n",
    "    #################################################################\n",
    "    initialize!(setup)\n",
    "    #################################################################\n",
    "\n",
    "    ########################## turn to cuda arrays\n",
    "    ############# nodes\n",
    "    N_positionGPU=    CuArray(N_position)      \n",
    "    N_restrainedGPU=  CuArray(N_restrained)  \n",
    "    N_displacementGPU=CuArray(N_displacement)   \n",
    "    N_angleGPU=       CuArray(N_angle)       \n",
    "    N_currPositionGPU=CuArray(N_currPosition)    \n",
    "    N_linMomGPU=      CuArray(N_linMom)        \n",
    "    N_angMomGPU=      CuArray(N_angMom)        \n",
    "    N_intForceGPU=    CuArray(N_intForce)     \n",
    "    N_intMomentGPU=   CuArray(N_intMoment)        \n",
    "    N_momentGPU=      CuArray(N_moment)         \n",
    "    N_forceGPU=       CuArray(N_force)           \n",
    "    N_orientGPU=      CuArray(N_orient)       \n",
    "    N_edgeIDGPU=      CuArray(N_edgeID)         \n",
    "    N_edgeFirstGPU=   CuArray(N_edgeFirst)         \n",
    "\n",
    "\n",
    "    ############# edges\n",
    "    E_sourceGPU=                    CuArray(E_source)   \n",
    "    E_targetGPU=                    CuArray(E_target)\n",
    "    E_areaGPU=                      CuArray(E_area)                             \n",
    "    E_densityGPU=                   CuArray(E_density)\n",
    "    E_stiffnessGPU=                 CuArray(E_stiffness)\n",
    "    E_stressGPU=                    CuArray(E_stress)\n",
    "    E_axisGPU=                      CuArray(E_axis)          \n",
    "    E_currentRestLengthGPU=         CuArray(E_currentRestLength)\n",
    "    E_pos2GPU=                      CuArray(E_pos2)\n",
    "    E_angle1vGPU=                   CuArray(E_angle1v)\n",
    "    E_angle2vGPU=                   CuArray(E_angle2v)\n",
    "    E_angle1GPU=                    CuArray(E_angle1)\n",
    "    E_angle2GPU=                    CuArray(E_angle2)\n",
    "    E_currentTransverseStrainSumGPU=CuArray(E_currentTransverseStrainSum)\n",
    "    E_intForce1GPU=                 CuArray(E_intForce1) \n",
    "    E_intMoment1GPU=                CuArray(E_intMoment1)  \n",
    "    E_intForce2GPU=                 CuArray(E_intForce2) \n",
    "    E_intMoment2GPU=                CuArray(E_intMoment2)\n",
    "    E_dampGPU=                      CuArray(E_damp) \n",
    "    # E_stressTimeSteps=[]\n",
    "\n",
    "\n",
    "    #########################################\n",
    "    metavoxel = Dict(\n",
    "        \"N_positionGPU\" => N_positionGPU,    \n",
    "        \"N_restrainedGPU\" => N_restrainedGPU,  \n",
    "        \"N_displacementGPU\" => N_displacementGPU,\n",
    "        \"N_angleGPU\" => N_angleGPU,       \n",
    "        \"N_currPositionGPU\" => N_currPositionGPU,\n",
    "        \"N_linMomGPU\" => N_linMomGPU,      \n",
    "        \"N_angMomGPU\" => N_angMomGPU,      \n",
    "        \"N_intForceGPU\" => N_intForceGPU,    \n",
    "        \"N_intMomentGPU\" => N_intMomentGPU,   \n",
    "        \"N_momentGPU\" => N_momentGPU,      \n",
    "        \"N_forceGPU\" => N_forceGPU,       \n",
    "        \"N_orientGPU\" => N_orientGPU,      \n",
    "        \"N_edgeIDGPU\" => N_edgeIDGPU,      \n",
    "        \"N_edgeFirstGPU\" => N_edgeFirstGPU,\n",
    "        \"E_sourceGPU\" =>E_sourceGPU,                    \n",
    "        \"E_targetGPU\" =>E_targetGPU,                    \n",
    "        \"E_areaGPU\" =>E_areaGPU,                      \n",
    "        \"E_densityGPU\" =>E_densityGPU,                   \n",
    "        \"E_stiffnessGPU\" =>E_stiffnessGPU,                 \n",
    "        \"E_stressGPU\" =>E_stressGPU,                    \n",
    "        \"E_axisGPU\" =>E_axisGPU,                      \n",
    "        \"E_currentRestLengthGPU\" =>E_currentRestLengthGPU,         \n",
    "        \"E_pos2GPU\" =>E_pos2GPU,                      \n",
    "        \"E_angle1vGPU\" =>E_angle1vGPU,                   \n",
    "        \"E_angle2vGPU\" =>E_angle2vGPU,                   \n",
    "        \"E_angle1GPU\" =>E_angle1GPU,                    \n",
    "        \"E_angle2GPU\" =>E_angle2GPU,                    \n",
    "        \"E_currentTransverseStrainSumGPU\" =>E_currentTransverseStrainSumGPU,\n",
    "        \"E_intForce1GPU\" =>E_intForce1GPU,                 \n",
    "        \"E_intMoment1GPU\" =>E_intMoment1GPU,                \n",
    "        \"E_intForce2GPU\" =>E_intForce2GPU,                 \n",
    "        \"E_intMoment2GPU\" =>E_intMoment2GPU,                \n",
    "        \"E_dampGPU\" =>E_dampGPU                      \n",
    "    )\n",
    "\n",
    "    #########################################\n",
    "    if save\n",
    "        updateDataAndSave!(metavoxel,setup,\"../json/trialJuliaParallelGPU.json\")\n",
    "    end\n",
    "\n",
    "    dt=0.0251646\n",
    "    E = 3000.0  # MPa\n",
    "    s=2.38\n",
    "    mass=0.1\n",
    "    \n",
    "    \n",
    "    MaxFreq2=E*s/mass\n",
    "    dt= 1/(6.283185*sqrt(MaxFreq2))\n",
    "#     dt=0.0001646\n",
    "    \n",
    "    append!(displacements,[Array(metavoxel[\"N_displacementGPU\"])])\n",
    "    \n",
    "    t=@timed doTimeStep!(metavoxel,dt,0)\n",
    "    append!(displacements,[Array(metavoxel[\"N_displacementGPU\"])])\n",
    "    time=t[2]\n",
    "    println(\"first timestep took $time seconds\")\n",
    "    t=@timed simulateParallel!(metavoxel,numTimeSteps-1,dt,returnEvery)\n",
    "    time=t[2]\n",
    "    \n",
    "    \n",
    "    println(\"ran latticeSize $latticeSize with $voxCount voxels and $linkCount edges for $numTimeSteps time steps took $time seconds\")\n",
    "    return\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "fea (generic function with 1 method)"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function fea(setup)\n",
    "    #######################################################\n",
    "    function points(element, properties)\n",
    "        elements = properties[\"elements\"]\n",
    "        nodes = properties[\"nodes\"]\n",
    "        degrees_of_freedom = properties[\"degrees_of_freedom\"]\n",
    "\n",
    "        # find the nodes that the lements connects\n",
    "        fromNode = elements[element][1]\n",
    "        toNode = elements[element][2]\n",
    "\n",
    "        # the coordinates for each node\n",
    "        fromPoint = nodes[fromNode]\n",
    "        toPoint = nodes[toNode]\n",
    "\n",
    "        # find the degrees of freedom for each node\n",
    "        dofs = degrees_of_freedom[fromNode]\n",
    "        dofs=vcat(dofs,degrees_of_freedom[toNode])\n",
    "\n",
    "        return fromPoint, toPoint, dofs\n",
    "    end\n",
    "\n",
    "    function direction_cosine(vec1, vec2)\n",
    "        return dot(vec1,vec2) / (norm(vec1) * norm(vec2))\n",
    "    end\n",
    "\n",
    "    function rotation_matrix(element_vector, x_axis, y_axis,z_axis)\n",
    "        # find the direction cosines\n",
    "        x_proj = direction_cosine(element_vector, x_axis)\n",
    "        y_proj = direction_cosine(element_vector, y_axis)\n",
    "        z_proj = direction_cosine(element_vector, z_axis);\n",
    "        return [[x_proj y_proj z_proj 0 0 0];[0 0 0 x_proj y_proj z_proj]]\n",
    "    end\n",
    "\n",
    "    function rotation_matrix(element_vector, x_axis, y_axis,z_axis)\n",
    "        # find the direction cosines\n",
    "        L=norm(element_vector)\n",
    "        l = (element_vector[1])/L\n",
    "        m = (element_vector[2])/L\n",
    "        n = (element_vector[3])/L\n",
    "        D = ( l^2+ m^2+n^2)^0.5\n",
    "\n",
    "        transMatrix=[[l m  n  0  0  0  0  0  0  0  0  0];[-m/D l/D  0  0  0  0  0  0  0  0  0  0];[ -l*n/D  -m*n/D  D  0  0  0  0  0  0  0  0  0];[ 0  0  0       l       m  n  0  0  0  0  0  0];[ 0  0  0    -m/D     l/D  0  0  0  0  0  0  0];[ 0  0  0  -l*n/D  -m*n/D  D  0  0  0  0  0  0];[ 0  0  0  0  0  0       l       m  n  0  0  0];[ 0  0  0  0  0  0    -m/D     l/D  0  0  0  0];[ 0  0  0  0  0  0  -l*n/D  -m*n/D  D  0  0  0];[ 0  0  0  0  0  0  0  0  0       l       m  n];[ 0  0  0  0  0  0  0  0  0    -m/D     l/D  0];[ 0  0  0  0  0  0  0  0  0  -l*n/D  -m*n/D  D]]\n",
    "\n",
    "        return transMatrix\n",
    "    end\n",
    "    \n",
    "    #######################################################\n",
    "    function get_matrices(setup)\n",
    "\n",
    "        nodes      = setup[\"nodes\"]\n",
    "        edges      = setup[\"edges\"]\n",
    "        ndofs      = length(nodes)*6\n",
    "\n",
    "        x_axis     = [1 0 0]\n",
    "        y_axis     = [0 1 0]\n",
    "        z_axis     = [0 0 1]\n",
    "\n",
    "        M = zeros((ndofs,ndofs))\n",
    "        K = zeros((ndofs,ndofs))\n",
    "        \n",
    "        \n",
    "        for edge in edges\n",
    "            #degrees_of_freedom = properties[\"degrees_of_freedom\"]\n",
    "\n",
    "            element=parse(Int,edge[\"id\"][2:end])\n",
    "\n",
    "            # find the nodes that the lements connects\n",
    "            fromNode = nodes[edge[\"source\"]+1]\n",
    "            toNode = nodes[edge[\"target\"]+1]\n",
    "            \n",
    "\n",
    "            # the coordinates for each node\n",
    "            fromPoint = [fromNode[\"position\"][\"x\"] fromNode[\"position\"][\"y\"] fromNode[\"position\"][\"z\"]]\n",
    "            toPoint = [toNode[\"position\"][\"x\"] toNode[\"position\"][\"y\"] toNode[\"position\"][\"z\"]]\n",
    "\n",
    "            # find the degrees of freedom for each node\n",
    "            dofs = convert(Array{Int}, fromNode[\"degrees_of_freedom\"])\n",
    "            dofs=vcat(dofs,convert(Array{Int}, toNode[\"degrees_of_freedom\"]))\n",
    "\n",
    "            element_vector=toPoint-fromPoint\n",
    "\n",
    "            # find element mass and stifness matrices\n",
    "            length   = norm(element_vector)\n",
    "            rho      = edge[\"density\"]\n",
    "            area     = edge[\"area\"]\n",
    "            E        = edge[\"stiffness\"]# youngs modulus\n",
    "\n",
    "            A = edge[\"area\"]\n",
    "            G=1.0#todo shear_modulus\n",
    "            ixx = 1.0#todo section ixx\n",
    "            iyy = 1.0#todo section.iyy#\n",
    "            l0=length\n",
    "            j=1.0;#todo check\n",
    "            l02 = l0 * l0\n",
    "            l03 = l0 * l0 * l0\n",
    "            \n",
    "            ################################\n",
    "            mass=0.1\n",
    "            nu=0.3\n",
    "            W = 75\n",
    "            L = W/sqrt(2)\n",
    "            n_min = 1\n",
    "            n_max = 7\n",
    "            # Cross Section inputs, must be floats\n",
    "            E = 3000.0  # MPa\n",
    "            G = E * 1 / 3  # MPa\n",
    "            h = 2.38  # mm\n",
    "            b = 2.38  # mm\n",
    "            rho = 7.85e-9 / 3  # kg/mm^3\n",
    "            S = h * b\n",
    "            Sy = (S * (6 + 12 * nu + 6 * nu^2)/ (7 + 12 * nu + 4 * nu^2))\n",
    "            # For solid rectangular cross section (width=b, depth=d & ( b < d )):\n",
    "            Q = 1 / 3 - 0.2244 / (min(h / b, b / h) + 0.1607)\n",
    "            Jxx = Q * min(h * b^3, b * h^3)\n",
    "            \n",
    "            \n",
    "            ##if voxels\n",
    "            #nu=0\n",
    "            #L=l\n",
    "            #a1 = E*L # EA/L : Units of N/m\n",
    "            #a2 = E * L*L*L / (12.0*(1+nu)) # GJ/L : Units of N-m\n",
    "            #b1 = E*L # 12EI/L^3 : Units of N/m\n",
    "            #b2 = E*L*L/2.0 # 6EI/L^2 : Units of N (or N-m/m: torque related to linear distance)\n",
    "            #b3 = E*L*L*L/6.0 # 2EI/L : Units of N-m\n",
    "            \n",
    "            I= b*h^3/12\n",
    "            J=b*h*(b*b+h*h)/12\n",
    "            a1=E*b*h/L\n",
    "            a2=G*J/L\n",
    "            b1=12*E*I/(L^3)\n",
    "            b2=6*E*I/(L^2)\n",
    "            b3=2*E*I/(L)\n",
    "            \n",
    "            # Cm = rho * area * length /6.0\n",
    "            # Ck= E * area / length \n",
    "\n",
    "            # m = [[2 1];[1 2]]\n",
    "            # k = [[1 -1];[-1 1]]\n",
    "            \n",
    "\n",
    "            k = [[E*A/l0  0  0  0  0  0  -E*A/l0  0  0  0  0  0];[0  12*E*ixx/l03  0  0  0  6*E*ixx/l02  0  -12*E*ixx/l03  0  0  0  6*E*ixx/l02];[0  0  12*E*iyy/l03  0  -6*E*iyy/l02  0  0  0  -12*E*iyy/l03  0  -6*E*iyy/l02  0];[0  0  0  G*j/l0  0  0  0  0  0  -G*j/l0  0  0];[0  0  -6*E*iyy/l02  0  4*E*iyy/l0  0  0  0  6*E*iyy/l02  0  2*E*iyy/l0  0];[0  6*E*ixx/l02  0  0  0  4*E*ixx/l0  0  -6*E*ixx/l02  0  0  0  2*E*ixx/l0];[-E*A/l0  0  0  0  0  0  E*A/l0  0  0  0  0  0];[0  -12*E*ixx/l03  0  0  0  -6*E*ixx/l02  0  12*E*ixx/l03  0  0  0  -6*E*ixx/l02];[0  0  -12*E*iyy/l03  0  6*E*iyy/l02  0  0  0  12*E*iyy/l03  0  6*E*iyy/l02  0];[0  0  0  -G*j/l0  0  0  0  0  0  G*j/l0  0  0];[0  0  -6*E*iyy/l02  0  2*E*iyy/l0  0  0  0  6*E*iyy/l02  0  4*E*iyy/l0  0];[0  6*E*ixx/l02  0  0  0  2*E*ixx/l0  0  -6*E*ixx/l02  0  0  0  4*E*ixx/l0]]\n",
    "            k= [[ a1  0  0  0   0   0  -a1  0   0   0   0   0  ];\n",
    "                [  0 b1  0  0   0   b2  0  -b1  0   0   0   b2 ];\n",
    "                [  0  0  b1 0  -b2  0   0   0  -b1  0  -b2  0  ];\n",
    "                [  0  0  0  a2  0   0   0   0   0  -a2  0   0  ];\n",
    "                [  0  0  0  0  2b3  0   0   0   b2  0   b3  0  ];\n",
    "                [  0  0  0  0   0  2b3  0  -b2  0   0   0   b3 ];\n",
    "                [  0  0  0  0   0   0   a1  0   0   0   0   0  ];\n",
    "                [  0  0  0  0   0   0   0   b1  0   0   0  -b2 ];\n",
    "                [  0  0  0  0   0   0   0   0   b1  0   b2  0  ];\n",
    "                [  0  0  0  0   0   0   0   0   0   a2  0   0  ];\n",
    "                [  0  0  0  0   0   0   0   0   0    0 2b3  0  ];\n",
    "                [  0  0  0  0   0   0   0   0   0    0  0  2b3 ]]\n",
    "            # find rotated mass and stifness matrices\n",
    "            tau = rotation_matrix(element_vector, x_axis,y_axis,z_axis)\n",
    "\n",
    "            # m_r=transpose(tau)*m*tau\n",
    "            k_r=transpose(tau)*k*tau\n",
    "\n",
    "            # change from element to global coordinate\n",
    "            index= dofs.+1\n",
    "\n",
    "            B=zeros((12,ndofs))\n",
    "            for i in 1:12\n",
    "                  B[i,index[i]]=1.0\n",
    "            end\n",
    "\n",
    "\n",
    "            # M_rG= transpose(B)*m_r*B\n",
    "            K_rG= transpose(B)*k_r*B\n",
    "\n",
    "            # M += Cm .* M_rG\n",
    "            # K += Ck .* K_rG\n",
    "            K +=  K_rG\n",
    "\n",
    "        end\n",
    "        \n",
    "        \n",
    "        # construct the force vector\n",
    "        F=zeros(ndofs)\n",
    "        remove_indices=[];\n",
    "        for node in nodes\n",
    "            #insert!(F,i, value);\n",
    "            #F=vcat(F,value)\n",
    "            \n",
    "            \n",
    "            i=parse(Int,node[\"id\"][2:end])\n",
    "            f=node[\"force\"]\n",
    "            \n",
    "            # println(f)\n",
    "            F[(i)*6+1]=f[\"x\"]/100.0\n",
    "            F[(i)*6+2]=f[\"y\"]/100.0\n",
    "            F[(i)*6+3]=f[\"z\"]/100.0\n",
    "            F[(i)*6+4]=0\n",
    "            F[(i)*6+5]=0\n",
    "            F[(i)*6+6]=0\n",
    "            \n",
    "            dofs = convert(Array{Int}, node[\"degrees_of_freedom\"]).+1\n",
    "            restrained_dofs=node[\"restrained_degrees_of_freedom\"]\n",
    "            for (index, value) in enumerate(dofs)\n",
    "                if restrained_dofs[index]\n",
    "                    append!( remove_indices, value)\n",
    "                end\n",
    "            end\n",
    "            \n",
    "        end\n",
    "\n",
    "        #println(remove_indices)\n",
    "        #print(K)\n",
    "        #print(F)\n",
    "        \n",
    "\n",
    "        #M = M[setdiff(1:end, remove_indices), :]\n",
    "        K = K[setdiff(1:end, remove_indices), :]\n",
    "\n",
    "        #M = M[:,setdiff(1:end, remove_indices)]\n",
    "        K = K[:,setdiff(1:end, remove_indices)]\n",
    "\n",
    "        F = F[setdiff(1:end, remove_indices)]\n",
    "        return M,K,F\n",
    "    end\n",
    "    \n",
    "    \n",
    "    function updateDisplacement(setup, X)\n",
    "        nodes= setup[\"nodes\"]\n",
    "        i=0\n",
    "        for node in nodes\n",
    "            \n",
    "            if !node[\"restrained_degrees_of_freedom\"][1]\n",
    "                #i=parse(Int,node[\"id\"][2:end])\n",
    "                node[\"displacement\"][\"x\"]=X[(i)*6+1]\n",
    "                node[\"displacement\"][\"y\"]=X[(i)*6+2]\n",
    "                node[\"displacement\"][\"z\"]=X[(i)*6+3]\n",
    "                node[\"angle\"][\"x\"]=X[(i)*6+4]\n",
    "                node[\"angle\"][\"y\"]=X[(i)*6+5]\n",
    "                node[\"angle\"][\"z\"]=X[(i)*6+6]\n",
    "                append!(displacementFEA,[Vector3(X[(i)*6+1],X[(i)*6+2],X[(i)*6+3])])\n",
    "                i=i+1\n",
    "            else\n",
    "                append!(displacementFEA,[Vector3(0,0,0)])\n",
    "            end\n",
    "        end\n",
    "    end\n",
    "    \n",
    "    #######################################################\n",
    "\n",
    "    function get_stresses(setup)\n",
    "        nodes      = setup[\"nodes\"]\n",
    "        edges      = setup[\"edges\"]\n",
    "        ndofs      = length(nodes)*6\n",
    "\n",
    "        x_axis     = [1 0 0]\n",
    "        y_axis     = [0 1 0]\n",
    "        z_axis     = [0 0 1]\n",
    "\n",
    "        # find the stresses in each member\n",
    "        stresses=zeros(length(edges))\n",
    "        max11=-10e6\n",
    "        min11=10e6\n",
    "        for edge in edges\n",
    "            #degrees_of_freedom = properties[\"degrees_of_freedom\"]\n",
    "\n",
    "            element=parse(Int,edge[\"id\"][2:end])\n",
    "\n",
    "            # find the nodes that the lements connects\n",
    "            fromNode = nodes[edge[\"source\"]+1]\n",
    "            toNode = nodes[edge[\"target\"]+1]\n",
    "\n",
    "            # the coordinates for each node\n",
    "            fromPoint = [fromNode[\"position\"][\"x\"] fromNode[\"position\"][\"y\"] fromNode[\"position\"][\"z\"]]\n",
    "            toPoint = [toNode[\"position\"][\"x\"] toNode[\"position\"][\"y\"] toNode[\"position\"][\"z\"]]\n",
    "\n",
    "            # find the degrees of freedom for each node\n",
    "            dofs = convert(Array{Int}, fromNode[\"degrees_of_freedom\"])\n",
    "            dofs=vcat(dofs,convert(Array{Int}, toNode[\"degrees_of_freedom\"]))\n",
    "\n",
    "            element_vector=toPoint-fromPoint\n",
    "\n",
    "\n",
    "            # find rotated mass and stifness matrices\n",
    "            tau = rotation_matrix(element_vector, x_axis,y_axis,z_axis)\n",
    "\n",
    "            # i1=parse(Int,fromNode[\"id\"][2:end])\n",
    "            # i2=parse(Int,toNode[\"id\"][2:end])\n",
    "\n",
    "            # global_displacements=[X[(i1)*6+1] X[(i1)*6+2] X[(i1)*6+3] X[(i1)*6+4] X[(i1)*6+5] X[(i1)*6+6] X[(i2)*6+1] X[(i2)*6+2] X[(i2)*6+3] X[(i2)*6+4] X[(i2)*6+5] X[(i2)*6+6]] # todo change\n",
    "            global_displacements=[fromNode[\"displacement\"][\"x\"] fromNode[\"displacement\"][\"y\"] fromNode[\"displacement\"][\"z\"] fromNode[\"angle\"][\"x\"] fromNode[\"angle\"][\"y\"] fromNode[\"angle\"][\"z\"] toNode[\"displacement\"][\"x\"] toNode[\"displacement\"][\"y\"] toNode[\"displacement\"][\"z\"] toNode[\"angle\"][\"x\"] toNode[\"angle\"][\"y\"] toNode[\"angle\"][\"z\"]] # todo change\n",
    "\n",
    "            # nodal displacement\n",
    "\n",
    "            q=tau*transpose(global_displacements)\n",
    "            # println(q)\n",
    "            # calculate the strain and stresses\n",
    "            strain =(q[7]-q[1])/norm(element_vector)\n",
    "            E = edge[\"stiffness\"]# youngs modulus\n",
    "            stress=E.*strain\n",
    "            edge[\"stress\"]=stress\n",
    "            if stress>max11\n",
    "                max11=stress\n",
    "            end\n",
    "            if stress<min11\n",
    "                min11=stress\n",
    "            end\n",
    "            # println(element)\n",
    "            # println(stress)\n",
    "        end\n",
    "\n",
    "\n",
    "\n",
    "        setup[\"viz\"][\"minStress\"]=min11\n",
    "        setup[\"viz\"][\"maxStress\"]=max11\n",
    "        return stresses\n",
    "    end\n",
    "    \n",
    "    function initialize(setup)\n",
    "        nodes      = setup[\"nodes\"]\n",
    "        ndofs      = length(nodes)*6\n",
    "        \n",
    "        i=0\n",
    "        for node in nodes\n",
    "            dg=[]\n",
    "            for ii in 0:5\n",
    "                append!(dg,i+ii) \n",
    "            end\n",
    "            i+=6\n",
    "            node[\"degrees_of_freedom\"]=dg\n",
    "        end\n",
    "    end\n",
    "\n",
    "    #######################################################\n",
    "    function solveFea(setup)\n",
    "        // # determine the global matrices\n",
    "        initialize(setup)\n",
    "        \n",
    "        M,K,F=get_matrices(setup)\n",
    "        \n",
    "        #println(M)\n",
    "        #println(K)\n",
    "        #println(F)\n",
    "\n",
    "        #evals=eigvals(K,M)\n",
    "        #evecs=eigvecs(K,M)\n",
    "        #frequencies=sqrt.(evals)\n",
    "        X=inv(K)*F\n",
    "        # println(X)\n",
    "\n",
    "\n",
    "        #updateDisplacement(displacements);\n",
    "        updateDisplacement(setup, X)\n",
    "\n",
    "        # determine the stresses in each element\n",
    "        stresses=get_stresses(setup)\n",
    "    end\n",
    "    #######################################################\n",
    "    displacementFEA=[]\n",
    "    solveFea(setup)\n",
    "    return displacementFEA\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "getSetup (generic function with 1 method)"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function getSetup()\n",
    "    setup = Dict()\n",
    "\n",
    "    open(\"../json/setupValid2.json\", \"r\") do f\n",
    "#     open(\"../json/setupTest.json\", \"r\") do f\n",
    "    # open(\"../json/trialJulia.json\", \"r\") do f\n",
    "#     open(\"../json/setupTestUni4.json\", \"r\") do f\n",
    "    # open(\"../json/setupChiral.json\", \"r\") do f\n",
    "#     open(\"../json/setupTestCubeUni10.json\", \"r\") do f\n",
    "#         global setup\n",
    "        dicttxt = String(read(f))  # file information to string\n",
    "        setup=JSON.parse(dicttxt)  # parse and transform data\n",
    "    end\n",
    "\n",
    "    setup=setup[\"setup\"]\n",
    "    return setup\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "recommendedTimeStep (generic function with 1 method)"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function recommendedTimeStep()\n",
    "    \n",
    "    \n",
    "#     #find the largest natural frequency (sqrt(k/m)) that anything in the simulation will experience, then multiply by 2*pi and invert to get the optimally largest timestep that should retain stability\n",
    "#     MaxFreq2 = 0.0; #maximum frequency in the simulation in rad/sec\n",
    "    \n",
    "#     for e in 1:length(edges) #for each edge\n",
    "#         CVX_Link* pL = (*it);\n",
    "#         #axial\n",
    "#         m1 = mass(),  m2 = mass()\n",
    "#         thisMaxFreq2 = axialStiffness()/(m1<m2?m1:m2)\n",
    "#         if (thisMaxFreq2 > MaxFreq2) \n",
    "#             MaxFreq2 = thisMaxFreq2;\n",
    "#         end\n",
    "\n",
    "#         #rotational will always be less than or equal\n",
    "#     end\n",
    "        \n",
    "\n",
    "#     if (MaxFreq2 <= 0.0) #didn't find anything (i.e no links) check for individual voxelss\n",
    "#         for n in 1:length(nodes) #for each node\n",
    "#             thisMaxFreq2 = youngsModulus*nomSize/mass;\n",
    "#             #thisMaxFreq2 = (*it)->mat->youngsModulus()*(*it)->mat->nomSize/(*it)->mat->mass();\n",
    "#             if (thisMaxFreq2 > MaxFreq2) \n",
    "#                     MaxFreq2 = thisMaxFreq2;\n",
    "#             end\n",
    "#         end\n",
    "#     end\n",
    "\n",
    "#     if (MaxFreq2 <= 0.0) \n",
    "#         return 0.0\n",
    "#     else \n",
    "#         return 1.0/(6.283185*sqrt(MaxFreq2)) #the optimal timestep is to advance one radian of the highest natural frequency\n",
    "#     end\n",
    "    MaxFreq2=E*size/mass\n",
    "    return 1/(6.283185*sqrt(MaxFreq2))\n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "first timestep took 0.0004438 seconds\n",
      "ran latticeSize 4 with 8 voxels and 12 edges for 3000 time steps took 1.033987999 seconds\n",
      "FEA displacement= -0.003114564315143315,converged displacement= -0.0029412371432669194\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip6800\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip6800)\" d=\"\n",
       "M0 1600 L2400 1600 L2400 0 L0 0  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6801\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip6800)\" d=\"\n",
       "M297.389 1425.62 L2352.76 1425.62 L2352.76 121.675 L297.389 121.675  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6802\">\n",
       "    <rect x=\"297\" y=\"121\" width=\"2056\" height=\"1305\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  354.913,1425.62 354.913,121.675 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1001.26,1425.62 1001.26,121.675 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1647.6,1425.62 1647.6,121.675 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2293.94,1425.62 2293.94,121.675 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  297.389,1214.11 2352.76,1214.11 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  297.389,950.226 2352.76,950.226 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  297.389,686.344 2352.76,686.344 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  297.389,422.462 2352.76,422.462 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  297.389,158.579 2352.76,158.579 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,1425.62 2352.76,1425.62 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,1425.62 297.389,121.675 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  354.913,1425.62 354.913,1409.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1001.26,1425.62 1001.26,1409.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1647.6,1425.62 1647.6,1409.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2293.94,1425.62 2293.94,1409.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,1214.11 322.053,1214.11 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,950.226 322.053,950.226 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,686.344 322.053,686.344 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,422.462 322.053,422.462 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  297.389,158.579 322.053,158.579 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 354.913, 1479.62)\" x=\"354.913\" y=\"1479.62\">0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1001.26, 1479.62)\" x=\"1001.26\" y=\"1479.62\">1000</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1647.6, 1479.62)\" x=\"1647.6\" y=\"1479.62\">2000</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2293.94, 1479.62)\" x=\"2293.94\" y=\"1479.62\">3000</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 273.389, 1231.61)\" x=\"273.389\" y=\"1231.61\">-0.004</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 273.389, 967.726)\" x=\"273.389\" y=\"967.726\">-0.003</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 273.389, 703.844)\" x=\"273.389\" y=\"703.844\">-0.002</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 273.389, 439.962)\" x=\"273.389\" y=\"439.962\">-0.001</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 273.389, 176.079)\" x=\"273.389\" y=\"176.079\">0.000</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:84px; text-anchor:middle;\" transform=\"rotate(0, 1325.07, 73.2)\" x=\"1325.07\" y=\"73.2\">Convergence Study</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66px; text-anchor:middle;\" transform=\"rotate(0, 1325.07, 1559.48)\" x=\"1325.07\" y=\"1559.48\">timestep</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66px; text-anchor:middle;\" transform=\"rotate(-90, 89.2861, 773.647)\" x=\"89.2861\" y=\"773.647\">displacement</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  355.56,158.579 356.206,167.941 356.852,186.207 357.499,212.831 358.145,247.184 358.791,288.568 359.438,336.225 360.084,389.351 360.73,447.104 361.377,508.617 \n",
       "  362.023,573.011 362.669,639.403 363.316,706.919 363.962,774.704 364.608,841.931 365.255,907.808 365.901,971.592 366.547,1032.59 367.194,1090.17 367.84,1143.76 \n",
       "  368.486,1192.86 369.133,1237.04 369.779,1275.96 370.425,1309.33 371.072,1336.96 371.718,1358.73 372.365,1374.58 373.011,1384.54 373.657,1388.71 374.304,1387.26 \n",
       "  374.95,1380.4 375.596,1368.41 376.243,1351.63 376.889,1330.44 377.535,1305.25 378.182,1276.52 378.828,1244.71 379.474,1210.33 380.121,1173.89 380.767,1135.9 \n",
       "  381.413,1096.88 382.06,1057.33 382.706,1017.75 383.352,978.615 383.999,940.388 384.645,903.494 385.291,868.328 385.938,835.251 386.584,804.587 387.23,776.615 \n",
       "  387.877,751.575 388.523,729.661 389.169,711.024 389.816,695.768 390.462,683.953 391.108,675.596 391.755,670.67 392.401,669.11 393.047,670.812 393.694,675.634 \n",
       "  394.34,683.406 394.986,693.924 395.633,706.963 396.279,722.271 396.925,739.582 397.572,758.614 398.218,779.074 398.865,800.662 399.511,823.078 400.157,846.021 \n",
       "  400.804,869.194 401.45,892.31 402.096,915.092 402.743,937.278 403.389,958.621 404.035,978.895 404.682,997.895 405.328,1015.44 405.974,1031.37 406.621,1045.55 \n",
       "  407.267,1057.87 407.913,1068.26 408.56,1076.65 409.206,1083.03 409.852,1087.39 410.499,1089.74 411.145,1090.14 411.791,1088.65 412.438,1085.36 413.084,1080.37 \n",
       "  413.73,1073.8 414.377,1065.8 415.023,1056.51 415.669,1046.08 416.316,1034.7 416.962,1022.52 417.608,1009.73 418.255,996.507 418.901,983.017 419.547,969.437 \n",
       "  420.194,955.934 420.84,942.669 421.486,929.791 422.133,917.443 422.779,905.754 423.426,894.842 424.072,884.809 424.718,875.744 425.365,867.721 426.011,860.8 \n",
       "  426.657,855.023 427.304,850.418 427.95,846.998 428.596,844.761 429.243,843.692 429.889,843.759 430.535,844.921 431.182,847.125 431.828,850.304 432.474,854.387 \n",
       "  433.121,859.289 433.767,864.923 434.413,871.193 435.06,878.002 435.706,885.246 436.352,892.823 436.999,900.63 437.645,908.563 438.291,916.522 438.938,924.411 \n",
       "  439.584,932.137 440.23,939.612 440.877,946.756 441.523,953.495 442.169,959.761 442.816,965.497 443.462,970.653 444.108,975.188 444.755,979.069 445.401,982.273 \n",
       "  446.047,984.787 446.694,986.606 447.34,987.732 447.986,988.178 448.633,987.962 449.279,987.112 449.926,985.661 450.572,983.648 451.218,981.118 451.865,978.12 \n",
       "  452.511,974.708 453.157,970.937 453.804,966.867 454.45,962.557 455.096,958.067 455.743,953.46 456.389,948.794 457.035,944.128 457.682,939.518 458.328,935.018 \n",
       "  458.974,930.678 459.621,926.545 460.267,922.661 460.913,919.063 461.56,915.785 462.206,912.855 462.852,910.295 463.499,908.123 464.145,906.351 464.791,904.985 \n",
       "  465.438,904.028 466.084,903.476 466.73,903.321 467.377,903.551 468.023,904.148 468.669,905.093 469.316,906.36 469.962,907.924 470.608,909.754 471.255,911.819 \n",
       "  471.901,914.085 472.547,916.518 473.194,919.082 473.84,921.742 474.487,924.462 475.133,927.206 475.779,929.942 476.426,932.636 477.072,935.257 477.718,937.777 \n",
       "  478.365,940.168 479.011,942.407 479.657,944.472 480.304,946.344 480.95,948.008 481.596,949.451 482.243,950.664 482.889,951.64 483.535,952.377 484.182,952.875 \n",
       "  484.828,953.135 485.474,953.163 486.121,952.968 486.767,952.56 487.413,951.951 488.06,951.157 488.706,950.193 489.352,949.077 489.999,947.828 490.645,946.467 \n",
       "  491.291,945.013 491.938,943.488 492.584,941.912 493.23,940.306 493.877,938.692 494.523,937.088 495.169,935.513 495.816,933.986 496.462,932.523 497.108,931.14 \n",
       "  497.755,929.85 498.401,928.665 499.048,927.597 499.694,926.653 500.34,925.84 500.987,925.165 501.633,924.629 502.279,924.234 502.926,923.98 503.572,923.865 \n",
       "  504.218,923.885 504.865,924.035 505.511,924.308 506.157,924.697 506.804,925.193 507.45,925.787 508.096,926.466 508.743,927.22 509.389,928.038 510.035,928.907 \n",
       "  510.682,929.814 511.328,930.748 511.974,931.695 512.621,932.646 513.267,933.586 513.913,934.507 514.56,935.396 515.206,936.245 515.852,937.046 516.499,937.789 \n",
       "  517.145,938.468 517.791,939.077 518.438,939.612 519.084,940.069 519.73,940.444 520.377,940.737 521.023,940.946 521.669,941.073 522.316,941.119 522.962,941.085 \n",
       "  523.608,940.976 524.255,940.796 524.901,940.549 525.548,940.24 526.194,939.876 526.84,939.463 527.487,939.007 528.133,938.516 528.779,937.997 529.426,937.458 \n",
       "  530.072,936.904 530.718,936.345 531.365,935.786 532.011,935.234 532.657,934.696 533.304,934.178 533.95,933.685 534.596,933.222 535.243,932.794 535.889,932.405 \n",
       "  536.535,932.057 537.182,931.755 537.828,931.499 538.474,931.291 539.121,931.132 539.767,931.022 540.413,930.961 541.06,930.947 541.706,930.98 542.352,931.056 \n",
       "  542.999,931.173 543.645,931.33 544.291,931.521 544.938,931.745 545.584,931.996 546.23,932.27 546.877,932.565 547.523,932.875 548.169,933.196 548.816,933.524 \n",
       "  549.462,933.854 550.109,934.183 550.755,934.507 551.401,934.821 552.048,935.123 552.694,935.409 553.34,935.677 553.987,935.923 554.633,936.146 555.279,936.344 \n",
       "  555.926,936.515 556.572,936.658 557.218,936.773 557.865,936.858 558.511,936.915 559.157,936.943 559.804,936.944 560.45,936.917 561.096,936.865 561.743,936.789 \n",
       "  562.389,936.691 563.035,936.572 563.682,936.436 564.328,936.283 564.974,936.117 565.621,935.941 566.267,935.756 566.913,935.565 567.56,935.371 568.206,935.175 \n",
       "  568.852,934.982 569.499,934.792 570.145,934.608 570.791,934.432 571.438,934.266 572.084,934.112 572.73,933.97 573.377,933.842 574.023,933.73 574.669,933.633 \n",
       "  575.316,933.554 575.962,933.491 576.609,933.445 577.255,933.416 577.901,933.404 578.548,933.408 579.194,933.428 579.84,933.463 580.487,933.512 581.133,933.574 \n",
       "  581.779,933.647 582.426,933.73 583.072,933.823 583.718,933.923 584.365,934.029 585.011,934.139 585.657,934.253 586.304,934.368 586.95,934.483 587.596,934.597 \n",
       "  588.243,934.708 588.889,934.816 589.535,934.918 590.182,935.015 590.828,935.104 591.474,935.185 592.121,935.258 592.767,935.322 593.413,935.376 594.06,935.421 \n",
       "  594.706,935.455 595.352,935.479 595.999,935.494 596.645,935.498 597.291,935.493 597.938,935.478 598.584,935.455 599.23,935.424 599.877,935.386 600.523,935.341 \n",
       "  601.17,935.29 601.816,935.234 602.462,935.173 603.109,935.11 603.755,935.044 604.401,934.976 605.048,934.908 605.694,934.84 606.34,934.773 606.987,934.708 \n",
       "  607.633,934.645 608.279,934.585 608.926,934.53 609.572,934.478 610.218,934.431 610.865,934.389 611.511,934.353 612.157,934.323 612.804,934.298 613.45,934.28 \n",
       "  614.096,934.267 614.743,934.26 615.389,934.259 616.035,934.264 616.682,934.274 617.328,934.289 617.974,934.309 618.621,934.333 619.267,934.36 619.913,934.391 \n",
       "  620.56,934.425 621.206,934.462 621.852,934.5 622.499,934.539 623.145,934.579 623.791,934.62 624.438,934.66 625.084,934.699 625.731,934.738 626.377,934.774 \n",
       "  627.023,934.809 627.67,934.841 628.316,934.871 628.962,934.898 629.609,934.922 630.255,934.942 630.901,934.959 631.548,934.973 632.194,934.983 632.84,934.989 \n",
       "  633.487,934.992 634.133,934.992 634.779,934.988 635.426,934.981 636.072,934.972 636.718,934.959 637.365,934.945 638.011,934.927 638.657,934.909 639.304,934.888 \n",
       "  639.95,934.866 640.596,934.843 641.243,934.82 641.889,934.796 642.535,934.772 643.182,934.748 643.828,934.725 644.474,934.703 645.121,934.681 645.767,934.661 \n",
       "  646.413,934.642 647.06,934.625 647.706,934.61 648.352,934.596 648.999,934.584 649.645,934.575 650.291,934.568 650.938,934.562 651.584,934.559 652.231,934.558 \n",
       "  652.877,934.559 653.523,934.561 654.17,934.566 654.816,934.572 655.462,934.58 656.109,934.589 656.755,934.6 657.401,934.611 658.048,934.623 658.694,934.637 \n",
       "  659.34,934.65 659.987,934.664 660.633,934.679 661.279,934.693 661.926,934.707 662.572,934.72 663.218,934.734 663.865,934.746 664.511,934.758 665.157,934.769 \n",
       "  665.804,934.779 666.45,934.787 667.096,934.795 667.743,934.802 668.389,934.807 669.035,934.811 669.682,934.814 670.328,934.815 670.974,934.816 671.621,934.815 \n",
       "  672.267,934.813 672.913,934.81 673.56,934.806 674.206,934.801 674.852,934.795 675.499,934.789 676.145,934.782 676.792,934.775 677.438,934.767 678.084,934.758 \n",
       "  678.731,934.75 679.377,934.742 680.023,934.733 680.67,934.725 681.316,934.717 681.962,934.709 682.609,934.702 683.255,934.695 683.901,934.689 684.548,934.683 \n",
       "  685.194,934.678 685.84,934.674 686.487,934.67 687.133,934.667 687.779,934.665 688.426,934.663 689.072,934.663 689.718,934.663 690.365,934.663 691.011,934.665 \n",
       "  691.657,934.667 692.304,934.669 692.95,934.672 693.596,934.676 694.243,934.68 694.889,934.684 695.535,934.688 696.182,934.693 696.828,934.698 697.474,934.703 \n",
       "  698.121,934.708 698.767,934.713 699.413,934.718 700.06,934.723 700.706,934.727 701.352,934.731 701.999,934.735 702.645,934.739 703.292,934.742 703.938,934.745 \n",
       "  704.584,934.748 705.231,934.75 705.877,934.751 706.523,934.753 707.17,934.753 707.816,934.754 708.462,934.753 709.109,934.753 709.755,934.752 710.401,934.751 \n",
       "  711.048,934.749 711.694,934.747 712.34,934.745 712.987,934.743 713.633,934.74 714.279,934.737 714.926,934.735 715.572,934.732 716.218,934.729 716.865,934.726 \n",
       "  717.511,934.723 718.157,934.72 718.804,934.717 719.45,934.714 720.096,934.712 720.743,934.71 721.389,934.707 722.035,934.706 722.682,934.704 723.328,934.703 \n",
       "  723.974,934.701 724.621,934.701 725.267,934.7 725.913,934.7 726.56,934.699 727.206,934.7 727.853,934.7 728.499,934.701 729.145,934.701 729.792,934.702 \n",
       "  730.438,934.704 731.084,934.705 731.731,934.706 732.377,934.708 733.023,934.71 733.67,934.711 734.316,934.713 734.962,934.715 735.609,934.717 736.255,934.718 \n",
       "  736.901,934.72 737.548,934.722 738.194,934.723 738.84,934.725 739.487,934.726 740.133,934.727 740.779,934.728 741.426,934.729 742.072,934.73 742.718,934.731 \n",
       "  743.365,934.731 744.011,934.731 744.657,934.732 745.304,934.732 745.95,934.732 746.596,934.731 747.243,934.731 747.889,934.73 748.535,934.73 749.182,934.729 \n",
       "  749.828,934.728 750.474,934.727 751.121,934.726 751.767,934.725 752.414,934.724 753.06,934.723 753.706,934.722 754.353,934.721 754.999,934.72 755.645,934.719 \n",
       "  756.292,934.718 756.938,934.717 757.584,934.716 758.231,934.716 758.877,934.715 759.523,934.714 760.17,934.714 760.816,934.713 761.462,934.713 762.109,934.713 \n",
       "  762.755,934.713 763.401,934.712 764.048,934.712 764.694,934.713 765.34,934.713 765.987,934.713 766.633,934.713 767.279,934.714 767.926,934.714 768.572,934.715 \n",
       "  769.218,934.715 769.865,934.716 770.511,934.716 771.157,934.717 771.804,934.718 772.45,934.718 773.096,934.719 773.743,934.72 774.389,934.72 775.035,934.721 \n",
       "  775.682,934.721 776.328,934.722 776.974,934.722 777.621,934.723 778.267,934.723 778.914,934.723 779.56,934.723 780.206,934.724 780.853,934.724 781.499,934.724 \n",
       "  782.145,934.724 782.792,934.724 783.438,934.724 784.084,934.724 784.731,934.724 785.377,934.723 786.023,934.723 786.67,934.723 787.316,934.723 787.962,934.722 \n",
       "  788.609,934.722 789.255,934.721 789.901,934.721 790.548,934.721 791.194,934.72 791.84,934.72 792.487,934.72 793.133,934.719 793.779,934.719 794.426,934.719 \n",
       "  795.072,934.718 795.718,934.718 796.365,934.718 797.011,934.718 797.657,934.717 798.304,934.717 798.95,934.717 799.596,934.717 800.243,934.717 800.889,934.717 \n",
       "  801.535,934.717 802.182,934.717 802.828,934.717 803.475,934.717 804.121,934.717 804.767,934.718 805.414,934.718 806.06,934.718 806.706,934.718 807.353,934.718 \n",
       "  807.999,934.719 808.645,934.719 809.292,934.719 809.938,934.719 810.584,934.72 811.231,934.72 811.877,934.72 812.523,934.72 813.17,934.72 813.816,934.72 \n",
       "  814.462,934.721 815.109,934.721 815.755,934.721 816.401,934.721 817.048,934.721 817.694,934.721 818.34,934.721 818.987,934.721 819.633,934.721 820.279,934.721 \n",
       "  820.926,934.721 821.572,934.721 822.218,934.721 822.865,934.721 823.511,934.721 824.157,934.721 824.804,934.721 825.45,934.72 826.096,934.72 826.743,934.72 \n",
       "  827.389,934.72 828.036,934.72 828.682,934.72 829.328,934.72 829.975,934.72 830.621,934.719 831.267,934.719 831.914,934.719 832.56,934.719 833.206,934.719 \n",
       "  833.853,934.719 834.499,934.719 835.145,934.719 835.792,934.719 836.438,934.719 837.084,934.719 837.731,934.719 838.377,934.719 839.023,934.719 839.67,934.719 \n",
       "  840.316,934.719 840.962,934.719 841.609,934.719 842.255,934.719 842.901,934.719 843.548,934.719 844.194,934.719 844.84,934.719 845.487,934.719 846.133,934.719 \n",
       "  846.779,934.72 847.426,934.72 848.072,934.72 848.718,934.72 849.365,934.72 850.011,934.72 850.657,934.72 851.304,934.72 851.95,934.72 852.596,934.72 \n",
       "  853.243,934.72 853.889,934.72 854.536,934.72 855.182,934.72 855.828,934.72 856.475,934.72 857.121,934.72 857.767,934.72 858.414,934.72 859.06,934.72 \n",
       "  859.706,934.72 860.353,934.72 860.999,934.72 861.645,934.72 862.292,934.72 862.938,934.72 863.584,934.72 864.231,934.72 864.877,934.72 865.523,934.72 \n",
       "  866.17,934.72 866.816,934.72 867.462,934.72 868.109,934.72 868.755,934.72 869.401,934.719 870.048,934.719 870.694,934.719 871.34,934.719 871.987,934.719 \n",
       "  872.633,934.719 873.279,934.719 873.926,934.719 874.572,934.719 875.218,934.719 875.865,934.719 876.511,934.719 877.157,934.719 877.804,934.719 878.45,934.719 \n",
       "  879.097,934.719 879.743,934.719 880.389,934.719 881.036,934.719 881.682,934.72 882.328,934.72 882.975,934.72 883.621,934.72 884.267,934.72 884.914,934.72 \n",
       "  885.56,934.72 886.206,934.72 886.853,934.72 887.499,934.72 888.145,934.72 888.792,934.72 889.438,934.72 890.084,934.72 890.731,934.72 891.377,934.72 \n",
       "  892.023,934.72 892.67,934.72 893.316,934.72 893.962,934.72 894.609,934.72 895.255,934.72 895.901,934.72 896.548,934.72 897.194,934.72 897.84,934.72 \n",
       "  898.487,934.72 899.133,934.72 899.779,934.72 900.426,934.72 901.072,934.72 901.718,934.72 902.365,934.72 903.011,934.72 903.657,934.72 904.304,934.72 \n",
       "  904.95,934.72 905.597,934.72 906.243,934.72 906.889,934.72 907.536,934.72 908.182,934.72 908.828,934.72 909.475,934.72 910.121,934.72 910.767,934.72 \n",
       "  911.414,934.72 912.06,934.72 912.706,934.72 913.353,934.72 913.999,934.72 914.645,934.72 915.292,934.72 915.938,934.72 916.584,934.72 917.231,934.72 \n",
       "  917.877,934.72 918.523,934.72 919.17,934.72 919.816,934.72 920.462,934.72 921.109,934.72 921.755,934.72 922.401,934.72 923.048,934.72 923.694,934.72 \n",
       "  924.34,934.72 924.987,934.72 925.633,934.72 926.279,934.72 926.926,934.72 927.572,934.72 928.218,934.72 928.865,934.72 929.511,934.72 930.158,934.72 \n",
       "  930.804,934.72 931.45,934.72 932.097,934.72 932.743,934.72 933.389,934.72 934.036,934.72 934.682,934.72 935.328,934.72 935.975,934.72 936.621,934.72 \n",
       "  937.267,934.72 937.914,934.72 938.56,934.72 939.206,934.72 939.853,934.72 940.499,934.72 941.145,934.72 941.792,934.72 942.438,934.72 943.084,934.72 \n",
       "  943.731,934.72 944.377,934.72 945.023,934.72 945.67,934.72 946.316,934.72 946.962,934.72 947.609,934.72 948.255,934.72 948.901,934.72 949.548,934.72 \n",
       "  950.194,934.72 950.84,934.72 951.487,934.72 952.133,934.72 952.779,934.72 953.426,934.72 954.072,934.72 954.719,934.72 955.365,934.72 956.011,934.72 \n",
       "  956.658,934.72 957.304,934.72 957.95,934.72 958.597,934.72 959.243,934.72 959.889,934.72 960.536,934.72 961.182,934.72 961.828,934.72 962.475,934.72 \n",
       "  963.121,934.72 963.767,934.72 964.414,934.72 965.06,934.72 965.706,934.72 966.353,934.72 966.999,934.72 967.645,934.72 968.292,934.72 968.938,934.72 \n",
       "  969.584,934.72 970.231,934.72 970.877,934.72 971.523,934.72 972.17,934.72 972.816,934.72 973.462,934.72 974.109,934.72 974.755,934.72 975.401,934.72 \n",
       "  976.048,934.72 976.694,934.72 977.34,934.72 977.987,934.72 978.633,934.72 979.279,934.72 979.926,934.72 980.572,934.72 981.219,934.72 981.865,934.72 \n",
       "  982.511,934.72 983.158,934.72 983.804,934.72 984.45,934.72 985.097,934.72 985.743,934.72 986.389,934.72 987.036,934.72 987.682,934.72 988.328,934.72 \n",
       "  988.975,934.72 989.621,934.72 990.267,934.72 990.914,934.72 991.56,934.72 992.206,934.72 992.853,934.72 993.499,934.72 994.145,934.72 994.792,934.72 \n",
       "  995.438,934.72 996.084,934.72 996.731,934.72 997.377,934.72 998.023,934.72 998.67,934.72 999.316,934.72 999.962,934.72 1000.61,934.72 1001.26,934.72 \n",
       "  1001.9,934.72 1002.55,934.72 1003.19,934.72 1003.84,934.72 1004.49,934.72 1005.13,934.72 1005.78,934.72 1006.43,934.72 1007.07,934.72 1007.72,934.72 \n",
       "  1008.36,934.72 1009.01,934.72 1009.66,934.72 1010.3,934.72 1010.95,934.72 1011.6,934.72 1012.24,934.72 1012.89,934.72 1013.54,934.72 1014.18,934.72 \n",
       "  1014.83,934.72 1015.47,934.72 1016.12,934.72 1016.77,934.72 1017.41,934.72 1018.06,934.72 1018.71,934.72 1019.35,934.72 1020,934.72 1020.65,934.72 \n",
       "  1021.29,934.72 1021.94,934.72 1022.58,934.72 1023.23,934.72 1023.88,934.72 1024.52,934.72 1025.17,934.72 1025.82,934.72 1026.46,934.72 1027.11,934.72 \n",
       "  1027.76,934.72 1028.4,934.72 1029.05,934.72 1029.69,934.72 1030.34,934.72 1030.99,934.72 1031.63,934.72 1032.28,934.72 1032.93,934.72 1033.57,934.72 \n",
       "  1034.22,934.72 1034.86,934.72 1035.51,934.72 1036.16,934.72 1036.8,934.72 1037.45,934.72 1038.1,934.72 1038.74,934.72 1039.39,934.72 1040.04,934.72 \n",
       "  1040.68,934.72 1041.33,934.72 1041.97,934.72 1042.62,934.72 1043.27,934.72 1043.91,934.72 1044.56,934.72 1045.21,934.72 1045.85,934.72 1046.5,934.72 \n",
       "  1047.15,934.72 1047.79,934.72 1048.44,934.72 1049.08,934.72 1049.73,934.72 1050.38,934.72 1051.02,934.72 1051.67,934.72 1052.32,934.72 1052.96,934.72 \n",
       "  1053.61,934.72 1054.26,934.72 1054.9,934.72 1055.55,934.72 1056.19,934.72 1056.84,934.72 1057.49,934.72 1058.13,934.72 1058.78,934.72 1059.43,934.72 \n",
       "  1060.07,934.72 1060.72,934.72 1061.36,934.72 1062.01,934.72 1062.66,934.72 1063.3,934.72 1063.95,934.72 1064.6,934.72 1065.24,934.72 1065.89,934.72 \n",
       "  1066.54,934.72 1067.18,934.72 1067.83,934.72 1068.47,934.72 1069.12,934.72 1069.77,934.72 1070.41,934.72 1071.06,934.72 1071.71,934.72 1072.35,934.72 \n",
       "  1073,934.72 1073.65,934.72 1074.29,934.72 1074.94,934.72 1075.58,934.72 1076.23,934.72 1076.88,934.72 1077.52,934.72 1078.17,934.72 1078.82,934.72 \n",
       "  1079.46,934.72 1080.11,934.72 1080.76,934.72 1081.4,934.72 1082.05,934.72 1082.69,934.72 1083.34,934.72 1083.99,934.72 1084.63,934.72 1085.28,934.72 \n",
       "  1085.93,934.72 1086.57,934.72 1087.22,934.72 1087.86,934.72 1088.51,934.72 1089.16,934.72 1089.8,934.72 1090.45,934.72 1091.1,934.72 1091.74,934.72 \n",
       "  1092.39,934.72 1093.04,934.72 1093.68,934.72 1094.33,934.72 1094.97,934.72 1095.62,934.72 1096.27,934.72 1096.91,934.72 1097.56,934.72 1098.21,934.72 \n",
       "  1098.85,934.72 1099.5,934.72 1100.15,934.72 1100.79,934.72 1101.44,934.72 1102.08,934.72 1102.73,934.72 1103.38,934.72 1104.02,934.72 1104.67,934.72 \n",
       "  1105.32,934.72 1105.96,934.72 1106.61,934.72 1107.26,934.72 1107.9,934.72 1108.55,934.72 1109.19,934.72 1109.84,934.72 1110.49,934.72 1111.13,934.72 \n",
       "  1111.78,934.72 1112.43,934.72 1113.07,934.72 1113.72,934.72 1114.36,934.72 1115.01,934.72 1115.66,934.72 1116.3,934.72 1116.95,934.72 1117.6,934.72 \n",
       "  1118.24,934.72 1118.89,934.72 1119.54,934.72 1120.18,934.72 1120.83,934.72 1121.47,934.72 1122.12,934.72 1122.77,934.72 1123.41,934.72 1124.06,934.72 \n",
       "  1124.71,934.72 1125.35,934.72 1126,934.72 1126.65,934.72 1127.29,934.72 1127.94,934.72 1128.58,934.72 1129.23,934.72 1129.88,934.72 1130.52,934.72 \n",
       "  1131.17,934.72 1131.82,934.72 1132.46,934.72 1133.11,934.72 1133.76,934.72 1134.4,934.72 1135.05,934.72 1135.69,934.72 1136.34,934.72 1136.99,934.72 \n",
       "  1137.63,934.72 1138.28,934.72 1138.93,934.72 1139.57,934.72 1140.22,934.72 1140.86,934.72 1141.51,934.72 1142.16,934.72 1142.8,934.72 1143.45,934.72 \n",
       "  1144.1,934.72 1144.74,934.72 1145.39,934.72 1146.04,934.72 1146.68,934.72 1147.33,934.72 1147.97,934.72 1148.62,934.72 1149.27,934.72 1149.91,934.72 \n",
       "  1150.56,934.72 1151.21,934.72 1151.85,934.72 1152.5,934.72 1153.15,934.72 1153.79,934.72 1154.44,934.72 1155.08,934.72 1155.73,934.72 1156.38,934.72 \n",
       "  1157.02,934.72 1157.67,934.72 1158.32,934.72 1158.96,934.72 1159.61,934.72 1160.26,934.72 1160.9,934.72 1161.55,934.72 1162.19,934.72 1162.84,934.72 \n",
       "  1163.49,934.72 1164.13,934.72 1164.78,934.72 1165.43,934.72 1166.07,934.72 1166.72,934.72 1167.36,934.72 1168.01,934.72 1168.66,934.72 1169.3,934.72 \n",
       "  1169.95,934.72 1170.6,934.72 1171.24,934.72 1171.89,934.72 1172.54,934.72 1173.18,934.72 1173.83,934.72 1174.47,934.72 1175.12,934.72 1175.77,934.72 \n",
       "  1176.41,934.72 1177.06,934.72 1177.71,934.72 1178.35,934.72 1179,934.72 1179.65,934.72 1180.29,934.72 1180.94,934.72 1181.58,934.72 1182.23,934.72 \n",
       "  1182.88,934.72 1183.52,934.72 1184.17,934.72 1184.82,934.72 1185.46,934.72 1186.11,934.72 1186.76,934.72 1187.4,934.72 1188.05,934.72 1188.69,934.72 \n",
       "  1189.34,934.72 1189.99,934.72 1190.63,934.72 1191.28,934.72 1191.93,934.72 1192.57,934.72 1193.22,934.72 1193.86,934.72 1194.51,934.72 1195.16,934.72 \n",
       "  1195.8,934.72 1196.45,934.72 1197.1,934.72 1197.74,934.72 1198.39,934.72 1199.04,934.72 1199.68,934.72 1200.33,934.72 1200.97,934.72 1201.62,934.72 \n",
       "  1202.27,934.72 1202.91,934.72 1203.56,934.72 1204.21,934.72 1204.85,934.72 1205.5,934.72 1206.15,934.72 1206.79,934.72 1207.44,934.72 1208.08,934.72 \n",
       "  1208.73,934.72 1209.38,934.72 1210.02,934.72 1210.67,934.72 1211.32,934.72 1211.96,934.72 1212.61,934.72 1213.26,934.72 1213.9,934.72 1214.55,934.72 \n",
       "  1215.19,934.72 1215.84,934.72 1216.49,934.72 1217.13,934.72 1217.78,934.72 1218.43,934.72 1219.07,934.72 1219.72,934.72 1220.36,934.72 1221.01,934.72 \n",
       "  1221.66,934.72 1222.3,934.72 1222.95,934.72 1223.6,934.72 1224.24,934.72 1224.89,934.72 1225.54,934.72 1226.18,934.72 1226.83,934.72 1227.47,934.72 \n",
       "  1228.12,934.72 1228.77,934.72 1229.41,934.72 1230.06,934.72 1230.71,934.72 1231.35,934.72 1232,934.72 1232.65,934.72 1233.29,934.72 1233.94,934.72 \n",
       "  1234.58,934.72 1235.23,934.72 1235.88,934.72 1236.52,934.72 1237.17,934.72 1237.82,934.72 1238.46,934.72 1239.11,934.72 1239.76,934.72 1240.4,934.72 \n",
       "  1241.05,934.72 1241.69,934.72 1242.34,934.72 1242.99,934.72 1243.63,934.72 1244.28,934.72 1244.93,934.72 1245.57,934.72 1246.22,934.72 1246.87,934.72 \n",
       "  1247.51,934.72 1248.16,934.72 1248.8,934.72 1249.45,934.72 1250.1,934.72 1250.74,934.72 1251.39,934.72 1252.04,934.72 1252.68,934.72 1253.33,934.72 \n",
       "  1253.97,934.72 1254.62,934.72 1255.27,934.72 1255.91,934.72 1256.56,934.72 1257.21,934.72 1257.85,934.72 1258.5,934.72 1259.15,934.72 1259.79,934.72 \n",
       "  1260.44,934.72 1261.08,934.72 1261.73,934.72 1262.38,934.72 1263.02,934.72 1263.67,934.72 1264.32,934.72 1264.96,934.72 1265.61,934.72 1266.26,934.72 \n",
       "  1266.9,934.72 1267.55,934.72 1268.19,934.72 1268.84,934.72 1269.49,934.72 1270.13,934.72 1270.78,934.72 1271.43,934.72 1272.07,934.72 1272.72,934.72 \n",
       "  1273.37,934.72 1274.01,934.72 1274.66,934.72 1275.3,934.72 1275.95,934.72 1276.6,934.72 1277.24,934.72 1277.89,934.72 1278.54,934.72 1279.18,934.72 \n",
       "  1279.83,934.72 1280.47,934.72 1281.12,934.72 1281.77,934.72 1282.41,934.72 1283.06,934.72 1283.71,934.72 1284.35,934.72 1285,934.72 1285.65,934.72 \n",
       "  1286.29,934.72 1286.94,934.72 1287.58,934.72 1288.23,934.72 1288.88,934.72 1289.52,934.72 1290.17,934.72 1290.82,934.72 1291.46,934.72 1292.11,934.72 \n",
       "  1292.76,934.72 1293.4,934.72 1294.05,934.72 1294.69,934.72 1295.34,934.72 1295.99,934.72 1296.63,934.72 1297.28,934.72 1297.93,934.72 1298.57,934.72 \n",
       "  1299.22,934.72 1299.87,934.72 1300.51,934.72 1301.16,934.72 1301.8,934.72 1302.45,934.72 1303.1,934.72 1303.74,934.72 1304.39,934.72 1305.04,934.72 \n",
       "  1305.68,934.72 1306.33,934.72 1306.97,934.72 1307.62,934.72 1308.27,934.72 1308.91,934.72 1309.56,934.72 1310.21,934.72 1310.85,934.72 1311.5,934.72 \n",
       "  1312.15,934.72 1312.79,934.72 1313.44,934.72 1314.08,934.72 1314.73,934.72 1315.38,934.72 1316.02,934.72 1316.67,934.72 1317.32,934.72 1317.96,934.72 \n",
       "  1318.61,934.72 1319.26,934.72 1319.9,934.72 1320.55,934.72 1321.19,934.72 1321.84,934.72 1322.49,934.72 1323.13,934.72 1323.78,934.72 1324.43,934.72 \n",
       "  1325.07,934.72 1325.72,934.72 1326.37,934.72 1327.01,934.72 1327.66,934.72 1328.3,934.72 1328.95,934.72 1329.6,934.72 1330.24,934.72 1330.89,934.72 \n",
       "  1331.54,934.72 1332.18,934.72 1332.83,934.72 1333.47,934.72 1334.12,934.72 1334.77,934.72 1335.41,934.72 1336.06,934.72 1336.71,934.72 1337.35,934.72 \n",
       "  1338,934.72 1338.65,934.72 1339.29,934.72 1339.94,934.72 1340.58,934.72 1341.23,934.72 1341.88,934.72 1342.52,934.72 1343.17,934.72 1343.82,934.72 \n",
       "  1344.46,934.72 1345.11,934.72 1345.76,934.72 1346.4,934.72 1347.05,934.72 1347.69,934.72 1348.34,934.72 1348.99,934.72 1349.63,934.72 1350.28,934.72 \n",
       "  1350.93,934.72 1351.57,934.72 1352.22,934.72 1352.87,934.72 1353.51,934.72 1354.16,934.72 1354.8,934.72 1355.45,934.72 1356.1,934.72 1356.74,934.72 \n",
       "  1357.39,934.72 1358.04,934.72 1358.68,934.72 1359.33,934.72 1359.97,934.72 1360.62,934.72 1361.27,934.72 1361.91,934.72 1362.56,934.72 1363.21,934.72 \n",
       "  1363.85,934.72 1364.5,934.72 1365.15,934.72 1365.79,934.72 1366.44,934.72 1367.08,934.72 1367.73,934.72 1368.38,934.72 1369.02,934.72 1369.67,934.72 \n",
       "  1370.32,934.72 1370.96,934.72 1371.61,934.72 1372.26,934.72 1372.9,934.72 1373.55,934.72 1374.19,934.72 1374.84,934.72 1375.49,934.72 1376.13,934.72 \n",
       "  1376.78,934.72 1377.43,934.72 1378.07,934.72 1378.72,934.72 1379.37,934.72 1380.01,934.72 1380.66,934.72 1381.3,934.72 1381.95,934.72 1382.6,934.72 \n",
       "  1383.24,934.72 1383.89,934.72 1384.54,934.72 1385.18,934.72 1385.83,934.72 1386.47,934.72 1387.12,934.72 1387.77,934.72 1388.41,934.72 1389.06,934.72 \n",
       "  1389.71,934.72 1390.35,934.72 1391,934.72 1391.65,934.72 1392.29,934.72 1392.94,934.72 1393.58,934.72 1394.23,934.72 1394.88,934.72 1395.52,934.72 \n",
       "  1396.17,934.72 1396.82,934.72 1397.46,934.72 1398.11,934.72 1398.76,934.72 1399.4,934.72 1400.05,934.72 1400.69,934.72 1401.34,934.72 1401.99,934.72 \n",
       "  1402.63,934.72 1403.28,934.72 1403.93,934.72 1404.57,934.72 1405.22,934.72 1405.87,934.72 1406.51,934.72 1407.16,934.72 1407.8,934.72 1408.45,934.72 \n",
       "  1409.1,934.72 1409.74,934.72 1410.39,934.72 1411.04,934.72 1411.68,934.72 1412.33,934.72 1412.97,934.72 1413.62,934.72 1414.27,934.72 1414.91,934.72 \n",
       "  1415.56,934.72 1416.21,934.72 1416.85,934.72 1417.5,934.72 1418.15,934.72 1418.79,934.72 1419.44,934.72 1420.08,934.72 1420.73,934.72 1421.38,934.72 \n",
       "  1422.02,934.72 1422.67,934.72 1423.32,934.72 1423.96,934.72 1424.61,934.72 1425.26,934.72 1425.9,934.72 1426.55,934.72 1427.19,934.72 1427.84,934.72 \n",
       "  1428.49,934.72 1429.13,934.72 1429.78,934.72 1430.43,934.72 1431.07,934.72 1431.72,934.72 1432.37,934.72 1433.01,934.72 1433.66,934.72 1434.3,934.72 \n",
       "  1434.95,934.72 1435.6,934.72 1436.24,934.72 1436.89,934.72 1437.54,934.72 1438.18,934.72 1438.83,934.72 1439.47,934.72 1440.12,934.72 1440.77,934.72 \n",
       "  1441.41,934.72 1442.06,934.72 1442.71,934.72 1443.35,934.72 1444,934.72 1444.65,934.72 1445.29,934.72 1445.94,934.72 1446.58,934.72 1447.23,934.72 \n",
       "  1447.88,934.72 1448.52,934.72 1449.17,934.72 1449.82,934.72 1450.46,934.72 1451.11,934.72 1451.76,934.72 1452.4,934.72 1453.05,934.72 1453.69,934.72 \n",
       "  1454.34,934.72 1454.99,934.72 1455.63,934.72 1456.28,934.72 1456.93,934.72 1457.57,934.72 1458.22,934.72 1458.87,934.72 1459.51,934.72 1460.16,934.72 \n",
       "  1460.8,934.72 1461.45,934.72 1462.1,934.72 1462.74,934.72 1463.39,934.72 1464.04,934.72 1464.68,934.72 1465.33,934.72 1465.97,934.72 1466.62,934.72 \n",
       "  1467.27,934.72 1467.91,934.72 1468.56,934.72 1469.21,934.72 1469.85,934.72 1470.5,934.72 1471.15,934.72 1471.79,934.72 1472.44,934.72 1473.08,934.72 \n",
       "  1473.73,934.72 1474.38,934.72 1475.02,934.72 1475.67,934.72 1476.32,934.72 1476.96,934.72 1477.61,934.72 1478.26,934.72 1478.9,934.72 1479.55,934.72 \n",
       "  1480.19,934.72 1480.84,934.72 1481.49,934.72 1482.13,934.72 1482.78,934.72 1483.43,934.72 1484.07,934.72 1484.72,934.72 1485.37,934.72 1486.01,934.72 \n",
       "  1486.66,934.72 1487.3,934.72 1487.95,934.72 1488.6,934.72 1489.24,934.72 1489.89,934.72 1490.54,934.72 1491.18,934.72 1491.83,934.72 1492.47,934.72 \n",
       "  1493.12,934.72 1493.77,934.72 1494.41,934.72 1495.06,934.72 1495.71,934.72 1496.35,934.72 1497,934.72 1497.65,934.72 1498.29,934.72 1498.94,934.72 \n",
       "  1499.58,934.72 1500.23,934.72 1500.88,934.72 1501.52,934.72 1502.17,934.72 1502.82,934.72 1503.46,934.72 1504.11,934.72 1504.76,934.72 1505.4,934.72 \n",
       "  1506.05,934.72 1506.69,934.72 1507.34,934.72 1507.99,934.72 1508.63,934.72 1509.28,934.72 1509.93,934.72 1510.57,934.72 1511.22,934.72 1511.87,934.72 \n",
       "  1512.51,934.72 1513.16,934.72 1513.8,934.72 1514.45,934.72 1515.1,934.72 1515.74,934.72 1516.39,934.72 1517.04,934.72 1517.68,934.72 1518.33,934.72 \n",
       "  1518.97,934.72 1519.62,934.72 1520.27,934.72 1520.91,934.72 1521.56,934.72 1522.21,934.72 1522.85,934.72 1523.5,934.72 1524.15,934.72 1524.79,934.72 \n",
       "  1525.44,934.72 1526.08,934.72 1526.73,934.72 1527.38,934.72 1528.02,934.72 1528.67,934.72 1529.32,934.72 1529.96,934.72 1530.61,934.72 1531.26,934.72 \n",
       "  1531.9,934.72 1532.55,934.72 1533.19,934.72 1533.84,934.72 1534.49,934.72 1535.13,934.72 1535.78,934.72 1536.43,934.72 1537.07,934.72 1537.72,934.72 \n",
       "  1538.37,934.72 1539.01,934.72 1539.66,934.72 1540.3,934.72 1540.95,934.72 1541.6,934.72 1542.24,934.72 1542.89,934.72 1543.54,934.72 1544.18,934.72 \n",
       "  1544.83,934.72 1545.47,934.72 1546.12,934.72 1546.77,934.72 1547.41,934.72 1548.06,934.72 1548.71,934.72 1549.35,934.72 1550,934.72 1550.65,934.72 \n",
       "  1551.29,934.72 1551.94,934.72 1552.58,934.72 1553.23,934.72 1553.88,934.72 1554.52,934.72 1555.17,934.72 1555.82,934.72 1556.46,934.72 1557.11,934.72 \n",
       "  1557.76,934.72 1558.4,934.72 1559.05,934.72 1559.69,934.72 1560.34,934.72 1560.99,934.72 1561.63,934.72 1562.28,934.72 1562.93,934.72 1563.57,934.72 \n",
       "  1564.22,934.72 1564.87,934.72 1565.51,934.72 1566.16,934.72 1566.8,934.72 1567.45,934.72 1568.1,934.72 1568.74,934.72 1569.39,934.72 1570.04,934.72 \n",
       "  1570.68,934.72 1571.33,934.72 1571.97,934.72 1572.62,934.72 1573.27,934.72 1573.91,934.72 1574.56,934.72 1575.21,934.72 1575.85,934.72 1576.5,934.72 \n",
       "  1577.15,934.72 1577.79,934.72 1578.44,934.72 1579.08,934.72 1579.73,934.72 1580.38,934.72 1581.02,934.72 1581.67,934.72 1582.32,934.72 1582.96,934.72 \n",
       "  1583.61,934.72 1584.26,934.72 1584.9,934.72 1585.55,934.72 1586.19,934.72 1586.84,934.72 1587.49,934.72 1588.13,934.72 1588.78,934.72 1589.43,934.72 \n",
       "  1590.07,934.72 1590.72,934.72 1591.37,934.72 1592.01,934.72 1592.66,934.72 1593.3,934.72 1593.95,934.72 1594.6,934.72 1595.24,934.72 1595.89,934.72 \n",
       "  1596.54,934.72 1597.18,934.72 1597.83,934.72 1598.47,934.72 1599.12,934.72 1599.77,934.72 1600.41,934.72 1601.06,934.72 1601.71,934.72 1602.35,934.72 \n",
       "  1603,934.72 1603.65,934.72 1604.29,934.72 1604.94,934.72 1605.58,934.72 1606.23,934.72 1606.88,934.72 1607.52,934.72 1608.17,934.72 1608.82,934.72 \n",
       "  1609.46,934.72 1610.11,934.72 1610.76,934.72 1611.4,934.72 1612.05,934.72 1612.69,934.72 1613.34,934.72 1613.99,934.72 1614.63,934.72 1615.28,934.72 \n",
       "  1615.93,934.72 1616.57,934.72 1617.22,934.72 1617.87,934.72 1618.51,934.72 1619.16,934.72 1619.8,934.72 1620.45,934.72 1621.1,934.72 1621.74,934.72 \n",
       "  1622.39,934.72 1623.04,934.72 1623.68,934.72 1624.33,934.72 1624.97,934.72 1625.62,934.72 1626.27,934.72 1626.91,934.72 1627.56,934.72 1628.21,934.72 \n",
       "  1628.85,934.72 1629.5,934.72 1630.15,934.72 1630.79,934.72 1631.44,934.72 1632.08,934.72 1632.73,934.72 1633.38,934.72 1634.02,934.72 1634.67,934.72 \n",
       "  1635.32,934.72 1635.96,934.72 1636.61,934.72 1637.26,934.72 1637.9,934.72 1638.55,934.72 1639.19,934.72 1639.84,934.72 1640.49,934.72 1641.13,934.72 \n",
       "  1641.78,934.72 1642.43,934.72 1643.07,934.72 1643.72,934.72 1644.37,934.72 1645.01,934.72 1645.66,934.72 1646.3,934.72 1646.95,934.72 1647.6,934.72 \n",
       "  1648.24,934.72 1648.89,934.72 1649.54,934.72 1650.18,934.72 1650.83,934.72 1651.48,934.72 1652.12,934.72 1652.77,934.72 1653.41,934.72 1654.06,934.72 \n",
       "  1654.71,934.72 1655.35,934.72 1656,934.72 1656.65,934.72 1657.29,934.72 1657.94,934.72 1658.58,934.72 1659.23,934.72 1659.88,934.72 1660.52,934.72 \n",
       "  1661.17,934.72 1661.82,934.72 1662.46,934.72 1663.11,934.72 1663.76,934.72 1664.4,934.72 1665.05,934.72 1665.69,934.72 1666.34,934.72 1666.99,934.72 \n",
       "  1667.63,934.72 1668.28,934.72 1668.93,934.72 1669.57,934.72 1670.22,934.72 1670.87,934.72 1671.51,934.72 1672.16,934.72 1672.8,934.72 1673.45,934.72 \n",
       "  1674.1,934.72 1674.74,934.72 1675.39,934.72 1676.04,934.72 1676.68,934.72 1677.33,934.72 1677.98,934.72 1678.62,934.72 1679.27,934.72 1679.91,934.72 \n",
       "  1680.56,934.72 1681.21,934.72 1681.85,934.72 1682.5,934.72 1683.15,934.72 1683.79,934.72 1684.44,934.72 1685.08,934.72 1685.73,934.72 1686.38,934.72 \n",
       "  1687.02,934.72 1687.67,934.72 1688.32,934.72 1688.96,934.72 1689.61,934.72 1690.26,934.72 1690.9,934.72 1691.55,934.72 1692.19,934.72 1692.84,934.72 \n",
       "  1693.49,934.72 1694.13,934.72 1694.78,934.72 1695.43,934.72 1696.07,934.72 1696.72,934.72 1697.37,934.72 1698.01,934.72 1698.66,934.72 1699.3,934.72 \n",
       "  1699.95,934.72 1700.6,934.72 1701.24,934.72 1701.89,934.72 1702.54,934.72 1703.18,934.72 1703.83,934.72 1704.48,934.72 1705.12,934.72 1705.77,934.72 \n",
       "  1706.41,934.72 1707.06,934.72 1707.71,934.72 1708.35,934.72 1709,934.72 1709.65,934.72 1710.29,934.72 1710.94,934.72 1711.58,934.72 1712.23,934.72 \n",
       "  1712.88,934.72 1713.52,934.72 1714.17,934.72 1714.82,934.72 1715.46,934.72 1716.11,934.72 1716.76,934.72 1717.4,934.72 1718.05,934.72 1718.69,934.72 \n",
       "  1719.34,934.72 1719.99,934.72 1720.63,934.72 1721.28,934.72 1721.93,934.72 1722.57,934.72 1723.22,934.72 1723.87,934.72 1724.51,934.72 1725.16,934.72 \n",
       "  1725.8,934.72 1726.45,934.72 1727.1,934.72 1727.74,934.72 1728.39,934.72 1729.04,934.72 1729.68,934.72 1730.33,934.72 1730.98,934.72 1731.62,934.72 \n",
       "  1732.27,934.72 1732.91,934.72 1733.56,934.72 1734.21,934.72 1734.85,934.72 1735.5,934.72 1736.15,934.72 1736.79,934.72 1737.44,934.72 1738.08,934.72 \n",
       "  1738.73,934.72 1739.38,934.72 1740.02,934.72 1740.67,934.72 1741.32,934.72 1741.96,934.72 1742.61,934.72 1743.26,934.72 1743.9,934.72 1744.55,934.72 \n",
       "  1745.19,934.72 1745.84,934.72 1746.49,934.72 1747.13,934.72 1747.78,934.72 1748.43,934.72 1749.07,934.72 1749.72,934.72 1750.37,934.72 1751.01,934.72 \n",
       "  1751.66,934.72 1752.3,934.72 1752.95,934.72 1753.6,934.72 1754.24,934.72 1754.89,934.72 1755.54,934.72 1756.18,934.72 1756.83,934.72 1757.48,934.72 \n",
       "  1758.12,934.72 1758.77,934.72 1759.41,934.72 1760.06,934.72 1760.71,934.72 1761.35,934.72 1762,934.72 1762.65,934.72 1763.29,934.72 1763.94,934.72 \n",
       "  1764.58,934.72 1765.23,934.72 1765.88,934.72 1766.52,934.72 1767.17,934.72 1767.82,934.72 1768.46,934.72 1769.11,934.72 1769.76,934.72 1770.4,934.72 \n",
       "  1771.05,934.72 1771.69,934.72 1772.34,934.72 1772.99,934.72 1773.63,934.72 1774.28,934.72 1774.93,934.72 1775.57,934.72 1776.22,934.72 1776.87,934.72 \n",
       "  1777.51,934.72 1778.16,934.72 1778.8,934.72 1779.45,934.72 1780.1,934.72 1780.74,934.72 1781.39,934.72 1782.04,934.72 1782.68,934.72 1783.33,934.72 \n",
       "  1783.98,934.72 1784.62,934.72 1785.27,934.72 1785.91,934.72 1786.56,934.72 1787.21,934.72 1787.85,934.72 1788.5,934.72 1789.15,934.72 1789.79,934.72 \n",
       "  1790.44,934.72 1791.08,934.72 1791.73,934.72 1792.38,934.72 1793.02,934.72 1793.67,934.72 1794.32,934.72 1794.96,934.72 1795.61,934.72 1796.26,934.72 \n",
       "  1796.9,934.72 1797.55,934.72 1798.19,934.72 1798.84,934.72 1799.49,934.72 1800.13,934.72 1800.78,934.72 1801.43,934.72 1802.07,934.72 1802.72,934.72 \n",
       "  1803.37,934.72 1804.01,934.72 1804.66,934.72 1805.3,934.72 1805.95,934.72 1806.6,934.72 1807.24,934.72 1807.89,934.72 1808.54,934.72 1809.18,934.72 \n",
       "  1809.83,934.72 1810.48,934.72 1811.12,934.72 1811.77,934.72 1812.41,934.72 1813.06,934.72 1813.71,934.72 1814.35,934.72 1815,934.72 1815.65,934.72 \n",
       "  1816.29,934.72 1816.94,934.72 1817.58,934.72 1818.23,934.72 1818.88,934.72 1819.52,934.72 1820.17,934.72 1820.82,934.72 1821.46,934.72 1822.11,934.72 \n",
       "  1822.76,934.72 1823.4,934.72 1824.05,934.72 1824.69,934.72 1825.34,934.72 1825.99,934.72 1826.63,934.72 1827.28,934.72 1827.93,934.72 1828.57,934.72 \n",
       "  1829.22,934.72 1829.87,934.72 1830.51,934.72 1831.16,934.72 1831.8,934.72 1832.45,934.72 1833.1,934.72 1833.74,934.72 1834.39,934.72 1835.04,934.72 \n",
       "  1835.68,934.72 1836.33,934.72 1836.98,934.72 1837.62,934.72 1838.27,934.72 1838.91,934.72 1839.56,934.72 1840.21,934.72 1840.85,934.72 1841.5,934.72 \n",
       "  1842.15,934.72 1842.79,934.72 1843.44,934.72 1844.08,934.72 1844.73,934.72 1845.38,934.72 1846.02,934.72 1846.67,934.72 1847.32,934.72 1847.96,934.72 \n",
       "  1848.61,934.72 1849.26,934.72 1849.9,934.72 1850.55,934.72 1851.19,934.72 1851.84,934.72 1852.49,934.72 1853.13,934.72 1853.78,934.72 1854.43,934.72 \n",
       "  1855.07,934.72 1855.72,934.72 1856.37,934.72 1857.01,934.72 1857.66,934.72 1858.3,934.72 1858.95,934.72 1859.6,934.72 1860.24,934.72 1860.89,934.72 \n",
       "  1861.54,934.72 1862.18,934.72 1862.83,934.72 1863.48,934.72 1864.12,934.72 1864.77,934.72 1865.41,934.72 1866.06,934.72 1866.71,934.72 1867.35,934.72 \n",
       "  1868,934.72 1868.65,934.72 1869.29,934.72 1869.94,934.72 1870.58,934.72 1871.23,934.72 1871.88,934.72 1872.52,934.72 1873.17,934.72 1873.82,934.72 \n",
       "  1874.46,934.72 1875.11,934.72 1875.76,934.72 1876.4,934.72 1877.05,934.72 1877.69,934.72 1878.34,934.72 1878.99,934.72 1879.63,934.72 1880.28,934.72 \n",
       "  1880.93,934.72 1881.57,934.72 1882.22,934.72 1882.87,934.72 1883.51,934.72 1884.16,934.72 1884.8,934.72 1885.45,934.72 1886.1,934.72 1886.74,934.72 \n",
       "  1887.39,934.72 1888.04,934.72 1888.68,934.72 1889.33,934.72 1889.98,934.72 1890.62,934.72 1891.27,934.72 1891.91,934.72 1892.56,934.72 1893.21,934.72 \n",
       "  1893.85,934.72 1894.5,934.72 1895.15,934.72 1895.79,934.72 1896.44,934.72 1897.08,934.72 1897.73,934.72 1898.38,934.72 1899.02,934.72 1899.67,934.72 \n",
       "  1900.32,934.72 1900.96,934.72 1901.61,934.72 1902.26,934.72 1902.9,934.72 1903.55,934.72 1904.19,934.72 1904.84,934.72 1905.49,934.72 1906.13,934.72 \n",
       "  1906.78,934.72 1907.43,934.72 1908.07,934.72 1908.72,934.72 1909.37,934.72 1910.01,934.72 1910.66,934.72 1911.3,934.72 1911.95,934.72 1912.6,934.72 \n",
       "  1913.24,934.72 1913.89,934.72 1914.54,934.72 1915.18,934.72 1915.83,934.72 1916.48,934.72 1917.12,934.72 1917.77,934.72 1918.41,934.72 1919.06,934.72 \n",
       "  1919.71,934.72 1920.35,934.72 1921,934.72 1921.65,934.72 1922.29,934.72 1922.94,934.72 1923.58,934.72 1924.23,934.72 1924.88,934.72 1925.52,934.72 \n",
       "  1926.17,934.72 1926.82,934.72 1927.46,934.72 1928.11,934.72 1928.76,934.72 1929.4,934.72 1930.05,934.72 1930.69,934.72 1931.34,934.72 1931.99,934.72 \n",
       "  1932.63,934.72 1933.28,934.72 1933.93,934.72 1934.57,934.72 1935.22,934.72 1935.87,934.72 1936.51,934.72 1937.16,934.72 1937.8,934.72 1938.45,934.72 \n",
       "  1939.1,934.72 1939.74,934.72 1940.39,934.72 1941.04,934.72 1941.68,934.72 1942.33,934.72 1942.98,934.72 1943.62,934.72 1944.27,934.72 1944.91,934.72 \n",
       "  1945.56,934.72 1946.21,934.72 1946.85,934.72 1947.5,934.72 1948.15,934.72 1948.79,934.72 1949.44,934.72 1950.08,934.72 1950.73,934.72 1951.38,934.72 \n",
       "  1952.02,934.72 1952.67,934.72 1953.32,934.72 1953.96,934.72 1954.61,934.72 1955.26,934.72 1955.9,934.72 1956.55,934.72 1957.19,934.72 1957.84,934.72 \n",
       "  1958.49,934.72 1959.13,934.72 1959.78,934.72 1960.43,934.72 1961.07,934.72 1961.72,934.72 1962.37,934.72 1963.01,934.72 1963.66,934.72 1964.3,934.72 \n",
       "  1964.95,934.72 1965.6,934.72 1966.24,934.72 1966.89,934.72 1967.54,934.72 1968.18,934.72 1968.83,934.72 1969.48,934.72 1970.12,934.72 1970.77,934.72 \n",
       "  1971.41,934.72 1972.06,934.72 1972.71,934.72 1973.35,934.72 1974,934.72 1974.65,934.72 1975.29,934.72 1975.94,934.72 1976.58,934.72 1977.23,934.72 \n",
       "  1977.88,934.72 1978.52,934.72 1979.17,934.72 1979.82,934.72 1980.46,934.72 1981.11,934.72 1981.76,934.72 1982.4,934.72 1983.05,934.72 1983.69,934.72 \n",
       "  1984.34,934.72 1984.99,934.72 1985.63,934.72 1986.28,934.72 1986.93,934.72 1987.57,934.72 1988.22,934.72 1988.87,934.72 1989.51,934.72 1990.16,934.72 \n",
       "  1990.8,934.72 1991.45,934.72 1992.1,934.72 1992.74,934.72 1993.39,934.72 1994.04,934.72 1994.68,934.72 1995.33,934.72 1995.98,934.72 1996.62,934.72 \n",
       "  1997.27,934.72 1997.91,934.72 1998.56,934.72 1999.21,934.72 1999.85,934.72 2000.5,934.72 2001.15,934.72 2001.79,934.72 2002.44,934.72 2003.08,934.72 \n",
       "  2003.73,934.72 2004.38,934.72 2005.02,934.72 2005.67,934.72 2006.32,934.72 2006.96,934.72 2007.61,934.72 2008.26,934.72 2008.9,934.72 2009.55,934.72 \n",
       "  2010.19,934.72 2010.84,934.72 2011.49,934.72 2012.13,934.72 2012.78,934.72 2013.43,934.72 2014.07,934.72 2014.72,934.72 2015.37,934.72 2016.01,934.72 \n",
       "  2016.66,934.72 2017.3,934.72 2017.95,934.72 2018.6,934.72 2019.24,934.72 2019.89,934.72 2020.54,934.72 2021.18,934.72 2021.83,934.72 2022.48,934.72 \n",
       "  2023.12,934.72 2023.77,934.72 2024.41,934.72 2025.06,934.72 2025.71,934.72 2026.35,934.72 2027,934.72 2027.65,934.72 2028.29,934.72 2028.94,934.72 \n",
       "  2029.58,934.72 2030.23,934.72 2030.88,934.72 2031.52,934.72 2032.17,934.72 2032.82,934.72 2033.46,934.72 2034.11,934.72 2034.76,934.72 2035.4,934.72 \n",
       "  2036.05,934.72 2036.69,934.72 2037.34,934.72 2037.99,934.72 2038.63,934.72 2039.28,934.72 2039.93,934.72 2040.57,934.72 2041.22,934.72 2041.87,934.72 \n",
       "  2042.51,934.72 2043.16,934.72 2043.8,934.72 2044.45,934.72 2045.1,934.72 2045.74,934.72 2046.39,934.72 2047.04,934.72 2047.68,934.72 2048.33,934.72 \n",
       "  2048.98,934.72 2049.62,934.72 2050.27,934.72 2050.91,934.72 2051.56,934.72 2052.21,934.72 2052.85,934.72 2053.5,934.72 2054.15,934.72 2054.79,934.72 \n",
       "  2055.44,934.72 2056.09,934.72 2056.73,934.72 2057.38,934.72 2058.02,934.72 2058.67,934.72 2059.32,934.72 2059.96,934.72 2060.61,934.72 2061.26,934.72 \n",
       "  2061.9,934.72 2062.55,934.72 2063.19,934.72 2063.84,934.72 2064.49,934.72 2065.13,934.72 2065.78,934.72 2066.43,934.72 2067.07,934.72 2067.72,934.72 \n",
       "  2068.37,934.72 2069.01,934.72 2069.66,934.72 2070.3,934.72 2070.95,934.72 2071.6,934.72 2072.24,934.72 2072.89,934.72 2073.54,934.72 2074.18,934.72 \n",
       "  2074.83,934.72 2075.48,934.72 2076.12,934.72 2076.77,934.72 2077.41,934.72 2078.06,934.72 2078.71,934.72 2079.35,934.72 2080,934.72 2080.65,934.72 \n",
       "  2081.29,934.72 2081.94,934.72 2082.59,934.72 2083.23,934.72 2083.88,934.72 2084.52,934.72 2085.17,934.72 2085.82,934.72 2086.46,934.72 2087.11,934.72 \n",
       "  2087.76,934.72 2088.4,934.72 2089.05,934.72 2089.69,934.72 2090.34,934.72 2090.99,934.72 2091.63,934.72 2092.28,934.72 2092.93,934.72 2093.57,934.72 \n",
       "  2094.22,934.72 2094.87,934.72 2095.51,934.72 2096.16,934.72 2096.8,934.72 2097.45,934.72 2098.1,934.72 2098.74,934.72 2099.39,934.72 2100.04,934.72 \n",
       "  2100.68,934.72 2101.33,934.72 2101.98,934.72 2102.62,934.72 2103.27,934.72 2103.91,934.72 2104.56,934.72 2105.21,934.72 2105.85,934.72 2106.5,934.72 \n",
       "  2107.15,934.72 2107.79,934.72 2108.44,934.72 2109.09,934.72 2109.73,934.72 2110.38,934.72 2111.02,934.72 2111.67,934.72 2112.32,934.72 2112.96,934.72 \n",
       "  2113.61,934.72 2114.26,934.72 2114.9,934.72 2115.55,934.72 2116.19,934.72 2116.84,934.72 2117.49,934.72 2118.13,934.72 2118.78,934.72 2119.43,934.72 \n",
       "  2120.07,934.72 2120.72,934.72 2121.37,934.72 2122.01,934.72 2122.66,934.72 2123.3,934.72 2123.95,934.72 2124.6,934.72 2125.24,934.72 2125.89,934.72 \n",
       "  2126.54,934.72 2127.18,934.72 2127.83,934.72 2128.48,934.72 2129.12,934.72 2129.77,934.72 2130.41,934.72 2131.06,934.72 2131.71,934.72 2132.35,934.72 \n",
       "  2133,934.72 2133.65,934.72 2134.29,934.72 2134.94,934.72 2135.59,934.72 2136.23,934.72 2136.88,934.72 2137.52,934.72 2138.17,934.72 2138.82,934.72 \n",
       "  2139.46,934.72 2140.11,934.72 2140.76,934.72 2141.4,934.72 2142.05,934.72 2142.69,934.72 2143.34,934.72 2143.99,934.72 2144.63,934.72 2145.28,934.72 \n",
       "  2145.93,934.72 2146.57,934.72 2147.22,934.72 2147.87,934.72 2148.51,934.72 2149.16,934.72 2149.8,934.72 2150.45,934.72 2151.1,934.72 2151.74,934.72 \n",
       "  2152.39,934.72 2153.04,934.72 2153.68,934.72 2154.33,934.72 2154.98,934.72 2155.62,934.72 2156.27,934.72 2156.91,934.72 2157.56,934.72 2158.21,934.72 \n",
       "  2158.85,934.72 2159.5,934.72 2160.15,934.72 2160.79,934.72 2161.44,934.72 2162.09,934.72 2162.73,934.72 2163.38,934.72 2164.02,934.72 2164.67,934.72 \n",
       "  2165.32,934.72 2165.96,934.72 2166.61,934.72 2167.26,934.72 2167.9,934.72 2168.55,934.72 2169.19,934.72 2169.84,934.72 2170.49,934.72 2171.13,934.72 \n",
       "  2171.78,934.72 2172.43,934.72 2173.07,934.72 2173.72,934.72 2174.37,934.72 2175.01,934.72 2175.66,934.72 2176.3,934.72 2176.95,934.72 2177.6,934.72 \n",
       "  2178.24,934.72 2178.89,934.72 2179.54,934.72 2180.18,934.72 2180.83,934.72 2181.48,934.72 2182.12,934.72 2182.77,934.72 2183.41,934.72 2184.06,934.72 \n",
       "  2184.71,934.72 2185.35,934.72 2186,934.72 2186.65,934.72 2187.29,934.72 2187.94,934.72 2188.59,934.72 2189.23,934.72 2189.88,934.72 2190.52,934.72 \n",
       "  2191.17,934.72 2191.82,934.72 2192.46,934.72 2193.11,934.72 2193.76,934.72 2194.4,934.72 2195.05,934.72 2195.69,934.72 2196.34,934.72 2196.99,934.72 \n",
       "  2197.63,934.72 2198.28,934.72 2198.93,934.72 2199.57,934.72 2200.22,934.72 2200.87,934.72 2201.51,934.72 2202.16,934.72 2202.8,934.72 2203.45,934.72 \n",
       "  2204.1,934.72 2204.74,934.72 2205.39,934.72 2206.04,934.72 2206.68,934.72 2207.33,934.72 2207.98,934.72 2208.62,934.72 2209.27,934.72 2209.91,934.72 \n",
       "  2210.56,934.72 2211.21,934.72 2211.85,934.72 2212.5,934.72 2213.15,934.72 2213.79,934.72 2214.44,934.72 2215.09,934.72 2215.73,934.72 2216.38,934.72 \n",
       "  2217.02,934.72 2217.67,934.72 2218.32,934.72 2218.96,934.72 2219.61,934.72 2220.26,934.72 2220.9,934.72 2221.55,934.72 2222.19,934.72 2222.84,934.72 \n",
       "  2223.49,934.72 2224.13,934.72 2224.78,934.72 2225.43,934.72 2226.07,934.72 2226.72,934.72 2227.37,934.72 2228.01,934.72 2228.66,934.72 2229.3,934.72 \n",
       "  2229.95,934.72 2230.6,934.72 2231.24,934.72 2231.89,934.72 2232.54,934.72 2233.18,934.72 2233.83,934.72 2234.48,934.72 2235.12,934.72 2235.77,934.72 \n",
       "  2236.41,934.72 2237.06,934.72 2237.71,934.72 2238.35,934.72 2239,934.72 2239.65,934.72 2240.29,934.72 2240.94,934.72 2241.59,934.72 2242.23,934.72 \n",
       "  2242.88,934.72 2243.52,934.72 2244.17,934.72 2244.82,934.72 2245.46,934.72 2246.11,934.72 2246.76,934.72 2247.4,934.72 2248.05,934.72 2248.69,934.72 \n",
       "  2249.34,934.72 2249.99,934.72 2250.63,934.72 2251.28,934.72 2251.93,934.72 2252.57,934.72 2253.22,934.72 2253.87,934.72 2254.51,934.72 2255.16,934.72 \n",
       "  2255.8,934.72 2256.45,934.72 2257.1,934.72 2257.74,934.72 2258.39,934.72 2259.04,934.72 2259.68,934.72 2260.33,934.72 2260.98,934.72 2261.62,934.72 \n",
       "  2262.27,934.72 2262.91,934.72 2263.56,934.72 2264.21,934.72 2264.85,934.72 2265.5,934.72 2266.15,934.72 2266.79,934.72 2267.44,934.72 2268.09,934.72 \n",
       "  2268.73,934.72 2269.38,934.72 2270.02,934.72 2270.67,934.72 2271.32,934.72 2271.96,934.72 2272.61,934.72 2273.26,934.72 2273.9,934.72 2274.55,934.72 \n",
       "  2275.19,934.72 2275.84,934.72 2276.49,934.72 2277.13,934.72 2277.78,934.72 2278.43,934.72 2279.07,934.72 2279.72,934.72 2280.37,934.72 2281.01,934.72 \n",
       "  2281.66,934.72 2282.3,934.72 2282.95,934.72 2283.6,934.72 2284.24,934.72 2284.89,934.72 2285.54,934.72 2286.18,934.72 2286.83,934.72 2287.48,934.72 \n",
       "  2288.12,934.72 2288.77,934.72 2289.41,934.72 2290.06,934.72 2290.71,934.72 2291.35,934.72 2292,934.72 2292.65,934.72 2293.29,934.72 2293.94,934.72 \n",
       "  2294.59,934.72 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6802)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  355.56,980.458 356.206,980.458 356.852,980.458 357.499,980.458 358.145,980.458 358.791,980.458 359.438,980.458 360.084,980.458 360.73,980.458 361.377,980.458 \n",
       "  362.023,980.458 362.669,980.458 363.316,980.458 363.962,980.458 364.608,980.458 365.255,980.458 365.901,980.458 366.547,980.458 367.194,980.458 367.84,980.458 \n",
       "  368.486,980.458 369.133,980.458 369.779,980.458 370.425,980.458 371.072,980.458 371.718,980.458 372.365,980.458 373.011,980.458 373.657,980.458 374.304,980.458 \n",
       "  374.95,980.458 375.596,980.458 376.243,980.458 376.889,980.458 377.535,980.458 378.182,980.458 378.828,980.458 379.474,980.458 380.121,980.458 380.767,980.458 \n",
       "  381.413,980.458 382.06,980.458 382.706,980.458 383.352,980.458 383.999,980.458 384.645,980.458 385.291,980.458 385.938,980.458 386.584,980.458 387.23,980.458 \n",
       "  387.877,980.458 388.523,980.458 389.169,980.458 389.816,980.458 390.462,980.458 391.108,980.458 391.755,980.458 392.401,980.458 393.047,980.458 393.694,980.458 \n",
       "  394.34,980.458 394.986,980.458 395.633,980.458 396.279,980.458 396.925,980.458 397.572,980.458 398.218,980.458 398.865,980.458 399.511,980.458 400.157,980.458 \n",
       "  400.804,980.458 401.45,980.458 402.096,980.458 402.743,980.458 403.389,980.458 404.035,980.458 404.682,980.458 405.328,980.458 405.974,980.458 406.621,980.458 \n",
       "  407.267,980.458 407.913,980.458 408.56,980.458 409.206,980.458 409.852,980.458 410.499,980.458 411.145,980.458 411.791,980.458 412.438,980.458 413.084,980.458 \n",
       "  413.73,980.458 414.377,980.458 415.023,980.458 415.669,980.458 416.316,980.458 416.962,980.458 417.608,980.458 418.255,980.458 418.901,980.458 419.547,980.458 \n",
       "  420.194,980.458 420.84,980.458 421.486,980.458 422.133,980.458 422.779,980.458 423.426,980.458 424.072,980.458 424.718,980.458 425.365,980.458 426.011,980.458 \n",
       "  426.657,980.458 427.304,980.458 427.95,980.458 428.596,980.458 429.243,980.458 429.889,980.458 430.535,980.458 431.182,980.458 431.828,980.458 432.474,980.458 \n",
       "  433.121,980.458 433.767,980.458 434.413,980.458 435.06,980.458 435.706,980.458 436.352,980.458 436.999,980.458 437.645,980.458 438.291,980.458 438.938,980.458 \n",
       "  439.584,980.458 440.23,980.458 440.877,980.458 441.523,980.458 442.169,980.458 442.816,980.458 443.462,980.458 444.108,980.458 444.755,980.458 445.401,980.458 \n",
       "  446.047,980.458 446.694,980.458 447.34,980.458 447.986,980.458 448.633,980.458 449.279,980.458 449.926,980.458 450.572,980.458 451.218,980.458 451.865,980.458 \n",
       "  452.511,980.458 453.157,980.458 453.804,980.458 454.45,980.458 455.096,980.458 455.743,980.458 456.389,980.458 457.035,980.458 457.682,980.458 458.328,980.458 \n",
       "  458.974,980.458 459.621,980.458 460.267,980.458 460.913,980.458 461.56,980.458 462.206,980.458 462.852,980.458 463.499,980.458 464.145,980.458 464.791,980.458 \n",
       "  465.438,980.458 466.084,980.458 466.73,980.458 467.377,980.458 468.023,980.458 468.669,980.458 469.316,980.458 469.962,980.458 470.608,980.458 471.255,980.458 \n",
       "  471.901,980.458 472.547,980.458 473.194,980.458 473.84,980.458 474.487,980.458 475.133,980.458 475.779,980.458 476.426,980.458 477.072,980.458 477.718,980.458 \n",
       "  478.365,980.458 479.011,980.458 479.657,980.458 480.304,980.458 480.95,980.458 481.596,980.458 482.243,980.458 482.889,980.458 483.535,980.458 484.182,980.458 \n",
       "  484.828,980.458 485.474,980.458 486.121,980.458 486.767,980.458 487.413,980.458 488.06,980.458 488.706,980.458 489.352,980.458 489.999,980.458 490.645,980.458 \n",
       "  491.291,980.458 491.938,980.458 492.584,980.458 493.23,980.458 493.877,980.458 494.523,980.458 495.169,980.458 495.816,980.458 496.462,980.458 497.108,980.458 \n",
       "  497.755,980.458 498.401,980.458 499.048,980.458 499.694,980.458 500.34,980.458 500.987,980.458 501.633,980.458 502.279,980.458 502.926,980.458 503.572,980.458 \n",
       "  504.218,980.458 504.865,980.458 505.511,980.458 506.157,980.458 506.804,980.458 507.45,980.458 508.096,980.458 508.743,980.458 509.389,980.458 510.035,980.458 \n",
       "  510.682,980.458 511.328,980.458 511.974,980.458 512.621,980.458 513.267,980.458 513.913,980.458 514.56,980.458 515.206,980.458 515.852,980.458 516.499,980.458 \n",
       "  517.145,980.458 517.791,980.458 518.438,980.458 519.084,980.458 519.73,980.458 520.377,980.458 521.023,980.458 521.669,980.458 522.316,980.458 522.962,980.458 \n",
       "  523.608,980.458 524.255,980.458 524.901,980.458 525.548,980.458 526.194,980.458 526.84,980.458 527.487,980.458 528.133,980.458 528.779,980.458 529.426,980.458 \n",
       "  530.072,980.458 530.718,980.458 531.365,980.458 532.011,980.458 532.657,980.458 533.304,980.458 533.95,980.458 534.596,980.458 535.243,980.458 535.889,980.458 \n",
       "  536.535,980.458 537.182,980.458 537.828,980.458 538.474,980.458 539.121,980.458 539.767,980.458 540.413,980.458 541.06,980.458 541.706,980.458 542.352,980.458 \n",
       "  542.999,980.458 543.645,980.458 544.291,980.458 544.938,980.458 545.584,980.458 546.23,980.458 546.877,980.458 547.523,980.458 548.169,980.458 548.816,980.458 \n",
       "  549.462,980.458 550.109,980.458 550.755,980.458 551.401,980.458 552.048,980.458 552.694,980.458 553.34,980.458 553.987,980.458 554.633,980.458 555.279,980.458 \n",
       "  555.926,980.458 556.572,980.458 557.218,980.458 557.865,980.458 558.511,980.458 559.157,980.458 559.804,980.458 560.45,980.458 561.096,980.458 561.743,980.458 \n",
       "  562.389,980.458 563.035,980.458 563.682,980.458 564.328,980.458 564.974,980.458 565.621,980.458 566.267,980.458 566.913,980.458 567.56,980.458 568.206,980.458 \n",
       "  568.852,980.458 569.499,980.458 570.145,980.458 570.791,980.458 571.438,980.458 572.084,980.458 572.73,980.458 573.377,980.458 574.023,980.458 574.669,980.458 \n",
       "  575.316,980.458 575.962,980.458 576.609,980.458 577.255,980.458 577.901,980.458 578.548,980.458 579.194,980.458 579.84,980.458 580.487,980.458 581.133,980.458 \n",
       "  581.779,980.458 582.426,980.458 583.072,980.458 583.718,980.458 584.365,980.458 585.011,980.458 585.657,980.458 586.304,980.458 586.95,980.458 587.596,980.458 \n",
       "  588.243,980.458 588.889,980.458 589.535,980.458 590.182,980.458 590.828,980.458 591.474,980.458 592.121,980.458 592.767,980.458 593.413,980.458 594.06,980.458 \n",
       "  594.706,980.458 595.352,980.458 595.999,980.458 596.645,980.458 597.291,980.458 597.938,980.458 598.584,980.458 599.23,980.458 599.877,980.458 600.523,980.458 \n",
       "  601.17,980.458 601.816,980.458 602.462,980.458 603.109,980.458 603.755,980.458 604.401,980.458 605.048,980.458 605.694,980.458 606.34,980.458 606.987,980.458 \n",
       "  607.633,980.458 608.279,980.458 608.926,980.458 609.572,980.458 610.218,980.458 610.865,980.458 611.511,980.458 612.157,980.458 612.804,980.458 613.45,980.458 \n",
       "  614.096,980.458 614.743,980.458 615.389,980.458 616.035,980.458 616.682,980.458 617.328,980.458 617.974,980.458 618.621,980.458 619.267,980.458 619.913,980.458 \n",
       "  620.56,980.458 621.206,980.458 621.852,980.458 622.499,980.458 623.145,980.458 623.791,980.458 624.438,980.458 625.084,980.458 625.731,980.458 626.377,980.458 \n",
       "  627.023,980.458 627.67,980.458 628.316,980.458 628.962,980.458 629.609,980.458 630.255,980.458 630.901,980.458 631.548,980.458 632.194,980.458 632.84,980.458 \n",
       "  633.487,980.458 634.133,980.458 634.779,980.458 635.426,980.458 636.072,980.458 636.718,980.458 637.365,980.458 638.011,980.458 638.657,980.458 639.304,980.458 \n",
       "  639.95,980.458 640.596,980.458 641.243,980.458 641.889,980.458 642.535,980.458 643.182,980.458 643.828,980.458 644.474,980.458 645.121,980.458 645.767,980.458 \n",
       "  646.413,980.458 647.06,980.458 647.706,980.458 648.352,980.458 648.999,980.458 649.645,980.458 650.291,980.458 650.938,980.458 651.584,980.458 652.231,980.458 \n",
       "  652.877,980.458 653.523,980.458 654.17,980.458 654.816,980.458 655.462,980.458 656.109,980.458 656.755,980.458 657.401,980.458 658.048,980.458 658.694,980.458 \n",
       "  659.34,980.458 659.987,980.458 660.633,980.458 661.279,980.458 661.926,980.458 662.572,980.458 663.218,980.458 663.865,980.458 664.511,980.458 665.157,980.458 \n",
       "  665.804,980.458 666.45,980.458 667.096,980.458 667.743,980.458 668.389,980.458 669.035,980.458 669.682,980.458 670.328,980.458 670.974,980.458 671.621,980.458 \n",
       "  672.267,980.458 672.913,980.458 673.56,980.458 674.206,980.458 674.852,980.458 675.499,980.458 676.145,980.458 676.792,980.458 677.438,980.458 678.084,980.458 \n",
       "  678.731,980.458 679.377,980.458 680.023,980.458 680.67,980.458 681.316,980.458 681.962,980.458 682.609,980.458 683.255,980.458 683.901,980.458 684.548,980.458 \n",
       "  685.194,980.458 685.84,980.458 686.487,980.458 687.133,980.458 687.779,980.458 688.426,980.458 689.072,980.458 689.718,980.458 690.365,980.458 691.011,980.458 \n",
       "  691.657,980.458 692.304,980.458 692.95,980.458 693.596,980.458 694.243,980.458 694.889,980.458 695.535,980.458 696.182,980.458 696.828,980.458 697.474,980.458 \n",
       "  698.121,980.458 698.767,980.458 699.413,980.458 700.06,980.458 700.706,980.458 701.352,980.458 701.999,980.458 702.645,980.458 703.292,980.458 703.938,980.458 \n",
       "  704.584,980.458 705.231,980.458 705.877,980.458 706.523,980.458 707.17,980.458 707.816,980.458 708.462,980.458 709.109,980.458 709.755,980.458 710.401,980.458 \n",
       "  711.048,980.458 711.694,980.458 712.34,980.458 712.987,980.458 713.633,980.458 714.279,980.458 714.926,980.458 715.572,980.458 716.218,980.458 716.865,980.458 \n",
       "  717.511,980.458 718.157,980.458 718.804,980.458 719.45,980.458 720.096,980.458 720.743,980.458 721.389,980.458 722.035,980.458 722.682,980.458 723.328,980.458 \n",
       "  723.974,980.458 724.621,980.458 725.267,980.458 725.913,980.458 726.56,980.458 727.206,980.458 727.853,980.458 728.499,980.458 729.145,980.458 729.792,980.458 \n",
       "  730.438,980.458 731.084,980.458 731.731,980.458 732.377,980.458 733.023,980.458 733.67,980.458 734.316,980.458 734.962,980.458 735.609,980.458 736.255,980.458 \n",
       "  736.901,980.458 737.548,980.458 738.194,980.458 738.84,980.458 739.487,980.458 740.133,980.458 740.779,980.458 741.426,980.458 742.072,980.458 742.718,980.458 \n",
       "  743.365,980.458 744.011,980.458 744.657,980.458 745.304,980.458 745.95,980.458 746.596,980.458 747.243,980.458 747.889,980.458 748.535,980.458 749.182,980.458 \n",
       "  749.828,980.458 750.474,980.458 751.121,980.458 751.767,980.458 752.414,980.458 753.06,980.458 753.706,980.458 754.353,980.458 754.999,980.458 755.645,980.458 \n",
       "  756.292,980.458 756.938,980.458 757.584,980.458 758.231,980.458 758.877,980.458 759.523,980.458 760.17,980.458 760.816,980.458 761.462,980.458 762.109,980.458 \n",
       "  762.755,980.458 763.401,980.458 764.048,980.458 764.694,980.458 765.34,980.458 765.987,980.458 766.633,980.458 767.279,980.458 767.926,980.458 768.572,980.458 \n",
       "  769.218,980.458 769.865,980.458 770.511,980.458 771.157,980.458 771.804,980.458 772.45,980.458 773.096,980.458 773.743,980.458 774.389,980.458 775.035,980.458 \n",
       "  775.682,980.458 776.328,980.458 776.974,980.458 777.621,980.458 778.267,980.458 778.914,980.458 779.56,980.458 780.206,980.458 780.853,980.458 781.499,980.458 \n",
       "  782.145,980.458 782.792,980.458 783.438,980.458 784.084,980.458 784.731,980.458 785.377,980.458 786.023,980.458 786.67,980.458 787.316,980.458 787.962,980.458 \n",
       "  788.609,980.458 789.255,980.458 789.901,980.458 790.548,980.458 791.194,980.458 791.84,980.458 792.487,980.458 793.133,980.458 793.779,980.458 794.426,980.458 \n",
       "  795.072,980.458 795.718,980.458 796.365,980.458 797.011,980.458 797.657,980.458 798.304,980.458 798.95,980.458 799.596,980.458 800.243,980.458 800.889,980.458 \n",
       "  801.535,980.458 802.182,980.458 802.828,980.458 803.475,980.458 804.121,980.458 804.767,980.458 805.414,980.458 806.06,980.458 806.706,980.458 807.353,980.458 \n",
       "  807.999,980.458 808.645,980.458 809.292,980.458 809.938,980.458 810.584,980.458 811.231,980.458 811.877,980.458 812.523,980.458 813.17,980.458 813.816,980.458 \n",
       "  814.462,980.458 815.109,980.458 815.755,980.458 816.401,980.458 817.048,980.458 817.694,980.458 818.34,980.458 818.987,980.458 819.633,980.458 820.279,980.458 \n",
       "  820.926,980.458 821.572,980.458 822.218,980.458 822.865,980.458 823.511,980.458 824.157,980.458 824.804,980.458 825.45,980.458 826.096,980.458 826.743,980.458 \n",
       "  827.389,980.458 828.036,980.458 828.682,980.458 829.328,980.458 829.975,980.458 830.621,980.458 831.267,980.458 831.914,980.458 832.56,980.458 833.206,980.458 \n",
       "  833.853,980.458 834.499,980.458 835.145,980.458 835.792,980.458 836.438,980.458 837.084,980.458 837.731,980.458 838.377,980.458 839.023,980.458 839.67,980.458 \n",
       "  840.316,980.458 840.962,980.458 841.609,980.458 842.255,980.458 842.901,980.458 843.548,980.458 844.194,980.458 844.84,980.458 845.487,980.458 846.133,980.458 \n",
       "  846.779,980.458 847.426,980.458 848.072,980.458 848.718,980.458 849.365,980.458 850.011,980.458 850.657,980.458 851.304,980.458 851.95,980.458 852.596,980.458 \n",
       "  853.243,980.458 853.889,980.458 854.536,980.458 855.182,980.458 855.828,980.458 856.475,980.458 857.121,980.458 857.767,980.458 858.414,980.458 859.06,980.458 \n",
       "  859.706,980.458 860.353,980.458 860.999,980.458 861.645,980.458 862.292,980.458 862.938,980.458 863.584,980.458 864.231,980.458 864.877,980.458 865.523,980.458 \n",
       "  866.17,980.458 866.816,980.458 867.462,980.458 868.109,980.458 868.755,980.458 869.401,980.458 870.048,980.458 870.694,980.458 871.34,980.458 871.987,980.458 \n",
       "  872.633,980.458 873.279,980.458 873.926,980.458 874.572,980.458 875.218,980.458 875.865,980.458 876.511,980.458 877.157,980.458 877.804,980.458 878.45,980.458 \n",
       "  879.097,980.458 879.743,980.458 880.389,980.458 881.036,980.458 881.682,980.458 882.328,980.458 882.975,980.458 883.621,980.458 884.267,980.458 884.914,980.458 \n",
       "  885.56,980.458 886.206,980.458 886.853,980.458 887.499,980.458 888.145,980.458 888.792,980.458 889.438,980.458 890.084,980.458 890.731,980.458 891.377,980.458 \n",
       "  892.023,980.458 892.67,980.458 893.316,980.458 893.962,980.458 894.609,980.458 895.255,980.458 895.901,980.458 896.548,980.458 897.194,980.458 897.84,980.458 \n",
       "  898.487,980.458 899.133,980.458 899.779,980.458 900.426,980.458 901.072,980.458 901.718,980.458 902.365,980.458 903.011,980.458 903.657,980.458 904.304,980.458 \n",
       "  904.95,980.458 905.597,980.458 906.243,980.458 906.889,980.458 907.536,980.458 908.182,980.458 908.828,980.458 909.475,980.458 910.121,980.458 910.767,980.458 \n",
       "  911.414,980.458 912.06,980.458 912.706,980.458 913.353,980.458 913.999,980.458 914.645,980.458 915.292,980.458 915.938,980.458 916.584,980.458 917.231,980.458 \n",
       "  917.877,980.458 918.523,980.458 919.17,980.458 919.816,980.458 920.462,980.458 921.109,980.458 921.755,980.458 922.401,980.458 923.048,980.458 923.694,980.458 \n",
       "  924.34,980.458 924.987,980.458 925.633,980.458 926.279,980.458 926.926,980.458 927.572,980.458 928.218,980.458 928.865,980.458 929.511,980.458 930.158,980.458 \n",
       "  930.804,980.458 931.45,980.458 932.097,980.458 932.743,980.458 933.389,980.458 934.036,980.458 934.682,980.458 935.328,980.458 935.975,980.458 936.621,980.458 \n",
       "  937.267,980.458 937.914,980.458 938.56,980.458 939.206,980.458 939.853,980.458 940.499,980.458 941.145,980.458 941.792,980.458 942.438,980.458 943.084,980.458 \n",
       "  943.731,980.458 944.377,980.458 945.023,980.458 945.67,980.458 946.316,980.458 946.962,980.458 947.609,980.458 948.255,980.458 948.901,980.458 949.548,980.458 \n",
       "  950.194,980.458 950.84,980.458 951.487,980.458 952.133,980.458 952.779,980.458 953.426,980.458 954.072,980.458 954.719,980.458 955.365,980.458 956.011,980.458 \n",
       "  956.658,980.458 957.304,980.458 957.95,980.458 958.597,980.458 959.243,980.458 959.889,980.458 960.536,980.458 961.182,980.458 961.828,980.458 962.475,980.458 \n",
       "  963.121,980.458 963.767,980.458 964.414,980.458 965.06,980.458 965.706,980.458 966.353,980.458 966.999,980.458 967.645,980.458 968.292,980.458 968.938,980.458 \n",
       "  969.584,980.458 970.231,980.458 970.877,980.458 971.523,980.458 972.17,980.458 972.816,980.458 973.462,980.458 974.109,980.458 974.755,980.458 975.401,980.458 \n",
       "  976.048,980.458 976.694,980.458 977.34,980.458 977.987,980.458 978.633,980.458 979.279,980.458 979.926,980.458 980.572,980.458 981.219,980.458 981.865,980.458 \n",
       "  982.511,980.458 983.158,980.458 983.804,980.458 984.45,980.458 985.097,980.458 985.743,980.458 986.389,980.458 987.036,980.458 987.682,980.458 988.328,980.458 \n",
       "  988.975,980.458 989.621,980.458 990.267,980.458 990.914,980.458 991.56,980.458 992.206,980.458 992.853,980.458 993.499,980.458 994.145,980.458 994.792,980.458 \n",
       "  995.438,980.458 996.084,980.458 996.731,980.458 997.377,980.458 998.023,980.458 998.67,980.458 999.316,980.458 999.962,980.458 1000.61,980.458 1001.26,980.458 \n",
       "  1001.9,980.458 1002.55,980.458 1003.19,980.458 1003.84,980.458 1004.49,980.458 1005.13,980.458 1005.78,980.458 1006.43,980.458 1007.07,980.458 1007.72,980.458 \n",
       "  1008.36,980.458 1009.01,980.458 1009.66,980.458 1010.3,980.458 1010.95,980.458 1011.6,980.458 1012.24,980.458 1012.89,980.458 1013.54,980.458 1014.18,980.458 \n",
       "  1014.83,980.458 1015.47,980.458 1016.12,980.458 1016.77,980.458 1017.41,980.458 1018.06,980.458 1018.71,980.458 1019.35,980.458 1020,980.458 1020.65,980.458 \n",
       "  1021.29,980.458 1021.94,980.458 1022.58,980.458 1023.23,980.458 1023.88,980.458 1024.52,980.458 1025.17,980.458 1025.82,980.458 1026.46,980.458 1027.11,980.458 \n",
       "  1027.76,980.458 1028.4,980.458 1029.05,980.458 1029.69,980.458 1030.34,980.458 1030.99,980.458 1031.63,980.458 1032.28,980.458 1032.93,980.458 1033.57,980.458 \n",
       "  1034.22,980.458 1034.86,980.458 1035.51,980.458 1036.16,980.458 1036.8,980.458 1037.45,980.458 1038.1,980.458 1038.74,980.458 1039.39,980.458 1040.04,980.458 \n",
       "  1040.68,980.458 1041.33,980.458 1041.97,980.458 1042.62,980.458 1043.27,980.458 1043.91,980.458 1044.56,980.458 1045.21,980.458 1045.85,980.458 1046.5,980.458 \n",
       "  1047.15,980.458 1047.79,980.458 1048.44,980.458 1049.08,980.458 1049.73,980.458 1050.38,980.458 1051.02,980.458 1051.67,980.458 1052.32,980.458 1052.96,980.458 \n",
       "  1053.61,980.458 1054.26,980.458 1054.9,980.458 1055.55,980.458 1056.19,980.458 1056.84,980.458 1057.49,980.458 1058.13,980.458 1058.78,980.458 1059.43,980.458 \n",
       "  1060.07,980.458 1060.72,980.458 1061.36,980.458 1062.01,980.458 1062.66,980.458 1063.3,980.458 1063.95,980.458 1064.6,980.458 1065.24,980.458 1065.89,980.458 \n",
       "  1066.54,980.458 1067.18,980.458 1067.83,980.458 1068.47,980.458 1069.12,980.458 1069.77,980.458 1070.41,980.458 1071.06,980.458 1071.71,980.458 1072.35,980.458 \n",
       "  1073,980.458 1073.65,980.458 1074.29,980.458 1074.94,980.458 1075.58,980.458 1076.23,980.458 1076.88,980.458 1077.52,980.458 1078.17,980.458 1078.82,980.458 \n",
       "  1079.46,980.458 1080.11,980.458 1080.76,980.458 1081.4,980.458 1082.05,980.458 1082.69,980.458 1083.34,980.458 1083.99,980.458 1084.63,980.458 1085.28,980.458 \n",
       "  1085.93,980.458 1086.57,980.458 1087.22,980.458 1087.86,980.458 1088.51,980.458 1089.16,980.458 1089.8,980.458 1090.45,980.458 1091.1,980.458 1091.74,980.458 \n",
       "  1092.39,980.458 1093.04,980.458 1093.68,980.458 1094.33,980.458 1094.97,980.458 1095.62,980.458 1096.27,980.458 1096.91,980.458 1097.56,980.458 1098.21,980.458 \n",
       "  1098.85,980.458 1099.5,980.458 1100.15,980.458 1100.79,980.458 1101.44,980.458 1102.08,980.458 1102.73,980.458 1103.38,980.458 1104.02,980.458 1104.67,980.458 \n",
       "  1105.32,980.458 1105.96,980.458 1106.61,980.458 1107.26,980.458 1107.9,980.458 1108.55,980.458 1109.19,980.458 1109.84,980.458 1110.49,980.458 1111.13,980.458 \n",
       "  1111.78,980.458 1112.43,980.458 1113.07,980.458 1113.72,980.458 1114.36,980.458 1115.01,980.458 1115.66,980.458 1116.3,980.458 1116.95,980.458 1117.6,980.458 \n",
       "  1118.24,980.458 1118.89,980.458 1119.54,980.458 1120.18,980.458 1120.83,980.458 1121.47,980.458 1122.12,980.458 1122.77,980.458 1123.41,980.458 1124.06,980.458 \n",
       "  1124.71,980.458 1125.35,980.458 1126,980.458 1126.65,980.458 1127.29,980.458 1127.94,980.458 1128.58,980.458 1129.23,980.458 1129.88,980.458 1130.52,980.458 \n",
       "  1131.17,980.458 1131.82,980.458 1132.46,980.458 1133.11,980.458 1133.76,980.458 1134.4,980.458 1135.05,980.458 1135.69,980.458 1136.34,980.458 1136.99,980.458 \n",
       "  1137.63,980.458 1138.28,980.458 1138.93,980.458 1139.57,980.458 1140.22,980.458 1140.86,980.458 1141.51,980.458 1142.16,980.458 1142.8,980.458 1143.45,980.458 \n",
       "  1144.1,980.458 1144.74,980.458 1145.39,980.458 1146.04,980.458 1146.68,980.458 1147.33,980.458 1147.97,980.458 1148.62,980.458 1149.27,980.458 1149.91,980.458 \n",
       "  1150.56,980.458 1151.21,980.458 1151.85,980.458 1152.5,980.458 1153.15,980.458 1153.79,980.458 1154.44,980.458 1155.08,980.458 1155.73,980.458 1156.38,980.458 \n",
       "  1157.02,980.458 1157.67,980.458 1158.32,980.458 1158.96,980.458 1159.61,980.458 1160.26,980.458 1160.9,980.458 1161.55,980.458 1162.19,980.458 1162.84,980.458 \n",
       "  1163.49,980.458 1164.13,980.458 1164.78,980.458 1165.43,980.458 1166.07,980.458 1166.72,980.458 1167.36,980.458 1168.01,980.458 1168.66,980.458 1169.3,980.458 \n",
       "  1169.95,980.458 1170.6,980.458 1171.24,980.458 1171.89,980.458 1172.54,980.458 1173.18,980.458 1173.83,980.458 1174.47,980.458 1175.12,980.458 1175.77,980.458 \n",
       "  1176.41,980.458 1177.06,980.458 1177.71,980.458 1178.35,980.458 1179,980.458 1179.65,980.458 1180.29,980.458 1180.94,980.458 1181.58,980.458 1182.23,980.458 \n",
       "  1182.88,980.458 1183.52,980.458 1184.17,980.458 1184.82,980.458 1185.46,980.458 1186.11,980.458 1186.76,980.458 1187.4,980.458 1188.05,980.458 1188.69,980.458 \n",
       "  1189.34,980.458 1189.99,980.458 1190.63,980.458 1191.28,980.458 1191.93,980.458 1192.57,980.458 1193.22,980.458 1193.86,980.458 1194.51,980.458 1195.16,980.458 \n",
       "  1195.8,980.458 1196.45,980.458 1197.1,980.458 1197.74,980.458 1198.39,980.458 1199.04,980.458 1199.68,980.458 1200.33,980.458 1200.97,980.458 1201.62,980.458 \n",
       "  1202.27,980.458 1202.91,980.458 1203.56,980.458 1204.21,980.458 1204.85,980.458 1205.5,980.458 1206.15,980.458 1206.79,980.458 1207.44,980.458 1208.08,980.458 \n",
       "  1208.73,980.458 1209.38,980.458 1210.02,980.458 1210.67,980.458 1211.32,980.458 1211.96,980.458 1212.61,980.458 1213.26,980.458 1213.9,980.458 1214.55,980.458 \n",
       "  1215.19,980.458 1215.84,980.458 1216.49,980.458 1217.13,980.458 1217.78,980.458 1218.43,980.458 1219.07,980.458 1219.72,980.458 1220.36,980.458 1221.01,980.458 \n",
       "  1221.66,980.458 1222.3,980.458 1222.95,980.458 1223.6,980.458 1224.24,980.458 1224.89,980.458 1225.54,980.458 1226.18,980.458 1226.83,980.458 1227.47,980.458 \n",
       "  1228.12,980.458 1228.77,980.458 1229.41,980.458 1230.06,980.458 1230.71,980.458 1231.35,980.458 1232,980.458 1232.65,980.458 1233.29,980.458 1233.94,980.458 \n",
       "  1234.58,980.458 1235.23,980.458 1235.88,980.458 1236.52,980.458 1237.17,980.458 1237.82,980.458 1238.46,980.458 1239.11,980.458 1239.76,980.458 1240.4,980.458 \n",
       "  1241.05,980.458 1241.69,980.458 1242.34,980.458 1242.99,980.458 1243.63,980.458 1244.28,980.458 1244.93,980.458 1245.57,980.458 1246.22,980.458 1246.87,980.458 \n",
       "  1247.51,980.458 1248.16,980.458 1248.8,980.458 1249.45,980.458 1250.1,980.458 1250.74,980.458 1251.39,980.458 1252.04,980.458 1252.68,980.458 1253.33,980.458 \n",
       "  1253.97,980.458 1254.62,980.458 1255.27,980.458 1255.91,980.458 1256.56,980.458 1257.21,980.458 1257.85,980.458 1258.5,980.458 1259.15,980.458 1259.79,980.458 \n",
       "  1260.44,980.458 1261.08,980.458 1261.73,980.458 1262.38,980.458 1263.02,980.458 1263.67,980.458 1264.32,980.458 1264.96,980.458 1265.61,980.458 1266.26,980.458 \n",
       "  1266.9,980.458 1267.55,980.458 1268.19,980.458 1268.84,980.458 1269.49,980.458 1270.13,980.458 1270.78,980.458 1271.43,980.458 1272.07,980.458 1272.72,980.458 \n",
       "  1273.37,980.458 1274.01,980.458 1274.66,980.458 1275.3,980.458 1275.95,980.458 1276.6,980.458 1277.24,980.458 1277.89,980.458 1278.54,980.458 1279.18,980.458 \n",
       "  1279.83,980.458 1280.47,980.458 1281.12,980.458 1281.77,980.458 1282.41,980.458 1283.06,980.458 1283.71,980.458 1284.35,980.458 1285,980.458 1285.65,980.458 \n",
       "  1286.29,980.458 1286.94,980.458 1287.58,980.458 1288.23,980.458 1288.88,980.458 1289.52,980.458 1290.17,980.458 1290.82,980.458 1291.46,980.458 1292.11,980.458 \n",
       "  1292.76,980.458 1293.4,980.458 1294.05,980.458 1294.69,980.458 1295.34,980.458 1295.99,980.458 1296.63,980.458 1297.28,980.458 1297.93,980.458 1298.57,980.458 \n",
       "  1299.22,980.458 1299.87,980.458 1300.51,980.458 1301.16,980.458 1301.8,980.458 1302.45,980.458 1303.1,980.458 1303.74,980.458 1304.39,980.458 1305.04,980.458 \n",
       "  1305.68,980.458 1306.33,980.458 1306.97,980.458 1307.62,980.458 1308.27,980.458 1308.91,980.458 1309.56,980.458 1310.21,980.458 1310.85,980.458 1311.5,980.458 \n",
       "  1312.15,980.458 1312.79,980.458 1313.44,980.458 1314.08,980.458 1314.73,980.458 1315.38,980.458 1316.02,980.458 1316.67,980.458 1317.32,980.458 1317.96,980.458 \n",
       "  1318.61,980.458 1319.26,980.458 1319.9,980.458 1320.55,980.458 1321.19,980.458 1321.84,980.458 1322.49,980.458 1323.13,980.458 1323.78,980.458 1324.43,980.458 \n",
       "  1325.07,980.458 1325.72,980.458 1326.37,980.458 1327.01,980.458 1327.66,980.458 1328.3,980.458 1328.95,980.458 1329.6,980.458 1330.24,980.458 1330.89,980.458 \n",
       "  1331.54,980.458 1332.18,980.458 1332.83,980.458 1333.47,980.458 1334.12,980.458 1334.77,980.458 1335.41,980.458 1336.06,980.458 1336.71,980.458 1337.35,980.458 \n",
       "  1338,980.458 1338.65,980.458 1339.29,980.458 1339.94,980.458 1340.58,980.458 1341.23,980.458 1341.88,980.458 1342.52,980.458 1343.17,980.458 1343.82,980.458 \n",
       "  1344.46,980.458 1345.11,980.458 1345.76,980.458 1346.4,980.458 1347.05,980.458 1347.69,980.458 1348.34,980.458 1348.99,980.458 1349.63,980.458 1350.28,980.458 \n",
       "  1350.93,980.458 1351.57,980.458 1352.22,980.458 1352.87,980.458 1353.51,980.458 1354.16,980.458 1354.8,980.458 1355.45,980.458 1356.1,980.458 1356.74,980.458 \n",
       "  1357.39,980.458 1358.04,980.458 1358.68,980.458 1359.33,980.458 1359.97,980.458 1360.62,980.458 1361.27,980.458 1361.91,980.458 1362.56,980.458 1363.21,980.458 \n",
       "  1363.85,980.458 1364.5,980.458 1365.15,980.458 1365.79,980.458 1366.44,980.458 1367.08,980.458 1367.73,980.458 1368.38,980.458 1369.02,980.458 1369.67,980.458 \n",
       "  1370.32,980.458 1370.96,980.458 1371.61,980.458 1372.26,980.458 1372.9,980.458 1373.55,980.458 1374.19,980.458 1374.84,980.458 1375.49,980.458 1376.13,980.458 \n",
       "  1376.78,980.458 1377.43,980.458 1378.07,980.458 1378.72,980.458 1379.37,980.458 1380.01,980.458 1380.66,980.458 1381.3,980.458 1381.95,980.458 1382.6,980.458 \n",
       "  1383.24,980.458 1383.89,980.458 1384.54,980.458 1385.18,980.458 1385.83,980.458 1386.47,980.458 1387.12,980.458 1387.77,980.458 1388.41,980.458 1389.06,980.458 \n",
       "  1389.71,980.458 1390.35,980.458 1391,980.458 1391.65,980.458 1392.29,980.458 1392.94,980.458 1393.58,980.458 1394.23,980.458 1394.88,980.458 1395.52,980.458 \n",
       "  1396.17,980.458 1396.82,980.458 1397.46,980.458 1398.11,980.458 1398.76,980.458 1399.4,980.458 1400.05,980.458 1400.69,980.458 1401.34,980.458 1401.99,980.458 \n",
       "  1402.63,980.458 1403.28,980.458 1403.93,980.458 1404.57,980.458 1405.22,980.458 1405.87,980.458 1406.51,980.458 1407.16,980.458 1407.8,980.458 1408.45,980.458 \n",
       "  1409.1,980.458 1409.74,980.458 1410.39,980.458 1411.04,980.458 1411.68,980.458 1412.33,980.458 1412.97,980.458 1413.62,980.458 1414.27,980.458 1414.91,980.458 \n",
       "  1415.56,980.458 1416.21,980.458 1416.85,980.458 1417.5,980.458 1418.15,980.458 1418.79,980.458 1419.44,980.458 1420.08,980.458 1420.73,980.458 1421.38,980.458 \n",
       "  1422.02,980.458 1422.67,980.458 1423.32,980.458 1423.96,980.458 1424.61,980.458 1425.26,980.458 1425.9,980.458 1426.55,980.458 1427.19,980.458 1427.84,980.458 \n",
       "  1428.49,980.458 1429.13,980.458 1429.78,980.458 1430.43,980.458 1431.07,980.458 1431.72,980.458 1432.37,980.458 1433.01,980.458 1433.66,980.458 1434.3,980.458 \n",
       "  1434.95,980.458 1435.6,980.458 1436.24,980.458 1436.89,980.458 1437.54,980.458 1438.18,980.458 1438.83,980.458 1439.47,980.458 1440.12,980.458 1440.77,980.458 \n",
       "  1441.41,980.458 1442.06,980.458 1442.71,980.458 1443.35,980.458 1444,980.458 1444.65,980.458 1445.29,980.458 1445.94,980.458 1446.58,980.458 1447.23,980.458 \n",
       "  1447.88,980.458 1448.52,980.458 1449.17,980.458 1449.82,980.458 1450.46,980.458 1451.11,980.458 1451.76,980.458 1452.4,980.458 1453.05,980.458 1453.69,980.458 \n",
       "  1454.34,980.458 1454.99,980.458 1455.63,980.458 1456.28,980.458 1456.93,980.458 1457.57,980.458 1458.22,980.458 1458.87,980.458 1459.51,980.458 1460.16,980.458 \n",
       "  1460.8,980.458 1461.45,980.458 1462.1,980.458 1462.74,980.458 1463.39,980.458 1464.04,980.458 1464.68,980.458 1465.33,980.458 1465.97,980.458 1466.62,980.458 \n",
       "  1467.27,980.458 1467.91,980.458 1468.56,980.458 1469.21,980.458 1469.85,980.458 1470.5,980.458 1471.15,980.458 1471.79,980.458 1472.44,980.458 1473.08,980.458 \n",
       "  1473.73,980.458 1474.38,980.458 1475.02,980.458 1475.67,980.458 1476.32,980.458 1476.96,980.458 1477.61,980.458 1478.26,980.458 1478.9,980.458 1479.55,980.458 \n",
       "  1480.19,980.458 1480.84,980.458 1481.49,980.458 1482.13,980.458 1482.78,980.458 1483.43,980.458 1484.07,980.458 1484.72,980.458 1485.37,980.458 1486.01,980.458 \n",
       "  1486.66,980.458 1487.3,980.458 1487.95,980.458 1488.6,980.458 1489.24,980.458 1489.89,980.458 1490.54,980.458 1491.18,980.458 1491.83,980.458 1492.47,980.458 \n",
       "  1493.12,980.458 1493.77,980.458 1494.41,980.458 1495.06,980.458 1495.71,980.458 1496.35,980.458 1497,980.458 1497.65,980.458 1498.29,980.458 1498.94,980.458 \n",
       "  1499.58,980.458 1500.23,980.458 1500.88,980.458 1501.52,980.458 1502.17,980.458 1502.82,980.458 1503.46,980.458 1504.11,980.458 1504.76,980.458 1505.4,980.458 \n",
       "  1506.05,980.458 1506.69,980.458 1507.34,980.458 1507.99,980.458 1508.63,980.458 1509.28,980.458 1509.93,980.458 1510.57,980.458 1511.22,980.458 1511.87,980.458 \n",
       "  1512.51,980.458 1513.16,980.458 1513.8,980.458 1514.45,980.458 1515.1,980.458 1515.74,980.458 1516.39,980.458 1517.04,980.458 1517.68,980.458 1518.33,980.458 \n",
       "  1518.97,980.458 1519.62,980.458 1520.27,980.458 1520.91,980.458 1521.56,980.458 1522.21,980.458 1522.85,980.458 1523.5,980.458 1524.15,980.458 1524.79,980.458 \n",
       "  1525.44,980.458 1526.08,980.458 1526.73,980.458 1527.38,980.458 1528.02,980.458 1528.67,980.458 1529.32,980.458 1529.96,980.458 1530.61,980.458 1531.26,980.458 \n",
       "  1531.9,980.458 1532.55,980.458 1533.19,980.458 1533.84,980.458 1534.49,980.458 1535.13,980.458 1535.78,980.458 1536.43,980.458 1537.07,980.458 1537.72,980.458 \n",
       "  1538.37,980.458 1539.01,980.458 1539.66,980.458 1540.3,980.458 1540.95,980.458 1541.6,980.458 1542.24,980.458 1542.89,980.458 1543.54,980.458 1544.18,980.458 \n",
       "  1544.83,980.458 1545.47,980.458 1546.12,980.458 1546.77,980.458 1547.41,980.458 1548.06,980.458 1548.71,980.458 1549.35,980.458 1550,980.458 1550.65,980.458 \n",
       "  1551.29,980.458 1551.94,980.458 1552.58,980.458 1553.23,980.458 1553.88,980.458 1554.52,980.458 1555.17,980.458 1555.82,980.458 1556.46,980.458 1557.11,980.458 \n",
       "  1557.76,980.458 1558.4,980.458 1559.05,980.458 1559.69,980.458 1560.34,980.458 1560.99,980.458 1561.63,980.458 1562.28,980.458 1562.93,980.458 1563.57,980.458 \n",
       "  1564.22,980.458 1564.87,980.458 1565.51,980.458 1566.16,980.458 1566.8,980.458 1567.45,980.458 1568.1,980.458 1568.74,980.458 1569.39,980.458 1570.04,980.458 \n",
       "  1570.68,980.458 1571.33,980.458 1571.97,980.458 1572.62,980.458 1573.27,980.458 1573.91,980.458 1574.56,980.458 1575.21,980.458 1575.85,980.458 1576.5,980.458 \n",
       "  1577.15,980.458 1577.79,980.458 1578.44,980.458 1579.08,980.458 1579.73,980.458 1580.38,980.458 1581.02,980.458 1581.67,980.458 1582.32,980.458 1582.96,980.458 \n",
       "  1583.61,980.458 1584.26,980.458 1584.9,980.458 1585.55,980.458 1586.19,980.458 1586.84,980.458 1587.49,980.458 1588.13,980.458 1588.78,980.458 1589.43,980.458 \n",
       "  1590.07,980.458 1590.72,980.458 1591.37,980.458 1592.01,980.458 1592.66,980.458 1593.3,980.458 1593.95,980.458 1594.6,980.458 1595.24,980.458 1595.89,980.458 \n",
       "  1596.54,980.458 1597.18,980.458 1597.83,980.458 1598.47,980.458 1599.12,980.458 1599.77,980.458 1600.41,980.458 1601.06,980.458 1601.71,980.458 1602.35,980.458 \n",
       "  1603,980.458 1603.65,980.458 1604.29,980.458 1604.94,980.458 1605.58,980.458 1606.23,980.458 1606.88,980.458 1607.52,980.458 1608.17,980.458 1608.82,980.458 \n",
       "  1609.46,980.458 1610.11,980.458 1610.76,980.458 1611.4,980.458 1612.05,980.458 1612.69,980.458 1613.34,980.458 1613.99,980.458 1614.63,980.458 1615.28,980.458 \n",
       "  1615.93,980.458 1616.57,980.458 1617.22,980.458 1617.87,980.458 1618.51,980.458 1619.16,980.458 1619.8,980.458 1620.45,980.458 1621.1,980.458 1621.74,980.458 \n",
       "  1622.39,980.458 1623.04,980.458 1623.68,980.458 1624.33,980.458 1624.97,980.458 1625.62,980.458 1626.27,980.458 1626.91,980.458 1627.56,980.458 1628.21,980.458 \n",
       "  1628.85,980.458 1629.5,980.458 1630.15,980.458 1630.79,980.458 1631.44,980.458 1632.08,980.458 1632.73,980.458 1633.38,980.458 1634.02,980.458 1634.67,980.458 \n",
       "  1635.32,980.458 1635.96,980.458 1636.61,980.458 1637.26,980.458 1637.9,980.458 1638.55,980.458 1639.19,980.458 1639.84,980.458 1640.49,980.458 1641.13,980.458 \n",
       "  1641.78,980.458 1642.43,980.458 1643.07,980.458 1643.72,980.458 1644.37,980.458 1645.01,980.458 1645.66,980.458 1646.3,980.458 1646.95,980.458 1647.6,980.458 \n",
       "  1648.24,980.458 1648.89,980.458 1649.54,980.458 1650.18,980.458 1650.83,980.458 1651.48,980.458 1652.12,980.458 1652.77,980.458 1653.41,980.458 1654.06,980.458 \n",
       "  1654.71,980.458 1655.35,980.458 1656,980.458 1656.65,980.458 1657.29,980.458 1657.94,980.458 1658.58,980.458 1659.23,980.458 1659.88,980.458 1660.52,980.458 \n",
       "  1661.17,980.458 1661.82,980.458 1662.46,980.458 1663.11,980.458 1663.76,980.458 1664.4,980.458 1665.05,980.458 1665.69,980.458 1666.34,980.458 1666.99,980.458 \n",
       "  1667.63,980.458 1668.28,980.458 1668.93,980.458 1669.57,980.458 1670.22,980.458 1670.87,980.458 1671.51,980.458 1672.16,980.458 1672.8,980.458 1673.45,980.458 \n",
       "  1674.1,980.458 1674.74,980.458 1675.39,980.458 1676.04,980.458 1676.68,980.458 1677.33,980.458 1677.98,980.458 1678.62,980.458 1679.27,980.458 1679.91,980.458 \n",
       "  1680.56,980.458 1681.21,980.458 1681.85,980.458 1682.5,980.458 1683.15,980.458 1683.79,980.458 1684.44,980.458 1685.08,980.458 1685.73,980.458 1686.38,980.458 \n",
       "  1687.02,980.458 1687.67,980.458 1688.32,980.458 1688.96,980.458 1689.61,980.458 1690.26,980.458 1690.9,980.458 1691.55,980.458 1692.19,980.458 1692.84,980.458 \n",
       "  1693.49,980.458 1694.13,980.458 1694.78,980.458 1695.43,980.458 1696.07,980.458 1696.72,980.458 1697.37,980.458 1698.01,980.458 1698.66,980.458 1699.3,980.458 \n",
       "  1699.95,980.458 1700.6,980.458 1701.24,980.458 1701.89,980.458 1702.54,980.458 1703.18,980.458 1703.83,980.458 1704.48,980.458 1705.12,980.458 1705.77,980.458 \n",
       "  1706.41,980.458 1707.06,980.458 1707.71,980.458 1708.35,980.458 1709,980.458 1709.65,980.458 1710.29,980.458 1710.94,980.458 1711.58,980.458 1712.23,980.458 \n",
       "  1712.88,980.458 1713.52,980.458 1714.17,980.458 1714.82,980.458 1715.46,980.458 1716.11,980.458 1716.76,980.458 1717.4,980.458 1718.05,980.458 1718.69,980.458 \n",
       "  1719.34,980.458 1719.99,980.458 1720.63,980.458 1721.28,980.458 1721.93,980.458 1722.57,980.458 1723.22,980.458 1723.87,980.458 1724.51,980.458 1725.16,980.458 \n",
       "  1725.8,980.458 1726.45,980.458 1727.1,980.458 1727.74,980.458 1728.39,980.458 1729.04,980.458 1729.68,980.458 1730.33,980.458 1730.98,980.458 1731.62,980.458 \n",
       "  1732.27,980.458 1732.91,980.458 1733.56,980.458 1734.21,980.458 1734.85,980.458 1735.5,980.458 1736.15,980.458 1736.79,980.458 1737.44,980.458 1738.08,980.458 \n",
       "  1738.73,980.458 1739.38,980.458 1740.02,980.458 1740.67,980.458 1741.32,980.458 1741.96,980.458 1742.61,980.458 1743.26,980.458 1743.9,980.458 1744.55,980.458 \n",
       "  1745.19,980.458 1745.84,980.458 1746.49,980.458 1747.13,980.458 1747.78,980.458 1748.43,980.458 1749.07,980.458 1749.72,980.458 1750.37,980.458 1751.01,980.458 \n",
       "  1751.66,980.458 1752.3,980.458 1752.95,980.458 1753.6,980.458 1754.24,980.458 1754.89,980.458 1755.54,980.458 1756.18,980.458 1756.83,980.458 1757.48,980.458 \n",
       "  1758.12,980.458 1758.77,980.458 1759.41,980.458 1760.06,980.458 1760.71,980.458 1761.35,980.458 1762,980.458 1762.65,980.458 1763.29,980.458 1763.94,980.458 \n",
       "  1764.58,980.458 1765.23,980.458 1765.88,980.458 1766.52,980.458 1767.17,980.458 1767.82,980.458 1768.46,980.458 1769.11,980.458 1769.76,980.458 1770.4,980.458 \n",
       "  1771.05,980.458 1771.69,980.458 1772.34,980.458 1772.99,980.458 1773.63,980.458 1774.28,980.458 1774.93,980.458 1775.57,980.458 1776.22,980.458 1776.87,980.458 \n",
       "  1777.51,980.458 1778.16,980.458 1778.8,980.458 1779.45,980.458 1780.1,980.458 1780.74,980.458 1781.39,980.458 1782.04,980.458 1782.68,980.458 1783.33,980.458 \n",
       "  1783.98,980.458 1784.62,980.458 1785.27,980.458 1785.91,980.458 1786.56,980.458 1787.21,980.458 1787.85,980.458 1788.5,980.458 1789.15,980.458 1789.79,980.458 \n",
       "  1790.44,980.458 1791.08,980.458 1791.73,980.458 1792.38,980.458 1793.02,980.458 1793.67,980.458 1794.32,980.458 1794.96,980.458 1795.61,980.458 1796.26,980.458 \n",
       "  1796.9,980.458 1797.55,980.458 1798.19,980.458 1798.84,980.458 1799.49,980.458 1800.13,980.458 1800.78,980.458 1801.43,980.458 1802.07,980.458 1802.72,980.458 \n",
       "  1803.37,980.458 1804.01,980.458 1804.66,980.458 1805.3,980.458 1805.95,980.458 1806.6,980.458 1807.24,980.458 1807.89,980.458 1808.54,980.458 1809.18,980.458 \n",
       "  1809.83,980.458 1810.48,980.458 1811.12,980.458 1811.77,980.458 1812.41,980.458 1813.06,980.458 1813.71,980.458 1814.35,980.458 1815,980.458 1815.65,980.458 \n",
       "  1816.29,980.458 1816.94,980.458 1817.58,980.458 1818.23,980.458 1818.88,980.458 1819.52,980.458 1820.17,980.458 1820.82,980.458 1821.46,980.458 1822.11,980.458 \n",
       "  1822.76,980.458 1823.4,980.458 1824.05,980.458 1824.69,980.458 1825.34,980.458 1825.99,980.458 1826.63,980.458 1827.28,980.458 1827.93,980.458 1828.57,980.458 \n",
       "  1829.22,980.458 1829.87,980.458 1830.51,980.458 1831.16,980.458 1831.8,980.458 1832.45,980.458 1833.1,980.458 1833.74,980.458 1834.39,980.458 1835.04,980.458 \n",
       "  1835.68,980.458 1836.33,980.458 1836.98,980.458 1837.62,980.458 1838.27,980.458 1838.91,980.458 1839.56,980.458 1840.21,980.458 1840.85,980.458 1841.5,980.458 \n",
       "  1842.15,980.458 1842.79,980.458 1843.44,980.458 1844.08,980.458 1844.73,980.458 1845.38,980.458 1846.02,980.458 1846.67,980.458 1847.32,980.458 1847.96,980.458 \n",
       "  1848.61,980.458 1849.26,980.458 1849.9,980.458 1850.55,980.458 1851.19,980.458 1851.84,980.458 1852.49,980.458 1853.13,980.458 1853.78,980.458 1854.43,980.458 \n",
       "  1855.07,980.458 1855.72,980.458 1856.37,980.458 1857.01,980.458 1857.66,980.458 1858.3,980.458 1858.95,980.458 1859.6,980.458 1860.24,980.458 1860.89,980.458 \n",
       "  1861.54,980.458 1862.18,980.458 1862.83,980.458 1863.48,980.458 1864.12,980.458 1864.77,980.458 1865.41,980.458 1866.06,980.458 1866.71,980.458 1867.35,980.458 \n",
       "  1868,980.458 1868.65,980.458 1869.29,980.458 1869.94,980.458 1870.58,980.458 1871.23,980.458 1871.88,980.458 1872.52,980.458 1873.17,980.458 1873.82,980.458 \n",
       "  1874.46,980.458 1875.11,980.458 1875.76,980.458 1876.4,980.458 1877.05,980.458 1877.69,980.458 1878.34,980.458 1878.99,980.458 1879.63,980.458 1880.28,980.458 \n",
       "  1880.93,980.458 1881.57,980.458 1882.22,980.458 1882.87,980.458 1883.51,980.458 1884.16,980.458 1884.8,980.458 1885.45,980.458 1886.1,980.458 1886.74,980.458 \n",
       "  1887.39,980.458 1888.04,980.458 1888.68,980.458 1889.33,980.458 1889.98,980.458 1890.62,980.458 1891.27,980.458 1891.91,980.458 1892.56,980.458 1893.21,980.458 \n",
       "  1893.85,980.458 1894.5,980.458 1895.15,980.458 1895.79,980.458 1896.44,980.458 1897.08,980.458 1897.73,980.458 1898.38,980.458 1899.02,980.458 1899.67,980.458 \n",
       "  1900.32,980.458 1900.96,980.458 1901.61,980.458 1902.26,980.458 1902.9,980.458 1903.55,980.458 1904.19,980.458 1904.84,980.458 1905.49,980.458 1906.13,980.458 \n",
       "  1906.78,980.458 1907.43,980.458 1908.07,980.458 1908.72,980.458 1909.37,980.458 1910.01,980.458 1910.66,980.458 1911.3,980.458 1911.95,980.458 1912.6,980.458 \n",
       "  1913.24,980.458 1913.89,980.458 1914.54,980.458 1915.18,980.458 1915.83,980.458 1916.48,980.458 1917.12,980.458 1917.77,980.458 1918.41,980.458 1919.06,980.458 \n",
       "  1919.71,980.458 1920.35,980.458 1921,980.458 1921.65,980.458 1922.29,980.458 1922.94,980.458 1923.58,980.458 1924.23,980.458 1924.88,980.458 1925.52,980.458 \n",
       "  1926.17,980.458 1926.82,980.458 1927.46,980.458 1928.11,980.458 1928.76,980.458 1929.4,980.458 1930.05,980.458 1930.69,980.458 1931.34,980.458 1931.99,980.458 \n",
       "  1932.63,980.458 1933.28,980.458 1933.93,980.458 1934.57,980.458 1935.22,980.458 1935.87,980.458 1936.51,980.458 1937.16,980.458 1937.8,980.458 1938.45,980.458 \n",
       "  1939.1,980.458 1939.74,980.458 1940.39,980.458 1941.04,980.458 1941.68,980.458 1942.33,980.458 1942.98,980.458 1943.62,980.458 1944.27,980.458 1944.91,980.458 \n",
       "  1945.56,980.458 1946.21,980.458 1946.85,980.458 1947.5,980.458 1948.15,980.458 1948.79,980.458 1949.44,980.458 1950.08,980.458 1950.73,980.458 1951.38,980.458 \n",
       "  1952.02,980.458 1952.67,980.458 1953.32,980.458 1953.96,980.458 1954.61,980.458 1955.26,980.458 1955.9,980.458 1956.55,980.458 1957.19,980.458 1957.84,980.458 \n",
       "  1958.49,980.458 1959.13,980.458 1959.78,980.458 1960.43,980.458 1961.07,980.458 1961.72,980.458 1962.37,980.458 1963.01,980.458 1963.66,980.458 1964.3,980.458 \n",
       "  1964.95,980.458 1965.6,980.458 1966.24,980.458 1966.89,980.458 1967.54,980.458 1968.18,980.458 1968.83,980.458 1969.48,980.458 1970.12,980.458 1970.77,980.458 \n",
       "  1971.41,980.458 1972.06,980.458 1972.71,980.458 1973.35,980.458 1974,980.458 1974.65,980.458 1975.29,980.458 1975.94,980.458 1976.58,980.458 1977.23,980.458 \n",
       "  1977.88,980.458 1978.52,980.458 1979.17,980.458 1979.82,980.458 1980.46,980.458 1981.11,980.458 1981.76,980.458 1982.4,980.458 1983.05,980.458 1983.69,980.458 \n",
       "  1984.34,980.458 1984.99,980.458 1985.63,980.458 1986.28,980.458 1986.93,980.458 1987.57,980.458 1988.22,980.458 1988.87,980.458 1989.51,980.458 1990.16,980.458 \n",
       "  1990.8,980.458 1991.45,980.458 1992.1,980.458 1992.74,980.458 1993.39,980.458 1994.04,980.458 1994.68,980.458 1995.33,980.458 1995.98,980.458 1996.62,980.458 \n",
       "  1997.27,980.458 1997.91,980.458 1998.56,980.458 1999.21,980.458 1999.85,980.458 2000.5,980.458 2001.15,980.458 2001.79,980.458 2002.44,980.458 2003.08,980.458 \n",
       "  2003.73,980.458 2004.38,980.458 2005.02,980.458 2005.67,980.458 2006.32,980.458 2006.96,980.458 2007.61,980.458 2008.26,980.458 2008.9,980.458 2009.55,980.458 \n",
       "  2010.19,980.458 2010.84,980.458 2011.49,980.458 2012.13,980.458 2012.78,980.458 2013.43,980.458 2014.07,980.458 2014.72,980.458 2015.37,980.458 2016.01,980.458 \n",
       "  2016.66,980.458 2017.3,980.458 2017.95,980.458 2018.6,980.458 2019.24,980.458 2019.89,980.458 2020.54,980.458 2021.18,980.458 2021.83,980.458 2022.48,980.458 \n",
       "  2023.12,980.458 2023.77,980.458 2024.41,980.458 2025.06,980.458 2025.71,980.458 2026.35,980.458 2027,980.458 2027.65,980.458 2028.29,980.458 2028.94,980.458 \n",
       "  2029.58,980.458 2030.23,980.458 2030.88,980.458 2031.52,980.458 2032.17,980.458 2032.82,980.458 2033.46,980.458 2034.11,980.458 2034.76,980.458 2035.4,980.458 \n",
       "  2036.05,980.458 2036.69,980.458 2037.34,980.458 2037.99,980.458 2038.63,980.458 2039.28,980.458 2039.93,980.458 2040.57,980.458 2041.22,980.458 2041.87,980.458 \n",
       "  2042.51,980.458 2043.16,980.458 2043.8,980.458 2044.45,980.458 2045.1,980.458 2045.74,980.458 2046.39,980.458 2047.04,980.458 2047.68,980.458 2048.33,980.458 \n",
       "  2048.98,980.458 2049.62,980.458 2050.27,980.458 2050.91,980.458 2051.56,980.458 2052.21,980.458 2052.85,980.458 2053.5,980.458 2054.15,980.458 2054.79,980.458 \n",
       "  2055.44,980.458 2056.09,980.458 2056.73,980.458 2057.38,980.458 2058.02,980.458 2058.67,980.458 2059.32,980.458 2059.96,980.458 2060.61,980.458 2061.26,980.458 \n",
       "  2061.9,980.458 2062.55,980.458 2063.19,980.458 2063.84,980.458 2064.49,980.458 2065.13,980.458 2065.78,980.458 2066.43,980.458 2067.07,980.458 2067.72,980.458 \n",
       "  2068.37,980.458 2069.01,980.458 2069.66,980.458 2070.3,980.458 2070.95,980.458 2071.6,980.458 2072.24,980.458 2072.89,980.458 2073.54,980.458 2074.18,980.458 \n",
       "  2074.83,980.458 2075.48,980.458 2076.12,980.458 2076.77,980.458 2077.41,980.458 2078.06,980.458 2078.71,980.458 2079.35,980.458 2080,980.458 2080.65,980.458 \n",
       "  2081.29,980.458 2081.94,980.458 2082.59,980.458 2083.23,980.458 2083.88,980.458 2084.52,980.458 2085.17,980.458 2085.82,980.458 2086.46,980.458 2087.11,980.458 \n",
       "  2087.76,980.458 2088.4,980.458 2089.05,980.458 2089.69,980.458 2090.34,980.458 2090.99,980.458 2091.63,980.458 2092.28,980.458 2092.93,980.458 2093.57,980.458 \n",
       "  2094.22,980.458 2094.87,980.458 2095.51,980.458 2096.16,980.458 2096.8,980.458 2097.45,980.458 2098.1,980.458 2098.74,980.458 2099.39,980.458 2100.04,980.458 \n",
       "  2100.68,980.458 2101.33,980.458 2101.98,980.458 2102.62,980.458 2103.27,980.458 2103.91,980.458 2104.56,980.458 2105.21,980.458 2105.85,980.458 2106.5,980.458 \n",
       "  2107.15,980.458 2107.79,980.458 2108.44,980.458 2109.09,980.458 2109.73,980.458 2110.38,980.458 2111.02,980.458 2111.67,980.458 2112.32,980.458 2112.96,980.458 \n",
       "  2113.61,980.458 2114.26,980.458 2114.9,980.458 2115.55,980.458 2116.19,980.458 2116.84,980.458 2117.49,980.458 2118.13,980.458 2118.78,980.458 2119.43,980.458 \n",
       "  2120.07,980.458 2120.72,980.458 2121.37,980.458 2122.01,980.458 2122.66,980.458 2123.3,980.458 2123.95,980.458 2124.6,980.458 2125.24,980.458 2125.89,980.458 \n",
       "  2126.54,980.458 2127.18,980.458 2127.83,980.458 2128.48,980.458 2129.12,980.458 2129.77,980.458 2130.41,980.458 2131.06,980.458 2131.71,980.458 2132.35,980.458 \n",
       "  2133,980.458 2133.65,980.458 2134.29,980.458 2134.94,980.458 2135.59,980.458 2136.23,980.458 2136.88,980.458 2137.52,980.458 2138.17,980.458 2138.82,980.458 \n",
       "  2139.46,980.458 2140.11,980.458 2140.76,980.458 2141.4,980.458 2142.05,980.458 2142.69,980.458 2143.34,980.458 2143.99,980.458 2144.63,980.458 2145.28,980.458 \n",
       "  2145.93,980.458 2146.57,980.458 2147.22,980.458 2147.87,980.458 2148.51,980.458 2149.16,980.458 2149.8,980.458 2150.45,980.458 2151.1,980.458 2151.74,980.458 \n",
       "  2152.39,980.458 2153.04,980.458 2153.68,980.458 2154.33,980.458 2154.98,980.458 2155.62,980.458 2156.27,980.458 2156.91,980.458 2157.56,980.458 2158.21,980.458 \n",
       "  2158.85,980.458 2159.5,980.458 2160.15,980.458 2160.79,980.458 2161.44,980.458 2162.09,980.458 2162.73,980.458 2163.38,980.458 2164.02,980.458 2164.67,980.458 \n",
       "  2165.32,980.458 2165.96,980.458 2166.61,980.458 2167.26,980.458 2167.9,980.458 2168.55,980.458 2169.19,980.458 2169.84,980.458 2170.49,980.458 2171.13,980.458 \n",
       "  2171.78,980.458 2172.43,980.458 2173.07,980.458 2173.72,980.458 2174.37,980.458 2175.01,980.458 2175.66,980.458 2176.3,980.458 2176.95,980.458 2177.6,980.458 \n",
       "  2178.24,980.458 2178.89,980.458 2179.54,980.458 2180.18,980.458 2180.83,980.458 2181.48,980.458 2182.12,980.458 2182.77,980.458 2183.41,980.458 2184.06,980.458 \n",
       "  2184.71,980.458 2185.35,980.458 2186,980.458 2186.65,980.458 2187.29,980.458 2187.94,980.458 2188.59,980.458 2189.23,980.458 2189.88,980.458 2190.52,980.458 \n",
       "  2191.17,980.458 2191.82,980.458 2192.46,980.458 2193.11,980.458 2193.76,980.458 2194.4,980.458 2195.05,980.458 2195.69,980.458 2196.34,980.458 2196.99,980.458 \n",
       "  2197.63,980.458 2198.28,980.458 2198.93,980.458 2199.57,980.458 2200.22,980.458 2200.87,980.458 2201.51,980.458 2202.16,980.458 2202.8,980.458 2203.45,980.458 \n",
       "  2204.1,980.458 2204.74,980.458 2205.39,980.458 2206.04,980.458 2206.68,980.458 2207.33,980.458 2207.98,980.458 2208.62,980.458 2209.27,980.458 2209.91,980.458 \n",
       "  2210.56,980.458 2211.21,980.458 2211.85,980.458 2212.5,980.458 2213.15,980.458 2213.79,980.458 2214.44,980.458 2215.09,980.458 2215.73,980.458 2216.38,980.458 \n",
       "  2217.02,980.458 2217.67,980.458 2218.32,980.458 2218.96,980.458 2219.61,980.458 2220.26,980.458 2220.9,980.458 2221.55,980.458 2222.19,980.458 2222.84,980.458 \n",
       "  2223.49,980.458 2224.13,980.458 2224.78,980.458 2225.43,980.458 2226.07,980.458 2226.72,980.458 2227.37,980.458 2228.01,980.458 2228.66,980.458 2229.3,980.458 \n",
       "  2229.95,980.458 2230.6,980.458 2231.24,980.458 2231.89,980.458 2232.54,980.458 2233.18,980.458 2233.83,980.458 2234.48,980.458 2235.12,980.458 2235.77,980.458 \n",
       "  2236.41,980.458 2237.06,980.458 2237.71,980.458 2238.35,980.458 2239,980.458 2239.65,980.458 2240.29,980.458 2240.94,980.458 2241.59,980.458 2242.23,980.458 \n",
       "  2242.88,980.458 2243.52,980.458 2244.17,980.458 2244.82,980.458 2245.46,980.458 2246.11,980.458 2246.76,980.458 2247.4,980.458 2248.05,980.458 2248.69,980.458 \n",
       "  2249.34,980.458 2249.99,980.458 2250.63,980.458 2251.28,980.458 2251.93,980.458 2252.57,980.458 2253.22,980.458 2253.87,980.458 2254.51,980.458 2255.16,980.458 \n",
       "  2255.8,980.458 2256.45,980.458 2257.1,980.458 2257.74,980.458 2258.39,980.458 2259.04,980.458 2259.68,980.458 2260.33,980.458 2260.98,980.458 2261.62,980.458 \n",
       "  2262.27,980.458 2262.91,980.458 2263.56,980.458 2264.21,980.458 2264.85,980.458 2265.5,980.458 2266.15,980.458 2266.79,980.458 2267.44,980.458 2268.09,980.458 \n",
       "  2268.73,980.458 2269.38,980.458 2270.02,980.458 2270.67,980.458 2271.32,980.458 2271.96,980.458 2272.61,980.458 2273.26,980.458 2273.9,980.458 2274.55,980.458 \n",
       "  2275.19,980.458 2275.84,980.458 2276.49,980.458 2277.13,980.458 2277.78,980.458 2278.43,980.458 2279.07,980.458 2279.72,980.458 2280.37,980.458 2281.01,980.458 \n",
       "  2281.66,980.458 2282.3,980.458 2282.95,980.458 2283.6,980.458 2284.24,980.458 2284.89,980.458 2285.54,980.458 2286.18,980.458 2286.83,980.458 2287.48,980.458 \n",
       "  2288.12,980.458 2288.77,980.458 2289.41,980.458 2290.06,980.458 2290.71,980.458 2291.35,980.458 2292,980.458 2292.65,980.458 2293.29,980.458 2293.94,980.458 \n",
       "  2294.59,980.458 \n",
       "  \"/>\n",
       "<path clip-path=\"url(#clip6800)\" d=\"\n",
       "M1853.56 386.635 L2280.76 386.635 L2280.76 205.195 L1853.56 205.195  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1853.56,386.635 2280.76,386.635 2280.76,205.195 1853.56,205.195 1853.56,386.635 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1877.56,265.675 2021.56,265.675 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2045.56, 283.175)\" x=\"2045.56\" y=\"283.175\">Dynamic</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6800)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1877.56,326.155 2021.56,326.155 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6800)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2045.56, 343.655)\" x=\"2045.56\" y=\"343.655\">FEA</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "setup=getSetup()\n",
    "displacementFEA=fea(setup)\n",
    "\n",
    "latticeSize=4\n",
    "numTimeSteps=3000\n",
    "setup=getSetup()\n",
    "displacements=[]\n",
    "save=true\n",
    "returnEvery=1\n",
    "runMetavoxelGPU!(setup,numTimeSteps,latticeSize,displacements,returnEvery,false)\n",
    "\n",
    "numTimeStepsRecorded=length(displacements)\n",
    "d=[]\n",
    "dFEA=[]\n",
    "j=length(displacements[end])\n",
    "step=1\n",
    "for i in 1:step:numTimeStepsRecorded\n",
    "    append!(d,displacements[i][j].y)\n",
    "    append!(dFEA,displacementFEA[j].y)\n",
    "end\n",
    "println(\"FEA displacement= $(displacementFEA[j].y),converged displacement= $(displacements[numTimeSteps][j].y)\")\n",
    "plot(1:step:numTimeStepsRecorded,d,label=\"Dynamic\",xlabel=\"timestep\",ylabel=\"displacement\",title=\"Convergence Study\")\n",
    "plot!(1:step:numTimeStepsRecorded,dFEA,label=\"FEA\")\n",
    "# savefig(\"convergence\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip5000\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip5000)\" d=\"\n",
       "M0 1600 L2400 1600 L2400 0 L0 0  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip5001\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip5000)\" d=\"\n",
       "M235.533 1487.47 L2352.76 1487.47 L2352.76 47.2441 L235.533 47.2441  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip5002\">\n",
       "    <rect x=\"235\" y=\"47\" width=\"2118\" height=\"1441\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  295.454,1487.47 295.454,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  794.799,1487.47 794.799,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1294.14,1487.47 1294.14,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1793.49,1487.47 1793.49,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2292.83,1487.47 2292.83,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  235.533,1396.74 2352.76,1396.74 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  235.533,960.492 2352.76,960.492 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  235.533,524.249 2352.76,524.249 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  235.533,88.0053 2352.76,88.0053 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  235.533,1487.47 2352.76,1487.47 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  235.533,1487.47 235.533,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  295.454,1487.47 295.454,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  794.799,1487.47 794.799,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1294.14,1487.47 1294.14,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1793.49,1487.47 1793.49,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2292.83,1487.47 2292.83,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  235.533,1396.74 260.939,1396.74 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  235.533,960.492 260.939,960.492 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  235.533,524.249 260.939,524.249 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  235.533,88.0053 260.939,88.0053 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 295.454, 1541.47)\" x=\"295.454\" y=\"1541.47\">4</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 794.799, 1541.47)\" x=\"794.799\" y=\"1541.47\">5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1294.14, 1541.47)\" x=\"1294.14\" y=\"1541.47\">6</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1793.49, 1541.47)\" x=\"1793.49\" y=\"1541.47\">7</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2292.83, 1541.47)\" x=\"2292.83\" y=\"1541.47\">8</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 211.533, 1414.24)\" x=\"211.533\" y=\"1414.24\">-0.003</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 211.533, 977.992)\" x=\"211.533\" y=\"977.992\">-0.002</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 211.533, 541.749)\" x=\"211.533\" y=\"541.749\">-0.001</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 211.533, 105.505)\" x=\"211.533\" y=\"105.505\">0.000</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip5002)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  295.454,88.0053 794.799,88.0053 1294.14,90.0895 1793.49,88.0053 2292.83,1446.71 \n",
       "  \"/>\n",
       "<path clip-path=\"url(#clip5000)\" d=\"\n",
       "M1947.14 251.724 L2280.76 251.724 L2280.76 130.764 L1947.14 130.764  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1947.14,251.724 2280.76,251.724 2280.76,130.764 1947.14,130.764 1947.14,251.724 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5000)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1971.14,191.244 2115.14,191.244 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip5000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2139.14, 208.744)\" x=\"2139.14\" y=\"208.744\">FEA</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "n=[]\n",
    "nFEA=[]\n",
    "j=length(displacements[end])\n",
    "for i in 4:j\n",
    "    append!(n,displacements[end][i].y)\n",
    "    append!(nFEA,displacementFEA[i].y)\n",
    "end\n",
    "plot(4:j,nFEA,label=\"FEA\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "@webio": {
   "lastCommId": null,
   "lastKernelId": null
  },
  "kernelspec": {
   "display_name": "Julia 1.2.0",
   "language": "julia",
   "name": "julia-1.2"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}