Go to the source code of this file.
|
void | usage (const std::string &progName) |
| how to use this, and command line processor More...
|
|
void | process_cmd_line (int argc, char **argv, std::vector< std::string > &names, unsigned char &dim, double &threshold, XdrMODE &format, bool &verbose, bool &quiet) |
|
bool | do_compare (EquationSystems &les, EquationSystems &res, double threshold, bool verbose) |
| everything that is identical for the systems, and should not go into EquationSystems::compare(), can go in this do_compare(). More...
|
|
int | main (int argc, char **argv) |
|
◆ do_compare()
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
build the left and right mesh for left, init them
build EquationSystems objects, read them
let's see what do_compare found out
Definition at line 276 of file compare.C.
287 std::vector<std::string> names;
288 unsigned char dim = static_cast<unsigned char>(-1);
291 bool verbose =
false;
303 if (
dim == static_cast<unsigned char>(-1))
304 libmesh_error_msg(
"ERROR: you must specify the dimension on " \
305 <<
"the command line!\n\n" \
307 <<
" -d 3 ... for example");
315 <<
" dimensionality = " << +
dim << std::endl
316 <<
" mesh = " << names[0] << std::endl
317 <<
" left system = " << names[1] << std::endl
318 <<
" right system = " << names[2] << std::endl
319 <<
" threshold = " << threshold << std::endl
320 <<
" read format = " << format << std::endl
334 left_mesh.
read (names[0]);
335 right_mesh.read (names[0]);
338 left_mesh.print_info();
353 if (names.size() == 3)
355 left_system.read (names[1], format);
356 right_system.read (names[2], format);
359 libmesh_error_msg(
"Bad input specified.");
361 are_equal =
do_compare (left_system, right_system, threshold, verbose);
367 unsigned int our_result;
373 <<
" Congrat's, up to the defined threshold, the two"
383 <<
" Oops, differences occurred!"
385 <<
" Use -v to obtain more information where differences occurred."
References dim, do_compare(), libMesh::TriangleWrapper::init(), libMesh::out, process_cmd_line(), libMesh::READ, libMesh::UnstructuredMesh::read(), libMesh::EquationSystems::read(), and libMesh::TOLERANCE.
◆ process_cmd_line()
void process_cmd_line |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
std::vector< std::string > & |
names, |
|
|
unsigned char & |
dim, |
|
|
double & |
threshold, |
|
|
XdrMODE & |
format, |
|
|
bool & |
verbose, |
|
|
bool & |
quiet |
|
) |
| |
Get mesh file name
Get the mesh dimension
Get left file name
Get right file name
Get the comparison threshold
Use ascii format
Use binary format
Be verbose
Be totally quiet, no matter what -v says
Definition at line 88 of file compare.C.
102 bool format_set =
false;
103 bool left_name_set =
false;
106 usage(std::string(argv[0]));
109 while ((opt = getopt(argc, argv, optionStr)) != -1)
120 names.push_back(optarg);
122 libmesh_error_msg(
"ERROR: Mesh file name must precede left file name!");
131 dim = cast_int<unsigned char>(atoi(optarg));
142 names.push_back(optarg);
143 left_name_set =
true;
146 libmesh_error_msg(
"ERROR: Mesh file name must precede right file name!");
155 if ((!names.empty()) && (left_name_set))
156 names.push_back(optarg);
158 libmesh_error_msg(
"ERROR: Mesh file name and left file name must precede right file name!");
167 threshold = atof(optarg);
177 libmesh_error_msg(
"ERROR: Equation system file format already set!");
192 libmesh_error_msg(
"ERROR: Equation system file format already set!");
References libMesh::DECODE, dim, libMesh::READ, and usage().
Referenced by main().
◆ usage()
void usage |
( |
const std::string & |
progName | ) |
|
how to use this, and command line processor
Definition at line 48 of file compare.C.
50 std::ostringstream helpList;
51 helpList <<
"usage:\n"
57 <<
" -d <dim> <dim>-dimensional mesh\n"
58 <<
" -m <string> Mesh file name\n"
59 <<
" -l <string> Left Equation Systems file name\n"
60 <<
" -r <string> Right Equation Systems file name\n"
61 <<
" -t <float> threshold\n"
62 <<
" -a ASCII format (default)\n"
63 <<
" -b binary format\n"
65 <<
" -q really quiet\n"
66 <<
" -h Print help menu\n"
69 <<
" This program is used to compare equation systems to a user-specified\n"
70 <<
" threshold. Equation systems are imported in the libMesh format\n"
71 <<
" provided through the read and write methods in class EquationSystems.\n"
73 <<
" ./compare -d 3 -m grid.xda -l leftfile.dat -r rightfile.dat -b -t 1.e-8\n"
75 <<
" will read in the mesh grid.xda, the equation systems leftfile.dat and\n"
76 <<
" rightfile.dat in binary format and compare systems, and especially the\n"
77 <<
" floats stored in vectors. The comparison is said to be passed when the\n"
78 <<
" floating point values agree up to the given threshold. When no threshold\n"
79 <<
" is set the default libMesh tolerance is used. If neither -a or -b are set,\n"
80 <<
" ASCII format is assumed.\n"
83 libmesh_error_msg(helpList.str());
Referenced by process_cmd_line().
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
PAPI stands for Performance Application Programming Interface.
static const Real TOLERANCE
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.
bool do_compare(EquationSystems &les, EquationSystems &res, double threshold, bool verbose)
everything that is identical for the systems, and should not go into EquationSystems::compare(),...
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.
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
void usage(const std::string &progName)
how to use this, and command line processor
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.
virtual bool compare(const EquationSystems &other_es, const Real threshold, const bool verbose) const
void process_cmd_line(int argc, char **argv, std::vector< std::string > &names, unsigned char &dim, double &threshold, XdrMODE &format, bool &verbose, bool &quiet)