ensight_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 #ifndef LIBMESH_ENSIGHT_IO_H
20 #define LIBMESH_ENSIGHT_IO_H
21 
22 // libMesh includes
23 #include "libmesh/libmesh.h"
24 #include "libmesh/enum_elem_type.h"
25 #include "libmesh/mesh_base.h"
26 #include "libmesh/mesh_output.h"
27 
28 // C++ includes
29 #include <map>
30 #include <string>
31 #include <vector>
32 
33 namespace libMesh
34 {
35 
36 // Forward declarations
37 class EquationSystems;
38 
43 class EnsightIO : public MeshOutput<MeshBase>
44 {
45  public:
46 
50  EnsightIO (const std::string &filename, const EquationSystems &eq);
51 
52  ~EnsightIO ();
53 
58  void add_vector (const std::string &system, const std::string &vec_description,
59  const std::string &u, const std::string &v);
60 
64  void add_vector (const std::string &system, const std::string &vec_description,
65  const std::string &u, const std::string &v, const std::string &w);
66 
70  void add_scalar (const std::string &system, const std::string &scalar_description,
71  const std::string &s);
72 
76  virtual void write (const std::string &name);
77 
81  void write (const double time = 0);
82 
83  bool& has_mesh_refinement();
84 
85 private:
86 
87  // Define aux. structures
88 
89  // Represents the vectors that are used by the EnsightIO
90  struct Vectors
91  {
92  std::string description;
93  std::vector<std::string> components;
94  };
95 
96  // Represents the scalars
97  struct Scalars
98  {
99  std::string scalar_name;
100  std::string description;
101  };
102 
103  // Store the variables of system
104  struct SystemVars
105  {
106  std::vector<Vectors> EnsightVectors;
107  std::vector<Scalars> EnsightScalars;
108  };
109 
110 
111  typedef std::map <std::string, SystemVars> SystemsVarsMap;
112  typedef std::map <std::string, SystemVars>::iterator SystemsVarsMapIterator;
113  typedef std::pair<std::string, SystemVars> SystemsVarsValue;
114 
115  // private methods
116  // write solution in ascii format file
117  void write_ascii (const double time = 0);
118  void write_scalar_ascii (const std::string &sys, const std::string &var);
119  void write_vector_ascii (const std::string &sys, const std::vector<std::string> &vec, const std::string &var_name);
120  void write_solution_ascii ();
121  void write_geometry_ascii ();
122 
123 
124  void write_case();
125  void elem_type_to_string (ElemType, char*);
126 
127  // private Attributes
128  std::string _ensight_file_name;
129  std::vector<double> _time_steps;
132 };
133 
134 
135 } // namespace libMesh
136 
137 
138 #endif // LIBMESH_ENSIGHT_IO_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo