Ejemplo n.º 1
0
TDF_API K K_DECL TDF_optionCodeInfo(K h, K windCode) {
	::THANDLE tdf = NULL;
	std::string code;
	try {
		TDF::parseTdfHandle(h, tdf);
		code = q::q2String(windCode);
	}
	catch (std::string const& error) {
		return q::error2q(error);
	}

	::TDF_OPTION_CODE info = { 0 };
	::TDF_ERR result = static_cast<::TDF_ERR>(::TDF_GetOptionCodeInfo(tdf, code.c_str(), &info));
	if (result != TDF_ERR_SUCCESS) {
		return q::error2q(::TDF::getError(result));
	}

	q::K_ptr data(ktn(0, 6 + 12));
	kK(data.get())[0 +  0] = ks(const_cast<S>(info.basicCode.szWindCode));
	kK(data.get())[0 +  1] = ks(const_cast<S>(info.basicCode.szMarket));
	kK(data.get())[0 +  2] = ks(const_cast<S>(info.basicCode.szCode));
	kK(data.get())[0 +  3] = ks(const_cast<S>(info.basicCode.szENName));
	kK(data.get())[0 +  4] = ks(const_cast<S>(Wind::encoder::GB18030_UTF8::encode(info.basicCode.szCNName).c_str()));
	kK(data.get())[0 +  5] = kg(info.basicCode.nType);
	kK(data.get())[6 +  0] = ks(const_cast<S>(info.szContractID));
	kK(data.get())[6 +  1] = ks(const_cast<S>(info.szUnderlyingSecurityID));
	kK(data.get())[6 +  2] = kc(info.chCallOrPut);
	kK(data.get())[6 +  3] = kd(q::date2q(info.nExerciseDate));
	kK(data.get())[6 +  4] = kc(info.chUnderlyingType);
	kK(data.get())[6 +  5] = kc(info.chOptionType);
	kK(data.get())[6 +  6] = kc(info.chPriceLimitType);
	kK(data.get())[6 +  7] = ki(info.nContractMultiplierUnit);
	kK(data.get())[6 +  8] = kf(info.nExercisePrice);
	kK(data.get())[6 +  9] = kd(q::date2q(info.nStartDate));
	kK(data.get())[6 + 10] = kd(q::date2q(info.nEndDate));
	kK(data.get())[6 + 11] = kd(q::date2q(info.nExpireDate));
	return data.release();
}
Ejemplo n.º 2
0
const Matrix &
PDeltaCrdTransf2d::getInitialGlobalStiffMatrix(const Matrix &kb)
{
    static double tmp [6][6];
    double oneOverL = 1.0/L;
    double kb00, kb01, kb02, kb10, kb11, kb12, kb20, kb21, kb22;
    
    kb00 = kb(0,0);		kb01 = kb(0,1);		kb02 = kb(0,2);
    kb10 = kb(1,0);		kb11 = kb(1,1);		kb12 = kb(1,2);
    kb20 = kb(2,0);		kb21 = kb(2,1);		kb22 = kb(2,2);
    
    double t02 = 0.0;
    double t12 = 1.0;
    double t22 = 0.0;
    
    if (nodeIOffset != 0) {
        t02 =  cosTheta*nodeIOffset[1] - sinTheta*nodeIOffset[0];
        t12 =  oneOverL*(sinTheta*nodeIOffset[1]+cosTheta*nodeIOffset[0]) + 1.0;
        t22 =  oneOverL*(sinTheta*nodeIOffset[1]+cosTheta*nodeIOffset[0]);
    }
    
    double t05 = 0.0;
    double t15 = 0.0;
    double t25 = 1.0;
    
    if (nodeJOffset != 0) {
        t05 = -cosTheta*nodeJOffset[1] + sinTheta*nodeJOffset[0];
        t15 = -oneOverL*(sinTheta*nodeJOffset[1]+cosTheta*nodeJOffset[0]);
        t25 = -oneOverL*(sinTheta*nodeJOffset[1]+cosTheta*nodeJOffset[0]) + 1.0;
    }
    
    double sl = sinTheta*oneOverL;
    double cl = cosTheta*oneOverL;
    
    tmp[0][0] = -cosTheta*kb00 - sl*(kb01+kb02);
    tmp[0][1] = -sinTheta*kb00 + cl*(kb01+kb02);
    tmp[0][2] = (nodeIOffset) ? t02*kb00 + t12*kb01 + t22*kb02 : kb01;
    tmp[0][3] = -tmp[0][0];
    tmp[0][4] = -tmp[0][1];
    tmp[0][5] = (nodeJOffset) ? t05*kb00 + t15*kb01 + t25*kb02 : kb02;
    
    tmp[1][0] = -cosTheta*kb10 - sl*(kb11+kb12);
    tmp[1][1] = -sinTheta*kb10 + cl*(kb11+kb12);
    tmp[1][2] = (nodeIOffset) ? t02*kb10 + t12*kb11 + t22*kb12 : kb11;
    tmp[1][3] = -tmp[1][0];
    tmp[1][4] = -tmp[1][1];
    tmp[1][5] = (nodeJOffset) ? t05*kb10 + t15*kb11 + t25*kb12 : kb12;
    
    tmp[2][0] = -cosTheta*kb20 - sl*(kb21+kb22);
    tmp[2][1] = -sinTheta*kb20 + cl*(kb21+kb22);
    tmp[2][2] = (nodeIOffset) ? t02*kb20 + t12*kb21 + t22*kb22 : kb21;
    tmp[2][3] = -tmp[2][0];
    tmp[2][4] = -tmp[2][1];
    tmp[2][5] = (nodeJOffset) ? t05*kb20 + t15*kb21 + t25*kb22 : kb22;
    
    kg(0,0) = -cosTheta*tmp[0][0] - sl*(tmp[1][0]+tmp[2][0]);
    kg(0,1) = -cosTheta*tmp[0][1] - sl*(tmp[1][1]+tmp[2][1]);
    kg(0,2) = -cosTheta*tmp[0][2] - sl*(tmp[1][2]+tmp[2][2]);
    kg(0,3) = -cosTheta*tmp[0][3] - sl*(tmp[1][3]+tmp[2][3]);
    kg(0,4) = -cosTheta*tmp[0][4] - sl*(tmp[1][4]+tmp[2][4]);
    kg(0,5) = -cosTheta*tmp[0][5] - sl*(tmp[1][5]+tmp[2][5]);
    
    kg(1,0) = -sinTheta*tmp[0][0] + cl*(tmp[1][0]+tmp[2][0]);
    kg(1,1) = -sinTheta*tmp[0][1] + cl*(tmp[1][1]+tmp[2][1]);
    kg(1,2) = -sinTheta*tmp[0][2] + cl*(tmp[1][2]+tmp[2][2]);
    kg(1,3) = -sinTheta*tmp[0][3] + cl*(tmp[1][3]+tmp[2][3]);
    kg(1,4) = -sinTheta*tmp[0][4] + cl*(tmp[1][4]+tmp[2][4]);
    kg(1,5) = -sinTheta*tmp[0][5] + cl*(tmp[1][5]+tmp[2][5]);
    
    if (nodeIOffset) {
        kg(2,0) =  t02*tmp[0][0] + t12*tmp[1][0] + t22*tmp[2][0];
        kg(2,1) =  t02*tmp[0][1] + t12*tmp[1][1] + t22*tmp[2][1];
        kg(2,2) =  t02*tmp[0][2] + t12*tmp[1][2] + t22*tmp[2][2];
        kg(2,3) =  t02*tmp[0][3] + t12*tmp[1][3] + t22*tmp[2][3];
        kg(2,4) =  t02*tmp[0][4] + t12*tmp[1][4] + t22*tmp[2][4];
        kg(2,5) =  t02*tmp[0][5] + t12*tmp[1][5] + t22*tmp[2][5];
    }
    else {
        kg(2,0) = tmp[1][0];
        kg(2,1) = tmp[1][1];
        kg(2,2) = tmp[1][2];
        kg(2,3) = tmp[1][3];
        kg(2,4) = tmp[1][4];
        kg(2,5) = tmp[1][5];
    }
    
    kg(3,0) = -kg(0,0);
    kg(3,1) = -kg(0,1);
    kg(3,2) = -kg(0,2);
    kg(3,3) = -kg(0,3);
    kg(3,4) = -kg(0,4);
    kg(3,5) = -kg(0,5);
    
    kg(4,0) = -kg(1,0);
    kg(4,1) = -kg(1,1);
    kg(4,2) = -kg(1,2);
    kg(4,3) = -kg(1,3);
    kg(4,4) = -kg(1,4);
    kg(4,5) = -kg(1,5);
    
    if (nodeJOffset) {
        kg(5,0) =  t05*tmp[0][0] + t15*tmp[1][0] + t25*tmp[2][0];
        kg(5,1) =  t05*tmp[0][1] + t15*tmp[1][1] + t25*tmp[2][1];
        kg(5,2) =  t05*tmp[0][2] + t15*tmp[1][2] + t25*tmp[2][2];
        kg(5,3) =  t05*tmp[0][3] + t15*tmp[1][3] + t25*tmp[2][3];
        kg(5,4) =  t05*tmp[0][4] + t15*tmp[1][4] + t25*tmp[2][4];
        kg(5,5) =  t05*tmp[0][5] + t15*tmp[1][5] + t25*tmp[2][5];
    }
    else {
        kg(5,0) =  tmp[2][0];
        kg(5,1) =  tmp[2][1];
        kg(5,2) =  tmp[2][2];
        kg(5,3) =  tmp[2][3];
        kg(5,4) =  tmp[2][4];
        kg(5,5) =  tmp[2][5];
    }
    
    return kg;
}
Ejemplo n.º 3
0
QString Fixture::status() const
{
    QString info;
    QString t;

    QString title("<TR><TD CLASS='hilite' COLSPAN='3'>%1</TD></TR>");
    QString subTitle("<TR><TD CLASS='subhi' COLSPAN='3'>%1</TD></TR>");
    QString genInfo("<TR><TD CLASS='emphasis'>%1</TD><TD COLSPAN='2'>%2</TD></TR>");

    /********************************************************************
     * General info
     ********************************************************************/

    info += "<TABLE COLS='3' WIDTH='100%'>";

    // Fixture title
    info += title.arg(name());

    // Manufacturer
    if (isDimmer() == false)
    {
        info += genInfo.arg(tr("Manufacturer")).arg(m_fixtureDef->manufacturer());
        info += genInfo.arg(tr("Model")).arg(m_fixtureDef->model());
        info += genInfo.arg(tr("Mode")).arg(m_fixtureMode->name());
        info += genInfo.arg(tr("Type")).arg(m_fixtureDef->type());
    }
    else
    {
        info += genInfo.arg(tr("Type")).arg(tr("Generic Dimmer"));
    }

    // Universe
    info += genInfo.arg(tr("Universe")).arg(universe() + 1);

    // Address
    QString range = QString("%1 - %2").arg(address() + 1).arg(address() + channels());
    info += genInfo.arg(tr("Address Range")).arg(range);

    // Channels
    info += genInfo.arg(tr("Channels")).arg(channels());

    // Binary address
    QString binaryStr = QString("%1").arg(address() + 1, 10, 2, QChar('0'));
    QString dipTable("<TABLE COLS='33' cellspacing='0'><TR><TD COLSPAN='33'><IMG SRC=\"" ":/ds_top.png\"></TD></TR>");
    dipTable += "<TR><TD><IMG SRC=\"" ":/ds_border.png\"></TD><TD><IMG SRC=\"" ":/ds_border.png\"></TD>";
    for (int i = 9; i >= 0; i--)
    {
        if (binaryStr.at(i) == '0')
            dipTable += "<TD COLSPAN='3'><IMG SRC=\"" ":/ds_off.png\"></TD>";
        else
            dipTable += "<TD COLSPAN='3'><IMG SRC=\"" ":/ds_on.png\"></TD>";
    }
    dipTable += "<TD><IMG SRC=\"" ":/ds_border.png\"></TD></TR>";
    dipTable += "<TR><TD COLSPAN='33'><IMG SRC=\"" ":/ds_bottom.png\"></TD></TR>";
    dipTable += "</TABLE>";

    info += genInfo.arg(tr("Binary Address (DIP)"))
            .arg(QString("%1").arg(dipTable));

    /********************************************************************
     * Channels
     ********************************************************************/

    // Title row
    info += QString("<TR><TD CLASS='subhi'>%1</TD>").arg(tr("Channel"));
    info += QString("<TD CLASS='subhi'>%1</TD>").arg(tr("DMX"));
    info += QString("<TD CLASS='subhi'>%1</TD></TR>").arg(tr("Name"));

    // Fill table with the fixture's channels
    for (quint32 ch = 0; ch < channels();	ch++)
    {
        QString chInfo("<TR><TD>%1</TD><TD>%2</TD><TD>%3</TD></TR>");
        info += chInfo.arg(ch + 1).arg(address() + ch + 1)
                .arg(channel(ch)->name());
    }

    /********************************************************************
     * Extended device information for non-dimmers
     ********************************************************************/

    if (isDimmer() == false)
    {
        QLCPhysical physical = m_fixtureMode->physical();
        info += title.arg(tr("Physical"));

        float mmInch = 0.0393700787;
        float kgLbs = 2.20462262;
        QString mm("%1mm (%2\")");
        QString kg("%1kg (%2 lbs)");
        QString W("%1W");
        info += genInfo.arg(tr("Width")).arg(mm.arg(physical.width()))
                                        .arg(physical.width() * mmInch, 0, 'g', 4);
        info += genInfo.arg(tr("Height")).arg(mm.arg(physical.height()))
                                         .arg(physical.height() * mmInch, 0, 'g', 4);
        info += genInfo.arg(tr("Depth")).arg(mm.arg(physical.depth()))
                                        .arg(physical.depth() * mmInch, 0, 'g', 4);
        info += genInfo.arg(tr("Weight")).arg(kg.arg(physical.weight()))
                                         .arg(physical.weight() * kgLbs, 0, 'g', 4);
        info += genInfo.arg(tr("Power consumption")).arg(W.arg(physical.powerConsumption()));
        info += genInfo.arg(tr("DMX Connector")).arg(physical.dmxConnector());

        // Bulb
        QString K("%1K");
        QString lm("%1lm");
        info += subTitle.arg(tr("Bulb"));
        info += genInfo.arg(tr("Type")).arg(physical.bulbType());
        info += genInfo.arg(tr("Luminous Flux")).arg(lm.arg(physical.bulbLumens()));
        info += genInfo.arg(tr("Colour Temperature")).arg(K.arg(physical.bulbColourTemperature()));

        // Lens
        QString angle1("%1&deg;");
        QString angle2("%1&deg; &ndash; %2&deg;");

        info += subTitle.arg(tr("Lens"));
        info += genInfo.arg(tr("Name")).arg(physical.lensName());

        if (physical.lensDegreesMin() == physical.lensDegreesMax())
        {
            info += genInfo.arg(tr("Beam Angle"))
                .arg(angle1.arg(physical.lensDegreesMin()));
        }
        else
        {
            info += genInfo.arg(tr("Beam Angle"))
                .arg(angle2.arg(physical.lensDegreesMin())
                .arg(physical.lensDegreesMax()));
        }


        // Focus
        QString range("%1&deg;");
        info += subTitle.arg(tr("Focus"));
        info += genInfo.arg(tr("Type")).arg(physical.focusType());
        info += genInfo.arg(tr("Pan Range")).arg(range.arg(physical.focusPanMax()));
        info += genInfo.arg(tr("Tilt Range")).arg(range.arg(physical.focusTiltMax()));
    }

    // HTML document & table closure
    info += "</TABLE>";

    if (isDimmer() == false)
    {
        info += "<HR>";
        info += "<DIV CLASS='author' ALIGN='right'>";
        info += tr("Fixture definition author: ") + fixtureDef()->author();
        info += "</DIV>";
    }

    return info;
}
Ejemplo n.º 4
0
const Matrix &
PDeltaCrdTransf2d::getGlobalStiffMatrix(const Matrix &kb, const Vector &pb)
{
    static double kl[6][6];
    static double tmp[6][6];
    double oneOverL = 1.0/L;
    
    // Basic stiffness
    double kb00, kb01, kb02, kb10, kb11, kb12, kb20, kb21, kb22;
    kb00 = kb(0,0);		kb01 = kb(0,1);		kb02 = kb(0,2);
    kb10 = kb(1,0);		kb11 = kb(1,1);		kb12 = kb(1,2);
    kb20 = kb(2,0);		kb21 = kb(2,1);		kb22 = kb(2,2);
    
    // Transform basic stiffness to local system
    kl[0][0] =  kb00;
    kl[1][0] = -oneOverL*(kb10+kb20);
    kl[2][0] = -kb10;
    kl[3][0] = -kb00;
    kl[4][0] = -kl[1][0];
    kl[5][0] = -kb20;
    
    kl[0][1] = -oneOverL*(kb01+kb02);
    kl[1][1] =  oneOverL*oneOverL*(kb11+kb12+kb21+kb22);
    kl[2][1] =  oneOverL*(kb11+kb12);
    kl[3][1] = -kl[0][1];
    kl[4][1] = -kl[1][1];
    kl[5][1] =  oneOverL*(kb21+kb22);
    
    kl[0][2] = -kb01;
    kl[1][2] =  oneOverL*(kb11+kb21);
    kl[2][2] =  kb11;
    kl[3][2] =  kb01;
    kl[4][2] = -kl[1][2];
    kl[5][2] =  kb21;
    
    kl[0][3] = -kl[0][0];
    kl[1][3] = -kl[1][0];
    kl[2][3] = -kl[2][0];
    kl[3][3] = -kl[3][0];
    kl[4][3] = -kl[4][0];
    kl[5][3] = -kl[5][0];
    
    kl[0][4] = -kl[0][1];
    kl[1][4] = -kl[1][1];
    kl[2][4] = -kl[2][1];
    kl[3][4] = -kl[3][1];
    kl[4][4] = -kl[4][1];
    kl[5][4] = -kl[5][1];
    
    kl[0][5] = -kb02;
    kl[1][5] =  oneOverL*(kb12+kb22);
    kl[2][5] =  kb12;
    kl[3][5] =  kb02;
    kl[4][5] = -kl[1][5];
    kl[5][5] =  kb22;
    
    // Include geometric stiffness effects in local system
    double NoverL = pb(0)*oneOverL;
    kl[1][1] += NoverL;
    kl[4][4] += NoverL;
    kl[1][4] -= NoverL;
    kl[4][1] -= NoverL;
    
    double t02 = 0.0;
    double t12 = 0.0;
    double t35 = 0.0;
    double t45 = 0.0;
    
    if (nodeIOffset != 0) {
        t02 = -cosTheta*nodeIOffset[1] + sinTheta*nodeIOffset[0];
        t12 =  sinTheta*nodeIOffset[1] + cosTheta*nodeIOffset[0];
    }
    
    if (nodeJOffset != 0) {
        t35 = -cosTheta*nodeJOffset[1] + sinTheta*nodeJOffset[0];
        t45 =  sinTheta*nodeJOffset[1] + cosTheta*nodeJOffset[0];
    }
    
    // Now transform from local to global ... compute kl*T
    tmp[0][0] = kl[0][0]*cosTheta - kl[0][1]*sinTheta;
    tmp[1][0] = kl[1][0]*cosTheta - kl[1][1]*sinTheta;
    tmp[2][0] = kl[2][0]*cosTheta - kl[2][1]*sinTheta;
    tmp[3][0] = kl[3][0]*cosTheta - kl[3][1]*sinTheta;
    tmp[4][0] = kl[4][0]*cosTheta - kl[4][1]*sinTheta;
    tmp[5][0] = kl[5][0]*cosTheta - kl[5][1]*sinTheta;
    
    tmp[0][1] = kl[0][0]*sinTheta + kl[0][1]*cosTheta;
    tmp[1][1] = kl[1][0]*sinTheta + kl[1][1]*cosTheta;
    tmp[2][1] = kl[2][0]*sinTheta + kl[2][1]*cosTheta;
    tmp[3][1] = kl[3][0]*sinTheta + kl[3][1]*cosTheta;
    tmp[4][1] = kl[4][0]*sinTheta + kl[4][1]*cosTheta;
    tmp[5][1] = kl[5][0]*sinTheta + kl[5][1]*cosTheta;
    
    if (nodeIOffset) {
        tmp[0][2] = kl[0][0]*t02 + kl[0][1]*t12 + kl[0][2];
        tmp[1][2] = kl[1][0]*t02 + kl[1][1]*t12 + kl[1][2];
        tmp[2][2] = kl[2][0]*t02 + kl[2][1]*t12 + kl[2][2];
        tmp[3][2] = kl[3][0]*t02 + kl[3][1]*t12 + kl[3][2];
        tmp[4][2] = kl[4][0]*t02 + kl[4][1]*t12 + kl[4][2];
        tmp[5][2] = kl[5][0]*t02 + kl[5][1]*t12 + kl[5][2];
    }
    else {
        tmp[0][2] = kl[0][2];
        tmp[1][2] = kl[1][2];
        tmp[2][2] = kl[2][2];
        tmp[3][2] = kl[3][2];
        tmp[4][2] = kl[4][2];
        tmp[5][2] = kl[5][2];
    }
    
    tmp[0][3] = kl[0][3]*cosTheta - kl[0][4]*sinTheta;
    tmp[1][3] = kl[1][3]*cosTheta - kl[1][4]*sinTheta;
    tmp[2][3] = kl[2][3]*cosTheta - kl[2][4]*sinTheta;
    tmp[3][3] = kl[3][3]*cosTheta - kl[3][4]*sinTheta;
    tmp[4][3] = kl[4][3]*cosTheta - kl[4][4]*sinTheta;
    tmp[5][3] = kl[5][3]*cosTheta - kl[5][4]*sinTheta;
    
    tmp[0][4] = kl[0][3]*sinTheta + kl[0][4]*cosTheta;
    tmp[1][4] = kl[1][3]*sinTheta + kl[1][4]*cosTheta;
    tmp[2][4] = kl[2][3]*sinTheta + kl[2][4]*cosTheta;
    tmp[3][4] = kl[3][3]*sinTheta + kl[3][4]*cosTheta;
    tmp[4][4] = kl[4][3]*sinTheta + kl[4][4]*cosTheta;
    tmp[5][4] = kl[5][3]*sinTheta + kl[5][4]*cosTheta;
    
    if (nodeJOffset) {
        tmp[0][5] = kl[0][3]*t35 + kl[0][4]*t45 + kl[0][5];
        tmp[1][5] = kl[1][3]*t35 + kl[1][4]*t45 + kl[1][5];
        tmp[2][5] = kl[2][3]*t35 + kl[2][4]*t45 + kl[2][5];
        tmp[3][5] = kl[3][3]*t35 + kl[3][4]*t45 + kl[3][5];
        tmp[4][5] = kl[4][3]*t35 + kl[4][4]*t45 + kl[4][5];
        tmp[5][5] = kl[5][3]*t35 + kl[5][4]*t45 + kl[5][5];
    }
    else {
        tmp[0][5] = kl[0][5];
        tmp[1][5] = kl[1][5];
        tmp[2][5] = kl[2][5];
        tmp[3][5] = kl[3][5];
        tmp[4][5] = kl[4][5];
        tmp[5][5] = kl[5][5];
    }
    
    // Now compute T'*(kl*T)
    kg(0,0) = cosTheta*tmp[0][0] - sinTheta*tmp[1][0];
    kg(0,1) = cosTheta*tmp[0][1] - sinTheta*tmp[1][1];
    kg(0,2) = cosTheta*tmp[0][2] - sinTheta*tmp[1][2];
    kg(0,3) = cosTheta*tmp[0][3] - sinTheta*tmp[1][3];
    kg(0,4) = cosTheta*tmp[0][4] - sinTheta*tmp[1][4];
    kg(0,5) = cosTheta*tmp[0][5] - sinTheta*tmp[1][5];
    
    kg(1,0) = sinTheta*tmp[0][0] + cosTheta*tmp[1][0];
    kg(1,1) = sinTheta*tmp[0][1] + cosTheta*tmp[1][1];
    kg(1,2) = sinTheta*tmp[0][2] + cosTheta*tmp[1][2];
    kg(1,3) = sinTheta*tmp[0][3] + cosTheta*tmp[1][3];
    kg(1,4) = sinTheta*tmp[0][4] + cosTheta*tmp[1][4];
    kg(1,5) = sinTheta*tmp[0][5] + cosTheta*tmp[1][5];
    
    if (nodeIOffset) {
        kg(2,0) = t02*tmp[0][0] + t12*tmp[1][0] + tmp[2][0];
        kg(2,1) = t02*tmp[0][1] + t12*tmp[1][1] + tmp[2][1];
        kg(2,2) = t02*tmp[0][2] + t12*tmp[1][2] + tmp[2][2];
        kg(2,3) = t02*tmp[0][3] + t12*tmp[1][3] + tmp[2][3];
        kg(2,4) = t02*tmp[0][4] + t12*tmp[1][4] + tmp[2][4];
        kg(2,5) = t02*tmp[0][5] + t12*tmp[1][5] + tmp[2][5];
    }
    else {
        kg(2,0) = tmp[2][0];
        kg(2,1) = tmp[2][1];
        kg(2,2) = tmp[2][2];
        kg(2,3) = tmp[2][3];
        kg(2,4) = tmp[2][4];
        kg(2,5) = tmp[2][5];
    }
    
    kg(3,0) = cosTheta*tmp[3][0] - sinTheta*tmp[4][0];
    kg(3,1) = cosTheta*tmp[3][1] - sinTheta*tmp[4][1];
    kg(3,2) = cosTheta*tmp[3][2] - sinTheta*tmp[4][2];
    kg(3,3) = cosTheta*tmp[3][3] - sinTheta*tmp[4][3];
    kg(3,4) = cosTheta*tmp[3][4] - sinTheta*tmp[4][4];
    kg(3,5) = cosTheta*tmp[3][5] - sinTheta*tmp[4][5];
    
    kg(4,0) = sinTheta*tmp[3][0] + cosTheta*tmp[4][0];
    kg(4,1) = sinTheta*tmp[3][1] + cosTheta*tmp[4][1];
    kg(4,2) = sinTheta*tmp[3][2] + cosTheta*tmp[4][2];
    kg(4,3) = sinTheta*tmp[3][3] + cosTheta*tmp[4][3];
    kg(4,4) = sinTheta*tmp[3][4] + cosTheta*tmp[4][4];
    kg(4,5) = sinTheta*tmp[3][5] + cosTheta*tmp[4][5];
    
    if (nodeJOffset) {
        kg(5,0) = t35*tmp[3][0] + t45*tmp[4][0] + tmp[5][0];
        kg(5,1) = t35*tmp[3][1] + t45*tmp[4][1] + tmp[5][1];
        kg(5,2) = t35*tmp[3][2] + t45*tmp[4][2] + tmp[5][2];
        kg(5,3) = t35*tmp[3][3] + t45*tmp[4][3] + tmp[5][3];
        kg(5,4) = t35*tmp[3][4] + t45*tmp[4][4] + tmp[5][4];
        kg(5,5) = t35*tmp[3][5] + t45*tmp[4][5] + tmp[5][5];
    }
    else {
        kg(5,0) = tmp[5][0];
        kg(5,1) = tmp[5][1];
        kg(5,2) = tmp[5][2];
        kg(5,3) = tmp[5][3];
        kg(5,4) = tmp[5][4];
        kg(5,5) = tmp[5][5];
    }
    
    return kg;
}