double DLibshuff::dCalculate(int x, int y){ double sum = 0; minX = getMinX(x); if (m->control_pressed) { return sum; } minXY = getMinXY(x, y); if (m->control_pressed) { return sum; } vector<int> nx = calcN(minX); if (m->control_pressed) { return sum; } vector<int> nxy = calcN(minXY); if (m->control_pressed) { return sum; } for(int i=0;i<numDXs;i++){ float h = (nx[i] - nxy[i]) / (float) groupSizes[x]; sum += h * h * stepSize; } return sum; }
Triangle::Triangle(ngl::Vec3 _v1, ngl::Vec3 _v2, ngl::Vec3 _v3, ngl::Vec3 _n1, ngl::Vec3 _n2, ngl::Vec3 _n3): m_v1(_v1), m_v2(_v2), m_v3(_v3), m_n1(_n1), m_n2(_n2), m_n3(_n3) { calcN(); calcD(); }
SpBasis::SpBasis(double _omega, int _nMax, int _lMax) : Basis(std::string("SpBasis"), std::vector<std::string>( { "n", "l", "m", "s" })), omega(_omega), nMax(_nMax), lMax(_nMax + 1), mMax(_nMax + 1, _lMax + 1) { //Defining maximum numbers and determining basis size size = 0; for (int n = 0; n <= nMax; n++) { // Here to specify lMax dependency on n lMax(n) = _lMax; for (int l = 0; l <= lMax(n); l++) { mMax(n, l) = l; size += 2 * l + 1; } } //Considering spin size *= 2; //Filling the quantum numbers for each state qNumbers = arma::imat(size, qNumSize); int i = 0; for (int s = -1; s <= 1; s += 2) for (int n = 0; n <= nMax; n++) for (int l = 0; l <= lMax(n); l++) for (int m = -mMax(n, l); m <= mMax(n, l); m++) { qNumbers(i, 0) = n; qNumbers(i, 1) = l; qNumbers(i, 2) = m; qNumbers(i, 3) = s; i++; } //Calculating N normalization coefficients nu = NUCLEON_MASS * omega / 2 / HBAR; N = arma::zeros<arma::vec>(size); calcN(); }
void CalcKinCharacteristics::run() { showParams(); core::Code code; core::InternalGearRatios k; core::GearSetTypes types; core::FakeItem fake; std::vector<core::IIOItem*> containers; containers.push_back( &code ); containers.push_back( &k ); containers.push_back( &types ); containers.push_back( &fake ); while ( core::Singletons::getInstance()->getLoaderFromFile()->load( containers, core::IOFileManager::eOutputFileType::KIN_SLOW ) ) { Characteristics ch; ch._tooth = calcZ(k, types); ch._torque = calcM( code, k ); ch._angVelocity = calcW( code, k, ch._tooth ); ch._power = calcN( ch._angVelocity, ch._torque ); ch._kpdZacStepen = calcKpdZacStepen( k, ch._angVelocity, ch._power ); ch._kpdTorque = calcMh( code, k, ch._kpdZacStepen ); ch._qualityCriterias = calcQualityCriterias( ch._kpdTorque, ch._angVelocity ); printCharacteristics( code, ch ); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile( NS_CORE IOFileManager::eOutputFileType::RESULT, code ); NS_CORE GearBoxWithChanger gb( code ); gb.createChainsForAllgears(); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile( NS_CORE IOFileManager::eOutputFileType::RESULT, gb ); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile( NS_CORE IOFileManager::eOutputFileType::RESULT, types ); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile( NS_CORE IOFileManager::eOutputFileType::RESULT, fake ); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile( NS_CORE IOFileManager::eOutputFileType::RESULT, k ); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile( NS_CORE IOFileManager::eOutputFileType::RESULT, ch ); NS_CORE Singletons::getInstance()->getIOFileManager()->writeToFile(NS_CORE IOFileManager::eOutputFileType::RESULT, NS_CORE IOFileManager::end); m_characteristics.push_back( ch ); } }