Exemple #1
0
void Field::write(const H5::CommonFG &loc, const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", project()->enumtype, "Field");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "project", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "project", "..");
  // H5::createHardLink(group, "configuration", parent,
  //                    "configurations/" + configuration->name());
  H5::createSoftLink(group, "configuration",
                     "../configurations/" + configuration()->name());
  H5::createHardLink(group, "project/configurations/" +
                                configuration()->name() + "/fields",
                     name(), group, ".");
  // H5::createHardLink(group, "manifold", parent,
  //                    "manifolds/" + manifold->name());
  H5::createSoftLink(group, "manifold", "../manifolds/" + manifold()->name());
  H5::createHardLink(group,
                     "project/manifolds/" + manifold()->name() + "/fields",
                     name(), group, ".");
  // H5::createHardLink(group, "tangentspace", parent,
  //                    "tangentspaces/" + tangentspace->name());
  H5::createSoftLink(group, "tangentspace",
                     "../tangentspaces/" + tangentspace()->name());
  H5::createHardLink(group, "project/tangentspaces/" + tangentspace()->name() +
                                "/fields",
                     name(), group, ".");
  // H5::createHardLink(group, "tensortype", parent,
  //                    "tensortypes/" + tensortype->name());
  H5::createSoftLink(group, "tensortype",
                     "../tensortypes/" + tensortype()->name());
  H5::createGroup(group, "discretefields", discretefields());
}
void ParameterValue::write(const H5::CommonFG &loc,
                           const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name);
  H5::createAttribute(group, "type", parameter.lock()->project.lock()->enumtype,
                      "ParameterValue");
  H5::createAttribute(group, "name", name);
  H5::createHardLink(group, "parameter", parent,
                     string("project/parameters/") + parameter.lock()->name);
  switch (value_type) {
  case type_empty:
    // do nothing
    break;
  case type_int:
    H5::createAttribute(group, "data", value_int);
    break;
  case type_double:
    H5::createAttribute(group, "data", value_double);
    break;
  case type_string:
    H5::createAttribute(group, "data", value_string);
    break;
  default:
    assert(0);
  }
  group.createGroup("configurations");
}
void DiscretizationBlock::write(const H5::CommonFG &loc,
                                const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name);
  H5::createAttribute(
      group, "type",
      discretization.lock()->manifold.lock()->project.lock()->enumtype,
      "DiscretizationBlock");
  H5::createAttribute(group, "name", name);
  H5::createHardLink(group, "discretization", parent, ".");
  if (region.valid()) {
#warning "TODO: write using boxtype HDF5 type"
    vector<hssize_t> offset = region.lower(), shape = region.shape();
    std::reverse(offset.begin(), offset.end());
    H5::createAttribute(group, "offset", offset);
    std::reverse(shape.begin(), shape.end());
    H5::createAttribute(group, "shape", shape);
  }
  if (active.valid()) {
    // TODO write_active<0>(group, *this, active);
    write_active<1>(group, *this, active);
    write_active<2>(group, *this, active);
    write_active<3>(group, *this, active);
    write_active<4>(group, *this, active);
  }
}
Exemple #4
0
void Parameter::write(const H5::CommonFG &loc,
                      const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name);
  H5::createAttribute(group, "type", project.lock()->enumtype, "Parameter");
  H5::createAttribute(group, "name", name);
  H5::createHardLink(group, "project", parent, ".");
  H5::createGroup(group, "parametervalues", parametervalues);
}
void TensorComponent::write(const H5::CommonFG &loc,
                            const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", tensortype()->project()->enumtype,
                      "TensorComponent");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "tensortype", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "tensortype", "..");
  H5::createAttribute(group, "storage_index", storage_index());
  H5::createAttribute(group, "indexvalues", indexvalues());
}
Exemple #6
0
void TensorType::write(const H5::CommonFG &loc,
                       const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", project()->enumtype, "TensorType");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "project", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "project", "..");
  H5::createAttribute(group, "dimension", dimension());
  H5::createAttribute(group, "rank", rank());
  H5::createGroup(group, "tensorcomponents", tensorcomponents());
  // TODO: write storage_indices
}
void TangentSpace::write(const H5::CommonFG &loc,
                         const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name);
  H5::createAttribute(group, "type", project.lock()->enumtype, "TangentSpace");
  H5::createAttribute(group, "name", name);
  H5::createHardLink(group, "project", parent, ".");
  H5::createHardLink(group, "configuration", parent,
                     string("configurations/") + configuration->name);
  H5::createHardLink(group, string("project/configurations/") +
                                configuration->name + "/tangentspaces",
                     name, group, ".");
  H5::createAttribute(group, "dimension", dimension);
  H5::createGroup(group, "bases", bases);
  group.createGroup("fields");
}
Exemple #8
0
void Basis::write(const H5::CommonFG &loc, const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", tangentspace()->project()->enumtype,
                      "Basis");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "tangentspace", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "tangentspace", "..");
  // H5::createHardLink(group, "configuration", parent,
  //                    string("project/configurations/") +
  //                    configuration->name);
  H5::createSoftLink(group, "configuration",
                     string("../project/configurations/") +
                         configuration()->name());
  H5::createHardLink(group, string("tangentspace/project/configurations/") +
                                configuration()->name() + "/bases",
                     name(), group, ".");
  H5::createGroup(group, "basisvectors", basisvectors());
  // TODO: output directions
}
Exemple #9
0
void Manifold::write(const H5::CommonFG &loc,
                     const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", project()->enumtype, "Manifold");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "project", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "project", "..");
  // H5::createHardLink(group, "configuration", parent,
  //                    "configurations/" + configuration->name());
  H5::createSoftLink(group, "configuration",
                     "../configurations/" + configuration()->name());
  H5::createHardLink(group, "project/configurations/" +
                                configuration()->name() + "/manifolds",
                     name(), group, ".");
  H5::createAttribute(group, "dimension", dimension());
  H5::createGroup(group, "discretizations", discretizations());
  H5::createGroup(group, "subdiscretizations", subdiscretizations());
  group.createGroup("fields");
  group.createGroup("coordinatesystems");
}
void SubDiscretization::write(const H5::CommonFG &loc,
                              const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", manifold()->project()->enumtype,
                      "SubDiscretization");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "manifold", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "manifold", "..");
  // H5::createHardLink(group, "parent_discretization", parent,
  //                    string("discretizations/") +
  //                    parent_discretization->name());
  H5::createSoftLink(group, "parent_discretization",
                     string("../discretizations/") +
                         parent_discretization()->name());
  H5::createHardLink(group, string("manifold/discretizations/") +
                                parent_discretization()->name() +
                                "/child_discretizations",
                     name(), group, ".");
  // H5::createHardLink(group, "child_discretization", parent,
  //                    string("discretizations/") +
  //                    child_discretization->name());
  H5::createSoftLink(group, "child_discretization",
                     string("../discretizations/") +
                         child_discretization()->name());
  H5::createHardLink(group, string("manifold/discretizations/") +
                                child_discretization()->name() +
                                "/parent_discretizations",
                     name(), group, ".");
  auto tmp_factor = factor();
  std::reverse(tmp_factor.begin(), tmp_factor.end());
  H5::createAttribute(group, "factor", tmp_factor);
  auto tmp_offset = offset();
  std::reverse(tmp_offset.begin(), tmp_offset.end());
  H5::createAttribute(group, "offset", tmp_offset);
}