libMesh
Functions
meshplot.C File Reference

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 28 of file meshplot.C.

References libMesh::TriangleWrapper::init(), mesh, libMesh::out, libMesh::MeshBase::print_info(), libMesh::MeshBase::read(), libMesh::EquationSystems::READ_ADDITIONAL_DATA, libMesh::EquationSystems::READ_BASIC_ONLY, libMesh::EquationSystems::READ_DATA, libMesh::EquationSystems::READ_HEADER, libMesh::MeshBase::write(), and libMesh::NameBasedIO::write_equation_systems().

29 {
30  LibMeshInit init(argc, argv);
31 
32  Mesh mesh(init.comm());
34 
35  if (argc < 3 || argc > 4)
36  libmesh_error_msg
37  ("Usage: " << argv[0] <<
38  " inputmesh [inputsolution] outputplot");
39 
40  LOG_CALL("mesh.read()", "main", mesh.read(argv[1]));
41 
42  libMesh::out << "Loaded mesh " << argv[1] << std::endl;
43  mesh.print_info();
44 
45  if (argc > 3)
46  {
47  std::string solnname = argv[2];
48 
49  LOG_CALL("es.read()", "main",
50  es.read(solnname,
51  EquationSystems::READ_HEADER |
52  EquationSystems::READ_DATA |
53  EquationSystems::READ_ADDITIONAL_DATA |
54  EquationSystems::READ_BASIC_ONLY));
55 
56  libMesh::out << "Loaded solution " << solnname << std::endl;
57  es.print_info();
58  }
59 
60  std::string outputname(argv[argc-1]);
61  {
62  LOG_SCOPE("write_equation_systems()", "main");
63  if ((outputname.find(".xda") != std::string::npos) ||
64  (outputname.find(".xdr") != std::string::npos))
65  {
66  mesh.write("mesh-"+outputname);
67  es.write("soln-"+outputname);
68  }
69  else
70  NameBasedIO(mesh).write_equation_systems (outputname, es);
71  }
72 
73  libMesh::out << "Wrote output " << outputname << std::endl;
74 
75  return 0;
76 }
This class supports simple reads and writes in any libMesh-supported format, by dispatching to one of...
Definition: namebased_io.h:44
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 read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
MeshBase & mesh
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:90
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
Definition: mesh_base.C:1562
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
virtual void write(const std::string &name) const =0
OStreamProxy out
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50