[cig-commits] r13539 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Tue Dec 9 18:13:42 PST 2008
Author: luis
Date: 2008-12-09 18:13:42 -0800 (Tue, 09 Dec 2008)
New Revision: 13539
Modified:
cs/cigma/trunk/src/cli_base_cmd.cpp
cs/cigma/trunk/src/cli_compare_cmd.cpp
cs/cigma/trunk/src/cli_compare_cmd.h
cs/cigma/trunk/src/cli_eval_cmd.cpp
cs/cigma/trunk/src/cli_extract_cmd.cpp
Log:
Moved secondary options to "other" section
Modified: cs/cigma/trunk/src/cli_base_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_base_cmd.cpp 2008-12-10 02:13:40 UTC (rev 13538)
+++ cs/cigma/trunk/src/cli_base_cmd.cpp 2008-12-10 02:13:42 UTC (rev 13539)
@@ -18,6 +18,7 @@
if (usage != "")
{
cout << usage << endl;
+ cout << endl;
}
if (opts.options().size() > 0)
Modified: cs/cigma/trunk/src/cli_compare_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.cpp 2008-12-10 02:13:40 UTC (rev 13538)
+++ cs/cigma/trunk/src/cli_compare_cmd.cpp 2008-12-10 02:13:42 UTC (rev 13539)
@@ -15,7 +15,8 @@
{
name = "compare";
brief = "Calculate local and global residuals over two fields";
- usage = "Usage: cigma compare <FIRST-FIELD> <SECOND-FIELD> [ -o <RESIDUAL-FILE> ]";
+ usage = "Usage: cigma compare <FIRST-FIELD> <SECOND-FIELD> -o <RESIDUAL-FILE>";
+ appendix = "";
}
CompareCmd::~CompareCmd()
@@ -30,16 +31,21 @@
opts_section = "Compare Options: ";
opts.add_options()
- ("mesh,m", po::value<string>(&imesh), "Integration mesh")
- ("first,a", po::value<string>(&first), "First field path")
- ("second,b", po::value<string>(&second), "Second field path")
- ("output,o", po::value<string>(&outputfile), "Output file (residuals)")
- ("first-mesh", po::value<string>(&firstmesh), "Associated mesh of first field")
- ("second-mesh", po::value<string>(&secondmesh), "Associated mesh of second field")
- ("mesh-cell", po::value<string>(&imeshcell), "Associated cell type of integration mesh")
- ("first-mesh-cell", po::value<string>(&firstmeshcell), "Associated cell type of first mesh")
- ("second-mesh-cell", po::value<string>(&secondmeshcell), "Associated cell type of second mesh")
+ ("first,a", po::value<string>(&first), "Path to first field")
+ ("second,b", po::value<string>(&second), "Path to second field")
+ ("output,o", po::value<string>(&outputfile), "Output file (for residuals)")
+ ;
+
+ other.add_options()
("freq,f", po::value<int>(&(op.freq)), "Output frequency of timer")
+ ("threshold", po::value<double>(&threshold), "Threshold residual")
+ ("rule,r", po::value<string>(&rule), "Integration rule")
+ ("mesh,m", po::value<string>(&mesh), "Path to integration mesh")
+ ("first-mesh", po::value<string>(&mesh1), "Mesh for first field")
+ ("second-mesh", po::value<string>(&mesh2), "Mesh for second field")
+ ("mesh-cell", po::value<string>(&cell), "Cell type of integration mesh")
+ ("first-mesh-cell", po::value<string>(&cell1), "Cell type for first mesh")
+ ("second-mesh-cell", po::value<string>(&cell2), "Cell type for second mesh")
;
args.add("first", 1);
@@ -70,13 +76,43 @@
op.freq = 1000;
}
+ if (!vm.count("first"))
+ {
+ string msg("No first field was specified (use --first option)");
+ throw cigma::Exception("CompareCmd::configure", msg, 1);
+ }
+
+ if (!vm.count("second"))
+ {
+ string msg("No second field was specified (use --second option)");
+ throw cigma::Exception("CompareCmd::configure", msg, 1);
+ }
+
+ if (!vm.count("output"))
+ {
+ string msg("No output file for residuals was specified (use --output option)");
+ throw cigma::Exception("CompareCmd::configure", msg, 1);
+ }
+
+ if (!vm.count("threshold"))
+ {
+ threshold = 0;
+ }
+ else
+ {
+ if (threshold < 0)
+ {
+ string msg("Threshold must be non-negative!");
+ throw cigma::Exception("CompareCmd::configure", msg, 1);
+ }
+ }
+
op.first_name = first;
op.second_name = second;
- DataPath im(imesh);
- op.domain_info.mesh_info.p_mesh = DataPath(imesh);
+ op.domain_info.mesh_info.p_mesh = DataPath(mesh);
op.domain_info.p_field = (op.domain_info.mesh_info).get_nc_path();
- op.domain_info.fe_info.q_info.cell_type_name = imeshcell;
+ op.domain_info.fe_info.q_info.cell_type_name = cell;
op.configure();
}
@@ -90,11 +126,11 @@
}
TRI_LOG_STR("CompareCmd::run()");
- TRI_LOG(imesh);
TRI_LOG(first);
TRI_LOG(second);
- TRI_LOG(firstmesh);
- TRI_LOG(secondmesh);
+ TRI_LOG(mesh);
+ TRI_LOG(mesh1);
+ TRI_LOG(mesh2);
TRI_LOG(outputfile);
DataPath path(outputfile);
@@ -104,6 +140,15 @@
double L2 = op.residuals->L2();
double max_residual = op.residuals->max();
+ if (threshold >= L2)
+ {
+ if (op.verbose)
+ {
+ cout << "Threshold " << threshold << " exceeded!" << endl;
+ }
+ status = 1;
+ }
+
if (op.verbose)
{
// report errors
Modified: cs/cigma/trunk/src/cli_compare_cmd.h
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.h 2008-12-10 02:13:40 UTC (rev 13538)
+++ cs/cigma/trunk/src/cli_compare_cmd.h 2008-12-10 02:13:42 UTC (rev 13539)
@@ -23,13 +23,11 @@
public:
- std::string imesh, imeshcell;
- std::string irule;
- std::string first;
- std::string second;
- std::string firstmesh, secondmesh;
- std::string firstmeshcell, secondmeshcell;
+ std::string mesh, cell, rule;
+ std::string first, mesh1, cell1;
+ std::string second, mesh2, cell2;
std::string outputfile;
+ double threshold;
CompareOp op;
Modified: cs/cigma/trunk/src/cli_eval_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_eval_cmd.cpp 2008-12-10 02:13:40 UTC (rev 13538)
+++ cs/cigma/trunk/src/cli_eval_cmd.cpp 2008-12-10 02:13:42 UTC (rev 13539)
@@ -16,10 +16,8 @@
{
name = "eval";
brief = "Evaluate function at specified quadrature points";
- usage = "Usage: cigma eval <FUNC> <QPTS-IN> <QVALS-OUT>";
- appendix = \
- ""
- ;
+ usage = "Usage: cigma eval <FUNC> <QPTS-IN> -o <QVALS-OUT>";
+ appendix = "";
}
EvalCmd::~EvalCmd()
Modified: cs/cigma/trunk/src/cli_extract_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_extract_cmd.cpp 2008-12-10 02:13:40 UTC (rev 13538)
+++ cs/cigma/trunk/src/cli_extract_cmd.cpp 2008-12-10 02:13:42 UTC (rev 13539)
@@ -20,9 +20,8 @@
{
name = "extract";
brief = "Extract quadrature points from a mesh";
-
- usage = "Usage: cigma extract [options] <MESH-IN> <QPTS-OUT>\n";
- appendix = "...";
+ usage = "Usage: cigma extract [options] <MESH-IN> -o <QPTS-OUT>";
+ appendix = "";
}
ExtractCmd::~ExtractCmd()
@@ -38,14 +37,17 @@
opts_section = "Extract Options: ";
opts.add_options()
- ("rule,r", po::value<string>(&rule), "use a specific quadrature rule")
- ("rule-order,q", po::value<unsigned int>(&rule_order), "use a specific quadrature order")
("mesh,m", po::value<string>(&mesh), "mesh file (or path)")
+ ("rule,r", po::value<string>(&rule), "use a specific quadrature rule")
("output,o", po::value<string>(&points), "Output HDF5 file for quadrature points")
;
+ other.add_options()
+ ("rule-order", po::value<unsigned int>(&rule_order), "use a specific quadrature order")
+ ;
+
args.add("mesh", 1);
- args.add("output", 1);
+ //args.add("output", 1);
}
@@ -133,17 +135,9 @@
// Close the hdf5 file
DataPath path(points);
- int status;
-
- try
- {
- status = op.run();
- }
- catch (cigma::Exception& e)
- {
- throw e;
- }
+ int status = op.run();
+
if (op.verbose)
{
cout << "Writing quadrature points to the file " << path.filename() << endl;
More information about the CIG-COMMITS
mailing list