61     typedef std::size_t size_t;
    65     typedef std::vector<Vector3Type> NodeContainerType;
    81     template< 
class TVec, 
class TMat>
    82     inline static void Spin(
const TVec& V, TMat& S)
    84         S(0, 0) = 0.00;     S(0, 1) = -V(2);    S(0, 2) = V(1);
    85         S(1, 0) = V(2);     S(1, 1) = 0.00;     S(1, 2) = -V(0);
    86         S(2, 0) = -V(1);    S(2, 1) = V(0);     S(2, 2) = 0.00;
    97     template< 
class TVec, 
class TMat>
    98     inline static void Spin_AtRow(
const TVec& V, TMat& S, 
size_t row_index)
   100         size_t i0 = row_index;
   101         size_t i1 = 1 + row_index;
   102         size_t i2 = 2 + row_index;
   106         S(i0, 0) = 0.00;    S(i0, 1) = -v2;     S(i0, 2) = v1;
   107         S(i1, 0) = v2;      S(i1, 1) = 0.00;    S(i1, 2) = -v0;
   108         S(i2, 0) = -v1;     S(i2, 1) = v0;      S(i2, 2) = 0.00;
   120     template< 
class TVec, 
class TMat>
   121     inline static void Spin_AtRow(
const TVec& V, TMat& S, 
size_t vector_index, 
size_t matrix_row_index)
   123         size_t i0 = matrix_row_index;
   124         size_t i1 = 1 + matrix_row_index;
   125         size_t i2 = 2 + matrix_row_index;
   126         double v0 = V(vector_index);
   127         double v1 = V(vector_index + 1);
   128         double v2 = V(vector_index + 2);
   129         S(i0, 0) = 0.00;    S(i0, 1) = -v2;     S(i0, 2) = v1;
   130         S(i1, 0) = v2;      S(i1, 1) = 0.00;    S(i1, 2) = -v0;
   131         S(i2, 0) = -v1;     S(i2, 1) = v0;      S(i2, 2) = 0.00;
   142     template< 
class TVec, 
class TMat>
   143     inline static void Spin(
const TVec& V, TMat& S, 
double mult)
   145         S(0, 0) = 0.00;         S(0, 1) = -mult * V(2); S(0, 2) = mult * V(1);
   146         S(1, 0) = mult * V(2);  S(1, 1) = 0.00;         S(1, 2) = -mult * V(0);
   147         S(2, 0) = -mult * V(1); S(2, 1) = mult * V(0);  S(2, 2) = 0.00;
   160     template< 
class TVec, 
class TMat>
   161     inline static void Spin_AtRow(
const TVec& V, TMat& S, 
double mult, 
size_t row_index)
   163         size_t i0 = row_index;
   164         size_t i1 = 1 + row_index;
   165         size_t i2 = 2 + row_index;
   166         double v0 = mult * V(i0);
   167         double v1 = mult * V(i1);
   168         double v2 = mult * V(i2);
   169         S(i0, 0) = 0.00;    S(i0, 1) = -v2;     S(i0, 2) = v1;
   170         S(i1, 0) = v2;      S(i1, 1) = 0.00;    S(i1, 2) = -v0;
   171         S(i2, 0) = -v1;     S(i2, 1) = v0;      S(i2, 2) = 0.00;
   185     template< 
class TVec, 
class TMat>
   186     inline static void Spin_AtRow(
const TVec& V, TMat& S, 
double mult, 
size_t vector_index, 
size_t matrix_row_index)
   188         size_t i0 = matrix_row_index;
   189         size_t i1 = 1 + matrix_row_index;
   190         size_t i2 = 2 + matrix_row_index;
   191         double v0 = mult * V(vector_index);
   192         double v1 = mult * V(vector_index + 1);
   193         double v2 = mult * V(vector_index + 2);
   194         S(i0, 0) = 0.00;    S(i0, 1) = -v2;     S(i0, 2) = v1;
   195         S(i1, 0) = v2;      S(i1, 1) = 0.00;    S(i1, 2) = -v0;
   196         S(i2, 0) = -v1;     S(i2, 1) = v0;      S(i2, 2) = 0.00;
   199     static void SetZero(
size_t n, 
size_t m, MatrixType& I);
   208     inline static void SetIdentity(
size_t n, MatrixType& I, 
double value = 1.0)
   211         for (
size_t j = 0; j < n; ++j)
   223     inline static void GetBlock(
const VectorType& A, 
size_t begin, 
size_t end, VectorType& B)
   225         size_t n = end - begin;
   226         for (
size_t i = 0; i < n; ++i)
   238     inline static void GetBlock(
const MatrixType& A, 
size_t begin, 
size_t end, MatrixType& B)
   240         size_t n = end - begin;
   241         for (
size_t i = 0; i < n; ++i)
   242             for (
size_t j = 0; j < n; ++j)
   243                 B(i, j) = A(i + begin, j + begin);
   254     inline static void SetBlock(MatrixType& A, 
size_t begin, 
size_t end, 
const MatrixType& B)
   256         size_t n = end - begin;
   257         for (
size_t i = 0; i < n; ++i)
   258             for (
size_t j = 0; j < n; ++j)
   259                 A(i + begin, j + begin) = B(i, j);
   262     static void OuterProd(
const VectorType& A, 
const VectorType& B, MatrixType& C);
   273     inline static void Compute_Pt(
size_t num_nodes, MatrixType& P)
   275         double a = double(num_nodes - 1) / double(num_nodes);
   276         double b = -1.0 / double(num_nodes);
   278         size_t num_dofs = num_nodes * 6;
   282         for (
size_t i = 0; i < num_nodes; i++)
   292             for (
size_t k = i + 1; k < num_nodes; k++)
   314     inline static void Compute_S(
const NodeContainerType& nodes, MatrixType& S)
   316         size_t num_nodes = nodes.size();
   317         size_t num_dofs = num_nodes * 6;
   321         for (
size_t i = 0; i < num_nodes; i++)
   340     inline static void Compute_H(
const VectorType& displacements, MatrixType& H)
   342         size_t num_dofs = displacements.
Size();
   343         size_t num_nodes = num_dofs / 6;
   347         static MatrixType Omega(3, 3);
   348         static MatrixType Omega2(3, 3);
   349         static MatrixType Hi(3, 3);
   350         static VectorType rv(3);
   352         for (
size_t i = 0; i < num_nodes; i++)
   354             size_t index = i * 6;
   356             GetBlock(displacements, index + 3, index + 6, rv);
   358             double angle = rv.
Norm();
   360             if (angle >= 2.0 * M_PI)
   361                 angle = std::fmod(angle, 2.0 * M_PI);
   365                 double angle2 = angle * angle;
   366                 double angle4 = angle2 * angle2;
   367                 double angle6 = angle4 * angle2;
   368                 eta = 1.0 / 12.0 + 1.0 / 720.0 * angle2 + 1.0 / 30240.0 * angle4 + 1.0 / 1209600.0 * angle6;
   371                 eta = (1.0 - 0.5 * angle * std::tan(0.5 * M_PI - 0.5 * angle)) / (angle * angle);
   375             Omega2.addMatrixProduct(0.0, Omega, Omega, 1.0);
   382             SetBlock(H, index + 3, index + 6, Hi);
   395     inline static void Compute_L(
const VectorType& displacements, 
const VectorType& forces, 
const MatrixType& H, MatrixType& L)
   397         size_t num_dofs = displacements.
Size();
   398         size_t num_nodes = num_dofs / 6;
   400         SetZero(num_dofs, num_dofs, L);
   402         static VectorType rotationVector(3);
   403         static VectorType momentVector(3);
   404         static MatrixType Omega(3, 3);
   405         static MatrixType Omega2(3, 3);
   406         static MatrixType Li(3, 3);
   407         static MatrixType LiTemp1(3, 3);
   408         static MatrixType MxR(3, 3);
   409         static MatrixType RxM(3, 3);
   410         static MatrixType Hi(3, 3);
   412         for (
size_t i = 0; i < num_nodes; i++)
   414             size_t index = i * 6;
   416             GetBlock(displacements, index + 3, index + 6, rotationVector);
   417             GetBlock(forces, index + 3, index + 6, momentVector);
   419             double angle = rotationVector.
Norm();
   421             if (angle >= 2.0 * M_PI)
   422                 angle = std::fmod(angle, 2.0 * M_PI);
   424             double angle2 = angle * angle;
   425             double angle4 = angle2 * angle2;
   426             double angle6 = angle4 * angle2;
   431                 eta = 1.0 / 12.0 + angle2 / 720.0 + angle4 / 30240.0 + angle6 / 1209600.0;
   432                 mu = 1.0 / 360.0 + angle2 / 7560.0 + angle4 / 201600.0 + angle6 / 5987520.0;
   435                 eta = (1.0 - 0.5 * angle * std::tan(0.5 * M_PI - 0.5 * angle)) / (angle * angle);
   436                 double sin_h_angle = std::sin(0.5 * angle);
   437                 mu = (angle2 + 4.0 * std::cos(angle) + angle * std::sin(angle) - 4.0) / (4.0 * angle4 * sin_h_angle * sin_h_angle);
   440             Spin(rotationVector, Omega);
   441             Omega2.addMatrixProduct(0.0, Omega, Omega, 1.0);
   443             OuterProd(momentVector, rotationVector, MxR);
   444             OuterProd(rotationVector, momentVector, RxM);
   446             SetIdentity(3, Li, (rotationVector ^ momentVector));
   450             LiTemp1.addMatrixProduct(0.0, Omega2, MxR, mu);
   451             Spin(momentVector, MxR, 0.5);
   456             GetBlock(H, index + 3, index + 6, Hi);
   457             Li.addMatrixProduct(0.0, LiTemp1, Hi, 1.0);
   459             SetBlock(L, index + 3, index + 6, Li);
 Float vector abstraction. 
Definition: Vector.h:94
static void SetZero(size_t n, size_t m, MatrixType &I)
Sets the input matrix to the zero matrix of requested size. 
Definition: ASDEICR.cc:34
double Norm(void) const
Return the norm of vector. 
Definition: Vector.cpp:780
static void Compute_Pt(size_t num_nodes, MatrixType &P)
Computes the Translational Projector Matrix. 
Definition: ASDEICR.h:273
static void Compute_H(const VectorType &displacements, MatrixType &H)
Computes the Axial Vector Jacobian. 
Definition: ASDEICR.h:340
static void Spin_AtRow(const TVec &V, TMat &S, double mult, size_t vector_index, size_t matrix_row_index)
Computes the Spin of the input vector V, from the specified index, and saves the result into the outp...
Definition: ASDEICR.h:186
static void OuterProd(const VectorType &A, const VectorType &B, MatrixType &C)
computes the outer product A x B, in C. 
Definition: ASDEICR.cc:46
static void GetBlock(const VectorType &A, size_t begin, size_t end, VectorType &B)
Copies the block [begin:end[ from A to B. 
Definition: ASDEICR.h:223
static void Spin_AtRow(const TVec &V, TMat &S, size_t row_index)
Computes the Spin of the input vector V, and saves the result into the output matrix S...
Definition: ASDEICR.h:98
static void SetIdentity(size_t n, MatrixType &I, double value=1.0)
Sets the input matrix to the identity of requested size. 
Definition: ASDEICR.h:208
int Size(void) const
Returns the size of the Vector. 
Definition: Vector.h:235
static void Spin_AtRow(const TVec &V, TMat &S, double mult, size_t row_index)
Computes the Spin of the input vector V, and saves the result into the output matrix S...
Definition: ASDEICR.h:161
static void Spin(const TVec &V, TMat &S)
Computes the Spin of the input vector V, and saves the result into the output matrix S...
Definition: ASDEICR.h:82
static void GetBlock(const MatrixType &A, size_t begin, size_t end, MatrixType &B)
Copies the block [begin:end[ from A to B. 
Definition: ASDEICR.h:238
static void Compute_S(const NodeContainerType &nodes, MatrixType &S)
Computes the Spin Lever Matrix. 
Definition: ASDEICR.h:314
static void Spin(const TVec &V, TMat &S, double mult)
Computes the Spin of the input vector V, and saves the result into the output matrix S...
Definition: ASDEICR.h:143
int addMatrix(double factThis, const Matrix &other, double factOther)
Add a factor fact times the Matrix other to the current Matrix. 
Definition: Matrix.cpp:566
EICR Element Independent CoRotational formulation. 
Definition: ASDEICR.h:56
static void Compute_L(const VectorType &displacements, const VectorType &forces, const MatrixType &H, MatrixType &L)
Computes the Spin derivative of (Axial Vector Jacobian)^T contracted with the nodal moment vector...
Definition: ASDEICR.h:395
Open source finite element program for structural analysis. 
Definition: ContinuaReprComponent.h:35
Matrix of floats. 
Definition: Matrix.h:111
static void Spin_AtRow(const TVec &V, TMat &S, size_t vector_index, size_t matrix_row_index)
Computes the Spin of the input vector V, from the specified index, and saves the result into the outp...
Definition: ASDEICR.h:121
static void SetBlock(MatrixType &A, size_t begin, size_t end, const MatrixType &B)
Copies the block [begin:end[ from B to A. 
Definition: ASDEICR.h:254
ASDQuaternion A simple class that implements the main features of quaternion algebra. 
Definition: ASDMath.h:328