MOAB: Mesh Oriented datABase  (version 5.3.1)
ReaderIface.hpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  */
00015 
00016 #ifndef MOAB_READER_IFACE_HPP
00017 #define MOAB_READER_IFACE_HPP
00018 
00019 #include "moab/Types.hpp"
00020 
00021 #include <vector>
00022 
00023 namespace moab
00024 {
00025 
00026 class FileOptions;
00027 
00028 /**
00029  *\brief Interface for mesh reader implementations.
00030  *\version 1.00
00031  *\date 2004-4-23
00032  *\author Jason Kraftcheck
00033  */
00034 class ReaderIface
00035 {
00036   public:
00037     virtual ~ReaderIface() {}
00038 
00039     /** Struct used to specify subset of file to read */
00040     struct IDTag
00041     {
00042         const char* tag_name;   //!< Name of tag containing integer IDs
00043         const int* tag_values;  //!< Array of integer ID values
00044         int num_tag_values;     //!< Length of tag_values array
00045     };
00046 
00047     struct SubsetList
00048     {
00049         /** An array of tag name and value sets specifying
00050          *  the subset of the file to read.  If multiple
00051          *  tags are specified, the sets that match all
00052          *  tags (intersection) should be read.
00053          */
00054         IDTag* tag_list;
00055         int tag_list_length;  //!< Length of tag_list array
00056         int num_parts;        //!< If non-zero, load 1/num_parts of the matching sets
00057         int part_number;      //!< If num_parts is non-zero, load part_number-th fraction of the sets
00058     };
00059 
00060     /**
00061      *\brief Load mesh from a file.
00062      *
00063      * Method all readers must provide to import a mesh.
00064      *
00065      *\param file_name      The file to read.
00066      *\param file_set       Optional pointer to entity set representing
00067      *                      file.  If this is not NULL, reader may optionally
00068      *                      tag the pointed-to set with format-specific
00069      *                      meta-data.
00070      *\param subset_list    An optional struct pointer specifying the tags identifying
00071      *                      entity sets to be read.
00072      *\param file_id_tag    If specified, reader should store for each entity
00073      *                      it reads, a unique integer ID for this tag.
00074      *\author Jason Kraftcheck
00075      */
00076     virtual ErrorCode load_file( const char* file_name, const EntityHandle* file_set, const FileOptions& opts,
00077                                  const SubsetList* subset_list = 0, const Tag* file_id_tag = 0 ) = 0;
00078 
00079     /**
00080      *\brief Read tag values from a file.
00081      *
00082      * Read the list if all integer tag values from the file for
00083      * a tag that is a single integer value per entity.
00084      *
00085      *\param file_name      The file to read.
00086      *\param tag_name       The tag for which to read values
00087      *\param tag_values_out Output: The list of tag values.
00088      *\param subset_list    An array of tag name and value sets specifying
00089      *                      the subset of the file to read.  If multiple
00090      *                      tags are specified, the sets that match all
00091      *                      tags (intersection) should be read.
00092      *\param subset_list_length The length of the 'subset_list' array.
00093      */
00094     virtual ErrorCode read_tag_values( const char* file_name, const char* tag_name, const FileOptions& opts,
00095                                        std::vector< int >& tag_values_out, const SubsetList* subset_list = 0 ) = 0;
00096 };
00097 
00098 }  // namespace moab
00099 
00100 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines