Sample code for linking datasets

Hi,
I am trying to link two datasets, in the HDF viewer, I expect one of the datasets to appear with a "Link to Target" General Property as shown in the image below
[cid:191492413@09032011-213E]

The code I am writing for it is
.....

//Create the plyElemSet.

hsize_t dim[] = { indices.size() };

H5::IntType plyElemSetType( H5::PredType::NATIVE_INT );

H5::DataSet plyElemSet = file.createDataSet(

plyElemSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

//write it to the meshElementSetPath

H5::DataSet meshElementSet = file.createDataSet(

meshSpElementDataSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

meshElementSet.write( &(indices[0]), plyElemSetType );

//link plyElemSet to meshElementSetPath

plyElemSet.reference((void*)&meshElementSet, meshSpElementDataSetPath.str().c_str());

....

It doesn't link the way I would like it to. Any help, examples would be most useful.

Thanks,

Mukund Rajamony,

Hi,
I am trying to link two datasets, in the HDF viewer, I expect one of the datasets to appear with a "Link to Target" General Property
The code I am writing for it is
.....

//Create the plyElemSet.

hsize_t dim[] = { indices.size() };

H5::IntType plyElemSetType( H5::PredType::NATIVE_INT );

H5::DataSet plyElemSet = file.createDataSet(

plyElemSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

//write it to the meshElementSetPath

H5::DataSet meshElementSet = file.createDataSet(

meshSpElementDataSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

meshElementSet.write( &(indices[0]), plyElemSetType );

//link plyElemSet to meshElementSetPath

plyElemSet.reference((void*)&meshElementSet, meshSpElementDataSetPath.str().c_str());

....

It doesn't link the way I would like it to. Any help, examples would be most useful.

Thanks,

Mukund Rajamony,

The best way to create a link in HDFView is to use the following steps:
1) right-mouse click on a group
2) "new" --> "Link"

Thanks
--pc

···

On 3/9/2011 7:46 AM, Mukund Rajamony wrote:

Hi,
I am trying to link two datasets, in the HDF viewer, I expect one of the datasets to appear with a "Link to Target" General Property
The code I am writing for it is
.....

//Create the plyElemSet.

hsize_t dim[] = { indices.size() };

H5::IntType plyElemSetType( H5::PredType::NATIVE_INT );

H5::DataSet plyElemSet = file.createDataSet(

plyElemSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

//write it to the meshElementSetPath

H5::DataSet meshElementSet = file.createDataSet(

meshSpElementDataSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

meshElementSet.write( &(indices[0]), plyElemSetType );

//link plyElemSet to meshElementSetPath

plyElemSet.reference((void*)&meshElementSet, meshSpElementDataSetPath.str().c_str());

....

It doesn't link the way I would like it to. Any help, examples would be most useful.
Thanks,

Mukund Rajamony,

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Peter,
Thank you. I was trying to figure out the C++ API for softlinking. I am currently using the api below to link

H5Lcreate_soft(meshSpElementDataSetPath.str().c_str(), file.getId(), plyElemSetPath.str().c_str(), H5P_DEFAULT, H5P_DEFAULT);

When I view the created h5 file, I get the same softlinked behaviour I want. It seems curious that there is no C++ API for this.

Thanks,
Mukund

···

________________________________
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org] On Behalf Of Peter Cao
Sent: March 9, 2011 9:22 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] Sample code for linking datasets

The best way to create a link in HDFView is to use the following steps:
1) right-mouse click on a group
2) "new" --> "Link"

Thanks
--pc

On 3/9/2011 7:46 AM, Mukund Rajamony wrote:
Hi,
I am trying to link two datasets, in the HDF viewer, I expect one of the datasets to appear with a "Link to Target" General Property
The code I am writing for it is
.....

//Create the plyElemSet.

hsize_t dim[] = { indices.size() };

H5::IntType plyElemSetType( H5::PredType::NATIVE_INT );

H5::DataSet plyElemSet = file.createDataSet(

plyElemSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

//write it to the meshElementSetPath

H5::DataSet meshElementSet = file.createDataSet(

meshSpElementDataSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

meshElementSet.write( &(indices[0]), plyElemSetType );

//link plyElemSet to meshElementSetPath

plyElemSet.reference((void*)&meshElementSet, meshSpElementDataSetPath.str().c_str());

....

It doesn't link the way I would like it to. Any help, examples would be most useful.

Thanks,

Mukund Rajamony,

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org<mailto:Hdf-forum@hdfgroup.org>
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Mukund,

Peter,
Thank you. I was trying to figure out the C++ API for softlinking. I am currently using the api below to link

H5Lcreate_soft(meshSpElementDataSetPath.str().c_str(), file.getId(), plyElemSetPath.str().c_str(), H5P_DEFAULT, H5P_DEFAULT);

When I view the created h5 file, I get the same softlinked behaviour I want. It seems curious that there is no C++ API for this.

Bringing 1.8 features into the C++ wrappers library have a very low priority for our group due to the lack of funding (and there is a workaround as you've figured out).

Elena

···

On Mar 10, 2011, at 9:16 AM, Mukund Rajamony wrote:

Thanks,
Mukund

From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org] On Behalf Of Peter Cao
Sent: March 9, 2011 9:22 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] Sample code for linking datasets

The best way to create a link in HDFView is to use the following steps:
1) right-mouse click on a group
2) "new" --> "Link"

Thanks
--pc

On 3/9/2011 7:46 AM, Mukund Rajamony wrote:

Hi,
I am trying to link two datasets, in the HDF viewer, I expect one of the datasets to appear with a "Link to Target" General Property
The code I am writing for it is
.....
//Create the plyElemSet.

hsize_t dim[] = { indices.size() };

H5::IntType plyElemSetType( H5::PredType::NATIVE_INT );

H5::DataSet plyElemSet = file.createDataSet(

plyElemSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

//write it to the meshElementSetPath

H5::DataSet meshElementSet = file.createDataSet(

meshSpElementDataSetPath.str().c_str(), plyElemSetType, H5::DataSpace( 1, dim ) );

meshElementSet.write( &(indices[0]), plyElemSetType );

//link plyElemSet to meshElementSetPath

plyElemSet.reference((void*)&meshElementSet, meshSpElementDataSetPath.str().c_str());

....

It doesn't link the way I would like it to. Any help, examples would be most useful.

Thanks,

Mukund Rajamony,

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org