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  using Utility::ends_with;
76  using Utility::contains;
77 
78  // See if the file exists. Perform this check on all processors
79  // so that the code is terminated properly in the case that the
80  // file does not exist.
81 
82  // For Nemesis files, the name we try to read will have suffixes
83  // identifying processor rank
84  if (ends_with(basename, ".nem") || ends_with(basename, ".n"))
85  {
86  std::ostringstream full_name;
87 
88  // Find the length of a string which represents the highest processor ID
89  full_name << (mymesh.n_processors());
90  int field_width = cast_int<int>(full_name.str().size());
91 
92  // reset the string stream
93  full_name.str("");
94 
95  // And build up the full filename
96  full_name << name
97  << '.' << mymesh.n_processors()
98  << '.' << std::setfill('0') << std::setw(field_width) << mymesh.processor_id();
99 
100  std::ifstream in (full_name.str().c_str());
101  libmesh_error_msg_if(!in.good(), "ERROR: cannot locate specified file:\n\t" << full_name.str());
102  }
103  else if (contains(basename, ".cp")) {} // Do error checking in the reader
104  else
105  {
106  std::ifstream in (name.c_str());
107  libmesh_error_msg_if(!in.good(), "ERROR: cannot locate specified file:\n\t" << name);
108  }
109 
110  // Look for parallel formats first
111  if (is_parallel_file_format(basename))
112  {
113  // no need to handle bz2 files here -- the Xdr class does that.
114  if (contains(basename, ".xda") ||
115  contains(basename, ".xdr"))
116  {
117  XdrIO xdr_io(mymesh);
118 
119  // .xda* ==> bzip2/gzip/ASCII flavors
120  if (contains(basename, ".xda"))
121  {
122  xdr_io.binary() = false;
123  xdr_io.read (name);
124  }
125  else // .xdr* ==> true binary XDR file
126  {
127  xdr_io.binary() = true;
128  xdr_io.read (name);
129  }
130 
131  // The xdr_io object gets constructed with legacy() == false.
132  // if legacy() == true then it means that a legacy file was detected and
133  // thus processor 0 performed the read. We therefore need to broadcast the
134  // mesh. Further, for this flavor of mesh solution data ordering is tied
135  // to the node ordering, so we better not reorder the nodes!
136  if (xdr_io.legacy())
137  {
138  mymesh.allow_renumbering(false);
139  MeshCommunication().broadcast(mymesh);
140  }
141 
142  // libHilbert-enabled libMesh builds should construct files
143  // with a canonical node ordering, which libHilbert-enabled
144  // builds will be able to read in again regardless of any
145  // renumbering. So in that case we're free to renumber.
146  // However, if either the writer or the reader of this file
147  // don't have libHilbert, then we'll have to skip
148  // renumbering because we need the numbering to remain
149  // consistent with any solution file we read in next.
150 #ifdef LIBMESH_HAVE_LIBHILBERT
151  // if (!xdr_io.libhilbert_ordering())
152  // skip_renumber_nodes_and_elements = true;
153 #else
154  mymesh.allow_renumbering(false);
155 #endif
156  }
157  else if (contains(basename, ".nem") ||
158  contains(basename, ".n"))
159  Nemesis_IO(mymesh).read (name);
160  else if (contains(basename, ".cp"))
161  {
162  if (contains(basename, ".cpa"))
163  CheckpointIO(mymesh, false).read(name);
164  else
165  CheckpointIO(mymesh, true).read(name);
166  }
167  }
168 
169  // Serial mesh formats
170  else
171  {
172  // Read the file based on extension. Only processor 0
173  // needs to read the mesh. It will then broadcast it and
174  // the other processors will pick it up
175  if (mymesh.processor_id() == 0)
176  {
177  LOG_SCOPE("read()", "NameBasedIO");
178 
179  std::ostringstream pid_suffix;
180  pid_suffix << '_' << getpid();
181  // Nasty hack for reading/writing zipped files
182  std::string new_name = name;
183  if (ends_with(name, ".bz2"))
184  {
185 #ifdef LIBMESH_HAVE_BZIP
186  new_name.erase(new_name.end() - 4, new_name.end());
187  new_name += pid_suffix.str();
188  std::string system_string = "bunzip2 -f -k -c ";
189  system_string += name + " > " + new_name;
190  LOG_SCOPE("system(bunzip2)", "NameBasedIO");
191  if (std::system(system_string.c_str()))
192  libmesh_file_error(system_string);
193 #else
194  libmesh_error_msg("ERROR: need bzip2/bunzip2 to open .bz2 file " << name);
195 #endif
196  }
197  else if (ends_with(name, ".xz"))
198  {
199 #ifdef LIBMESH_HAVE_XZ
200  new_name.erase(new_name.end() - 3, new_name.end());
201  new_name += pid_suffix.str();
202  std::string system_string = "xz -f -d -k -c ";
203  system_string += name + " > " + new_name;
204  LOG_SCOPE("system(xz -d)", "XdrIO");
205  if (std::system(system_string.c_str()))
206  libmesh_file_error(system_string);
207 #else
208  libmesh_error_msg("ERROR: need xz to open .xz file " << name);
209 #endif
210  }
211 
212  if (contains(basename, ".mat"))
213  MatlabIO(mymesh).read(new_name);
214 
215  else if (contains(basename, ".ucd"))
216  UCDIO(mymesh).read (new_name);
217 
218  else if (contains(basename, ".off") ||
219  contains(basename, ".ogl") ||
220  contains(basename, ".oogl"))
221  OFFIO(mymesh).read (new_name);
222 
223  else if (contains(basename, ".unv"))
224  UNVIO(mymesh).read (new_name);
225 
226  else if (contains(basename, ".node") ||
227  contains(basename, ".ele"))
228  TetGenIO(mymesh).read (new_name);
229 
230  else if (contains(basename, ".exd") ||
231  contains(basename, ".e"))
232  ExodusII_IO(mymesh).read (new_name);
233 
234  else if (contains(basename, ".msh"))
235  GmshIO(mymesh).read (new_name);
236 
237  else if (contains(basename, ".gmv"))
238  GMVIO(mymesh).read (new_name);
239 
240  else if (contains(basename, ".stl"))
241  STLIO(mymesh).read (new_name);
242 
243  else if (contains(basename, ".pvtu") ||
244  contains(basename, ".vtu"))
245  VTKIO(mymesh).read(new_name);
246 
247  else if (contains(basename, ".inp"))
248  AbaqusIO(mymesh).read(new_name);
249 
250  else if (contains(basename, ".bext") ||
251  contains(basename, ".bxt"))
252  DynaIO(mymesh).read (new_name);
253 
254  else if (contains(basename, ".bez"))
255  DynaIO(mymesh, false).read (new_name);
256 
257  else
258  {
259  libmesh_error_msg(" ERROR: Unrecognized file extension: " \
260  << name \
261  << "\n I understand the following:\n\n" \
262  << " *.bext -- Bezier files in DYNA format\n" \
263  << " *.bez -- Bezier DYNA files, omit spline nodes\n" \
264  << " *.bxt -- Bezier files in DYNA format\n" \
265  << " *.cpa -- libMesh Checkpoint ASCII format\n" \
266  << " *.cpr -- libMesh Checkpoint binary format\n" \
267  << " *.e -- Sandia's ExodusII format\n" \
268  << " *.exd -- Sandia's ExodusII format\n" \
269  << " *.gmv -- LANL's General Mesh Viewer format\n" \
270  << " *.inp -- Abaqus .inp format\n" \
271  << " *.mat -- Matlab triangular ASCII file\n" \
272  << " *.n -- Sandia's Nemesis format\n" \
273  << " *.nem -- Sandia's Nemesis format\n" \
274  << " *.off -- OOGL OFF surface format\n" \
275  << " *.ogl -- OOGL OFF surface format\n" \
276  << " *.oogl -- OOGL OFF surface format\n" \
277  << " *.pvtu -- Paraview VTK format\n" \
278  << " *.stl -- STereoLithography triangulation format\n" \
279  << " *.ucd -- AVS's ASCII UCD format\n" \
280  << " *.unv -- I-deas Universal format\n" \
281  << " *.vtu -- Paraview VTK format\n" \
282  << " *.xda -- libMesh ASCII format\n" \
283  << " *.xdr -- libMesh binary format\n" \
284  << " *.gz -- any above format gzipped\n" \
285  << " *.bz2 -- any above format bzip2'ed\n" \
286  << " *.xz -- any above format xzipped\n" \
287  );
288  }
289 
290  // If we temporarily decompressed a file, remove the
291  // uncompressed version
292  if (ends_with(basename, ".bz2"))
293  std::remove(new_name.c_str());
294  if (ends_with(basename, ".xz"))
295  std::remove(new_name.c_str());
296  }
297 
298  // Send the mesh & bcs (which are now only on processor 0) to the other
299  // processors
300  MeshCommunication().broadcast (mymesh);
301  }
302 }
303 
304 
305 void NameBasedIO::write (const std::string & name)
306 {
307  const MeshBase & mymesh = MeshOutput<MeshBase>::mesh();
308 
309  const std::string_view basename = Utility::basename_of(name);
310 
311  using Utility::contains;
312  using Utility::ends_with;
313 
314  // parallel formats are special -- they may choose to write
315  // separate files, let's not try to handle the zipping here.
316  if (is_parallel_file_format(basename))
317  {
318  // no need to handle bz2 files here -- the Xdr class does that.
319  if (contains(basename, ".xda"))
320  XdrIO(mymesh).write(name);
321 
322  else if (contains(basename, ".xdr"))
323  XdrIO(mymesh,true).write(name);
324 
325  else if (contains(basename, ".nem") ||
326  contains(basename, ".n"))
327  Nemesis_IO(mymesh).write(name);
328 
329  else if (contains(basename, ".cpa"))
330  CheckpointIO(mymesh,false).write(name);
331 
332  else if (contains(basename, ".cpr"))
333  CheckpointIO(mymesh,true).write(name);
334 
335  else
336  libmesh_error_msg("Couldn't deduce filetype for " << name);
337  }
338 
339  // serial file formats
340  else
341  {
342  // Nasty hack for reading/writing zipped files
343  std::string new_name = name;
344  int pid_0 = 0;
345  if (mymesh.processor_id() == 0)
346  pid_0 = getpid();
347  mymesh.comm().broadcast(pid_0);
348  std::ostringstream pid_suffix;
349  pid_suffix << '_' << pid_0;
350 
351  if (ends_with(name, ".bz2"))
352  {
353  new_name.erase(new_name.end() - 4, new_name.end());
354  new_name += pid_suffix.str();
355  }
356  else if (ends_with(name, ".xz"))
357  {
358  new_name.erase(new_name.end() - 3, new_name.end());
359  new_name += pid_suffix.str();
360  }
361 
362  // New scope so that io will close before we try to zip the file
363  {
364  // Write the file based on extension
365  if (contains(basename, ".dat"))
366  TecplotIO(mymesh).write (new_name);
367 
368  else if (contains(basename, ".plt"))
369  TecplotIO(mymesh,true).write (new_name);
370 
371  else if (contains(basename, ".ucd"))
372  UCDIO (mymesh).write (new_name);
373 
374  else if (contains(basename, ".gmv"))
375  if (mymesh.n_partitions() > 1)
376  GMVIO(mymesh).write (new_name);
377  else
378  {
379  GMVIO io(mymesh);
380  io.partitioning() = false;
381  io.write (new_name);
382  }
383 
384  else if (contains(basename, ".exd") ||
385  contains(basename, ".e"))
386  ExodusII_IO(mymesh).write(new_name);
387 
388  else if (contains(basename, ".unv"))
389  UNVIO(mymesh).write (new_name);
390 
391  else if (contains(basename, ".mesh"))
392  MEDITIO(mymesh).write (new_name);
393 
394  else if (contains(basename, ".poly"))
395  TetGenIO(mymesh).write (new_name);
396 
397  else if (contains(basename, ".msh"))
398  GmshIO(mymesh).write (new_name);
399 
400  else if (contains(basename, ".fro"))
401  FroIO(mymesh).write (new_name);
402 
403  else if (contains(basename, ".pvtu"))
404  VTKIO(mymesh).write (name);
405 
406  else if (contains(basename, ".stl"))
407  STLIO(mymesh).write (new_name);
408 
409  else
410  {
412  << " ERROR: Unrecognized file extension: " << name
413  << "\n I understand the following:\n\n"
414  << " *.cpa -- libMesh ASCII checkpoint format\n"
415  << " *.cpr -- libMesh binary checkpoint format,\n"
416  << " *.dat -- Tecplot ASCII file\n"
417  << " *.e -- Sandia's ExodusII format\n"
418  << " *.exd -- Sandia's ExodusII format\n"
419  << " *.fro -- ACDL's surface triangulation file\n"
420  << " *.gmv -- LANL's GMV (General Mesh Viewer) format\n"
421  << " *.mesh -- MEdit mesh format\n"
422  << " *.msh -- GMSH ASCII file\n"
423  << " *.n -- Sandia's Nemesis format\n"
424  << " *.nem -- Sandia's Nemesis format\n"
425  << " *.plt -- Tecplot binary file\n"
426  << " *.poly -- TetGen ASCII file\n"
427  << " *.pvtu -- VTK (paraview-readable) format\n"
428  << " *.stl -- STereoLithography triangulation format\n" \
429  << " *.ucd -- AVS's ASCII UCD format\n"
430  << " *.unv -- I-deas Universal format\n"
431  << " *.xda -- libMesh ASCII format\n"
432  << " *.xdr -- libMesh binary format,\n"
433  << std::endl
434  << "\n Exiting without writing output\n";
435  }
436  }
437 
438  // Nasty hack for reading/writing zipped files
439  if (ends_with(basename, ".bz2"))
440  {
441  LOG_SCOPE("system(bzip2)", "NameBasedIO");
442  if (mymesh.processor_id() == 0)
443  {
444  std::string system_string = "bzip2 -f -c ";
445  system_string += new_name + " > " + name;
446  if (std::system(system_string.c_str()))
447  libmesh_file_error(system_string);
448  std::remove(new_name.c_str());
449  }
450  mymesh.comm().barrier();
451  }
452  if (ends_with(basename, ".xz"))
453  {
454  LOG_SCOPE("system(xz)", "NameBasedIO");
455  if (mymesh.processor_id() == 0)
456  {
457  std::string system_string = "xz -f -c ";
458  system_string += new_name + " > " + name;
459  if (std::system(system_string.c_str()))
460  libmesh_file_error(system_string);
461  std::remove(new_name.c_str());
462  }
463  mymesh.comm().barrier();
464  }
465  }
466 }
467 
468 
469 void NameBasedIO::write_nodal_data (const std::string & name,
470  const std::vector<Number> & v,
471  const std::vector<std::string> & vn)
472 {
473  const MeshBase & mymesh = MeshOutput<MeshBase>::mesh();
474 
475  using Utility::contains;
476  using Utility::ends_with;
477 
478  // Write the file based on extension
479  if (contains(name, ".dat"))
480  TecplotIO(mymesh).write_nodal_data (name, v, vn);
481 
482  else if (contains(name, ".exd") ||
483  contains(name, ".e"))
484  ExodusII_IO(mymesh).write_nodal_data(name, v, vn);
485 
486  else if (contains(name, ".gmv"))
487  {
488  if (mymesh.n_subdomains() > 1)
489  GMVIO(mymesh).write_nodal_data (name, v, vn);
490  else
491  {
492  GMVIO io(mymesh);
493  io.partitioning() = false;
494  io.write_nodal_data (name, v, vn);
495  }
496  }
497 
498  else if (contains(name, ".mesh"))
499  MEDITIO(mymesh).write_nodal_data (name, v, vn);
500 
501  else if (contains(name, ".msh"))
502  GmshIO(mymesh).write_nodal_data (name, v, vn);
503 
504  else if (contains(name, ".nem") ||
505  contains(name, ".n"))
506  Nemesis_IO(mymesh).write_nodal_data(name, v, vn);
507 
508  else if (contains(name, ".plt"))
509  TecplotIO(mymesh,true).write_nodal_data (name, v, vn);
510 
511  else if (contains(name, ".pvtu"))
512  VTKIO(mymesh).write_nodal_data (name, v, vn);
513 
514  else if (contains(name, ".ucd"))
515  UCDIO (mymesh).write_nodal_data (name, v, vn);
516 
517  else
518  {
520  << " ERROR: Unrecognized file extension: " << name
521  << "\n I understand the following:\n\n"
522  << " *.dat -- Tecplot ASCII file\n"
523  << " *.e -- Sandia's ExodusII format\n"
524  << " *.exd -- Sandia's ExodusII format\n"
525  << " *.gmv -- LANL's GMV (General Mesh Viewer) format\n"
526  << " *.mesh -- MEdit mesh format\n"
527  << " *.msh -- GMSH ASCII file\n"
528  << " *.n -- Sandia's Nemesis format\n"
529  << " *.nem -- Sandia's Nemesis format\n"
530  << " *.plt -- Tecplot binary file\n"
531  << " *.pvtu -- Paraview VTK file\n"
532  << " *.ucd -- AVS's ASCII UCD format\n"
533  << "\n Exiting without writing output\n";
534  }
535 }
536 
537 
538 void NameBasedIO::write_equation_systems (const std::string & filename,
539  const EquationSystems & es,
540  const std::set<std::string> * system_names)
541 {
542  // XDA/XDR require a separate code path, and currently only support
543  // writing complete restarts
544  if (!system_names)
545  {
546  const std::string_view basename =
547  Utility::basename_of(filename);
548 
549  if (Utility::contains(basename, ".xda"))
550  {
551  es.write(filename,WRITE,
554  return;
555  }
556  else if (Utility::contains(basename, ".xdr"))
557  {
558  es.write(filename,ENCODE,
561  return;
562  }
563  }
564 
565  // Other formats just use the default "write nodal values" path
567  (filename, es, system_names);
568 }
569 
570 
572 {
573  using Utility::contains;
574  using Utility::ends_with;
575  return (contains(name, ".xda") || contains(name, ".xdr") ||
576  ends_with(name, ".nem") || ends_with(name, ".n") ||
577  contains(name, ".cp"));
578 }
579 
580 
581 } // 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:538
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:36
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.C:571
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 ends_with(std::string_view superstring, std::string_view suffix)
Look for a substring at the very end of a string.
Definition: utility.C:213
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:186
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:127
virtual void write(const std::string &mesh_file) override
This method implements writing a mesh to a specified file.
Definition: namebased_io.C:305
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:353
bool contains(std::string_view superstring, std::string_view substring)
Look for a substring within a string.
Definition: utility.C:205
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:469
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:1351
std::string_view basename_of(const std::string &fullname)
Definition: utility.C:108
subdomain_id_type n_subdomains() const
Definition: mesh_base.C:1034
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:270
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:1436
The UNVIO class implements the Ideas UNV universal file format.
Definition: unv_io.h:52