Added glob_pos calculation from datastructure
@@ -2,6 +2,8 @@ import ctypes as ct
import numpy as np
import copy
+import sharpy.utils.algebra as algebra
+
class AeroTimeStepInfo(object):
def __init__(self, dimensions, dimensions_star):
@@ -244,13 +246,23 @@ class StructTimeStepInfo(object):
self.psi_dot = np.zeros((self.num_elem, num_node_elem, 3), dtype=ct.c_double, order='F')
# FoR data
- self.quat = np.array([1, 0, 0, 0])
+ self.quat = np.array([1, 0, 0, 0], dtype=float)
self.for_pos = np.zeros((6,))
self.for_vel = np.zeros((6,))
- self.glob_pos = np.zeros_like(self.pos)
+ # self.glob_pos = np.zeros_like(self.pos)
def copy(self):
from copy import deepcopy
return deepcopy(self)
+ def glob_pos(self, include_rbm=True):
+ coords = np.zeros((self.num_node, 3))
+ for i_node in self.num_node:
+ coords[i_node, :] = self.pos[i_node, :]
+ coords[i_node, :] = np.dot(algebra.quat2rot(self.quat), coords[i_node, :])
+ if include_rbm:
+ coords[i_node, :] += self.for_pos[0:3]
+
+ return coords
+
