Branch data Line data Source code
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 WRITE_HDF5_HPP
17 : : #define WRITE_HDF5_HPP
18 : :
19 : : #include <list>
20 : : #include "moab/MOABConfig.h"
21 : : #ifdef MOAB_HAVE_MPI // include this before HDF5 headers to avoid conflicts
22 : : #include "moab_mpi.h"
23 : : #endif
24 : : #include "moab_mpe.h"
25 : : #include "mhdf.h"
26 : : #include "moab/Forward.hpp"
27 : : #include "moab/Range.hpp"
28 : : #include "moab/WriterIface.hpp"
29 : : #include "moab/RangeMap.hpp"
30 : : #include "moab/WriteUtilIface.hpp"
31 : : #include "DebugOutput.hpp"
32 : : #include "HDF5Common.hpp"
33 : :
34 : : namespace moab
35 : : {
36 : :
37 : : class IODebugTrack;
38 : :
39 : : /* If this define is not set, node->entity adjacencies will not be written */
40 : : #undef MB_H5M_WRITE_NODE_ADJACENCIES
41 : :
42 : : /**
43 : : * \brief Write mesh database to MOAB's native HDF5-based file format.
44 : : * \author Jason Kraftcheck
45 : : * \date 01 April 2004
46 : : */
47 : : class WriteHDF5 : public WriterIface
48 : : {
49 : :
50 : : public:
51 : : static WriterIface* factory( Interface* );
52 : :
53 : : WriteHDF5( Interface* iface );
54 : :
55 : : virtual ~WriteHDF5();
56 : :
57 : : /** Export specified meshsets to file
58 : : * \param filename The filename to export.
59 : : * \param export_sets Array of handles to sets to export, or NULL to export all.
60 : : * \param export_set_count Length of <code>export_sets</code> array.
61 : : */
62 : : ErrorCode write_file( const char* filename, const bool overwrite, const FileOptions& opts,
63 : : const EntityHandle* export_sets, const int export_set_count,
64 : : const std::vector< std::string >& qa_records, const Tag* tag_list = NULL, int num_tags = 0,
65 : : int user_dimension = 3 );
66 : :
67 : : /** The type to use for entity IDs w/in the file.
68 : : *
69 : : * NOTE: If this is changed, the value of id_type
70 : : * MUST be changed accordingly.
71 : : */
72 : : typedef EntityHandle wid_t; // change the name,
73 : : // to avoid conflicts to /usr/include/x86_64-linux-gnu/bits/types.h : id_t , which is unsigned
74 : : // int
75 : :
76 : : /** HDF5 type corresponding to type of wid_t */
77 : : static const hid_t id_type;
78 : :
79 : 896 : struct ExportType
80 : : {
81 : : //! The type of the entities in the range
82 : : EntityType type;
83 : : //! The number of nodes per entity - not used for nodes and sets
84 : : int num_nodes;
85 : :
86 [ - + ]: 1792 : virtual ~ExportType() {}
87 : :
88 : 0 : bool operator==( ExportType t ) const
89 : : {
90 [ # # ][ # # ]: 0 : return t.type == type && t.num_nodes == num_nodes;
91 : : }
92 : : bool operator!=( ExportType t ) const
93 : : {
94 : : return t.type != type || t.num_nodes != num_nodes;
95 : : }
96 : : bool operator<( ExportType t ) const
97 : : {
98 : : return type < t.type || ( type == t.type && num_nodes < t.num_nodes );
99 : : }
100 : : };
101 : :
102 : : //! Range of entities, grouped by type, to export
103 [ - + ][ + - ]: 1560 : struct ExportSet : public ExportType
[ + - ]
104 : : {
105 : : //! The range of entities.
106 : : Range range;
107 : : //! The first Id allocated by the mhdf library. Entities in range have sequential IDs.
108 : : wid_t first_id;
109 : : //! The offset at which to begin writing this processor's data.
110 : : //! Always zero except for parallel IO.
111 : : long offset;
112 : : //! Offset for adjacency data. Always zero except for parallel IO
113 : : long adj_offset;
114 : : //! If doing parallel IO, largest number of entities to write
115 : : //! for any processor (needed to do collective IO). Zero if unused.
116 : : long max_num_ents, max_num_adjs;
117 : : //! The total number of entities that will be written to the file
118 : : //! for this group. For serial IO, this should always be range.size().
119 : : //! For parallel IO, it will be the sum of range size over all processors.
120 : : //! For parallel IO, this value is undefined except for on the root
121 : : //! processor.
122 : : long total_num_ents;
123 : :
124 : : bool operator<( const ExportType& other ) const
125 : : {
126 : : return type < other.type || ( type == other.type && num_nodes < other.num_nodes );
127 : : }
128 : :
129 : : bool operator<( std::pair< int, int > other ) const
130 : : {
131 : : return type < other.first || ( type == other.first && num_nodes < other.second );
132 : : }
133 : :
134 : 118 : bool operator==( const ExportType& other ) const
135 : : {
136 [ + + ][ + + ]: 118 : return ( type == other.type && num_nodes == other.num_nodes );
137 : : }
138 : :
139 : : bool operator==( std::pair< int, int > other ) const
140 : : {
141 : : return ( type == other.first && num_nodes == other.second );
142 : : }
143 : :
144 : : const char* name() const;
145 : : };
146 : :
147 : : //! Tag to write to file.
148 : 2776 : struct TagDesc
149 : : {
150 : : //! The tag handle
151 : : Tag tag_id;
152 : : //! The offset at which to begin writting this processor's data.
153 : : //! Always zero except for parallel IO.
154 : : wid_t sparse_offset;
155 : : //! For variable-length tags, a second offset for the tag data table,
156 : : //! separate from the offset used for the ID and Index tables.
157 : : //! Always zero except for parallel IO.
158 : : wid_t var_data_offset;
159 : : //! Write sparse tag data (for serial, is always equal to !range.empty())
160 : : bool write_sparse;
161 : : //! If doing parallel IO, largest number, over all processes, of entities
162 : : //! for which to write tag data. Zero if unused.
163 : : unsigned long max_num_ents;
164 : : //! For variable-length tags during parallel IO: the largest number
165 : : //! of tag values to be written on by any process, used to calculate
166 : : //! the total number of collective writes that all processes must do.
167 : : //! Zero for fixed-length tags or if not doing parallel IO.
168 : : unsigned long max_num_vals;
169 : :
170 : : //! List of entity groups for which to write tag data in
171 : : //! dense format
172 : : std::vector< ExportType > dense_list;
173 : :
174 : 1647 : bool have_dense( const ExportType& type ) const
175 : : {
176 [ + - ][ + - ]: 1647 : return std::find( dense_list.begin(), dense_list.end(), type ) != dense_list.end();
177 : : }
178 : :
179 : : bool operator<( const TagDesc& ) const;
180 : : };
181 : :
182 : : /** Create attributes holding the HDF5 type handle for the
183 : : * type of a bunch of the default tags.
184 : : */
185 : : // static ErrorCode register_known_tag_types( Interface* );
186 : :
187 : : //! Store old HDF5 error handling function
188 : : struct HDF5ErrorHandler
189 : : {
190 : : HDF5_Error_Func_Type func;
191 : : void* data;
192 : : };
193 : :
194 : : mhdf_FileHandle file_ptr()
195 : : {
196 : : return filePtr;
197 : : }
198 : :
199 : : WriteUtilIface* write_util()
200 : : {
201 : : return writeUtil;
202 : : }
203 : :
204 : : protected:
205 : : //! Store old HDF5 error handling function
206 : : HDF5ErrorHandler errorHandler;
207 : :
208 : : /** Function to create the file. Virtual to allow override
209 : : * for parallel version.
210 : : */
211 : : virtual ErrorCode parallel_create_file( const char* filename, bool overwrite,
212 : : const std::vector< std::string >& qa_records, const FileOptions& opts,
213 : : const Tag* tag_list, int num_tags, int dimension = 3, double* times = 0 );
214 : : virtual ErrorCode write_finished();
215 : : virtual void debug_barrier_line( int lineno );
216 : :
217 : : //! Gather tags
218 : : ErrorCode gather_tags( const Tag* user_tag_list, int user_tag_list_length );
219 : :
220 : : /** Check if tag values for a given ExportSet should be written in dense format
221 : : *
222 : : *\param ents ExportSet to consider
223 : : *\param all_tagged Range containing all the entities in ents.range for
224 : : * which an explicit tag value is stored. Range may
225 : : * also contain entities not in ents.range, but may
226 : : * not contain entities in ents.range for which no tag
227 : : * value is stored.
228 : : *\param prefer_dense If true, will return true if at least 2/3 of the
229 : : * entities are tagged. This should not be passed as
230 : : * true if the tag does not have a default value, as
231 : : * tag values must be stored for all entities in the
232 : : * ExportSet for dense-formatted data.
233 : : */
234 : : bool check_dense_format_tag( const ExportSet& ents, const Range& all_tagged, bool prefer_dense );
235 : :
236 : : /** Helper function for create-file
237 : : *
238 : : * Calculate the sum of the number of non-set adjacencies
239 : : * of all entities in the passed range.
240 : : */
241 : : ErrorCode count_adjacencies( const Range& elements, wid_t& result );
242 : :
243 : : public: // make these public so helper classes in WriteHDF5Parallel can use them
244 : : /** Helper function for create-file
245 : : *
246 : : * Create zero-ed tables where element connectivity and
247 : : * adjacency data will be stored.
248 : : */
249 : : ErrorCode create_elem_table( const ExportSet& block, long num_ents, long& first_id_out );
250 : :
251 : : /** Helper function for create-file
252 : : *
253 : : * Create zero-ed table where set descriptions will be written
254 : : */
255 : : ErrorCode create_set_meta( long num_sets, long& first_id_out );
256 : :
257 : : protected:
258 : : /** Helper function for create-file
259 : : *
260 : : * Calculate total length of set contents and child tables.
261 : : */
262 : : ErrorCode count_set_size( const Range& sets, long& contents_length_out, long& children_length_out,
263 : : long& parents_length_out );
264 : :
265 : : //! Get information about a meshset
266 : : ErrorCode get_set_info( EntityHandle set, long& num_entities, long& num_children, long& num_parents,
267 : : unsigned long& flags );
268 : :
269 : : /** Helper function for create-file
270 : : *
271 : : * Create zero-ed tables where set data will be written.
272 : : */
273 : : ErrorCode create_set_tables( long contents_length, long children_length, long parents_length );
274 : :
275 : : //! Write exodus-type QA info
276 : : ErrorCode write_qa( const std::vector< std::string >& list );
277 : :
278 : : //!\brief Get tagged entities for which to write tag values
279 : : ErrorCode get_num_sparse_tagged_entities( const TagDesc& tag, size_t& count );
280 : : //!\brief Get tagged entities for which to write tag values
281 : : ErrorCode get_sparse_tagged_entities( const TagDesc& tag, Range& range );
282 : : //!\brief Get entities that will be written to file
283 : : void get_write_entities( Range& range );
284 : :
285 : : //! The size of the data buffer (<code>dataBuffer</code>).
286 : : size_t bufferSize;
287 : : //! A memory buffer to use for all I/O operations.
288 : : char* dataBuffer;
289 : :
290 : : //! Interface pointer passed to constructor
291 : : Interface* iFace;
292 : : //! Cached pointer to writeUtil interface.
293 : : WriteUtilIface* writeUtil;
294 : :
295 : : //! The file handle from the mhdf library
296 : : mhdf_FileHandle filePtr;
297 : :
298 : : //! Map from entity handles to file IDs
299 : : RangeMap< EntityHandle, wid_t > idMap;
300 : :
301 : : //! The list elements to export.
302 : : std::list< ExportSet > exportList;
303 : : //! The list of nodes to export
304 : : ExportSet nodeSet;
305 : : //! The list of sets to export
306 : : ExportSet setSet;
307 : :
308 : 212 : const ExportSet* find( ExportType type ) const
309 : : {
310 [ + + ]: 212 : if( type.type == MBVERTEX )
311 : 72 : return &nodeSet;
312 [ + + ]: 140 : else if( type.type == MBENTITYSET )
313 : 64 : return &setSet;
314 : : else
315 : : {
316 [ + - ]: 76 : std::list< ExportSet >::const_iterator it;
317 [ + - ]: 76 : it = std::find( exportList.begin(), exportList.end(), type );
318 [ + - ][ - + ]: 212 : return it == exportList.end() ? 0 : &*it;
[ + - ]
319 : : }
320 : : }
321 : :
322 : : //! Offset into set contents table (zero except for parallel)
323 : : unsigned long setContentsOffset;
324 : : //! Offset into set children table (zero except for parallel)
325 : : unsigned long setChildrenOffset, setParentsOffset;
326 : : //! The largest number of values to write
327 : : //! for any processor (needed to do collective IO).
328 : : long maxNumSetContents, maxNumSetChildren, maxNumSetParents;
329 : : //! Flags idicating if set data should be written.
330 : : //! For the normal (non-parallel) case, these values
331 : : //! will depend only on whether or not there is any
332 : : //! data to be written. For parallel-meshes, opening
333 : : //! the data table is collective so the values must
334 : : //! depend on whether or not any processor has meshsets
335 : : //! to be written.
336 : : bool writeSets, writeSetContents, writeSetChildren, writeSetParents;
337 : :
338 : : //! Struct describing a set for which the contained and linked entity
339 : : //! lists are something other than the local values. Used to store
340 : : //! data for shared sets owned by this process when writing in parallel.
341 [ # # ][ # # ]: 0 : struct SpecialSetData
[ # # ][ # # ]
342 : : {
343 : : EntityHandle setHandle;
344 : : unsigned setFlags;
345 : : std::vector< wid_t > contentIds;
346 : : std::vector< wid_t > childIds;
347 : : std::vector< wid_t > parentIds;
348 : : };
349 : : struct SpecSetLess
350 : : {
351 : 0 : bool operator()( const SpecialSetData& a, SpecialSetData b ) const
352 : : {
353 : 0 : return a.setHandle < b.setHandle;
354 : : }
355 : : };
356 : :
357 : : //! Array of special/shared sets, in order of handle value.
358 : : std::vector< SpecialSetData > specialSets;
359 : : const SpecialSetData* find_set_data( EntityHandle h ) const
360 : : {
361 : : return const_cast< WriteHDF5* >( this )->find_set_data( h );
362 : : }
363 : : SpecialSetData* find_set_data( EntityHandle h );
364 : :
365 : : //! The list of tags to export
366 : : std::list< TagDesc > tagList;
367 : :
368 : : //! True if doing parallel write
369 : : bool parallelWrite;
370 : : //! True if using collective IO calls for parallel write
371 : : bool collectiveIO;
372 : : //! True if writing dense-formatted tag data
373 : : bool writeTagDense;
374 : :
375 : : //! Property set to pass to H5Dwrite calls.
376 : : //! For serial, should be H5P_DEFAULTS.
377 : : //! For parallel, may request collective IO.
378 : : hid_t writeProp;
379 : :
380 : : //! Utility to log debug output
381 : : DebugOutput dbgOut;
382 : :
383 : : static MPEState topState;
384 : : static MPEState subState;
385 : :
386 : : //! Look for overlapping and/or missing writes
387 : : bool debugTrack;
388 : :
389 : : void print_id_map() const;
390 : : void print_id_map( std::ostream& str, const char* prefix = "" ) const;
391 : :
392 : : /** Helper function for create-file
393 : : *
394 : : * Write tag meta-info and create zero-ed table where
395 : : * tag values will be written.
396 : : *\param num_entities Number of entities for which to write tag data.
397 : : *\param var_len_total For variable-length tags, the total number of values
398 : : * in the data table.
399 : : */
400 : : ErrorCode create_tag( const TagDesc& tag_data, unsigned long num_entities, unsigned long var_len_total );
401 : :
402 : : /**\brief add entities to idMap */
403 : : ErrorCode assign_ids( const Range& entities, wid_t first_id );
404 : :
405 : : /** Get possibly compacted list of IDs for passed entities
406 : : *
407 : : * For the passed range of entities, determine if IDs
408 : : * can be compacted and write IDs to passed list.
409 : : *
410 : : * If the IDs are not compacted, the output list will contain
411 : : * a simple ordered list of IDs.
412 : : *
413 : : * If IDs are compacted, the output list will contain
414 : : * {start,count} pairs.
415 : : *
416 : : * If the ID list is compacted, ranged_list will be 'true'.
417 : : * Otherwise it will be 'false'.
418 : : */
419 : : ErrorCode range_to_blocked_list( const Range& input_range, std::vector< wid_t >& output_id_list,
420 : : bool& ranged_list );
421 : :
422 : : /** Get possibly compacted list of IDs for passed entities
423 : : *
424 : : * For the passed range of entities, determine if IDs
425 : : * can be compacted and write IDs to passed list.
426 : : *
427 : : * If the IDs are not compacted, the output list will contain
428 : : * a simple ordered list of IDs.
429 : : *
430 : : * If IDs are compacted, the output list will contain
431 : : * {start,count} pairs.
432 : : *
433 : : * If the ID list is compacted, ranged_list will be 'true'.
434 : : * Otherwise it will be 'false'.
435 : : */
436 : : ErrorCode range_to_blocked_list( const EntityHandle* input_ranges, size_t num_input_ranges,
437 : : std::vector< wid_t >& output_id_list, bool& ranged_list );
438 : :
439 : : ErrorCode range_to_id_list( const Range& input_range, wid_t* array );
440 : : //! Get IDs for entities
441 : : ErrorCode vector_to_id_list( const std::vector< EntityHandle >& input, std::vector< wid_t >& output,
442 : : bool remove_non_written = false );
443 : : //! Get IDs for entities
444 : : ErrorCode vector_to_id_list( const EntityHandle* input, wid_t* output, size_t num_entities );
445 : : //! Get IDs for entities
446 : : ErrorCode vector_to_id_list( const EntityHandle* input, size_t input_len, wid_t* output, size_t& output_len,
447 : : bool remove_non_written );
448 : :
449 : : /** When writing tags containing EntityHandles to file, need to convert tag
450 : : * data from EntityHandles to file IDs. This function does that.
451 : : *
452 : : * If the handle is not valid or does not correspond to an entity that will
453 : : * be written to the file, the file ID is set to zero.
454 : : *\param data The data buffer. As input, an array of EntityHandles. As
455 : : * output an array of file IDS, where the size of each integral
456 : : * file ID is the same as the size of EntityHandle.
457 : : *\param count The number of handles in the buffer.
458 : : *\return true if at least one of the handles is valid and will be written to
459 : : * the file or at least one of the handles is NULL (zero). false
460 : : * otherwise
461 : : */
462 : : bool convert_handle_tag( EntityHandle* data, size_t count ) const;
463 : : bool convert_handle_tag( const EntityHandle* source, EntityHandle* dest, size_t count ) const;
464 : :
465 : : /** Get IDs of adjacent entities.
466 : : *
467 : : * For all entities adjacent to the passed entity, if the
468 : : * adjacent entity is to be exported (ID is not zero), append
469 : : * the ID to the passed list.
470 : : */
471 : : ErrorCode get_adjacencies( EntityHandle entity, std::vector< wid_t >& adj );
472 : :
473 : : //! get sum of lengths of tag values (as number of type) for
474 : : //! variable length tag data.
475 : : ErrorCode get_tag_data_length( const TagDesc& tag_info, const Range& range, unsigned long& result );
476 : :
477 : : private:
478 : : //! Do the actual work of write_file. Separated from write_file
479 : : //! for easier resource cleanup.
480 : : ErrorCode write_file_impl( const char* filename, const bool overwrite, const FileOptions& opts,
481 : : const EntityHandle* export_sets, const int export_set_count,
482 : : const std::vector< std::string >& qa_records, const Tag* tag_list, int num_tags,
483 : : int user_dimension = 3 );
484 : :
485 : : ErrorCode init();
486 : :
487 : : ErrorCode serial_create_file( const char* filename, bool overwrite, const std::vector< std::string >& qa_records,
488 : : const Tag* tag_list, int num_tags, int dimension = 3 );
489 : :
490 : : /** Get all mesh to export from given list of sets.
491 : : *
492 : : * Populate exportSets, nodeSet and setSet with lists of
493 : : * entities to write.
494 : : *
495 : : * \param export_sets The list of meshsets to export
496 : : */
497 : : ErrorCode gather_mesh_info( const std::vector< EntityHandle >& export_sets );
498 : :
499 : : //! Same as gather_mesh_info, except for entire mesh
500 : : ErrorCode gather_all_mesh();
501 : :
502 : : //! Initialize internal data structures from gathered mesh
503 : : ErrorCode initialize_mesh( const Range entities_by_dim[5] );
504 : :
505 : : /** Write out the nodes.
506 : : *
507 : : * Note: Assigns IDs to nodes.
508 : : */
509 : : ErrorCode write_nodes();
510 : :
511 : : /** Write out element connectivity.
512 : : *
513 : : * Write connectivity for passed set of elements.
514 : : *
515 : : * Note: Assigns element IDs.
516 : : * Note: Must do write_nodes first so node IDs get assigned.
517 : : */
518 : : ErrorCode write_elems( ExportSet& elemset );
519 : :
520 : : /** Write out meshsets
521 : : *
522 : : * Write passed set of meshsets, including parent/child relations.
523 : : *
524 : : * Note: Must have written nodes and element connectivity
525 : : * so entities have assigned IDs.
526 : : */
527 : : ErrorCode write_sets( double* times );
528 : :
529 : : /** Write set contents/parents/children lists
530 : : *
531 : : *\param which_data Which set data to write (contents, parents, or children)
532 : : *\param handle HDF5 handle for data set in which to write data
533 : : *\param track Debugging tool
534 : : *\param ranged Will be populated with handles of sets for which
535 : : * contents were written in a range-compacted format.
536 : : * (mhdf_SET_RANGE_BIT). Should be null for parents/children.
537 : : *\param null_stripped Will be populated with handles of sets for which
538 : : * invalid or null handles were stripped from the contents
539 : : * list. This is only done for unordered sets. This argument
540 : : * should be null if writing parents/children because those
541 : : * lists are always ordered.
542 : : *\param set_sizes Will be populated with the length of the data written
543 : : * for those sets for which the handles were added to
544 : : * either \c ranged or \c null_stripped. Values are
545 : : * in handle order.
546 : : */
547 : : ErrorCode write_set_data( const WriteUtilIface::EntityListType which_data, const hid_t handle, IODebugTrack& track,
548 : : Range* ranged = 0, Range* null_stripped = 0, std::vector< long >* set_sizes = 0 );
549 : :
550 : : /** Write adjacency info for passed set of elements
551 : : *
552 : : * Note: Must have written element connectivity so elements
553 : : * have IDs assigned.
554 : : */
555 : : ErrorCode write_adjacencies( const ExportSet& export_set );
556 : :
557 : : /** Write tag information and data.
558 : : *
559 : : * Note: Must have already written nodes, elem connectivity and
560 : : * sets so that entities have IDs assigned.
561 : : */
562 : :
563 : : //! Write tag for all entities.
564 : : ErrorCode write_tag( const TagDesc& tag_data, double* times );
565 : :
566 : : //! Get element connectivity
567 : : ErrorCode get_connectivity( Range::const_iterator begin, Range::const_iterator end, int nodes_per_element,
568 : : wid_t* id_data_out );
569 : :
570 : : //! Get size data for tag
571 : : //!\param tag MOAB tag ID
572 : : //!\param moab_type Output: DataType for tag
573 : : //!\param num_bytes Output: MOAB tag size (bits for bit tags).
574 : : //! MB_VARIABLE_LENGTH for variable-length tags.
575 : : //!\param elem_size Output: Size of of the base data type of the
576 : : //! tag data (e.g. sizeof(double) if
577 : : //! moab_type == MB_TYPE_DOUBLE).
578 : : //! One for bit and opaque tags.
579 : : //!\param array_size Output: The number of valeus of size elem_size
580 : : //! for each tag. Always 1 for opaque data.
581 : : //! Nubmer of bits for bit tags.
582 : : //!\param file_type Output: mhdf type enumeration
583 : : //!\param hdf_type Output: Handle to HDF5 type object. Caller is
584 : : //! responsible for releasing this object
585 : : //! (calling H5Tclose).
586 : : ErrorCode get_tag_size( Tag tag, DataType& moab_type, int& num_bytes, int& elem_size, int& file_size,
587 : : mhdf_TagDataType& file_type, hid_t& hdf_type );
588 : :
589 : : //! Write ID table for sparse tag
590 : : ErrorCode write_sparse_ids( const TagDesc& tag_data, const Range& range, hid_t table_handle, size_t table_size,
591 : : const char* name = 0 );
592 : :
593 : : //! Write fixed-length tag data in sparse format
594 : : ErrorCode write_sparse_tag( const TagDesc& tag_data, const std::string& tag_name, DataType tag_data_type,
595 : : hid_t hdf5_data_type, int hdf5_type_size );
596 : :
597 : : //! Write end index data_set for a variable-length tag
598 : : ErrorCode write_var_len_indices( const TagDesc& tag_data, const Range& range, hid_t idx_table, size_t table_size,
599 : : int type_size, const char* name = 0 );
600 : :
601 : : //! Write tag value data_set for a variable-length tag
602 : : ErrorCode write_var_len_data( const TagDesc& tag_data, const Range& range, hid_t table, size_t table_size,
603 : : bool handle_tag, hid_t hdf_type, int type_size, const char* name = 0 );
604 : :
605 : : //! Write varialbe-length tag data
606 : : ErrorCode write_var_len_tag( const TagDesc& tag_info, const std::string& tag_name, DataType tag_data_type,
607 : : hid_t hdf5_type, int hdf5_type_size );
608 : :
609 : : //! Write dense-formatted tag data
610 : : ErrorCode write_dense_tag( const TagDesc& tag_data, const ExportSet& elem_data, const std::string& tag_name,
611 : : DataType tag_data_type, hid_t hdf5_data_type, int hdf5_type_size );
612 : :
613 : : //! Write data for fixed-size tag
614 : : ErrorCode write_tag_values( Tag tag_id, hid_t data_table, unsigned long data_offset, const Range& range,
615 : : DataType tag_data_type, hid_t hdf5_data_type, int hdf5_type_size,
616 : : unsigned long max_num_ents, IODebugTrack& debug_track );
617 : :
618 : : protected:
619 : : enum TimingValues
620 : : {
621 : : TOTAL_TIME = 0,
622 : : GATHER_TIME,
623 : : CREATE_TIME,
624 : : CREATE_NODE_TIME,
625 : : NEGOTIATE_TYPES_TIME,
626 : : CREATE_ELEM_TIME,
627 : : FILEID_EXCHANGE_TIME,
628 : : CREATE_ADJ_TIME,
629 : : CREATE_SET_TIME,
630 : : SHARED_SET_IDS,
631 : : SHARED_SET_CONTENTS,
632 : : SET_OFFSET_TIME,
633 : : CREATE_TAG_TIME,
634 : : COORD_TIME,
635 : : CONN_TIME,
636 : : SET_TIME,
637 : : SET_META,
638 : : SET_CONTENT,
639 : : SET_PARENT,
640 : : SET_CHILD,
641 : : ADJ_TIME,
642 : : TAG_TIME,
643 : : DENSE_TAG_TIME,
644 : : SPARSE_TAG_TIME,
645 : : VARLEN_TAG_TIME,
646 : : NUM_TIMES
647 : : };
648 : :
649 : : virtual void print_times( const double times[NUM_TIMES] ) const;
650 : : };
651 : :
652 : : } // namespace moab
653 : :
654 : : #endif
|