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 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 : 138 : class ReaderIface
35 : : {
36 : : public:
37 [ - + ]: 276 : 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, const EntityHandle* file_set, const FileOptions& opts,
77 : : const SubsetList* subset_list = 0, const Tag* file_id_tag = 0 ) = 0;
78 : :
79 : : /**
80 : : *\brief Read tag values from a file.
81 : : *
82 : : * Read the list if all integer tag values from the file for
83 : : * a tag that is a single integer value per entity.
84 : : *
85 : : *\param file_name The file to read.
86 : : *\param tag_name The tag for which to read values
87 : : *\param tag_values_out Output: The list of tag values.
88 : : *\param subset_list An array of tag name and value sets specifying
89 : : * the subset of the file to read. If multiple
90 : : * tags are specified, the sets that match all
91 : : * tags (intersection) should be read.
92 : : *\param subset_list_length The length of the 'subset_list' array.
93 : : */
94 : : virtual ErrorCode read_tag_values( const char* file_name, const char* tag_name, const FileOptions& opts,
95 : : std::vector< int >& tag_values_out, const SubsetList* subset_list = 0 ) = 0;
96 : : };
97 : :
98 : : } // namespace moab
99 : :
100 : : #endif
|