$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_NAMEBASED_IO_H 00021 #define LIBMESH_NAMEBASED_IO_H 00022 00023 // Local includes 00024 #include "libmesh/mesh_output.h" 00025 #include "libmesh/mesh_input.h" 00026 00027 namespace libMesh 00028 { 00029 00030 // Forward declarations 00031 class MeshBase; 00032 00044 // ------------------------------------------------------------ 00045 // NameBasedIO class definition 00046 class NameBasedIO : public MeshInput<MeshBase>, 00047 public MeshOutput<MeshBase> 00048 { 00049 public: 00050 00055 explicit 00056 NameBasedIO (const MeshBase&); 00057 00062 explicit 00063 NameBasedIO (MeshBase&); 00064 00068 virtual void read (const std::string& mesh_file); 00069 00073 virtual void write (const std::string& mesh_file); 00074 00084 virtual void write_equation_systems (const std::string& filename, 00085 const EquationSystems& es, 00086 const std::set<std::string>* system_names=NULL); 00087 00092 virtual void write_nodal_data (const std::string&, 00093 const std::vector<Number>&, 00094 const std::vector<std::string>&); 00095 00096 // Certain mesh formats can support parallel I/O, including the 00097 // "new" Xdr format and the Nemesis format. 00098 bool is_parallel_file_format (const std::string &filename); 00099 }; 00100 00101 00102 00103 // ------------------------------------------------------------ 00104 // NameBasedIO inline members 00105 inline 00106 NameBasedIO::NameBasedIO (const MeshBase& mesh) : 00107 MeshOutput<MeshBase> (mesh) 00108 { 00109 } 00110 00111 inline 00112 NameBasedIO::NameBasedIO (MeshBase& mesh) : 00113 MeshInput<MeshBase> (mesh), 00114 MeshOutput<MeshBase>(mesh) 00115 { 00116 } 00117 00118 inline 00119 bool 00120 NameBasedIO::is_parallel_file_format (const std::string &name) 00121 { 00122 return ((name.rfind(".xda") < name.size()) || 00123 (name.rfind(".xdr") < name.size()) || 00124 (name.rfind(".nem") < name.size()) || 00125 (name.rfind(".n") < name.size()) || 00126 (name.rfind(".cp") < name.size()) 00127 ); 00128 } 00129 00130 00131 } // namespace libMesh 00132 00133 00134 #endif // LIBMESH_NAMEBASED_IO_H