![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
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 WRITE_VTK_HPP
00017 #define WRITE_VTK_HPP
00018
00019 #include
00020
00021 #include "moab/Forward.hpp"
00022 #include "moab/WriterIface.hpp"
00023
00024 namespace moab
00025 {
00026
00027 class WriteUtilIface;
00028
00029 // class MB_DLL_EXPORT WriteVtk : public WriterIface
00030 class WriteVtk : public WriterIface
00031 {
00032
00033 public:
00034 //! Constructor
00035 WriteVtk( Interface* impl );
00036
00037 //! Destructor
00038 virtual ~WriteVtk();
00039
00040 static WriterIface* factory( Interface* );
00041
00042 //! writes out a file
00043 ErrorCode write_file( const char* file_name,
00044 const bool overwrite,
00045 const FileOptions& opts,
00046 const EntityHandle* output_list,
00047 const int num_sets,
00048 const std::vector< std::string >& qa_list,
00049 const Tag* tag_list = NULL,
00050 int num_tags = 0,
00051 int export_dimension = 3 );
00052
00053 private:
00054 //! Get entities to write, given set list passed to \ref write_file
00055 ErrorCode gather_mesh( const EntityHandle* set_list, int num_sets, Range& nodes, Range& elems );
00056
00057 //! Write 4-line VTK file header
00058 ErrorCode write_header( std::ostream& stream );
00059
00060 //! Write node coordinates
00061 ErrorCode write_nodes( std::ostream& stream, const Range& nodes );
00062
00063 //! Write element connectivity
00064 ErrorCode write_elems( std::ostream& stream, const Range& nodes, const Range& elems );
00065
00066 //! Write all tags on either the list of nodes or the list of elements
00067 ErrorCode write_tags( std::ostream& stream, bool nodes, const Range& entities, const Tag* tag_list, int num_tags );
00068
00069 //! Write the tad description for the passed tag and call the template
00070 //! \ref write_tag function to write the tag data.
00071 ErrorCode write_tag( std::ostream& stream, Tag tag, const Range& entities, const Range& tagged_entities );
00072
00073 //! Write tag data
00074 template < typename T >
00075 ErrorCode write_tag( std::ostream& stream,
00076 Tag tag,
00077 const Range& entities,
00078 const Range& tagged_entities,
00079 const int );
00080
00081 ErrorCode write_bit_tag( std::ostream& stream, Tag tag, const Range& entities, const Range& tagged_entities );
00082 //! Write a list of values
00083 template < typename T >
00084 void write_data( std::ostream& stream, const std::vector< T >& data, unsigned vals_per_tag );
00085
00086 Interface* mbImpl;
00087 WriteUtilIface* writeTool;
00088
00089 bool mStrict; // If true, do not write data that cannot fit in strict VTK file format.
00090 int freeNodes;
00091 bool createOneNodeCells;
00092 };
00093
00094 } // namespace moab
00095
00096 #endif