Esempio n. 1
0
 // -------------- HDF5  --------------------------
 /// Write into HDF5
 friend void h5_write(h5::group fg, std::string subgroup_name, linear_mesh const &m) {
  h5::group gr = fg.create_group(subgroup_name);
  h5_write(gr, "domain", m.domain());
  h5_write(gr, "min", m.xmin);
  h5_write(gr, "max", m.xmax);
  h5_write(gr, "size", long(m.size()));
 }
Esempio n. 2
0
 /// Approximation of a point of the domain by a mesh point
 template <typename D> std::tuple<bool, long, double> windowing(linear_mesh<D> const &mesh, typename D::point_t const &x) {
  double a = (x - mesh.x_min()) / mesh.delta();
  long i = std::floor(a), imax = long(mesh.size()) - 1;
  bool in = (i >= 0) && (i < imax);
  double w = a - i;
  if (i == imax) {
   --i;
   in = (std::abs(w) < 1.e-12);
   w = 1.0;
  }
  if (i == -1) {
   i = 0;
   in = (std::abs(1 - w) < 1.e-12);
   w = 1.0;
  }
  return std::make_tuple(in, i, w);
  // return std::make_tuple(in, (in ? i : 0),w);
 }
Esempio n. 3
0
 /// Mesh comparison
 bool operator==(linear_mesh const &M) const {
  return ((_dom == M._dom) && (size() == M.size()) && (std::abs(xmin - M.xmin) < 1.e-15) && (std::abs(xmax - M.xmax) < 1.e-15));
 }