// update decoded track and timing for CT Raw dump format int CCapsImage::UpdateDump() { PDISKTRACKINFO pti = di.pdt; // get actual revolution number, restart after the last revolution int rev = dii.nextrev % pti->rawtrackcnt; // true if all the available revolutions should be returned int allrev = (pti->trackcnt == pti->rawtrackcnt); // if all revolutions used the used data must be revolution#0 if (allrev) rev = 0; // save the real revolution number dii.realrev = rev; // set data buffer pti->trackbuf = pti->trackdata[rev]; pti->tracklen = allrev ? pti->rawlen : pti->tracksize[rev]; pti->trackbc = pti->tracklen << 3; pti->singletrackbc = pti->trackbc; // timing information is the same size as the current data, rev#0 for all revolutions pti->timecnt = pti->tracksize[rev]; // the real size of the sampled timings int rawsize = pti->rawtimecnt; // the amount of timing to be copied track size or real size - whichever is shorter int tsize = min(rawsize, pti->timecnt); // copy the timing memcpy(pti->timebuf, pti->rawtimebuf, tsize*sizeof(UDWORD)); // If sampled timing is shorter, fill the remaining area with 1000, default value // This does not change the average, since the previous data adds up to an average of 1000 int pos; for (pos = tsize; pos < pti->timecnt; pos++) { pti->timebuf[pos] = 1000; } // reset alternate density pti->timebuf[pos] = 0; // density map conversion if (di.flag & DI_LOCK_DENALT) ConvertDensity(pti); UpdateImage(rev); return imgeOk; }
void StructureMgrSingleton::UpdateStructUnit( int new_unit ) { Vehicle* veh = VehicleMgr.GetVehicle(); if ( veh ) { // Update FeaMaterial Units for ( size_t i = 0; i < m_FeaMaterialVec.size(); i++ ) { int density_unit_new, density_unit_old, pressure_unit_new, pressure_unit_old; switch ( new_unit ) { case vsp::SI_UNIT: density_unit_new = vsp::RHO_UNIT_KG_M3; pressure_unit_new = vsp::PRES_UNIT_PA; break; case vsp::CGS_UNIT: density_unit_new = vsp::RHO_UNIT_G_CM3; pressure_unit_new = vsp::PRES_UNIT_BA; break; case vsp::MPA_UNIT: density_unit_new = vsp::RHO_UNIT_TONNE_MM3; pressure_unit_new = vsp::PRES_UNIT_MPA; break; case vsp::BFT_UNIT: density_unit_new = vsp::RHO_UNIT_SLUG_FT3; pressure_unit_new = vsp::PRES_UNIT_PSF; break; case vsp::BIN_UNIT: density_unit_new = vsp::RHO_UNIT_LBFSEC2_IN4; pressure_unit_new = vsp::PRES_UNIT_PSI; break; } switch ( (int)veh->m_StructUnit.GetLastVal() ) { case vsp::SI_UNIT: density_unit_old = vsp::RHO_UNIT_KG_M3; pressure_unit_old = vsp::PRES_UNIT_PA; break; case vsp::CGS_UNIT: density_unit_old = vsp::RHO_UNIT_G_CM3; pressure_unit_old = vsp::PRES_UNIT_BA; break; case vsp::MPA_UNIT: density_unit_old = vsp::RHO_UNIT_TONNE_MM3; pressure_unit_old = vsp::PRES_UNIT_MPA; break; case vsp::BFT_UNIT: density_unit_old = vsp::RHO_UNIT_SLUG_FT3; pressure_unit_old = vsp::PRES_UNIT_PSF; break; case vsp::BIN_UNIT: density_unit_old = vsp::RHO_UNIT_LBFSEC2_IN4; pressure_unit_old = vsp::PRES_UNIT_PSI; break; } m_FeaMaterialVec[i]->m_MassDensity.Set( ConvertDensity( m_FeaMaterialVec[i]->m_MassDensity.Get(), density_unit_old, density_unit_new ) ); m_FeaMaterialVec[i]->m_ElasticModulus.Set( ConvertPressure( m_FeaMaterialVec[i]->m_ElasticModulus.Get(), pressure_unit_old, pressure_unit_new ) ); m_FeaMaterialVec[i]->m_ThermalExpanCoeff.Set( ConvertThermalExpanCoeff( m_FeaMaterialVec[i]->m_ThermalExpanCoeff.Get(), (int)veh->m_StructUnit.GetLastVal(), new_unit ) ); } // Update FeaProperty Units for ( size_t i = 0; i < m_FeaPropertyVec.size(); i++ ) { int length_unit_new, length_unit_old; switch ( new_unit ) { case vsp::SI_UNIT: length_unit_new = vsp::LEN_M; break; case vsp::CGS_UNIT: length_unit_new = vsp::LEN_CM; break; case vsp::MPA_UNIT: length_unit_new = vsp::LEN_MM; break; case vsp::BFT_UNIT: length_unit_new = vsp::LEN_FT; break; case vsp::BIN_UNIT: length_unit_new = vsp::LEN_IN; break; } switch ( (int)veh->m_StructUnit.GetLastVal() ) { case vsp::SI_UNIT: length_unit_old = vsp::LEN_M; break; case vsp::CGS_UNIT: length_unit_old = vsp::LEN_CM; break; case vsp::MPA_UNIT: length_unit_old = vsp::LEN_MM; break; case vsp::BFT_UNIT: length_unit_old = vsp::LEN_FT; break; case vsp::BIN_UNIT: length_unit_old = vsp::LEN_IN; break; } if ( m_FeaPropertyVec[i]->m_FeaPropertyType() == vsp::FEA_SHELL ) { m_FeaPropertyVec[i]->m_Thickness.Set( ConvertLength( m_FeaPropertyVec[i]->m_Thickness.Get(), length_unit_old, length_unit_new ) ); } else if ( m_FeaPropertyVec[i]->m_FeaPropertyType() == vsp::FEA_BEAM ) { if ( m_FeaPropertyVec[i]->m_CrossSectType() == vsp::FEA_XSEC_GENERAL ) { m_FeaPropertyVec[i]->m_CrossSecArea.Set( ConvertLength2( m_FeaPropertyVec[i]->m_CrossSecArea.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Ixx.Set( ConvertLength4( m_FeaPropertyVec[i]->m_Ixx.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Iyy.Set( ConvertLength4( m_FeaPropertyVec[i]->m_Iyy.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Izy.Set( ConvertLength4( m_FeaPropertyVec[i]->m_Izy.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Izz.Set( ConvertLength4( m_FeaPropertyVec[i]->m_Izz.Get(), length_unit_old, length_unit_new ) ); } else { m_FeaPropertyVec[i]->m_Dim1.Set( ConvertLength( m_FeaPropertyVec[i]->m_Dim1.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Dim2.Set( ConvertLength( m_FeaPropertyVec[i]->m_Dim2.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Dim3.Set( ConvertLength( m_FeaPropertyVec[i]->m_Dim3.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Dim4.Set( ConvertLength( m_FeaPropertyVec[i]->m_Dim4.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Dim5.Set( ConvertLength( m_FeaPropertyVec[i]->m_Dim5.Get(), length_unit_old, length_unit_new ) ); m_FeaPropertyVec[i]->m_Dim6.Set( ConvertLength( m_FeaPropertyVec[i]->m_Dim6.Get(), length_unit_old, length_unit_new ) ); } } } // Update Point Mass Units vector < FeaStructure* > struct_vec = GetAllFeaStructs(); for ( size_t i = 0; i < struct_vec.size(); i++ ) { vector < FeaPart* > prt_vec = struct_vec[i]->GetFeaPartVec(); for ( size_t j = 0; j < prt_vec.size(); j++ ) { if ( prt_vec[j]->GetType() == vsp::FEA_FIX_POINT ) { FeaFixPoint* fix_pnt = dynamic_cast<FeaFixPoint*>( prt_vec[j] ); assert( fix_pnt ); if ( fix_pnt->m_FixPointMassFlag() ) { int mass_unit_new = -1; int mass_unit_old = -1; switch ( new_unit ) { case vsp::SI_UNIT: mass_unit_new = vsp::MASS_UNIT_KG; break; case vsp::CGS_UNIT: mass_unit_new = vsp::MASS_UNIT_G; break; case vsp::MPA_UNIT: mass_unit_new = vsp::MASS_UNIT_TONNE; break; case vsp::BFT_UNIT: mass_unit_new = vsp::MASS_UNIT_SLUG; break; case vsp::BIN_UNIT: mass_unit_new = vsp::MASS_LBFSEC2IN; break; } switch ( (int)veh->m_StructUnit.GetLastVal() ) { case vsp::SI_UNIT: mass_unit_old = vsp::MASS_UNIT_KG; break; case vsp::CGS_UNIT: mass_unit_old = vsp::MASS_UNIT_G; break; case vsp::MPA_UNIT: mass_unit_old = vsp::MASS_UNIT_TONNE; break; case vsp::BFT_UNIT: mass_unit_old = vsp::MASS_UNIT_SLUG; break; case vsp::BIN_UNIT: mass_unit_old = vsp::MASS_LBFSEC2IN; break; } fix_pnt->m_FixPointMass.Set( ConvertMass( fix_pnt->m_FixPointMass.Get(), mass_unit_old, mass_unit_new ) ); } } } } } }