namebased_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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 
20 #ifndef LIBMESH_NAMEBASED_IO_H
21 #define LIBMESH_NAMEBASED_IO_H
22 
23 // Local includes
24 #include "libmesh/mesh_output.h"
25 #include "libmesh/mesh_input.h"
26 
27 namespace libMesh
28 {
29 
30 // Forward declarations
31 class MeshBase;
32 
44 class NameBasedIO : public MeshInput<MeshBase>,
45  public MeshOutput<MeshBase>
46 {
47 public:
48 
53  explicit
54  NameBasedIO (const MeshBase &);
55 
60  explicit
62 
66  virtual void read (const std::string & mesh_file) override;
67 
71  virtual void write (const std::string & mesh_file) override;
72 
82  virtual void write_equation_systems (const std::string & filename,
83  const EquationSystems & es,
84  const std::set<std::string> * system_names=nullptr) override;
85 
91 
96  virtual void write_nodal_data (const std::string &,
97  const std::vector<Number> &,
98  const std::vector<std::string> &) override;
99 
100  // Certain mesh formats can support parallel I/O, including the
101  // "new" Xdr format and the Nemesis format.
102  bool is_parallel_file_format (const std::string & filename);
103 };
104 
105 
106 
107 // ------------------------------------------------------------
108 // NameBasedIO inline members
109 inline
112 {
113 }
114 
115 inline
119 {
120 }
121 
122 inline
123 bool
125 {
126  return ((name.rfind(".xda") < name.size()) ||
127  (name.rfind(".xdr") < name.size()) ||
128  (name.rfind(".nem") + 4 == name.size()) ||
129  (name.rfind(".n") + 2 == name.size()) ||
130  (name.rfind(".cp") < name.size())
131  );
132 }
133 
134 
135 } // namespace libMesh
136 
137 
138 #endif // LIBMESH_NAMEBASED_IO_H
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
virtual void write_equation_systems(const std::string &filename, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Definition: namebased_io.C:487
Manages multiples systems of equations.
virtual void read(const std::string &mesh_file) override
Definition: namebased_io.C:59
MeshBase & mesh
NameBasedIO(const MeshBase &)
Definition: namebased_io.h:110
Base class for Mesh.
Definition: mesh_base.h:77
virtual void write(const std::string &mesh_file) override
Definition: namebased_io.C:276
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Definition: namebased_io.C:422
bool is_parallel_file_format(const std::string &filename)
Definition: namebased_io.h:124