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 MOAB_READER_IFACE_HPP
17 #define MOAB_READER_IFACE_HPP
18
19 #include "moab/Types.hpp"
20
21 #include <vector>
22
23 namespace moab
24 {
25
26 class FileOptions;
27
28 /**
29 *\brief Interface for mesh reader implementations.
30 *\version 1.00
31 *\date 2004-4-23
32 *\author Jason Kraftcheck
33 */
34 class ReaderIface
35 {
36 public:
37 virtual ~ReaderIface() {}
38
39 /** Struct used to specify subset of file to read */
40 struct IDTag
41 {
42 const char* tag_name; //!< Name of tag containing integer IDs
43 const int* tag_values; //!< Array of integer ID values
44 int num_tag_values; //!< Length of tag_values array
45 };
46
47 struct SubsetList
48 {
49 /** An array of tag name and value sets specifying
50 * the subset of the file to read. If multiple
51 * tags are specified, the sets that match all
52 * tags (intersection) should be read.
53 */
54 IDTag* tag_list;
55 int tag_list_length; //!< Length of tag_list array
56 int num_parts; //!< If non-zero, load 1/num_parts of the matching sets
57 int part_number; //!< If num_parts is non-zero, load part_number-th fraction of the sets
58 };
59
60 /**
61 *\brief Load mesh from a file.
62 *
63 * Method all readers must provide to import a mesh.
64 *
65 *\param file_name The file to read.
66 *\param file_set Optional pointer to entity set representing
67 * file. If this is not NULL, reader may optionally
68 * tag the pointed-to set with format-specific
69 * meta-data.
70 *\param subset_list An optional struct pointer specifying the tags identifying
71 * entity sets to be read.
72 *\param file_id_tag If specified, reader should store for each entity
73 * it reads, a unique integer ID for this tag.
74 *\author Jason Kraftcheck
75 */
76 virtual ErrorCode load_file( const char* file_name,
77 const EntityHandle* file_set,
78 const FileOptions& opts,
79 const SubsetList* subset_list = 0,
80 const Tag* file_id_tag = 0 ) = 0;
81
82 /**
83 *\brief Read tag values from a file.
84 *
85 * Read the list if all integer tag values from the file for
86 * a tag that is a single integer value per entity.
87 *
88 *\param file_name The file to read.
89 *\param tag_name The tag for which to read values
90 *\param tag_values_out Output: The list of tag values.
91 *\param subset_list An array of tag name and value sets specifying
92 * the subset of the file to read. If multiple
93 * tags are specified, the sets that match all
94 * tags (intersection) should be read.
95 *\param subset_list_length The length of the 'subset_list' array.
96 */
97 virtual ErrorCode read_tag_values( const char* file_name,
98 const char* tag_name,
99 const FileOptions& opts,
100 std::vector< int >& tag_values_out,
101 const SubsetList* subset_list = 0 ) = 0;
102 };
103
104 } // namespace moab
105
106 #endif