本文整理汇总了C++中h5::CommonFG类的典型用法代码示例。如果您正苦于以下问题:C++ CommonFG类的具体用法?C++ CommonFG怎么用?C++ CommonFG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommonFG类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: create
DataSet DataSet::create(const H5::CommonFG &parent,
const std::string &name,
const H5::DataType &fileType,
const NDSize &size,
const NDSize &maxsize,
const NDSize &chunks,
bool max_size_unlimited,
bool guess_chunks)
{
H5::DataSpace space;
if (size) {
if (maxsize) {
space = DataSpace::create(size, maxsize);
} else {
space = DataSpace::create(size, max_size_unlimited);
}
}
H5::DSetCreatPropList plcreate = H5::DSetCreatPropList::DEFAULT;
if (chunks) {
int rank = static_cast<int>(chunks.size());
plcreate.setChunk(rank, chunks.data());
} else if (guess_chunks) {
NDSize guessedChunks = DataSet::guessChunking(size, fileType.getSize());
plcreate.setChunk(static_cast<int>(guessedChunks.size()), guessedChunks.data());
}
H5::DataSet dset = parent.createDataSet(name, fileType, space);
return DataSet(dset);
}
开发者ID:wvangeit,项目名称:nix,代码行数:32,代码来源:DataSet.cpp
示例2: read
void DiscretizationBlock::read(
const H5::CommonFG &loc, const string &entry,
const shared_ptr<Discretization> &discretization) {
this->discretization = discretization;
auto group = loc.openGroup(entry);
assert(H5::readAttribute<string>(
group, "type",
discretization->manifold.lock()->project.lock()->enumtype) ==
"DiscretizationBlock");
H5::readAttribute(group, "name", name);
assert(H5::readGroupAttribute<string>(group, "discretization", "name") ==
discretization->name);
if (group.attrExists("offset")) {
vector<hssize_t> offset, shape;
H5::readAttribute(group, "offset", offset);
std::reverse(offset.begin(), offset.end());
H5::readAttribute(group, "shape", shape);
std::reverse(shape.begin(), shape.end());
region = box_t(offset, point_t(offset) + shape);
}
if (group.attrExists("active")) {
// TODO read_active<0>(group, *this, active);
read_active<1>(group, *this, active);
read_active<2>(group, *this, active);
read_active<3>(group, *this, active);
read_active<4>(group, *this, active);
}
}
开发者ID:Yurlungur,项目名称:SimulationIO,代码行数:28,代码来源:DiscretizationBlock.cpp
示例3: write
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);
}
}
开发者ID:Yurlungur,项目名称:SimulationIO,代码行数:26,代码来源:DiscretizationBlock.cpp
示例4: read
void Field::read(const H5::CommonFG &loc, const string &entry,
const shared_ptr<Project> &project) {
m_project = project;
auto group = loc.openGroup(entry);
assert(H5::readAttribute<string>(group, "type", project->enumtype) ==
"Field");
H5::readAttribute(group, "name", m_name);
assert(H5::readGroupAttribute<string>(group, "project", "name") ==
project->name());
// TODO: Read and interpret objects (shallowly) instead of naively only
// looking at their names
m_manifold = project->manifolds().at(
H5::readGroupAttribute<string>(group, "manifold", "name"));
m_configuration = project->configurations().at(
H5::readGroupAttribute<string>(group, "configuration", "name"));
assert(H5::readGroupAttribute<string>(group, "configuration/fields/" + name(),
"name") == name());
assert(H5::readGroupAttribute<string>(group, "manifold/fields/" + name(),
"name") == name());
m_tangentspace = project->tangentspaces().at(
H5::readGroupAttribute<string>(group, "tangentspace", "name"));
assert(H5::readGroupAttribute<string>(group, "tangentspace/fields/" + name(),
"name") == name());
m_tensortype = project->tensortypes().at(
H5::readGroupAttribute<string>(group, "tensortype", "name"));
H5::readGroup(group, "discretefields",
[&](const H5::Group &group, const string &name) {
readDiscreteField(group, name);
});
m_configuration->insert(name(), shared_from_this());
m_manifold->insert(name(), shared_from_this());
m_tangentspace->insert(name(), shared_from_this());
m_tensortype->noinsert(shared_from_this());
}
开发者ID:eschnett,项目名称:SimulationIO,代码行数:34,代码来源:Field.cpp
示例5: write
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());
}
开发者ID:eschnett,项目名称:SimulationIO,代码行数:34,代码来源:Field.cpp
示例6: write
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");
}
开发者ID:Yurlungur,项目名称:SimulationIO,代码行数:27,代码来源:ParameterValue.cpp
示例7: WriteString
void hdfutil::WriteString(const H5::CommonFG& group, const std::string & dsname, const std::string & str) {
hsize_t dims[] = {1};
H5::DataSpace dataspace(1, dims); // 1 string
H5::StrType strtype (0, str.size()); // string length
H5::DataSet dset = group.createDataSet(dsname, strtype, dataspace, CreatePropList());
dset.write(&str[0], strtype);
}
开发者ID:NaohiroHayashi,项目名称:bulletsim,代码行数:7,代码来源:hdfutil.cpp
示例8: read
void SubDiscretization::read(const H5::CommonFG &loc, const string &entry,
const shared_ptr<Manifold> &manifold) {
m_manifold = manifold;
auto group = loc.openGroup(entry);
assert(
H5::readAttribute<string>(group, "type", manifold->project()->enumtype) ==
"SubDiscretization");
H5::readAttribute(group, "name", m_name);
assert(H5::readGroupAttribute<string>(group, "manifold", "name") ==
manifold->name());
m_parent_discretization = manifold->discretizations().at(
H5::readGroupAttribute<string>(group, "parent_discretization", "name"));
assert(H5::readGroupAttribute<string>(
group,
string("parent_discretization/child_discretizations/") + name(),
"name") == name());
m_child_discretization = manifold->discretizations().at(
H5::readGroupAttribute<string>(group, "child_discretization", "name"));
assert(H5::readGroupAttribute<string>(
group,
string("child_discretization/parent_discretizations/") + name(),
"name") == name());
H5::readAttribute(group, "factor", m_factor);
std::reverse(m_factor.begin(), m_factor.end());
H5::readAttribute(group, "offset", m_offset);
std::reverse(m_offset.begin(), m_offset.end());
m_parent_discretization->insertChild(name(), shared_from_this());
m_child_discretization->insertParent(name(), shared_from_this());
}
开发者ID:lbovard,项目名称:SimulationIO,代码行数:29,代码来源:SubDiscretization.cpp
示例9: read
void Manifold::read(const H5::CommonFG &loc, const string &entry,
const shared_ptr<Project> &project) {
this->m_project = project;
auto group = loc.openGroup(entry);
assert(H5::readAttribute<string>(group, "type", project->enumtype) ==
"Manifold");
H5::readAttribute(group, "name", m_name);
assert(H5::readGroupAttribute<string>(group, "project", "name") ==
project->name());
m_configuration = project->configurations().at(
H5::readGroupAttribute<string>(group, "configuration", "name"));
assert(H5::readGroupAttribute<string>(
group, "configuration/manifolds/" + name(), "name") == name());
H5::readAttribute(group, "dimension", m_dimension);
H5::readGroup(group, "discretizations",
[&](const H5::Group &group, const string &name) {
readDiscretization(group, name);
});
H5::readGroup(group, "subdiscretizations",
[&](const H5::Group &group, const string &name) {
readSubDiscretization(group, name);
});
// Cannot check "fields", "coordinatesystems" since they have not been read
// yet
// assert(H5::checkGroupNames(group, "fields", fields));
// assert(H5::checkGroupNames(group, "coordinatesystems", fields));
m_configuration->insert(name(), shared_from_this());
}
开发者ID:eschnett,项目名称:SimulationIO,代码行数:28,代码来源:Manifold.cpp
示例10: read
void Project::read(const H5::CommonFG &loc) {
auto group = loc.openGroup(".");
createTypes(); // TODO: read from file instead to ensure integer constants are
// consistent
assert(H5::readAttribute<string>(group, "type", enumtype) == "Project");
H5::readAttribute(group, "name", m_name);
H5::readGroup(group, "parameters",
[&](const H5::Group &group, const string &name) {
readParameter(group, name);
});
H5::readGroup(group, "configurations",
[&](const H5::Group &group, const string &name) {
readConfiguration(group, name);
});
H5::readGroup(group, "tensortypes",
[&](const H5::Group &group, const string &name) {
readTensorType(group, name);
});
H5::readGroup(group, "manifolds",
[&](const H5::Group &group, const string &name) {
readManifold(group, name);
});
H5::readGroup(group, "tangentspaces",
[&](const H5::Group &group, const string &name) {
readTangentSpace(group, name);
});
H5::readGroup(group, "fields",
[&](const H5::Group &group, const string &name) {
readField(group, name);
});
H5::readGroup(group, "coordinatesystems",
[&](const H5::Group &group, const string &name) {
readCoordinateSystem(group, name);
});
}
开发者ID:eschnett,项目名称:SimulationIO,代码行数:35,代码来源:Project.cpp
示例11: write
void Project::write(const H5::CommonFG &loc,
const H5::H5Location &parent) const {
assert(invariant());
// auto group = loc.createGroup(name());
auto group = loc.openGroup(".");
createTypes();
auto typegroup = group.createGroup("types");
enumtype.commit(typegroup, "SimulationIO");
#if 0
rangetype.commit(typegroup, "Range");
#endif
for (int d = 0; d < int(pointtypes.size()); ++d)
pointtypes.at(d).commit(typegroup, "Point[" + itos(d) + "]");
for (int d = 0; d < int(boxtypes.size()); ++d)
boxtypes.at(d).commit(typegroup, "Box[" + itos(d) + "]");
for (int d = 0; d < int(regiontypes.size()); ++d)
regiontypes.at(d).commit(typegroup, "Region[" + itos(d) + "]");
H5::createAttribute(group, "type", enumtype, "Project");
H5::createAttribute(group, "name", name());
// no link to parent
H5::createGroup(group, "parameters", parameters());
H5::createGroup(group, "configurations", configurations());
H5::createGroup(group, "tensortypes", tensortypes());
H5::createGroup(group, "manifolds", manifolds());
H5::createGroup(group, "tangentspaces", tangentspaces());
H5::createGroup(group, "fields", fields());
H5::createGroup(group, "coordinatesystems", coordinatesystems());
}
开发者ID:eschnett,项目名称:SimulationIO,代码行数:28,代码来源:Project.cpp
示例12: load_version_information
std::string load_version_information(const H5::CommonFG& root)
{
using namespace H5;
char buf[32];
const DataSet dataset(DataSet(root.openDataSet("version")));
dataset.read(buf, dataset.getDataType());
return std::string(buf);
}
开发者ID:kozo2,项目名称:ecell4,代码行数:8,代码来源:extras.cpp
示例13: write
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);
}
开发者ID:Yurlungur,项目名称:SimulationIO,代码行数:9,代码来源:Parameter.cpp
示例14:
std::shared_ptr<H5::DataSet> NDArray<T, Nd>::WriteToH5(
const H5::CommonFG& group, const std::string& dsetName) const {
H5::DataType h5DType = GetH5DataType<T>();
hsize_t dims[Nd];
for (int i=0; i<Nd; ++i) dims[i] = mN[i];
H5::DataSpace h5DSpace(Nd, dims);
std::shared_ptr<H5::DataSet> dset = std::make_shared<H5::DataSet>(
group.createDataSet(dsetName.c_str(), h5DType, h5DSpace));
dset->write(mData, h5DType);
return dset;
}
开发者ID:ermalrrapaj,项目名称:two_phase_skyrme,代码行数:11,代码来源:NDArray.hpp
示例15: write
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());
}
开发者ID:lbovard,项目名称:SimulationIO,代码行数:13,代码来源:TensorComponent.cpp
示例16: read
void TensorComponent::read(const H5::CommonFG &loc, const string &entry,
const shared_ptr<TensorType> &tensortype) {
m_tensortype = tensortype;
auto group = loc.openGroup(entry);
assert(H5::readAttribute<string>(group, "type",
tensortype->project()->enumtype) ==
"TensorComponent");
H5::readAttribute(group, "name", m_name);
assert(H5::readGroupAttribute<string>(group, "tensortype", "name") ==
tensortype->name());
H5::readAttribute(group, "storage_index", m_storage_index);
H5::readAttribute(group, "indexvalues", m_indexvalues);
}
开发者ID:lbovard,项目名称:SimulationIO,代码行数:13,代码来源:TensorComponent.cpp
示例17: ReadString
std::string hdfutil::ReadString (const H5::CommonFG& group, const std::string & dsname) {
const H5::DataSet & dataset = group.openDataSet(dsname);
try {
H5::DataType type = dataset.getDataType();
std::string retval;
retval.resize(type.getSize());
dataset.read(&retval[0], dataset.getStrType());
return retval;
} catch (H5::Exception e) {
std::string error = "Unable to ReadString.";// + dsname;
throw std::runtime_error(error.c_str());
}
}
开发者ID:NaohiroHayashi,项目名称:bulletsim,代码行数:13,代码来源:hdfutil.cpp
示例18: write
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
}
开发者ID:lbovard,项目名称:SimulationIO,代码行数:14,代码来源:TensorType.cpp
示例19: read
void Parameter::read(const H5::CommonFG &loc, const string &entry,
const shared_ptr<Project> &project) {
this->project = project;
auto group = loc.openGroup(entry);
assert(H5::readAttribute<string>(group, "type", project->enumtype) ==
"Parameter");
H5::readAttribute(group, "name", name);
assert(H5::readGroupAttribute<string>(group, "project", "name") ==
project->name);
H5::readGroup(group, "parametervalues",
[&](const H5::Group &group, const string &name) {
readParameterValue(group, name);
});
}
开发者ID:Yurlungur,项目名称:SimulationIO,代码行数:14,代码来源:Parameter.cpp
示例20: write
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");
}
开发者ID:Yurlungur,项目名称:SimulationIO,代码行数:16,代码来源:TangentSpace.cpp
注:本文中的h5::CommonFG类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论