int AdaptiveSparseGrid::IsRefine(double* value, AdaptiveARRAY<int>* ix, AdaptiveARRAY<int>* iy) { if ( type == 1) { double mul = 1.0; for ( int j = 1; j <= dim; j++) { mul *= LinearBasisVolumeIntegral((*ix)(j)); } double sum1 = 0.0, sum2 = 0.0; for ( int j = 0; j < TotalDof; j++) { if ( currentvalue(j + 1) != 0) { sum1 += pow(mul * value[j], 2.0); sum2 += pow(currentvalue(j + 1), 2.0); } } double error; if ( sum2 <= 1e-15 ) { return 1; } else { error = sqrt(sum1) / sqrt(sum2); if ( error >= epsilon ) { return 1; } else { return 0; } } } else { double maximum = 0.0; for ( int i = 0 ; i < TotalDof; i++) { if ( fabs(value[i]) > maximum ) { maximum = fabs(value[i]); } } if ( maximum >= epsilon ) { return 1; } else { return 0; } } }
void CustomFunctionsPanel::populateFuncParamArmTCB(QComboBox *b, char * value, const QSet<QString> ¶msList) { b->clear(); b->addItem("----"); bool added = false; QString currentvalue(value); // Convert set into list and sort it alphabetically case insensitive QStringList list = QStringList::fromSet(paramsList); qSort(list.begin(), list.end(), caseInsensitiveLessThan); foreach (QString entry, list) { b->addItem(entry); if (entry==currentvalue) { b->setCurrentIndex(b->count()-1); added = true; } }