/** * Load monitors data found in nexus file * * @param entry :: The Nexus entry * */ std::vector<std::vector<int>> LoadILLReflectometry::loadMonitors(NeXus::NXEntry &entry) { // read in the data g_log.debug("Fetching monitor data..."); NXData dataGroup = entry.openNXData("monitor1/data"); NXInt data = dataGroup.openIntData(); // load the counts from the file into memory data.load(); std::vector<std::vector<int>> monitors( 1); // vector of monitors with one entry std::vector<int> monitor1(data(), data() + data.size()); monitors[0].swap(monitor1); // There is two monitors in data file, but the second one seems to be always 0 dataGroup = entry.openNXData("monitor2/data"); data = dataGroup.openIntData(); data.load(); std::vector<int> monitor2(data(), data() + data.size()); monitors.push_back(monitor2); return monitors; }
void MovingMeshFB::smoothMonitor(int s) { int i, j, k; std::vector<float> area(n_geometry(2)); std::vector<float> mass_lumping(n_geometry(0), 0); std::vector<float> monitor1(n_geometry(0)); for (i = 0;i < n_geometry(2);i ++) { const Point<2>& x0 = point(geometry(2,i).vertex(0)); const Point<2>& x1 = point(geometry(2,i).vertex(1)); const Point<2>& x2 = point(geometry(2,i).vertex(2)); area[i] = (x1[0] - x0[0])*(x2[1] - x0[1]) - (x2[0] - x0[0])*(x1[1] - x0[1]); for (j = 0;j < 3;j ++) { mass_lumping[geometry(2,i).vertex(j)] += area[i]; } } for (i = 0;i < s;i ++) { std::fill(monitor1.begin(), monitor1.end(), 0); for (j = 0;j < n_geometry(2);j ++) { for (k = 0;k < 3;k ++) { monitor1[geometry(2,j).vertex(k)] += monitor(j)*area[j]; } } for (j = 0;j < n_geometry(0);j ++) monitor1[j] /= 3*mass_lumping[j]; std::fill(monitor().begin(), monitor().end(), 0); for (j = 0;j < n_geometry(2);j ++) { for (k = 0;k < 3;k ++) { monitor(j) += monitor1[geometry(2,j).vertex(k)]; } } } }