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