libMesh
Functions
meshplot.C File Reference

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 28 of file meshplot.C.

References libMesh::LibMeshInit::comm(), 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  using namespace libMesh;
31 
32  LibMeshInit init(argc, argv);
33 
34  Mesh mesh(init.comm());
36 
37  if (argc < 3 || argc > 4)
38  libmesh_error_msg
39  ("Usage: " << argv[0] <<
40  " inputmesh [inputsolution] outputplot");
41 
42 
43  START_LOG("mesh.read()", "main");
44  mesh.read(argv[1]);
45  STOP_LOG("mesh.read()", "main");
46  libMesh::out << "Loaded mesh " << argv[1] << std::endl;
47  mesh.print_info();
48 
49  if (argc > 3)
50  {
51  START_LOG("es.read()", "main");
52  std::string solnname = argv[2];
53 
54  es.read(solnname,
59  STOP_LOG("es.read()", "main");
60  libMesh::out << "Loaded solution " << solnname << std::endl;
61  es.print_info();
62  }
63 
64  START_LOG("write_equation_systems()", "main");
65  std::string outputname(argv[argc-1]);
66  if ((outputname.find(".xda") != std::string::npos) ||
67  (outputname.find(".xdr") != std::string::npos))
68  {
69  mesh.write("mesh-"+outputname);
70  es.write("soln-"+outputname);
71  }
72  else
73  NameBasedIO(mesh).write_equation_systems (outputname, es);
74  STOP_LOG("write_equation_systems()", "main");
75 
76  libMesh::out << "Wrote output " << outputname << std::endl;
77 }
This class supports simple reads and writes in any libMesh-supported format, by dispatching to one of...
Definition: namebased_io.h:44
This is the EquationSystems class.
MeshBase & mesh
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:62
The libMesh namespace provides an interface to certain functionality in the library.
virtual void write_equation_systems(const std::string &filename, const EquationSystems &es, const std::set< std::string > *system_names=libmesh_nullptr) libmesh_override
This method implements writing a mesh with data to a specified file where the data is taken from the ...
Definition: namebased_io.C:490
void init(triangulateio &t)
Initializes the fields of t to NULL/0 as necessary.
virtual void write(const std::string &name)=0
OStreamProxy out
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
virtual void read(const std::string &name, void *mesh_data=libmesh_nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the mesh.
Definition: mesh_base.C:448