29 #ifndef ASDShellQ4LocalCoordinateSystem_h    30 #define ASDShellQ4LocalCoordinateSystem_h    50     typedef std::vector<Vector3Type> Vector3ContainerType;
    57         const Vector3Type& P1global,
    58         const Vector3Type& P2global,
    59         const Vector3Type& P3global,
    60         const Vector3Type& P4global,
    73         Vector3Type d13 = P3global - P1global;
    74         Vector3Type d24 = P4global - P2global;
    81         Vector3Type e3 = d13.
cross(d24);
    87         Vector3Type e1 = P2global - P1global;
    88         double e1_dot_e3 = e1.
dot(e3);
    92         if (std::abs(alpha) > 0.0)
    98         Vector3Type e2 = e3.cross(e1);
   102         for (
int i = 0; i < 3; i++)
   104             m_orientation(0, i) = e1(i);
   105             m_orientation(1, i) = e2(i);
   106             m_orientation(2, i) = e3(i);
   110         for (
int i = 0; i < 3; i++)
   112             m_P[0](i) = m_orientation(i, 0) * (P1global(0) - m_center(0)) + m_orientation(i, 1) * (P1global(1) - m_center(1)) + m_orientation(i, 2) * (P1global(2) - m_center(2));
   113             m_P[1](i) = m_orientation(i, 0) * (P2global(0) - m_center(0)) + m_orientation(i, 1) * (P2global(1) - m_center(1)) + m_orientation(i, 2) * (P2global(2) - m_center(2));
   114             m_P[2](i) = m_orientation(i, 0) * (P3global(0) - m_center(0)) + m_orientation(i, 1) * (P3global(1) - m_center(1)) + m_orientation(i, 2) * (P3global(2) - m_center(2));
   115             m_P[3](i) = m_orientation(i, 0) * (P4global(0) - m_center(0)) + m_orientation(i, 1) * (P4global(1) - m_center(1)) + m_orientation(i, 2) * (P4global(2) - m_center(2));
   121     inline const Vector3ContainerType& Nodes()
const { 
return m_P; }
   123     inline const Vector3Type& P1()
const { 
return m_P[0]; }
   124     inline const Vector3Type& P2()
const { 
return m_P[1]; }
   125     inline const Vector3Type& P3()
const { 
return m_P[2]; }
   126     inline const Vector3Type& P4()
const { 
return m_P[3]; }
   127     inline const Vector3Type& Center()
const { 
return m_center; }
   129     inline double X1()
const { 
return m_P[0][0]; }
   130     inline double X2()
const { 
return m_P[1][0]; }
   131     inline double X3()
const { 
return m_P[2][0]; }
   132     inline double X4()
const { 
return m_P[3][0]; }
   134     inline double Y1()
const { 
return m_P[0][1]; }
   135     inline double Y2()
const { 
return m_P[1][1]; }
   136     inline double Y3()
const { 
return m_P[2][1]; }
   137     inline double Y4()
const { 
return m_P[3][1]; }
   139     inline double Z1()
const { 
return m_P[0][2]; }
   140     inline double Z2()
const { 
return m_P[1][2]; }
   141     inline double Z3()
const { 
return m_P[2][2]; }
   142     inline double Z4()
const { 
return m_P[3][2]; }
   144     inline double X(
size_t i)
const { 
return m_P[i][0]; }
   145     inline double Y(
size_t i)
const { 
return m_P[i][1]; }
   146     inline double Z(
size_t i)
const { 
return m_P[i][2]; }
   148     inline double Area()
const { 
return m_area; }
   150     inline const MatrixType& Orientation()
const { 
return m_orientation; }
   152     inline Vector3Type Vx()
const { 
return Vector3Type(m_orientation(0, 0), m_orientation(0, 1), m_orientation(0, 2)); }
   153     inline Vector3Type Vy()
const { 
return Vector3Type(m_orientation(1, 0), m_orientation(1, 1), m_orientation(1, 2)); }
   154     inline Vector3Type Vz()
const { 
return Vector3Type(m_orientation(2, 0), m_orientation(2, 1), m_orientation(2, 2)); }
   156     inline double WarpageFactor()
const { 
return Z1(); }
   157     inline bool IsWarped()
const { 
return std::abs(WarpageFactor()) > 0.0; }
   159     inline void ComputeTotalRotationMatrix(MatrixType& R)
const   161         constexpr 
size_t mat_size = 24;
   163             R.resize(mat_size, mat_size);
   167         for (
size_t k = 0; k < 8; k++)
   170             R(i, i) = m_orientation(0, 0);   R(i, i + 1) = m_orientation(0, 1);   R(i, i + 2) = m_orientation(0, 2);
   171             R(i + 1, i) = m_orientation(1, 0);   R(i + 1, i + 1) = m_orientation(1, 1);   R(i + 1, i + 2) = m_orientation(1, 2);
   172             R(i + 2, i) = m_orientation(2, 0);   R(i + 2, i + 1) = m_orientation(2, 1);   R(i + 2, i + 2) = m_orientation(2, 2);
   176     inline void ComputeTotalWarpageMatrix(MatrixType& W, 
double wf)
const   178         constexpr 
size_t mat_size = 24;
   180             W.resize(mat_size, mat_size);
   183         for (
size_t i = 0; i < mat_size; i++)
   199     inline void ComputeTotalWarpageMatrix(MatrixType& W)
const   201         ComputeTotalWarpageMatrix(W, WarpageFactor());
   206     Vector3ContainerType m_P;
   207     Vector3Type m_center;
   208     MatrixType m_orientation;
   213 template<
class TStream>
   218     for (
size_t i = 0; i < 4; i++) {
   219         s << 
" (" << lc.X(i) << 
", " << lc.Y(i) << 
") ";
   222     s << 
"Normal: " << lc.Vz() << 
"\n";
   227 #endif // !ASDShellQ4LocalCoordinateSystem_h void Zero(void)
Zero's out the Matrix. 
Definition: Matrix.cpp:226
int noCols() const
Returns the number of columns, numCols, of the Matrix. 
Definition: Matrix.h:273
This class represent the local coordinate system of any element whose geometry is a 4-node Quadrilate...
Definition: ASDShellQ4LocalCoordinateSystem.h:41
void rotateVector(const TVector3_A &a, TVector3_B &b) const
Rotates a vector using this quaternion. 
Definition: ASDMath.h:556
T normalize()
makes this vector a unit vector. 
Definition: ASDMath.h:210
T dot(const ASDVector3 &b) const
Returns the dot product this vector with another vector. 
Definition: ASDMath.h:226
ASDVector3 cross(const ASDVector3 &b) const
Returns the cross product this vector with another vector. 
Definition: ASDMath.h:239
int noRows() const
Returns the number of rows, numRows, of the Matrix. 
Definition: Matrix.h:269
static ASDQuaternion FromAxisAngle(T x, T y, T z, T radians)
Returns a ASDQuaternion that represents a rotation of an angle 'radians' around the axis (x...
Definition: ASDMath.h:622
Open source finite element program for structural analysis. 
Definition: ContinuaReprComponent.h:35
Matrix of floats. 
Definition: Matrix.h:111
ASDQuaternion A simple class that implements the main features of quaternion algebra. 
Definition: ASDMath.h:328