libMesh
namebased_io.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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 // C++ includes
20 #include <iomanip>
21 #include <fstream>
22 #include <vector>
23 
24 #include <sys/types.h> // getpid
25 #include <unistd.h>
26 
27 // Local includes
28 #include "libmesh/libmesh_logging.h"
29 #include "libmesh/mesh_base.h"
30 #include "libmesh/mesh_communication.h"
31 #include "libmesh/namebased_io.h"
32 #include "libmesh/dyna_io.h"
33 #include "libmesh/exodusII_io.h"
34 #include "libmesh/gmv_io.h"
35 #include "libmesh/tecplot_io.h"
36 #include "libmesh/tetgen_io.h"
37 #include "libmesh/ucd_io.h"
38 #include "libmesh/unv_io.h"
39 #include "libmesh/matlab_io.h"
40 #include "libmesh/off_io.h"
41 #include "libmesh/medit_io.h"
42 #include "libmesh/nemesis_io.h"
43 #include "libmesh/gmsh_io.h"
44 #include "libmesh/fro_io.h"
45 #include "libmesh/xdr_io.h"
46 #include "libmesh/vtk_io.h"
47 #include "libmesh/abaqus_io.h"
48 #include "libmesh/checkpoint_io.h"
49 #include "libmesh/equation_systems.h"
50 #include "libmesh/enum_xdr_mode.h"
51 
52 #include "libmesh/parallel.h" // broadcast
53 
54 
55 namespace libMesh
56 {
57 
58 
59 
60 // ------------------------------------------------------------
61 // NameBasedIO members
62 void NameBasedIO::read (const std::string & name)
63 {
65 
66  // See if the file exists. Perform this check on all processors
67  // so that the code is terminated properly in the case that the
68  // file does not exist.
69 
70  // For Nemesis files, the name we try to read will have suffixes
71  // identifying processor rank
72  if (name.rfind(".nem") + 4 == name.size() ||
73  name.rfind(".n") + 2 == name.size())
74  {
75  std::ostringstream full_name;
76 
77  // Find the length of a string which represents the highest processor ID
78  full_name << (mymesh.n_processors());
79  int field_width = cast_int<int>(full_name.str().size());
80 
81  // reset the string stream
82  full_name.str("");
83 
84  // And build up the full filename
85  full_name << name
86  << '.' << mymesh.n_processors()
87  << '.' << std::setfill('0') << std::setw(field_width) << mymesh.processor_id();
88 
89  std::ifstream in (full_name.str().c_str());
90 
91  if (!in.good())
92  libmesh_error_msg("ERROR: cannot locate specified file:\n\t" << full_name.str());
93  }
94  else if (name.rfind(".cp")) {} // Do error checking in the reader
95  else
96  {
97  std::ifstream in (name.c_str());
98 
99  if (!in.good())
100  libmesh_error_msg("ERROR: cannot locate specified file:\n\t" << name);
101  }
102 
103  // Look for parallel formats first
105  {
106  // no need to handle bz2 files here -- the Xdr class does that.
107  if ((name.rfind(".xda") < name.size()) ||
108  (name.rfind(".xdr") < name.size()))
109  {
110  XdrIO xdr_io(mymesh);
111 
112  // .xda* ==> bzip2/gzip/ASCII flavors
113  if (name.rfind(".xda") < name.size())
114  {
115  xdr_io.binary() = false;
116  xdr_io.read (name);
117  }
118  else // .xdr* ==> true binary XDR file
119  {
120  xdr_io.binary() = true;
121  xdr_io.read (name);
122  }
123 
124  // The xdr_io object gets constructed with legacy() == false.
125  // if legacy() == true then it means that a legacy file was detected and
126  // thus processor 0 performed the read. We therefore need to broadcast the
127  // mesh. Further, for this flavor of mesh solution data ordering is tied
128  // to the node ordering, so we better not reorder the nodes!
129  if (xdr_io.legacy())
130  {
131  mymesh.allow_renumbering(false);
132  MeshCommunication().broadcast(mymesh);
133  }
134 
135  // libHilbert-enabled libMesh builds should construct files
136  // with a canonical node ordering, which libHilbert-enabled
137  // builds will be able to read in again regardless of any
138  // renumbering. So in that case we're free to renumber.
139  // However, if either the writer or the reader of this file
140  // don't have libHilbert, then we'll have to skip
141  // renumbering because we need the numbering to remain
142  // consistent with any solution file we read in next.
143 #ifdef LIBMESH_HAVE_LIBHILBERT
144  // if (!xdr_io.libhilbert_ordering())
145  // skip_renumber_nodes_and_elements = true;
146 #else
147  mymesh.allow_renumbering(false);
148 #endif
149  }
150  else if (name.rfind(".nem") < name.size() ||
151  name.rfind(".n") < name.size())
152  Nemesis_IO(mymesh).read (name);
153  else if (name.rfind(".cp") < name.size())
154  {
155  if (name.rfind(".cpa") < name.size())
156  CheckpointIO(mymesh, false).read(name);
157  else
158  CheckpointIO(mymesh, true).read(name);
159  }
160  }
161 
162  // Serial mesh formats
163  else
164  {
165  // Read the file based on extension. Only processor 0
166  // needs to read the mesh. It will then broadcast it and
167  // the other processors will pick it up
168  if (mymesh.processor_id() == 0)
169  {
170  LOG_SCOPE("read()", "NameBasedIO");
171 
172  std::ostringstream pid_suffix;
173  pid_suffix << '_' << getpid();
174  // Nasty hack for reading/writing zipped files
175  std::string new_name = name;
176  if (name.size() - name.rfind(".bz2") == 4)
177  {
178 #ifdef LIBMESH_HAVE_BZIP
179  new_name.erase(new_name.end() - 4, new_name.end());
180  new_name += pid_suffix.str();
181  std::string system_string = "bunzip2 -f -k -c ";
182  system_string += name + " > " + new_name;
183  LOG_SCOPE("system(bunzip2)", "NameBasedIO");
184  if (std::system(system_string.c_str()))
185  libmesh_file_error(system_string);
186 #else
187  libmesh_error_msg("ERROR: need bzip2/bunzip2 to open .bz2 file " << name);
188 #endif
189  }
190  else if (name.size() - name.rfind(".xz") == 3)
191  {
192 #ifdef LIBMESH_HAVE_XZ
193  new_name.erase(new_name.end() - 3, new_name.end());
194  new_name += pid_suffix.str();
195  std::string system_string = "xz -f -d -k -c ";
196  system_string += name + " > " + new_name;
197  LOG_SCOPE("system(xz -d)", "XdrIO");
198  if (std::system(system_string.c_str()))
199  libmesh_file_error(system_string);
200 #else
201  libmesh_error_msg("ERROR: need xz to open .xz file " << name);
202 #endif
203  }
204 
205  if (new_name.rfind(".mat") < new_name.size())
206  MatlabIO(mymesh).read(new_name);
207 
208  else if (new_name.rfind(".ucd") < new_name.size())
209  UCDIO(mymesh).read (new_name);
210 
211  else if ((new_name.rfind(".off") < new_name.size()) ||
212  (new_name.rfind(".ogl") < new_name.size()) ||
213  (new_name.rfind(".oogl") < new_name.size()))
214  OFFIO(mymesh).read (new_name);
215 
216  else if (new_name.rfind(".unv") < new_name.size())
217  UNVIO(mymesh).read (new_name);
218 
219  else if ((new_name.rfind(".node") < new_name.size()) ||
220  (new_name.rfind(".ele") < new_name.size()))
221  TetGenIO(mymesh).read (new_name);
222 
223  else if (new_name.rfind(".exd") < new_name.size() ||
224  new_name.rfind(".e") < new_name.size())
225  ExodusII_IO(mymesh).read (new_name);
226 
227  else if (new_name.rfind(".msh") < new_name.size())
228  GmshIO(mymesh).read (new_name);
229 
230  else if (new_name.rfind(".gmv") < new_name.size())
231  GMVIO(mymesh).read (new_name);
232 
233  else if (new_name.rfind(".vtu") < new_name.size())
234  VTKIO(mymesh).read(new_name);
235 
236  else if (new_name.rfind(".inp") < new_name.size())
237  AbaqusIO(mymesh).read(new_name);
238 
239  else if ((new_name.rfind(".bext") < new_name.size()) ||
240  (new_name.rfind(".bxt") < new_name.size()))
241  DynaIO(mymesh).read (new_name);
242 
243  else
244  {
245  libmesh_error_msg(" ERROR: Unrecognized file extension: " \
246  << name \
247  << "\n I understand the following:\n\n" \
248  << " *.bext -- Bezier files in DYNA format\n" \
249  << " *.bxt -- Bezier files in DYNA format\n" \
250  << " *.e -- Sandia's ExodusII format\n" \
251  << " *.exd -- Sandia's ExodusII format\n" \
252  << " *.gmv -- LANL's General Mesh Viewer format\n" \
253  << " *.mat -- Matlab triangular ASCII file\n" \
254  << " *.n -- Sandia's Nemesis format\n" \
255  << " *.nem -- Sandia's Nemesis format\n" \
256  << " *.off -- OOGL OFF surface format\n" \
257  << " *.ucd -- AVS's ASCII UCD format\n" \
258  << " *.unv -- I-deas Universal format\n" \
259  << " *.vtu -- Paraview VTK format\n" \
260  << " *.inp -- Abaqus .inp format\n" \
261  << " *.xda -- libMesh ASCII format\n" \
262  << " *.xdr -- libMesh binary format\n" \
263  << " *.gz -- any above format gzipped\n" \
264  << " *.bz2 -- any above format bzip2'ed\n" \
265  << " *.xz -- any above format xzipped\n" \
266  << " *.cpa -- libMesh Checkpoint ASCII format\n" \
267  << " *.cpr -- libMesh Checkpoint binary format\n");
268  }
269 
270  // If we temporarily decompressed a file, remove the
271  // uncompressed version
272  if (name.size() - name.rfind(".bz2") == 4)
273  std::remove(new_name.c_str());
274  if (name.size() - name.rfind(".xz") == 3)
275  std::remove(new_name.c_str());
276  }
277 
278  // Send the mesh & bcs (which are now only on processor 0) to the other
279  // processors
280  MeshCommunication().broadcast (mymesh);
281  }
282 }
283 
284 
285 void NameBasedIO::write (const std::string & name)
286 {
287  MeshBase & mymesh = MeshInput<MeshBase>::mesh();
288 
289  // parallel formats are special -- they may choose to write
290  // separate files, let's not try to handle the zipping here.
292  {
293  // no need to handle bz2 files here -- the Xdr class does that.
294  if (name.rfind(".xda") < name.size())
295  XdrIO(mymesh).write(name);
296 
297  else if (name.rfind(".xdr") < name.size())
298  XdrIO(mymesh,true).write(name);
299 
300  else if (name.rfind(".nem") < name.size() ||
301  name.rfind(".n") < name.size())
302  Nemesis_IO(mymesh).write(name);
303 
304  else if (name.rfind(".cpa") < name.size())
305  CheckpointIO(mymesh,false).write(name);
306 
307  else if (name.rfind(".cpr") < name.size())
308  CheckpointIO(mymesh,true).write(name);
309 
310  else
311  libmesh_error_msg("Couldn't deduce filetype for " << name);
312  }
313 
314  // serial file formats
315  else
316  {
317  // Nasty hack for reading/writing zipped files
318  std::string new_name = name;
319  pid_t pid_0 = 0;
320  if (mymesh.processor_id() == 0)
321  pid_0 = getpid();
322  mymesh.comm().broadcast(pid_0);
323  std::ostringstream pid_suffix;
324  pid_suffix << '_' << pid_0;
325 
326  if (name.size() - name.rfind(".bz2") == 4)
327  {
328  new_name.erase(new_name.end() - 4, new_name.end());
329  new_name += pid_suffix.str();
330  }
331  else if (name.size() - name.rfind(".xz") == 3)
332  {
333  new_name.erase(new_name.end() - 3, new_name.end());
334  new_name += pid_suffix.str();
335  }
336 
337  // New scope so that io will close before we try to zip the file
338  {
339  // Write the file based on extension
340  if (new_name.rfind(".dat") < new_name.size())
341  TecplotIO(mymesh).write (new_name);
342 
343  else if (new_name.rfind(".plt") < new_name.size())
344  TecplotIO(mymesh,true).write (new_name);
345 
346  else if (new_name.rfind(".ucd") < new_name.size())
347  UCDIO (mymesh).write (new_name);
348 
349  else if (new_name.rfind(".gmv") < new_name.size())
350  if (mymesh.n_partitions() > 1)
351  GMVIO(mymesh).write (new_name);
352  else
353  {
354  GMVIO io(mymesh);
355  io.partitioning() = false;
356  io.write (new_name);
357  }
358 
359  else if (new_name.rfind(".e") < new_name.size())
360  ExodusII_IO(mymesh).write(new_name);
361 
362  else if (new_name.rfind(".unv") < new_name.size())
363  UNVIO(mymesh).write (new_name);
364 
365  else if (new_name.rfind(".mesh") < new_name.size())
366  MEDITIO(mymesh).write (new_name);
367 
368  else if (new_name.rfind(".poly") < new_name.size())
369  TetGenIO(mymesh).write (new_name);
370 
371  else if (new_name.rfind(".msh") < new_name.size())
372  GmshIO(mymesh).write (new_name);
373 
374  else if (new_name.rfind(".fro") < new_name.size())
375  FroIO(mymesh).write (new_name);
376 
377  else if (new_name.rfind(".vtu") < new_name.size())
378  VTKIO(mymesh).write (new_name);
379 
380  else
381  {
383  << " ERROR: Unrecognized file extension: " << name
384  << "\n I understand the following:\n\n"
385  << " *.cpa -- libMesh ASCII checkpoint format\n"
386  << " *.cpr -- libMesh binary checkpoint format,\n"
387  << " *.dat -- Tecplot ASCII file\n"
388  << " *.e -- Sandia's ExodusII format\n"
389  << " *.exd -- Sandia's ExodusII format\n"
390  << " *.fro -- ACDL's surface triangulation file\n"
391  << " *.gmv -- LANL's GMV (General Mesh Viewer) format\n"
392  << " *.mesh -- MEdit mesh format\n"
393  << " *.mgf -- MGF binary mesh format\n"
394  << " *.msh -- GMSH ASCII file\n"
395  << " *.n -- Sandia's Nemesis format\n"
396  << " *.nem -- Sandia's Nemesis format\n"
397  << " *.plt -- Tecplot binary file\n"
398  << " *.poly -- TetGen ASCII file\n"
399  << " *.ucd -- AVS's ASCII UCD format\n"
400  << " *.ugrid -- Kelly's DIVA ASCII format\n"
401  << " *.unv -- I-deas Universal format\n"
402  << " *.vtu -- VTK (paraview-readable) format\n"
403  << " *.xda -- libMesh ASCII format\n"
404  << " *.xdr -- libMesh binary format,\n"
405  << std::endl
406  << "\n Exiting without writing output\n";
407  }
408  }
409 
410  // Nasty hack for reading/writing zipped files
411  if (name.size() - name.rfind(".bz2") == 4)
412  {
413  LOG_SCOPE("system(bzip2)", "NameBasedIO");
414  if (mymesh.processor_id() == 0)
415  {
416  std::string system_string = "bzip2 -f -c ";
417  system_string += new_name + " > " + name;
418  if (std::system(system_string.c_str()))
419  libmesh_file_error(system_string);
420  std::remove(new_name.c_str());
421  }
422  mymesh.comm().barrier();
423  }
424  if (name.size() - name.rfind(".xz") == 3)
425  {
426  LOG_SCOPE("system(xz)", "NameBasedIO");
427  if (mymesh.processor_id() == 0)
428  {
429  std::string system_string = "xz -f -c ";
430  system_string += new_name + " > " + name;
431  if (std::system(system_string.c_str()))
432  libmesh_file_error(system_string);
433  std::remove(new_name.c_str());
434  }
435  mymesh.comm().barrier();
436  }
437  }
438 }
439 
440 
441 void NameBasedIO::write_nodal_data (const std::string & name,
442  const std::vector<Number> & v,
443  const std::vector<std::string> & vn)
444 {
445  MeshBase & mymesh = MeshInput<MeshBase>::mesh();
446 
447  // Write the file based on extension
448  if (name.rfind(".dat") < name.size())
449  TecplotIO(mymesh).write_nodal_data (name, v, vn);
450 
451  else if (name.rfind(".e") < name.size())
452  ExodusII_IO(mymesh).write_nodal_data(name, v, vn);
453 
454  else if (name.rfind(".gmv") < name.size())
455  {
456  if (mymesh.n_subdomains() > 1)
457  GMVIO(mymesh).write_nodal_data (name, v, vn);
458  else
459  {
460  GMVIO io(mymesh);
461  io.partitioning() = false;
462  io.write_nodal_data (name, v, vn);
463  }
464  }
465 
466  else if (name.rfind(".mesh") < name.size())
467  MEDITIO(mymesh).write_nodal_data (name, v, vn);
468 
469  else if (name.rfind(".msh") < name.size())
470  GmshIO(mymesh).write_nodal_data (name, v, vn);
471 
472  else if (name.rfind(".nem") < name.size() ||
473  name.rfind(".n") < name.size())
474  Nemesis_IO(mymesh).write_nodal_data(name, v, vn);
475 
476  else if (name.rfind(".plt") < name.size())
477  TecplotIO(mymesh,true).write_nodal_data (name, v, vn);
478 
479  else if (name.rfind(".pvtu") < name.size())
480  VTKIO(mymesh).write_nodal_data (name, v, vn);
481 
482  else if (name.rfind(".ucd") < name.size())
483  UCDIO (mymesh).write_nodal_data (name, v, vn);
484 
485  else
486  {
488  << " ERROR: Unrecognized file extension: " << name
489  << "\n I understand the following:\n\n"
490  << " *.dat -- Tecplot ASCII file\n"
491  << " *.e -- Sandia's ExodusII format\n"
492  << " *.exd -- Sandia's ExodusII format\n"
493  << " *.gmv -- LANL's GMV (General Mesh Viewer) format\n"
494  << " *.mesh -- MEdit mesh format\n"
495  << " *.msh -- GMSH ASCII file\n"
496  << " *.n -- Sandia's Nemesis format\n"
497  << " *.nem -- Sandia's Nemesis format\n"
498  << " *.plt -- Tecplot binary file\n"
499  << " *.pvtu -- Paraview VTK file\n"
500  << " *.ucd -- AVS's ASCII UCD format\n"
501  << "\n Exiting without writing output\n";
502  }
503 }
504 
505 
506 void NameBasedIO::write_equation_systems (const std::string & filename,
507  const EquationSystems & es,
508  const std::set<std::string> * system_names)
509 {
510  // XDA/XDR require a separate code path, and currently only support
511  // writing complete restarts
512  if (!system_names)
513  {
514  if (filename.rfind(".xda") < filename.size())
515  {
516  es.write(filename,WRITE,
519  return;
520  }
521  else if (filename.rfind(".xdr") < filename.size())
522  {
523  es.write(filename,ENCODE,
526  return;
527  }
528  }
529 
530  // Other formats just use the default "write nodal values" path
532  (filename, es, system_names);
533 }
534 
535 
536 
537 } // namespace libMesh
libMesh::VTKIO::read
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file in VTK format.
Definition: vtk_io.C:155
libMesh::Nemesis_IO::write
virtual void write(const std::string &base_filename) override
This method implements writing a mesh to a specified file.
Definition: nemesis_io.C:1183
libMesh::AbaqusIO
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format.
Definition: abaqus_io.h:40
libMesh::FroIO
This class implements writing meshes in the .fro format used by the MIT ACDL.
Definition: fro_io.h:42
libMesh::Nemesis_IO
The Nemesis_IO class implements reading parallel meshes in the Nemesis file format from Sandia Nation...
Definition: nemesis_io.h:50
libMesh::GmshIO::read
virtual void read(const std::string &name) override
Reads in a mesh in the Gmsh *.msh format from the ASCII file given by name.
Definition: gmsh_io.C:147
libMesh::UNVIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file.
Definition: unv_io.C:262
libMesh::MatlabIO::read
virtual void read(const std::string &name) override
Reads in a matlab data file based on the string you pass it.
Definition: matlab_io.C:33
libMesh::NameBasedIO::write
virtual void write(const std::string &mesh_file) override
This method implements writing a mesh to a specified file.
Definition: namebased_io.C:285
libMesh::OFFIO
This class is responsible for reading an unstructured, triangulated surface in the standard OFF OOGL ...
Definition: off_io.h:39
libMesh::EquationSystems::WRITE_DATA
Definition: equation_systems.h:93
libMesh::XdrIO::binary
bool binary() const
Get/Set the flag indicating if we should read/write binary.
Definition: xdr_io.h:103
libMesh::TecplotIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file.
Definition: tecplot_io.C:175
libMesh::OFFIO::read
virtual void read(const std::string &name) override
Reads in an OFF OOGL data file based on the string you pass it.
Definition: off_io.C:35
libMesh::XdrIO
MeshIO class used for writing XDR (eXternal Data Representation) and XDA mesh files.
Definition: xdr_io.h:51
libMesh::MEDITIO
This class implements writing meshes in the mesh format used by the MEdit visualization tool develope...
Definition: medit_io.h:47
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::GmshIO
Reading and writing meshes in the Gmsh format.
Definition: gmsh_io.h:51
libMesh::TetGenIO::read
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file in TetGen format.
Definition: tetgen_io.C:34
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::TetGenIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified ".poly" file.
Definition: tetgen_io.C:273
libMesh::XdrIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file.
Definition: xdr_io.C:115
libMesh::UNVIO::read
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file.
Definition: unv_io.C:98
libMesh::WRITE
Definition: enum_xdr_mode.h:40
libMesh::MeshBase::n_partitions
unsigned int n_partitions() const
Definition: mesh_base.h:1153
libMesh::GMVIO
This class implements writing meshes in the GMV format.
Definition: gmv_io.h:54
libMesh::GmshIO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: gmsh_io.C:848
libMesh::FroIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file.
Definition: fro_io.C:41
libMesh::ExodusII_IO
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:51
libMesh::XdrIO::read
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file.
Definition: xdr_io.C:1210
libMesh::VTKIO
This class implements reading and writing meshes in the VTK format.
Definition: vtk_io.h:60
libMesh::ExodusII_IO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Write out a nodal solution.
Definition: exodusII_io.C:1124
libMesh::MeshCommunication::broadcast
void broadcast(MeshBase &) const
Definition: mesh_communication.C:1084
libMesh::NameBasedIO::is_parallel_file_format
bool is_parallel_file_format(const std::string &filename)
Definition: namebased_io.h:124
libMesh::MeshBase::n_subdomains
subdomain_id_type n_subdomains() const
Definition: mesh_base.C:477
libMesh::Nemesis_IO::read
virtual void read(const std::string &base_filename) override
Implements reading the mesh from several different files.
Definition: nemesis_io.C:150
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::UNVIO
The UNVIO class implements the Ideas UNV universal file format.
Definition: unv_io.h:52
libMesh::ParallelObject::n_processors
processor_id_type n_processors() const
Definition: parallel_object.h:100
libMesh::NameBasedIO::read
virtual void read(const std::string &mesh_file) override
This method implements reading a mesh from a specified file.
Definition: namebased_io.C:62
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::TecplotIO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: tecplot_io.C:188
libMesh::GMVIO::read
virtual void read(const std::string &mesh_file) override
This method implements reading a mesh from a specified file.
Definition: gmv_io.C:1879
libMesh::Nemesis_IO::write_nodal_data
virtual void write_nodal_data(const std::string &fname, const std::vector< Number > &soln, const std::vector< std::string > &names) override
Output a nodal solution from data in soln.
Definition: nemesis_io.C:1483
libMesh::GMVIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file.
Definition: gmv_io.C:271
libMesh::DynaIO
Reading and writing meshes in (a subset of) LS-DYNA format.
Definition: dyna_io.h:52
libMesh::CheckpointIO::read
virtual void read(const std::string &input_name) override
This method implements reading a mesh from a specified file.
Definition: checkpoint_io.C:804
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
libMesh::UCDIO::read
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file in UCD format.
Definition: ucd_io.C:84
libMesh::MeshOutput::write_equation_systems
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
Definition: mesh_output.C:31
libMesh::ENCODE
Definition: enum_xdr_mode.h:38
libMesh::GMVIO::partitioning
bool & partitioning()
Flag indicating whether or not to write the partitioning information for the mesh.
Definition: gmv_io.h:115
libMesh::TecplotIO
This class implements writing meshes in the Tecplot format.
Definition: tecplot_io.h:43
libMesh::UCDIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified file in UCD format.
Definition: ucd_io.C:105
libMesh::NameBasedIO::write_equation_systems
virtual void write_equation_systems(const std::string &filename, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
This method implements writing a mesh with data to a specified file where the data is taken from the ...
Definition: namebased_io.C:506
libMesh::CheckpointIO::write
virtual void write(const std::string &name) override
This method implements writing a mesh to a specified file.
Definition: checkpoint_io.C:283
libMesh::EquationSystems::write
void write(const std::string &name, const XdrMODE, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
Write the systems to disk using the XDR data format.
Definition: equation_systems_io.C:378
libMesh::XdrIO::legacy
bool legacy() const
Get/Set the flag indicating if we should read/write legacy.
Definition: xdr_io.h:109
libMesh::UCDIO::write_nodal_data
virtual void write_nodal_data(const std::string &fname, const std::vector< Number > &soln, const std::vector< std::string > &names) override
This method implements writing a mesh and solution to a specified file in UCD format.
Definition: ucd_io.C:333
libMesh::VTKIO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: vtk_io.C:251
libMesh::MeshInput::mesh
MT & mesh()
Definition: mesh_input.h:169
libMesh::ExodusII_IO::write
virtual void write(const std::string &fname) override
This method implements writing a mesh to a specified file.
Definition: exodusII_io.C:1338
libMesh::EquationSystems::WRITE_ADDITIONAL_DATA
Definition: equation_systems.h:94
libMesh::err
OStreamProxy err
libMesh::GmshIO::write
virtual void write(const std::string &name) override
This method implements writing a mesh to a specified file in the Gmsh *.msh format.
Definition: gmsh_io.C:831
libMesh::DynaIO::read
virtual void read(const std::string &name) override
Reads in a mesh in the Dyna format from the ASCII file given by name.
Definition: dyna_io.C:129
libMesh::AbaqusIO::read
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
Definition: abaqus_io.C:229
libMesh::VTKIO::write
virtual void write(const std::string &) override
Output the mesh without solutions to a .pvtu file.
libMesh::MeshBase::allow_renumbering
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use.
Definition: mesh_base.h:1025
libMesh::ExodusII_IO::read
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
Definition: exodusII_io.C:143
libMesh::MeshCommunication
This is the MeshCommunication class.
Definition: mesh_communication.h:50
libMesh::MEDITIO::write
virtual void write(const std::string &) override
This method implements writing a mesh to a specified ".mesh" file.
Definition: medit_io.C:37
libMesh::GMVIO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: gmv_io.C:281
libMesh::UCDIO
This class implements reading & writing meshes in the AVS's UCD format.
Definition: ucd_io.h:52
libMesh::MatlabIO
This class implements reading meshes in the Matlab PDE toolkit in a proprietary format.
Definition: matlab_io.h:85
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
libMesh::CheckpointIO
The CheckpointIO class can be used to write simplified restart files that can be used to restart simu...
Definition: checkpoint_io.h:60
libMesh::NameBasedIO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: namebased_io.C:441
libMesh::MEDITIO::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: medit_io.C:46
libMesh::TetGenIO
This class implements reading and writing meshes in the TetGen format.
Definition: tetgen_io.h:47