00001 #ifndef __FIBER_HDF5_LOADFIELD_HPP
00002 #define __FIBER_HDF5_LOADFIELD_HPP
00003
00004
00005 #include <bundle/Bundle.hpp>
00006 #include <F5/F5F.h>
00007
00008 namespace Fiber
00009 {
00010
00011 template <int Dims>
00012 bool getDimensions(MultiIndex<Dims>&dims, F5Path*field, const char*attribute_name, hid_t id)
00013 {
00014 hsize_t extension[FIBER_MAX_RANK];
00015 if (!F5LAget_dimensions(id, attribute_name, extension) == Dims)
00016 return false;
00017
00018 F5Tpermute_dimensions(field, Dims, extension, extension);
00019
00020 for(int i=0;i<Dims;i++)
00021 dims[i] += extension[i];
00022
00023 return true;
00024 }
00025
00026
00027 template <int N>
00028 struct GetFragmentInterfaces
00029 {
00030 static void setup(RefPtr<FragmentID>&FID, hsize_t dims[FIBER_MAX_RANK], F5Path*field, hid_t frag_id)
00031 {
00032 MultiIndex<N> FragmentSize;
00033 for(int i=0; i<N; i++)
00034 FragmentSize[i] = dims[i];
00035
00036 FID->addInterface( new SizeInterface( FragmentSize ) );
00037
00038 RefPtr<FragmentLocation<N> > F3 = new FragmentLocation<N>();
00039 if (getDimensions( F3->Offset , field, FIBER_FRAGMENT_OFFSET_ATTRIBUTE , frag_id )
00040 ||
00041 getDimensions( F3->OverlapStart, field, FIBER_FRAGMENT_NOOVERLAP_START_ATTRIBUTE, frag_id )
00042 ||
00043 getDimensions( F3->OverlapEnd , field, FIBER_FRAGMENT_NOOVERLAP_END_ATTRIBUTE , frag_id )
00044 )
00045 {
00046
00047
00048
00049
00050
00051
00052
00053
00054 FID->addInterface( F3 );
00055 }
00056 }
00057 };
00058
00059
00060 RefPtr<SizeInterface> getFieldSize(F5Path*field);
00061
00062 RefPtr<Field> ContiguousField(F5Path*field,
00063 const RefPtr<FiberTypeBase>&MyFiberType,
00064 const RefPtr<LoaderProgress>&TheLoaderProgressor);
00065
00066 RefPtr<Field> UniformField(F5Path*field, const RefPtr<LoaderProgress>&TheLoaderProgressor);
00067
00068 herr_t loadFragment(F5Path*field, const char*fragmentname,
00069 const RefPtr<FiberTypeBase> &MyFiberType,
00070 FragmentIDContainer &FIDC,
00071 const RefPtr<Field> &MyField,
00072 const RefPtr<LoaderProgress> &LP,
00073 const string &path_info);
00074
00075 herr_t loadCompoundFragment(F5Path*field, const char*fragmentname,
00076 const RefPtr<FiberTypeBase> &MyFiberType,
00077 FragmentIDContainer &FIDC,
00078 const RefPtr<Field> &MyField,
00079 const RefPtr<LoaderProgress> &LP,
00080 const string &path_info);
00081
00082 herr_t loadUniformFragment(F5Path*field, const char*fragmentname,
00083 FragmentIDContainer&FIDC,
00084 const RefPtr<Field> &MyField,
00085 const RefPtr<LoaderProgress> &LP,
00086 const string &path_info);
00087
00088
00089
00090 herr_t LoadRepresentationField(F5Path*field, Grid&MyGrid, Representation&Rep, const char*fieldname,
00091 const RefPtr<LoaderProgress>&TheLoaderProgressor);
00092
00093
00094 }
00095
00096
00097 #endif // __FIBER_HDF5_LOADFIELD_HPP
00098