QMap<QString, QVariant> SimpleMessageStyle::styleInfo(const QString &AStylePath) { QMap<QString, QVariant> info; QFile file(AStylePath+"/Info.plist"); if (!AStylePath.isEmpty() && file.open(QFile::ReadOnly)) { QString xmlError; QDomDocument doc; if (doc.setContent(&file,true,&xmlError)) { QDomElement elem = doc.documentElement().firstChildElement("dict").firstChildElement("key"); while (!elem.isNull()) { QString key = elem.text(); if (!key.isEmpty()) { elem = elem.nextSiblingElement(); if (elem.tagName() == "string") info.insert(key,elem.text()); else if (elem.tagName() == "integer") info.insert(key,elem.text().toInt()); else if (elem.tagName() == "true") info.insert(key,true); else if (elem.tagName() == "false") info.insert(key,false); } elem = elem.nextSiblingElement("key"); } } else { LOG_ERROR(QString("Failed to load simple style info from file content: %1").arg(xmlError)); } } else if (AStylePath.isEmpty()) { REPORT_ERROR("Failed to get simple style info: Style path is empty"); } else { LOG_ERROR(QString("Failed to load simple style info from file: %1").arg(file.errorString())); } return info; }
void GeostrophicRelation::run(const SingleLevelField &ghs, const TimeLevelIndex &timeIdx, const Field &gd, Field &u, Field &v) { const Mesh &mesh = static_cast<const Mesh&>(ghs.getMesh()); const Domain &domain = static_cast<const Domain&>(mesh.getDomain()); double Re = domain.getRadius(); int js = 0, jn = mesh.getNumGrid(1, FULL)-1; // ------------------------------------------------------------------------- if (u.getStaggerLocation() == CENTER && v.getStaggerLocation() == CENTER) { double dlon = mesh.getGridInterval(0, FULL, 0); double dlat = mesh.getGridInterval(1, FULL, 1); // assume equidistant grids // normal grids for (int j = 1; j < mesh.getNumGrid(1, FULL)-1; ++j) { double cosLat = mesh.getCosLat(FULL, j); double f = 2*OMEGA*mesh.getSinLat(FULL, j); for (int i = 0; i < mesh.getNumGrid(0, FULL); ++i) { if (fabs(f) <= 1.0e-15) { u(timeIdx, i, j) = 0; v(timeIdx, i, j) = 0; } else { double dgdLon = gd(timeIdx, i+1, j)-gd(timeIdx, i-1, j); double dgdLat = gd(timeIdx, i, j+1)-gd(timeIdx, i, j-1); double dghsLon = ghs(i+1, j)-ghs(i-1, j); double dghsLat = ghs(i, j+1)-ghs(i, j-1); u(timeIdx, i, j) = -(dgdLat+dghsLat)/(f*Re*2*dlat); v(timeIdx, i, j) = (dgdLon+dghsLon)/(f*Re*cosLat*2*dlon); } } } // pole grids for (int i = 0; i < mesh.getNumGrid(0, FULL); ++i) { u(timeIdx, i, js) = 0; u(timeIdx, i, jn) = 0; v(timeIdx, i, js) = 0; v(timeIdx, i, jn) = 0; } } else if (u.getStaggerLocation() == X_FACE && v.getStaggerLocation() == Y_FACE) { REPORT_ERROR("Under construction!"); } // ------------------------------------------------------------------------- u.applyBndCond(timeIdx); v.applyBndCond(timeIdx); }
acpi_status acpi_ds_scope_stack_push ( acpi_namespace_node *node, acpi_object_type8 type, acpi_walk_state *walk_state) { acpi_generic_state *scope_info; FUNCTION_TRACE ("Ds_scope_stack_push"); if (!node) { /* Invalid scope */ REPORT_ERROR (("Ds_scope_stack_push: null scope passed\n")); return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Make sure object type is valid */ if (!acpi_ex_validate_object_type (type)) { REPORT_WARNING (("Ds_scope_stack_push: type code out of range\n")); } /* Allocate a new scope object */ scope_info = acpi_ut_create_generic_state (); if (!scope_info) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Init new scope object */ scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; scope_info->scope.node = node; scope_info->common.value = (u16) type; /* Push new scope object onto stack */ acpi_ut_push_generic_state (&walk_state->scope_info, scope_info); return_ACPI_STATUS (AE_OK); }
extern "C" void gxpport_loadimmutable_from_platformbuffer (unsigned char* srcBuffer, int length, jboolean isStatic, int* ret_imgWidth, int* ret_imgHeight, gxpport_image_native_handle *newImmutableImagePtr, gxutl_native_image_error_codes* creationErrorPtr) { int rscSize; gxutl_image_buffer_raw* dataBuffer = (gxutl_image_buffer_raw*)srcBuffer; /* Check resource limit */ rscSize = ImgRegionRscSize(NULL, dataBuffer->width, dataBuffer->height); if (midpCheckResourceLimit(RSC_TYPE_IMAGE_IMMUT, rscSize) == 0) { /* Exceed Resource limit */ *creationErrorPtr = GXUTL_NATIVE_IMAGE_RESOURCE_LIMIT; return; } _Platform_ImmutableImage* immutableImage = (_Platform_ImmutableImage*)midpMalloc(sizeof(_Platform_ImmutableImage)); if (immutableImage == NULL) { *creationErrorPtr = GXUTL_NATIVE_IMAGE_OUT_OF_MEMORY_ERROR; return; } if (!load_raw(&immutableImage->qimage, dataBuffer, length, isStatic, ret_imgWidth, ret_imgHeight)) { midpFree(immutableImage); *creationErrorPtr = GXUTL_NATIVE_IMAGE_DECODING_ERROR; return; } /* Image creation succeeds */ if (midpIncResourceCount(RSC_TYPE_IMAGE_IMMUT, rscSize) == 0) { REPORT_ERROR(LC_LOWUI, "Error in updating resource limit" " for Immutable image"); } immutableImage->marker = 7; immutableImage->qpixmap = NULL; *newImmutableImagePtr = immutableImage; *creationErrorPtr = GXUTL_NATIVE_IMAGE_NO_ERROR; }
//init metadatas virtual void SetUp() { try { //get example images/staks if (chdir(((String)(getXmippPath() + (String)"/resources/test")).c_str())==-1) REPORT_ERROR(ERR_UNCLASSIFIED,"Could not change directory"); // testBaseName = xmippPath + "/resources/test"; imageName = "image/singleImage.spi"; } catch (XmippError &xe) { std::cerr << xe; exit(-1); } }
void FM_PCD_SetPrsStatistics(t_Handle h_FmPcd, bool enable) { t_FmPcd *p_FmPcd = (t_FmPcd*)h_FmPcd; SANITY_CHECK_RETURN(p_FmPcd, E_INVALID_HANDLE); SANITY_CHECK_RETURN(p_FmPcd->p_FmPcdPrs, E_INVALID_HANDLE); if(p_FmPcd->guestId != NCSW_MASTER_ID) { REPORT_ERROR(MAJOR, E_NOT_SUPPORTED, ("FM_PCD_SetPrsStatistics - guest mode!")); return; } if(enable) WRITE_UINT32(p_FmPcd->p_FmPcdPrs->p_FmPcdPrsRegs->ppsc, FM_PCD_PRS_PPSC_ALL_PORTS); else WRITE_UINT32(p_FmPcd->p_FmPcdPrs->p_FmPcdPrsRegs->ppsc, 0); }
// Get number from file .................................................... size_t FileName::getPrefixNumber(size_t pos) const { size_t first = rfind(AT); size_t result = ALL_IMAGES; if (first != npos) { std::vector<String> prefixes; size_t nPref = splitString(substr(0, first),",",prefixes, false); if (pos > nPref-1) REPORT_ERROR(ERR_ARG_INCORRECT, formatString("getPrefixNumber: Selected %lu position greater than %lu positions \n" " detected in %s filename.",pos+1, nPref, this->c_str())); if (isdigit(prefixes[pos].at(0))) result = textToSizeT(prefixes[pos].c_str()); } return result; }
void EditProfilesDialog::onRenameProfileClicked() { QListWidgetItem *listItem = ui.lstProfiles->selectedItems().value(0); if (listItem) { bool ok; QString profile = listItem->text(); QString newname = QInputDialog::getText(this,tr("Rename Profile"),tr("Enter new name for profile:"),QLineEdit::Normal,QString::null,&ok); if (ok && !newname.isEmpty()) { if (!FOptionsManager->renameProfile(profile, newname)) { REPORT_ERROR("Failed to rename profile"); QMessageBox::warning(this,tr("Error"),tr("Failed to rename profile")); } } } }
void FileLock::unlock() { if (islocked) { #ifdef __MINGW32__ HANDLE hFile = (HANDLE)_get_osfhandle(filenum); DWORD dwLastPos = SetFilePointer(hFile, 0, NULL, FILE_END); if (UnlockFile(hFile, 0, 0, dwLastPos, 0) != NULL) REPORT_ERROR(ERR_IO_LOCKED,"File cannot be unlocked."); #else fl.l_type = F_UNLCK; fcntl(filenum, F_SETLK, &fl); #endif islocked = false; } }
void read(int argc, char **argv) { parser.setCommandLine(argc, argv); int general_section = parser.addSection("General options"); fn_star = parser.getOption("--i", "Input STAR file with the images (as rlnImageName) to be saved in a stack"); fn_root = parser.getOption("--o", "Output rootname","output"); do_spider = parser.checkOption("--spider_format", "Write out in SPIDER stack format (by default MRC stack format)"); do_split_per_micrograph = parser.checkOption("--split_per_micrograph", "Write out separate stacks for each micrograph (needs rlnMicrographName in STAR file)"); do_apply_trans = parser.checkOption("--apply_transformation", "Apply the inplane-transformations (needs _rlnOriginX/Y and _rlnAnglePsi in STAR file)"); fn_ext = (do_spider) ? ".spi" : ".mrcs"; // Check for errors in the command-line option if (parser.checkForErrors()) REPORT_ERROR("Errors encountered on the command line, exiting..."); }
acpi_status acpi_ut_resolve_package_references ( acpi_operand_object *obj_desc) { u32 count; acpi_operand_object *sub_object; FUNCTION_TRACE ("Ut_resolve_package_references"); if (obj_desc->common.type != ACPI_TYPE_PACKAGE) { /* The object must be a package */ REPORT_ERROR (("Must resolve Package Refs on a Package\n")); return_ACPI_STATUS(AE_ERROR); } /* * TBD: what about nested packages? */ for (count = 0; count < obj_desc->package.count; count++) { sub_object = obj_desc->package.elements[count]; if (sub_object->common.type == INTERNAL_TYPE_REFERENCE) { if (sub_object->reference.opcode == AML_ZERO_OP) { sub_object->common.type = ACPI_TYPE_INTEGER; sub_object->integer.value = 0; } else if (sub_object->reference.opcode == AML_ONE_OP) { sub_object->common.type = ACPI_TYPE_INTEGER; sub_object->integer.value = 1; } else if (sub_object->reference.opcode == AML_ONES_OP) { sub_object->common.type = ACPI_TYPE_INTEGER; sub_object->integer.value = ACPI_INTEGER_MAX; } } } return_ACPI_STATUS(AE_OK); }
/** * A notification function for telling Java to perform installation of * a MIDlet with parameters * * If the given url is of the form http://www.sun.com/a/b/c/d.jad then * java will start a graphical installer will download the MIDlet * fom the internet. * If the given url is a file url (see below, file:///a/b/c/d.jar or * file:///a/b/c/d/jad) installation will be performed * in the backgroudn without launching the graphic installer application * * * @param url of MIDlet to install, can be either one of the following * 1. A full path to the jar file, of the following form file:///a/b/c/d.jar * 2. A full path to the JAD file, of the following form file:///a/b/c/d.jad * 3. An http url of jad file, of the following form, * http://www.sun.com/a/b/c/d.jad * @param silentInstall install the MIDlet without user interaction * @param forceUpdate install the MIDlet even if it already exist regardless * of version */ void javanotify_install_midlet_wparams(const char* httpUrl, int silentInstall, int forceUpdate) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; int length; REPORT_INFO2(LC_CORE,"javanotify_install_midlet_wparams() >> " "httpUrl = %s, silentInstall = %d\n", httpUrl, silentInstall); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.installer.GraphicalInstaller"; if (silentInstall == 1) { if (forceUpdate == 1) { argv[argc++] = "FU"; } else { argv[argc++] = "FI"; } } else { argv[argc++] = "I"; } length = strlen(httpUrl); if (length >= BINARY_BUFFER_MAX_LEN) { REPORT_ERROR(LC_AMS, "javanotify_install_midlet_wparams(): httpUrl is too long"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); memcpy(urlAddress, httpUrl, length); argv[argc++] = urlAddress; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/* Value of line integral through Kaiser-Bessel radial function (n >=2 dimensions) at distance s from center of function. Parameter m = 0, 1, or 2. */ double kaiser_proj(double s, double a, double alpha, int m) { double sda, sdas, w, arg, p; sda = s / a; sdas = sda * sda; w = 1.0 - sdas; if (w > 1.0e-10) { arg = alpha * sqrt(w); if (m == 0) { if (alpha == 0.0) p = 2.0 * a * sqrt(w); else p = (2.0 * a / alpha) * sinh(arg) / bessi0(alpha); } else if (m == 1) { if (alpha == 0.0) p = 2.0 * a * w * sqrt(w) * (2.0 / 3.0); else p = (2.0 * a / alpha) * sqrt(w) * (cosh(arg) - sinh(arg) / arg) / bessi1(alpha); } else if (m == 2) { if (alpha == 0.0) p = 2.0 * a * w * w * sqrt(w) * (8.0 / 15.0); else p = (2.0 * a / alpha) * w * ((3.0 / (arg * arg) + 1.0) * sinh(arg) - (3.0 / arg) * cosh(arg)) / bessi2(alpha); } else REPORT_ERROR(ERR_VALUE_INCORRECT, "m out of range in kaiser_proj()"); } else p = 0.0; return p; }
// Produce side info ===================================================== void ProgClassifyCL2DCore::produceSideInfo() { // Get maximum CL2D level maxLevel=0; FileName fnLevel; do fnLevel=formatString("%s/level_%02d/%s_classes.xmd",fnODir.c_str(),maxLevel++,fnRoot.c_str()); while (fnLevel.exists()); maxLevel-=2; if (maxLevel==-1) REPORT_ERROR(ERR_ARG_MISSING,"Cannot find any CL2D analysis in the directory given"); // Read all the blocks available in all MetaData StringVector blocksAux; CL2DBlock block; for (int level=0; level<=maxLevel; level++) { fnLevel=formatString("%s/level_%02d/%s_classes.xmd",fnODir.c_str(),level,fnRoot.c_str()); getBlocksInMetaDataFile(fnLevel,blocksAux); block.level=level; block.fnLevel=fnLevel; block.fnLevelCore=fnLevel.insertBeforeExtension("_core"); for (size_t i=0; i<blocksAux.size(); i++) { if (blocksAux[i].find("class")!=std::string::npos && blocksAux[i].find("images")!=std::string::npos) { block.block=blocksAux[i]; blocks.push_back(block); } } } // Create a task file distributor for all blocks size_t Nblocks=blocks.size(); taskDistributor=new MpiTaskDistributor(Nblocks,1,node); // Get image dimensions if (Nblocks>0) { size_t Zdim, Ndim; getImageSizeFromFilename(blocks[0].block+"@"+blocks[0].fnLevel,Xdim,Ydim,Zdim,Ndim); } }
STATUS DbgSetRopFlag( VOID ) { ERRORINFO err; /* set the ROP flag */ bRopDetected = TRUE; /* init log path */ if ( InitLogPath( MCEDP_REGCONFIG.LOG_PATH, MAX_PATH ) != MCEDP_STATUS_SUCCESS ) { REPORT_ERROR("InitLogPath()", &err); return MCEDP_STATUS_GENERAL_FAIL; } return MCEDP_STATUS_SHELLCODE_FLAG_SET; }
/** * Refreshs screen with offscreen buffer content and * returns new offscreen buffer for painting */ char *directfbapp_refresh(int x1, int y1, int x2, int y2) { int pitch; char *dst; int width; DFBRegion reg; /* DEBUG: to be deleted after debugging */ if (x1 < 0 || x2 < 0 || y1 < 0 || y2 < 0 || x1 > screen_width || x2 > screen_width || y1 > screen_height || y2 > screen_height) { char b[50]; sprintf(b, "%d %d %d %d", x1, x2, y1, y2); REPORT_ERROR1(LC_LOWUI, "Invalid rectangle for refresh: %s", b); // TODO: Should be fixed to return the current back buffer return NULL; } if (x1 >= x2) { width = sizeof(gxj_pixel_type); x2 = x1 + 1; } else { width = (x2 - x1) * sizeof(gxj_pixel_type); } if (y1 >= y2) { y2 = y1 + 1; } reg.x1 = x1; reg.y1 = y1; reg.x2 = x2; reg.y2 = y2; DFBCHECK(screen->Unlock(screen)); DFBCHECK(screen->Flip(screen, ®, DSFLIP_BLIT)); DFBCHECK(screen->Lock(screen, DSLF_WRITE, (void **)(void *)&dst, &pitch)); if (pitch != (int)sizeof(gxj_pixel_type) * screen_width) { REPORT_ERROR(LC_LOWUI, "Invalid pixel format: Supports only 16-bit, 5:6:5 display"); goto dfb_err; } return dst; dfb_err: return NULL; }
size_t FileName::getFileSize() const { Stat info; if (stat(c_str(), &info)) { char cCurrentPath[FILENAME_MAX]; char *success=getcwd(cCurrentPath, sizeof(cCurrentPath)); if (success==NULL) cCurrentPath[0]='\0'; REPORT_ERROR(ERR_UNCLASSIFIED,formatString("FileName::getFileSize: Cannot get size of file %s/%s",cCurrentPath,this->c_str())); } return info.st_size; // int fd = open(c_str(), O_RDONLY); // size_t size = lseek(fd, 0, SEEK_END); // seek to end of file // close(fd); // // return size; }
void read(int argc, char **argv) { parser.setCommandLine(argc, argv); int general_section = parser.addSection("General options"); fn1 = parser.getOption("--i1", "1st input STAR file "); fn2 = parser.getOption("--i2", "2nd input STAR file "); fn_both = parser.getOption("--both", "Output STAR file with entries from both input STAR files ", ""); fn_only1 = parser.getOption("--only1", "Output STAR file with entries that only occur in the 1st input STAR files ", ""); fn_only2 = parser.getOption("--only2", "Output STAR file with entries that only occur in the 2nd input STAR files ", ""); fn_label1 = parser.getOption("--label1", "1st metadata label for the comparison (may be string, int or DOUBLE)", ""); fn_label2 = parser.getOption("--label2", "2nd metadata label for the comparison (DOUBLE only) for 2D/3D-distance)", ""); fn_label3 = parser.getOption("--label3", "3rd metadata label for the comparison (DOUBLE only) for 3D-distance)", ""); eps = textToFloat(parser.getOption("--max_dist", "Maximum distance to consider a match (for int and DOUBLE only)", "0.")); // Check for errors in the command-line option if (parser.checkForErrors()) REPORT_ERROR("Errors encountered on the command line, exiting..."); }
bool SocksStreams::appendLocalConnection(const QString &AKey) { if (!AKey.isEmpty() && !FLocalKeys.contains(AKey)) { if (FServer.isListening() || FServer.listen(QHostAddress::Any, listeningPort())) { FLocalKeys.append(AKey); return true; } else if (!FServer.isListening()) { LOG_ERROR(QString("Failed to append local socks connection, port=%1: %2").arg(listeningPort()).arg(FServer.errorString())); } } else if (AKey.isEmpty()) { REPORT_ERROR("Failed to append local socks connection: Key is empty"); } return false; }
void MetaDataTable::setObject(MetaDataContainer * data, long int objectID) { long int idx = (objectID == -1) ? current_objectID : objectID; #ifdef DEBUG_CHECKSIZES if (idx >= objects.size()) REPORT_ERROR("MetaDataTable::setObject: idx >= objects.size()"); #endif // First delete old container if it exists if (this->objects[idx]) { this->objects[idx]->clear(); delete this->objects[idx]; } this->objects[idx] = new MetaDataContainer(*data); // Set all the labels from the data MDC as active std::vector<EMDLabel>::iterator location; std::vector<EMDLabel> newlabels; newlabels = data->getLabels(); for (int i = 0; i < newlabels.size(); i++) { EMDLabel label = newlabels[i]; location = std::find(activeLabels.begin(), activeLabels.end(), label); if (location == activeLabels.end()) { activeLabels.push_back(label); // Add this label with default values to the rest of the objects in this class for (long int idx2 = 0; idx2 < objects.size(); idx2++ ) { if (idx2 != idx) objects[idx2]->addDefaultValue(label); } } } }
bool FileName::isStar1(bool failIfNotExists) const { std::ifstream infile( this->removeAllPrefixes().c_str(), std::ios_base::in); String line; if (infile.fail()) { if (failIfNotExists) REPORT_ERROR( ERR_IO_NOTEXIST, formatString("File '%s' does not exist.", this->removeAllPrefixes().c_str())); else return false; } // Search for xmipp_3, char cline[128]; infile.getline(cline, 128); infile.close(); line = cline; size_t pos = line.find(METADATA_XMIPP_STAR); return (pos != npos); // xmipp_star_1 token found }
STATIC unsigned int parse_oct(char *oct, int len, int *error) { char *save_oct = oct; int save_len = len; unsigned int result = 0; *error = 0; for ( ; len; len--, oct++) { result <<= 3; if ((*oct >= '0') && (*oct <= '7')) { result |= *oct - '0'; } else { *error = 1; REPORT_ERROR((stderr, "Invalid octal \"%.*s\"", save_len + 1, save_oct - 1)); return (0); } } return (result); }
void read(int argc, char **argv) { parser.setCommandLine(argc, argv); int general_section = parser.addSection("General options"); fn_unt = parser.getOption("--u", "Input STAR file with untilted particles"); fn_til = parser.getOption("--t", "Input STAR file with tilted particles"); fn_eps = parser.getOption("--o", "Output EPS file ", "tiltpair.eps"); fn_sym = parser.getOption("--sym", "Symmetry point group", "C1"); exp_tilt = textToFloat(parser.getOption("--exp_tilt", "Choose symmetry operator that gives tilt angle closest to this value", "0.")); exp_beta = textToFloat(parser.getOption("--exp_beta", "Choose symmetry operator that gives beta angle closest to this value", "0.")); dist_from_alpha = textToFloat(parser.getOption("--dist_from_alpha", "Direction (alpha angle) of tilt axis from which to calculate distance", "0.")); dist_from_tilt = textToFloat(parser.getOption("--dist_from_tilt", "Tilt angle from which to calculate distance", "0.")); plot_max_tilt = textToFloat(parser.getOption("--max_tilt", "Maximum tilt angle to plot in the EPS file", "90.")); plot_spot_radius = textToInteger(parser.getOption("--spot_radius", "Radius in pixels of the spots in the tiltpair plot", "3")); // Check for errors in the command-line option if (parser.checkForErrors()) REPORT_ERROR("Errors encountered on the command line, exiting..."); }
void ParticlePolisherMpi::read(int argc, char **argv) { // Define a new MpiNode node = new MpiNode(argc, argv); // First read in non-parallelisation-dependent variables ParticlePolisher::read(argc, argv); // Don't put any output to screen for mpi slaves verb = (node->isMaster()) ? verb : 0; // Possibly also read parallelisation-dependent variables here if (node->size < 2) REPORT_ERROR("ParticlePolisherMpi::read ERROR: this program needs to be run with at least two MPI processes!"); // Print out MPI info printMpiNodesMachineNames(*node); }
void EditProfilesDialog::onAddProfileClicked() { bool ok; QString profile = QInputDialog::getText(this,tr("New Profile"),tr("Enter profile name:"),QLineEdit::Normal,QString::null,&ok); if (ok && !profile.isEmpty()) { QString password = QInputDialog::getText(this,tr("Profile Password"),tr("Enter profile password:"******"Confirm Password"),tr("Reenter password:"******"Failed to create profile"); QMessageBox::warning(this,tr("Error"),tr("Could not create profile, maybe this profile already exists")); } } else if (ok) { QMessageBox::warning(this,tr("Error"),tr("Passwords did not match")); } } }
static void request_temperature_measurement(void) { uint8_t bus; for( bus = 0; bus < N_1W_BUS; bus++ ) { #ifndef OW_ONE_BUS ow_set_bus(&PINB,&PORTB,&DDRB,PB0+bus); #endif // if( DS18X20_start_meas( DS18X20_POWER_PARASITE, NULL ) != DS18X20_OK) if( DS18X20_start_meas( DS18X20_POWER_EXTERN, NULL ) != DS18X20_OK) { // Error starting temp mesaure. REPORT_ERROR(ERR_FLAG_1WIRE_START_FAULT); //ow_error_cnt++; //ow_bus_error_cnt[bus]; count_1w_bus_error( bus ); //led1_timed( 200 ); } } }
void EMDL::printDefinitions(std::ostream& out) { out << "+++ RELION MetaDataLabel (EMDL) definitions: +++" << std::endl; std::map<std::string, std::string>::const_iterator strIt; for (strIt = definitions.begin(); strIt != definitions.end(); strIt++) { out << std::setw(30) << strIt->first; if (EMDL::isInt(names[strIt->first])) out << " (int) "; else if (EMDL::isLong(names[strIt->first])) out << " (long) "; else if (EMDL::isBool(names[strIt->first])) out << " (bool) "; else if (EMDL::isDouble(names[strIt->first])) out << " (DOUBLE) "; else if (EMDL::isString(names[strIt->first])) out << " (string) "; else REPORT_ERROR("EMDL::printDefinitions: unrecognised type"); out << ": " << strIt->second << std::endl; } }
// Constructor: prefix number and filename, mainly for selfiles.. void FileName::compose(size_t no, const String &str) { if (no == ALL_IMAGES || no == (size_t) -1) REPORT_ERROR(ERR_DEBUG_TEST, "Don't compose with 0 or -1 index, now images index start at 1"); if (no != ALL_IMAGES) { size_t first = str.rfind(AT); if (first != npos) { std::vector<String> prefixes; int nPref = splitString(str.substr(0, first),",",prefixes, false); if (isalpha(prefixes[nPref-1].at(0))) formatStringFast(*this, "%06lu,%s", no, str.c_str()); } else formatStringFast(*this, "%06lu@%s", no, str.c_str()); } else *this = str; }
// Fourier ring correlation ----------------------------------------------- // from precalculated Fourier Transforms, and without sampling rate etc. void getFSC(MultidimArray< Complex >& FT1, MultidimArray< Complex >& FT2, MultidimArray< double >& fsc) { if (!FT1.sameShape(FT2)) { REPORT_ERROR("fourierShellCorrelation ERROR: MultidimArrays have different shapes!"); } MultidimArray< int > radial_count(XSIZE(FT1)); MultidimArray<double> num, den1, den2; Matrix1D<double> f(3); num.initZeros(radial_count); den1.initZeros(radial_count); den2.initZeros(radial_count); fsc.initZeros(radial_count); FOR_ALL_ELEMENTS_IN_FFTW_TRANSFORM(FT1) { int idx = ROUND(sqrt(kp * kp + ip * ip + jp * jp)); if (idx >= XSIZE(FT1)) { continue; } Complex z1 = DIRECT_A3D_ELEM(FT1, k, i, j); Complex z2 = DIRECT_A3D_ELEM(FT2, k, i, j); double absz1 = abs(z1); double absz2 = abs(z2); num(idx) += (conj(z1) * z2).real; den1(idx) += absz1 * absz1; den2(idx) += absz2 * absz2; radial_count(idx)++; } FOR_ALL_ELEMENTS_IN_ARRAY1D(fsc) { fsc(i) = num(i) / sqrt(den1(i) * den2(i)); } }
void FileLock::lock(FILE * hdlFile) { if (islocked) unlock(); if (hdlFile != NULL) this->filenum = fileno(hdlFile); #ifdef __MINGW32__ HANDLE hFile = (HANDLE)_get_osfhandle(filenum); DWORD dwLastPos = SetFilePointer(hFile, 0, NULL, FILE_END); if (LockFile(hFile, 0, 0, dwLastPos, 0) != NULL) REPORT_ERROR(ERR_IO_LOCKED,"File cannot be locked."); #else fl.l_type = F_WRLCK; fcntl(filenum, F_SETLKW, &fl); #endif islocked = true; }