FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FragmentInterfaces.hpp
1#ifndef __FIBER_FIBERIO_HDF5_FRAGMENTINTERFACES_HPP
2#define __FIBER_FIBERIO_HDF5_FRAGMENTINTERFACES_HPP
3
4#include <memcore/Interface.hpp>
5#include <field/FragmentID.hpp>
6#include <F5/F5Path.h>
7#include <F5/F5F.h>
8
9namespace Fiber
10{
11namespace FiberIO
12{
13namespace HDF5
14{
15
16using namespace Fiber;
17using namespace MemCore;
18
19
24template <Dims_t Dims>
25bool loadDimensions(MultiIndex<Dims>&dims, F5Path*field, const char*attribute_name, hid_t id)
26{
27hsize_t extension[FIBER_MAX_RANK];
28 if (F5LAget_dimensions(id, attribute_name, extension) != Dims)
29 return false;
30
31 F5Tpermute_dimensions(field, Dims, extension, extension);
32
33 for(int i=0;i<Dims;i++)
34 dims[i] = extension[i];
35
36 return true;
37}
38
39
48template <Dims_t N>
50{
51 template <FragmentProperty TheProperty>
52static bool loadFragmentInfo(const char*AttributeName,
54 F5Path*field, hid_t frag_id)
55 {
57
60 bool Have = loadDimensions( V, field, AttributeName, frag_id );
61 if (!Have)
62 {
63 Verbose(30) << "Could not read optional fragment attribute " << AttributeName;
64 return false;
65 }
66
68 {
69 if (*CurrentFL != *NewFL)
70 {
71 Verbose(0) << "Fragment attribute " << AttributeName
72 << " with value " << V
73 << " is INCONSISTENT with previously defined value "
74 << (const MultiIndex<N>&)(*CurrentFL);
75 return false;
76 }
77 }
78 else
79 FID.addInterface( NewFL );
80
81 return true;
82 }
83
84static bool load(FragmentID&FID, hsize_t dims[FIBER_MAX_RANK], F5Path*field, hid_t frag_id)
85 {
87 for(int i=0; i<N; i++)
88 FragmentSize[i] = dims[i];
89
90 FID.addInterface( new SizeInterface( FragmentSize ) );
91
95
96 return true;
97
98 }
99
100#if 0
101 template <FragmentProperty TheProperty>
102static bool saveFragmentInfo(const char*AttributeName,
104 F5Path*field, hid_t frag_id)
105 {
107
109 {
110 return saveDimensions( *F3, field, AttributeName, frag_id );
111 }
112 return false;
113 }
114
116static void save(RefPtr<FragmentID>&FID, F5Path*field, hid_t frag_id)
117 {
119 {
120 // no need do something with it.
121 }
122
126 }
127#endif
128};
129
130bool loadFragmentProperties(int rank, FragmentID&FID, hsize_t dims[FIBER_MAX_RANK], F5Path*field, hid_t frag_id);
131
132}
133}
134}
135
136#endif // __FIBER_FIBERIO_HDF5_FRAGMENTINTERFACES_HPP
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Identification information about a field's fragment.
Definition FragmentID.hpp:42
An interface telling size and dimensionality of a dataset, a refcounted version of DynamicSize.
Definition field/DynamicSize.hpp:500
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
bool saveDimensions(MultiIndex< Dims > &dims, F5Path *field, const char *attribute_name, hid_t id)
Save an n-dimensional attribute to an HDF5 ID and apply dimensional permutation according to the give...
Definition LoadField.hpp:119
Load and save attributes on fragments.
Definition FragmentInterfaces.hpp:50