int main(int argc, char **argv) { if (!parse_arg(argc, argv)) { print_help(argc, argv); return EXIT_FAILURE; } // libMesh::LibMeshInit init(argc, argv); libMesh::LibMeshInit init(1, argv); // set argc to 1 to supress PETSc warnings. Condor2Dataset ds(init.comm()); ds.PrintInfo(); ds.OpenDataFile(filename_in); if (!ds.Valid()) { fprintf(stderr, "Invalid input data.\n"); return EXIT_FAILURE; } VortexExtractor extractor; extractor.SetDataset(&ds); extractor.SetGaugeTransformation(!nogauge); ds.LoadTimeStep(T0, 0); extractor.ExtractFaces(0); for (int t=T0+span; t<T0+T; t+=span) { ds.LoadTimeStep(t, 1); extractor.ExtractEdges(); extractor.ExtractFaces(1); extractor.RotateTimeSteps(); // extractor.TraceOverTime(); // extractor.TraceVirtualCells(); // extractor.SaveVortexLines(filename_out); } return EXIT_SUCCESS; }
void operator()(tbb::flow::continue_msg) const { const vfgpu_hdr_t& hdr = hdrs_all[frame]; const std::vector<vfgpu_pf_t>& pfs = pfs_all[frame]; GLHeader h = conv_hdr(cfg, hdrs_all[frame]); GLGPU3DDataset *ds = new GLGPU3DDataset; ds->SetHeader(h); ds->SetMeshType(cfg.meshtype); ds->BuildMeshGraph(); VortexExtractor *ex = new VortexExtractor; ex->SetDataset(ds); ex->Clear(); for (int i=0; i<pfs.size(); i++) { const vfgpu_pf_t &pf = pfs[i]; int chirality = pf.fid_and_chirality & 0x80000000 ? 1 : -1; int fid = pf.fid_and_chirality & 0x7fffffff; ex->AddPuncturedFace(fid, 0, chirality, pf.pos); } ex->TraceOverSpace(0); vobjs_all[hdr.frame] = ex->GetVortexObjects(0); std::vector<VortexLine> vlines = ex->GetVortexLines(); vlines_all[hdr.frame] = vlines; // write_vlines(hdr.frame, vlines); delete ds; delete ex; __sync_fetch_and_sub(&num_buffered_frames, 1); fprintf(stderr, "frame=%d, #pfs=%d, #vlines=%d\n", hdr.frame, (int)pfs.size(), (int)vlines.size()); }
void operator()(tbb::flow::continue_msg) const { const vfgpu_hdr_t& hdr0 = hdrs_all[f0], hdr1 = hdrs_all[f1]; GLHeader h0 = conv_hdr(cfg, hdr0), h1 = conv_hdr(cfg, hdr1); const std::vector<vfgpu_pf_t>& pfs0 = pfs_all[f0], pfs1 = pfs_all[f1]; const std::vector<vfgpu_pe_t>& pes = pes_all[interval]; const std::vector<VortexObject>& vobjs0 = vobjs_all[f0], vobjs1 = vobjs_all[f1]; std::vector<VortexLine>& vlines0 = vlines_all[f0], vlines1 = vlines_all[f1]; GLGPU3DDataset *ds = new GLGPU3DDataset; ds->SetHeader(h0); ds->SetMeshType(cfg.meshtype); ds->BuildMeshGraph(); VortexExtractor *ex = new VortexExtractor; ex->SetDataset(ds); for (int i=0; i<pfs0.size(); i++) { const vfgpu_pf_t &pf = pfs0[i]; int chirality = pf.fid_and_chirality & 0x80000000 ? 1 : -1; int fid = pf.fid_and_chirality & 0x7fffffff; ex->AddPuncturedFace(fid, 0, chirality, pf.pos); } for (int i=0; i<pfs1.size(); i++) { const vfgpu_pf_t &pf = pfs1[i]; int chirality = pf.fid_and_chirality & 0x80000000 ? 1 : -1; int fid = pf.fid_and_chirality & 0x7fffffff; ex->AddPuncturedFace(fid, 1, chirality, pf.pos); } for (int i=0; i<pes.size(); i++) { const vfgpu_pe_t &pe = pes[i]; int chirality = pe & 0x80000000 ? 1 : -1; int eid = pe & 0x7fffffff; ex->AddPuncturedEdge(eid, chirality, 0); } ex->SetVortexObjects(vobjs0, 0); ex->SetVortexObjects(vobjs1, 1); VortexTransitionMatrix mat = ex->TraceOverTime(); mat.SetInterval(interval); mat.Modularize(); vt.AddMatrix(mat); delete ex; delete ds; // compute_moving_speed(f0, f1, vlines0, vlines1, mat); write_mat(f0, f1, mat); write_vlines(f0, vlines0); fprintf(stderr, "interval={%d, %d}, #pfs0=%d, #pfs1=%d, #pes=%d\n", interval.first, interval.second, (int)pfs0.size(), (int)pfs1.size(), (int)pes.size()); // release resources pes_all[interval].clear(); int &fc0 = frame_counter[f0], &fc1 = frame_counter[f1]; __sync_fetch_and_add(&fc0, 1); __sync_fetch_and_add(&fc1, 1); if (fc0 == 2) { pfs_all[fc0] = std::vector<vfgpu_pf_t>(); vobjs_all[fc0] = std::vector<VortexObject>(); vlines_all[fc0] = std::vector<VortexLine>(); } if (fc1 == 2) { pfs_all[fc1] = std::vector<vfgpu_pf_t>(); vobjs_all[fc1] = std::vector<VortexObject>(); vlines_all[fc1] = std::vector<VortexLine>(); } __sync_fetch_and_sub(&num_buffered_frames, 1); }