Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
util.h
Go to the documentation of this file.
1 /**
2  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
3  * storing and accessing finite element mesh data.
4  *
5  * Copyright 2004 Sandia Corporation. Under the terms of Contract
6  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7  * retains certain rights in this software.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  */
15 
16 #ifndef mhdf_FILE_UTIL_H
17 #define mhdf_FILE_UTIL_H
18 
19 #include <sys/types.h>
20 #include <H5Ipublic.h>
21 #include "status.h"
22 #include "file-handle.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 void* mhdf_malloc( size_t size, mhdf_Status* status );
29 void* mhdf_realloc( void* ptr, size_t size, mhdf_Status* status );
30 
31 size_t mhdf_name_to_path( const char* name, char* path, size_t path_len );
32 
33 int mhdf_path_to_name( const char* path, char* name );
34 
35 char* mhdf_name_to_path_copy( const char* name, mhdf_Status* status );
36 
37 char* mhdf_name_to_path_cat( const char* prefix, const char* name, mhdf_Status* status );
38 
39 hid_t mhdf_elem_group_from_handle( FileHandle* file_ptr, const char* elem_handle, mhdf_Status* status );
40 
41 int mhdf_create_scalar_attrib( hid_t object, const char* name, hid_t type, const void* value, mhdf_Status* status );
42 
43 /* If type is zero, assumes opaque type.
44  On error, sets status and returns zero.
45  On success, returns non-zero and does not modify status */
46 int mhdf_read_scalar_attrib( hid_t object, const char* name, hid_t type, void* value, mhdf_Status* status );
47 
48 /* Search the specified object to see if it contains an
49  an attribute with passed name. Returns -1 on error, 1
50  if attribute was found, and zero if attribute was not
51  found.
52 */
53 int mhdf_find_attribute( hid_t object, const char* attrib_name, unsigned int* index_out, mhdf_Status* status );
54 
55 int mhdf_is_in_group( hid_t group, const char* name, mhdf_Status* status );
56 
57 int mhdf_read_data( hid_t data_table,
58  long offset,
59  long count,
60  hid_t type,
61  void* array,
62  hid_t read_prop,
63  mhdf_Status* status );
64 
65 int mhdf_write_data( hid_t data_table,
66  long offset,
67  long count,
68  hid_t type,
69  const void* array,
70  hid_t write_prop,
71  mhdf_Status* status );
72 
73 int mhdf_read_column( hid_t data_table,
74  int column,
75  long offset,
76  long count,
77  hid_t type,
78  void* array,
79  hid_t read_prop,
80  mhdf_Status* status );
81 
82 int mhdf_write_column( hid_t data_table,
83  int column,
84  long offset,
85  long count,
86  hid_t type,
87  const void* array,
88  hid_t write_prop,
89  mhdf_Status* status );
90 
91 hid_t mhdf_create_table( hid_t group, const char* path, hid_t type, int rank, hsize_t* dims, mhdf_Status* status );
92 
93 hid_t mhdf_create_table_with_prop( hid_t group,
94  const char* path,
95  hid_t type,
96  int rank,
97  hsize_t* dims,
98  hid_t dataset_creation_prop,
99  mhdf_Status* status );
100 
101 hid_t mhdf_open_table( hid_t group, const char* path, int columns, hsize_t* rows_out, mhdf_Status* status );
102 
103 hid_t mhdf_open_table2( hid_t group,
104  const char* path,
105  int rank,
106  hsize_t* dims_out,
107  long* start_id_out,
108  mhdf_Status* status );
109 
110 hid_t mhdf_open_table_simple( hid_t group, const char* path, mhdf_Status* status );
111 
112 int mhdf_compact_to_ranges( int* length_in_out, int* ids_in, int ordered );
113 
114 hid_t get_elem_type_enum( FileHandle* file_ptr, mhdf_Status* status );
115 
116 void mhdf_api_begin_internal( void );
117 void mhdf_api_end_internal( int expected_diff, const char* filename, int linenumber );
118 
119 int mhdf_write_max_id( FileHandle* file_ptr, mhdf_Status* status );
120 
121 #ifndef DEBUG_OPEN_HANDLES
122 #define API_BEGIN
123 #define API_END_H( n )
124 #else
125 #define API_BEGIN mhdf_api_begin_internal()
126 #define API_END_H( n ) mhdf_api_end_internal( n, __FILE__, __LINE__ )
127 #endif
128 #define API_END API_END_H( 0 )
129 
130 #ifdef __cplusplus
131 } /* extern "C" */
132 #endif
133 
134 #endif