void dump(FILE *fp, int forever, int oldfmt) { struct utmp ut; struct oldutmp uto; if (forever) fseek(fp, -10 * (oldfmt ? sizeof uto : sizeof ut), SEEK_END); do { if (oldfmt) while (fread(&uto, sizeof uto, 1, fp) == 1) print_utline(oldtonew(uto)); else while (fread(&ut, sizeof ut, 1, fp) == 1) print_utline(ut); if (forever) sleep(1); } while (forever); }
//--------------------------------------------------------- void NDG2D::OutputSampleXYZ ( int sample_N, DMat &newX, DMat &newY, DMat &newZ, // e.g. triangles on a sphere const DMat &FData, // old field data DMat &newFData, // new field data int zfield // if>0, use as z-elevation ) //--------------------------------------------------------- { DVec newR, newS, newT; DMat newVDM; int newNpts = 0; // Triangles OutputSampleNodes2D(sample_N, newR, newS); newNpts = newR.size(); newVDM = Vandermonde2D(this->N, newR, newS); const DMat& oldV = this->V; DMat oldtonew(newNpts, this->Np, "OldToNew"); oldtonew = trans(trans(oldV) | trans(newVDM)); //----------------------------------- // interpolate the field data //----------------------------------- int Nfields = FData.num_cols(); newFData.resize(newNpts*this->K, Nfields); //DVec scales(Nfields); // For each field, use tOldF to wrap field i. // Use tNewF to load the interpolated field // directly into column i of the output array. DMat tOldF, tNewF; for (int i=1; i<=Nfields; ++i) { tOldF.borrow(this->Np, this->K, (double*) FData.pCol(i)); tNewF.borrow(newNpts, this->K, (double*)newFData.pCol(i)); tNewF = oldtonew * tOldF; //scales(i) = tNewF.max_col_val_abs(i); } //----------------------------------- // interpolate the vertices //----------------------------------- newX = oldtonew * this->x; newY = oldtonew * this->y; if (this->bCoord3D) { newZ = oldtonew * this->z; } else { if (zfield>=1 && zfield<=Nfields) { // use field data for z-height newZ.load(newNpts, K, newFData.pCol(Nfields)); } else { // set z-data to 0.0 newZ.resize(newNpts, K, true, 0.0); } } }