F5L.h

00001 /*
00002  *
00003  * $Id: F5L.h,v 1.23 2008/03/19 21:21:43 werner Exp $
00004  *
00005  */
00006 
00007 #ifndef __F5Lield_H
00008 #define __F5Lield_H
00009 
00010 #include <F5/hdf5inc.h>
00011 
00012 #include "F5WinDLLApi.h"
00013 #include <F5/F5defs.h>
00014 
00015 #ifdef  __cplusplus
00016 #ifdef  F5_CPLUSPLUS
00017 namespace F5
00018 {
00019 
00020 template <int N, typename T, typename Trait=void> 
00021   struct Extent
00022 {
00023         T[N]    data;
00024 };
00025 
00026 } /* namespace F5 */
00027 #endif /* F5_CPLUSPLUS */
00028 
00029 extern "C"
00030 {
00031 #endif
00032 
00033 #define F5P_DEFAULT     (-1)
00034 
00035 
00094 F5_API hid_t    F5Lcreate(hid_t R_id, const char*fieldname, int dimension, const hsize_t*dims,
00095                           hid_t fieldtype, hid_t property_id);
00096 
00097 
00100 F5_API hid_t    F5LTcreate_topology(hid_t Grid_hid,
00101                                     const char*TopologyName,
00102                                     int IndexDepth,
00103                                     int SkeletonDimensionality,
00104                                     int DataspaceDimensionality,
00105                                     const hsize_t*refinement);
00106 
00110 F5_API  int     F5LTset_maximal_grid_refinement(hid_t ContentsGroup_id,
00111                                                 const char*gridname,
00112                                                 int     Dimensionality,
00113                                                 const hsize_t*refinement);
00114 
00124 F5_API  int     F5LTget_maximal_grid_refinement(hid_t ContentsGroup_id,
00125                                                 const char*gridname,
00126                                                 hsize_t*refinement);
00127         
00128 
00132 F5_API int   F5LTget_index_depth(hid_t Top_hid);
00133 
00134 
00163 F5_API hid_t    F5Lwrite(hid_t R_id, const char*fieldname,
00164                          int dimension, const hsize_t*dims,
00165                          hid_t fieldtype, hid_t memtype, const void * dataPtr,
00166                          hid_t enum_type, hid_t property_id);
00167 
00168 
00180 F5_API hid_t    F5Lwrite_fraction(hid_t R_id, const char*fieldname,
00181                                   int dimension, const hsize_t*full_dims,
00182                                   const hsize_t*datasize,
00183                                   hid_t fieldtype, hid_t memtype, const void * dataPtr,
00184                                   const hsize_t*datastart,
00185                                   const hsize_t*start_border, const hsize_t*end_border,
00186                                   const char*fraction_name, hid_t enum_type, hid_t property_id);        
00187 
00200 F5_API hid_t    F5LSwrite_fraction(hid_t R_id, const char*fieldname,
00201                                    int dimension, const hsize_t*full_dims,
00202                                    const hsize_t*datasize,
00203                                    hid_t fieldtype, hid_t memtype, const void *const* dataPtr,
00204                                    const hsize_t*datastart,
00205                                    const hsize_t*start_border, const hsize_t*end_border,
00206                                    const char*fraction_name,
00207                                    hid_t enum_type, hid_t property_id); 
00208 
00209 
00210 
00214 F5_API hid_t    F5Lwrite1D(hid_t R_id, const char*fieldname, hsize_t nElements,
00215                            hid_t fieldtype, hid_t memtype, const void * dataPtr,
00216                            hid_t enum_type, hid_t property_id);
00217 
00218 
00225 F5_API hid_t    F5Lwrite_linear(hid_t R_id, const char*fieldname,
00226                                 int dimension, const hsize_t*dataspace_dims,
00227                                 hid_t fieldtype, const void * base, const void * delta);
00228 
00229 
00230 F5_API int F5Lis_linear(hid_t Rep_id, const char*fieldname);
00231 
00242 F5_API hid_t    F5Lread_linear(hid_t F_id,
00243                                hsize_t*dims,
00244                                hid_t fieldtype,
00245                                void * base, void * delta);
00246 
00247 
00252 F5_API hid_t    F5Lwrite_entity(hid_t R_id, const char*fieldname,
00253                                 hid_t fieldtype,
00254                                 const void * value);
00255 
00256 
00257 
00264 F5_API hid_t F5Lwrites(hid_t F_id, const char*fieldname,
00265                        int dimension, const hsize_t*dims,
00266                        hid_t fieldtype, hid_t memtype,
00267                        const void *const*dataPtr,
00268                        hid_t enum_type,
00269                        hid_t property_id);
00270 
00296 F5_API hid_t F5LwriteX(hid_t R_id, const char*fieldname,
00297                        int Mrank, const hsize_t dims[],
00298                        hid_t fieldtype, hid_t memtype, 
00299                        const void *const dataPtr[], const int polynom_order[],
00300                        const int component_map[],
00301                        hid_t property_id, hid_t ProcIDLocation);
00302 
00303 
00319 F5_API hid_t    F5Lwrite_permutation(hid_t R_id, const char*fieldname,
00320                                      hsize_t size,
00321                                      hsize_t*permutation_indices,
00322                                      hsize_t nvalues,
00323                                      hid_t fieldtype, const void * dataPtr);
00324 
00325 
00329 F5_API hid_t F5Lget_type(hid_t Field_hid, int FieldIDisGroup);
00330 
00331 
00335 F5_API int      F5Lget_field_dimension_and_type(hid_t Representation_hid,
00336                                              const char*fieldname,
00337                                              hsize_t dims[FIBER_MAX_RANK], hid_t*type_id);
00338 
00339 F5_API int      F5LAsave_dimensions(hid_t Field_id, const char*aname, int rank, const hsize_t*dims);
00340 F5_API int      F5LAget_dimensions(hid_t Field_id, const char*aname, hsize_t dims[FIBER_MAX_RANK]);
00341 F5_API void     F5Lset_space(hid_t Field_id, int rank, const hsize_t*dims);
00342 
00343 F5_API void     F5Dset_type_attribute(hid_t F_id, hid_t fieldtype);
00344         
00345 /*
00346   already declared
00347   
00348 F5_API hid_t    F5LSwrite_fraction(hid_t R_id, const char*fieldname,
00349                                    int rank, const hsize_t*full_dims,
00350                                    const hsize_t*datasize,
00351                                    hid_t fieldtype, hid_t memtype, void *const*dataPtr,
00352                                    const hsize_t*datastart,
00353                                    const hsize_t*start_border, const hsize_t*end_border,
00354                                    const char*fraction_name,
00355                                    hid_t enum_type, hid_t property_id);
00356 */
00357 
00358         
00359 #ifdef  __cplusplus
00360 }    /* extern "C" */
00361 
00362 #ifdef  F5_CPLUSPLUS
00363 
00364 namespace F5
00365 {
00366 
00367 template <int N, typename Trait>
00368 inline hid_t LwriteX(hid_t R_id, const char*fieldname, 
00369                      const Extent<N, hsize_t, Trait>&dims,
00370                      hid_t fieldtype, hid_t memtype, 
00371                      const Extent<N, const void*, Trait>&dataPtr,
00372                      const Extent<N, int, Trait>&polynom_order,
00373                      hid_t property_id = F5P_DEFAULT)
00374 {
00375         return F5LwriteX(R_id, fieldname, N, dims.data,
00376                         fieldtype, memtype, 
00377                         dataPtr.data, polynom_order.data,
00378                         property_id);
00379 
00380 }
00381 
00382 template <int N, typename Trait>
00383 inline hid_t LwriteX(hid_t R_id, const char*fieldname, 
00384                      const Extent<N, hsize_t, Trait>&dims,
00385                      hid_t fieldtype,
00386                      const Extent<N, const void*, Trait>&dataPtr,
00387                      const Extent<N, int, Trait>&polynom_order,
00388                      hid_t property_id = F5P_DEFAULT)
00389 {
00390         return F5LwriteX(R_id, fieldname, N, dims.data,
00391                         fieldtype, 0, 
00392                         dataPtr.data, polynom_order.data,
00393                         property_id = F5P_DEFAULT);
00394 
00395 }
00396 
00397 template <typename T, typename value>
00398 inline T evalPolynom(const value&v, const T*data, int n)
00399 {
00400         if (n==0) return 0;
00401         if (n==1) return T[0];
00402         if (n==1) return T[0] + v*T[1];
00403         return T[0] + v*evalPolynom(v, data+1, n-1);
00404 }
00405 
00406 
00407 } /* namespace F5 */
00408 
00409 #endif  /* F5_CPLUSPLUS */
00410 
00411 #endif
00412 
00413 #endif  /* __F5Lield_H */
00414