Go to the documentation of this file.
29 #include "libmesh/libmesh.h"
30 #include "libmesh/dof_map.h"
31 #include "libmesh/equation_systems.h"
32 #include "libmesh/getpot.h"
33 #include "libmesh/mesh.h"
34 #include "libmesh/newton_solver.h"
35 #include "libmesh/numeric_vector.h"
36 #include "libmesh/parsed_fem_function.h"
37 #include "libmesh/point.h"
38 #include "libmesh/steady_solver.h"
39 #include "libmesh/enum_xdr_mode.h"
49 <<
" --dim d mesh dimension [default: autodetect]\n"
50 <<
" --inmesh filename input mesh file\n"
51 <<
" --insoln filename input solution file\n"
52 <<
" --calc func function to calculate\n"
53 <<
" --insys num input system number [default: 0]\n"
54 <<
" --outsoln filename output solution file [default: out_<insoln>]\n"
55 <<
" --family famname output FEM family [default: LAGRANGE]\n"
56 <<
" --order num output FEM order [default: 1]\n"
65 const std::string & argname,
66 const char * progname,
69 if (!cl.search(argname))
71 libMesh::err << (
"No " + argname +
" argument found!") << std::endl;
74 return cl.next(defaultarg);
78 int main(
int argc,
char ** argv)
82 GetPot cl(argc, argv);
86 const unsigned char requested_dim =
87 cast_int<unsigned char>(cl.follow(3,
"--dim"));
92 Mesh old_mesh(
init.comm(), requested_dim);
94 const std::string meshname =
97 old_mesh.read(meshname);
98 std::cout <<
"Mesh:" << std::endl;
99 old_mesh.print_info();
102 Mesh new_mesh(
init.comm(), requested_dim);
103 new_mesh.
read(meshname);
109 const std::string solnname =
117 if (solnname.rfind(
".xdr") < solnname.size())
119 else if (solnname.rfind(
".xda") < solnname.size())
122 libmesh_error_msg(
"Unrecognized file extension on " << solnname);
124 old_es.
read(solnname, read_mode,
133 const unsigned int sysnum =
134 cl.follow(0,
"--insys");
136 libmesh_assert_less(sysnum, old_es.
n_systems());
146 libmesh_make_unique<SteadySolver>(new_sys);
149 cl.follow(std::string(
"LAGRANGE"),
"--family");
152 cl.follow(1,
"--order");
154 const std::string calcfunc =
165 solver.
quiet =
false;
172 const std::string outsolnname = cl.follow(std::string(
"out_"+solnname),
"--outsoln");
174 new_es.
write(outsolnname.c_str(),
177 libMesh::out <<
"Wrote solution " << outsolnname << std::endl;
Manages consistently variables, degrees of freedom, and coefficient vectors.
int main(int argc, char **argv)
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const override
virtual void solve() override
Invokes the solver associated with the system.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
virtual System & add_system(const std::string &system_type, const std::string &name)
Add the system of type system_type named name to the systems array.
The libMesh namespace provides an interface to certain functionality in the library.
const T_sys & get_system(const std::string &name) const
std::unique_ptr< libMesh::FEMFunctionBase< libMesh::Number > > goal_func
unsigned int & fe_order()
This is a generic class that defines a solver to handle ImplicitSystem classes, including NonlinearIm...
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
std::string & fe_family()
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Real relative_step_tolerance
bool verbose
The DiffSolver may print a lot more to libMesh::out if verbose is set to true; default is false.
virtual void init()
Initialize all the systems.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false) override
Reads the file specified by name.
std::string current_sys_name
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
unsigned int n_systems() const
void read(const std::string &name, const XdrMODE, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
Read & initialize the systems from disk using the XDR data format.
void print_info(std::ostream &os=libMesh::out) const
Prints information about the equation systems, by default to libMesh::out.
This is the EquationSystems class.
bool quiet
The DiffSolver should not print anything to libMesh::out unless quiet is set to false; default is tru...
T assert_argument(GetPot &cl, const std::string &argname, const char *progname, const T &defaultarg)
ParsedFEMFunction provides support for FParser-based parsed functions in FEMSystem.
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.
libMesh::System * input_system
void usage_error(const char *progname)