//--------------------------------------------------------- void NDG3D::Normals3D() //--------------------------------------------------------- { // function [nx, ny, nz, sJ] = Normals3D() // Purpose : Compute outward pointing normals at // elements faces as well as surface Jacobians GeometricFactors3D(); // interpolate geometric factors to face nodes DMat frx=rx(Fmask,All), fsx=sx(Fmask,All), ftx=tx(Fmask,All); DMat fry=ry(Fmask,All), fsy=sy(Fmask,All), fty=ty(Fmask,All); DMat frz=rz(Fmask,All), fsz=sz(Fmask,All), ftz=tz(Fmask,All); // build normals nx.resize(4*Nfp, K); ny.resize(4*Nfp, K); nz.resize(4*Nfp, K); Index1D fid1(1,Nfp), fid2(Nfp+1,2*Nfp), fid3(2*Nfp+1,3*Nfp), fid4(3*Nfp+1,4*Nfp); // face 1 nx(fid1, All) = -ftx(fid1,All); ny(fid1, All) = -fty(fid1,All); nz(fid1, All) = -ftz(fid1,All); // face 2 nx(fid2, All) = -fsx(fid2,All); ny(fid2, All) = -fsy(fid2,All); nz(fid2, All) = -fsz(fid2,All); // face 3 nx(fid3, All) = frx(fid3,All) + fsx(fid3,All) + ftx(fid3,All); ny(fid3, All) = fry(fid3,All) + fsy(fid3,All) + fty(fid3,All); nz(fid3, All) = frz(fid3,All) + fsz(fid3,All) + ftz(fid3,All); // face 4 nx(fid4, All) = -frx(fid4,All); ny(fid4, All) = -fry(fid4,All); nz(fid4, All) = -frz(fid4,All); // normalise sJ = sqrt(sqr(nx) + sqr(ny) + sqr(nz)); nx.div_element(sJ); ny.div_element(sJ); nz.div_element(sJ); sJ.mult_element(J(Fmask, All)); //sJ=sJ.*J(Fmask(:),:); }
int FZipLump::FillCache() { if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress(); const char *buffer; if (Method == METHOD_STORED && (buffer = Owner->Reader->GetBuffer()) != NULL) { // This is an in-memory file so the cache can point directly to the file's data. Cache = const_cast<char*>(buffer) + Position; RefCount = -1; return -1; } Owner->Reader->Seek(Position, SEEK_SET); Cache = new char[LumpSize]; switch (Method) { case METHOD_STORED: { Owner->Reader->Read(Cache, LumpSize); break; } case METHOD_DEFLATE: { FileReaderZ frz(*Owner->Reader, true); frz.Read(Cache, LumpSize); break; } case METHOD_BZIP2: { FileReaderBZ2 frz(*Owner->Reader); frz.Read(Cache, LumpSize); break; } case METHOD_LZMA: { FileReaderLZMA frz(*Owner->Reader, LumpSize, true); frz.Read(Cache, LumpSize); break; } case METHOD_IMPLODE: { FZipExploder exploder; exploder.Explode((unsigned char *)Cache, LumpSize, Owner->Reader, CompressedSize, GPFlags); break; } case METHOD_SHRINK: { ShrinkLoop((unsigned char *)Cache, LumpSize, Owner->Reader, CompressedSize); break; } default: assert(0); return 0; } RefCount = 1; return 1; }
/* * The Meat of the class. * This function will populate the QTableWidget, mp_tablewidget, with * QTableWidgetItems representing the results of a query for what jobs exist on * the media name passed from the constructor stored in m_mediaName. */ void JobList::populateTable() { /* Can't do this in constructor because not neccesarily conected in constructor */ prepareFilterWidgets(); m_populated = true; Freeze frz(*mp_tableWidget); /* disable updating*/ /* Set up query */ QString query; fillQueryString(query); /* Set up the Header for the table */ QStringList headerlist = (QStringList() << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime") << tr("Job Type") << tr("Job Level") << tr("Job Files") << tr("Job Bytes") << tr("Job Status") << tr("Purged") << tr("File Set") << tr("Pool Name") << tr("First Volume") << tr("VolCount")); m_jobIdIndex = headerlist.indexOf(tr("Job Id")); m_purgedIndex = headerlist.indexOf(tr("Purged")); m_typeIndex = headerlist.indexOf(tr("Job Type")); m_statusIndex = headerlist.indexOf(tr("Job Status")); m_startIndex = headerlist.indexOf(tr("Job Starttime")); m_filesIndex = headerlist.indexOf(tr("Job Files")); m_bytesIndex = headerlist.indexOf(tr("Job Bytes")); m_levelIndex = headerlist.indexOf(tr("Job Level")); m_nameIndex = headerlist.indexOf(tr("Job Name")); m_filesetIndex = headerlist.indexOf(tr("File Set")); m_clientIndex = headerlist.indexOf(tr("Client")); /* Initialize the QTableWidget */ m_checkCurrentWidget = false; mp_tableWidget->clear(); m_checkCurrentWidget = true; mp_tableWidget->setColumnCount(headerlist.size()); mp_tableWidget->setHorizontalHeaderLabels(headerlist); mp_tableWidget->horizontalHeader()->setHighlightSections(false); mp_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); mp_tableWidget->setSortingEnabled(false); /* rows move on insert if sorting enabled */ if (mainWin->m_sqlDebug) { Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); } QStringList results; if (m_console->sql_cmd(query, results)) { m_resultCount = results.count(); QStringList fieldlist; mp_tableWidget->setRowCount(results.size()); int row = 0; /* Iterate through the record returned from the query */ QString resultline; foreach (resultline, results) { fieldlist = resultline.split("\t"); if (fieldlist.size() < 13) continue; /* some fields missing, ignore row */ TableItemFormatter jobitem(*mp_tableWidget, row); /* Iterate through fields in the record */ QStringListIterator fld(fieldlist); int col = 0; /* job id */ jobitem.setNumericFld(col++, fld.next()); /* job name */ jobitem.setTextFld(col++, fld.next()); /* client */ jobitem.setTextFld(col++, fld.next()); /* job starttime */ jobitem.setTextFld(col++, fld.next(), true); /* job type */ jobitem.setJobTypeFld(col++, fld.next()); /* job level */ jobitem.setJobLevelFld(col++, fld.next()); /* job files */ jobitem.setNumericFld(col++, fld.next()); /* job bytes */ jobitem.setBytesFld(col++, fld.next()); /* job status */ jobitem.setJobStatusFld(col++, fld.next()); /* purged */ jobitem.setBoolFld(col++, fld.next()); /* fileset */ jobitem.setTextFld(col++, fld.next()); /* pool name */ jobitem.setTextFld(col++, fld.next()); /* First Media */ jobitem.setTextFld(col++, fld.next()); /* Medias count */ jobitem.setNumericFld(col++, fld.next()); row++; }