[cig-commits] r9182 - cs/benchmark/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Tue Jan 29 11:47:50 PST 2008
Author: luis
Date: 2008-01-29 11:47:50 -0800 (Tue, 29 Jan 2008)
New Revision: 9182
Modified:
cs/benchmark/cigma/trunk/src/CompareCmd.cpp
cs/benchmark/cigma/trunk/src/CompareCmd.h
Log:
Use generic reader/writers in CompareCmd.
This change enables input/output from/to HDF5, VTK, or text files.
Currently the proper subclasses are instantiated based on the
file extension type. Eventually we'd want to be detect the
filetype based on the file's magic number (first few bytes).
Modified: cs/benchmark/cigma/trunk/src/CompareCmd.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/CompareCmd.cpp 2008-01-29 19:47:48 UTC (rev 9181)
+++ cs/benchmark/cigma/trunk/src/CompareCmd.cpp 2008-01-29 19:47:50 UTC (rev 9182)
@@ -3,13 +3,18 @@
#include <ctime>
#include "CompareCmd.h"
#include "StringUtils.h"
-#include "VtkUgSimpleWriter.h"
+
//#include "VtkUgMeshPart.h"
#include "MeshPart.h"
#include "Tet.h"
#include "Hex.h"
#include "Numeric.h"
#include "AnnLocator.h"
+
+//#include "VtkUgSimpleWriter.h"
+#include "HdfReader.h"
+#include "VtkReader.h"
+
#include "Misc.h"
@@ -29,6 +34,14 @@
field_b = 0;
residuals = 0; //XXX: create ResidualField class?
+ // readers & writers
+ readerA = 0;
+ readerB = 0;
+ readerM = 0;
+ readerQ = 0;
+ writer = 0;
+
+ // parameters
verbose = false;
output_frequency = 0;
}
@@ -65,6 +78,9 @@
// options for quadrature
opt->setOption("order");
+ opt->setOption("rule");
+ opt->setOption("rule-points");
+ opt->setOption("rule-weights");
// options for output
opt->setOption("output");
@@ -98,7 +114,10 @@
}
inputA = in;
parse_dataset_path(inputA, locationA, inputfileA, extA);
+ load_reader(&readerA, extA);
+ readerA->open(inputfileA);
+
in = opt->getValue("second");
if (in == 0)
{
@@ -111,6 +130,8 @@
}
inputB = in;
parse_dataset_path(inputB, locationB, inputfileB, extB);
+ load_reader(&readerB, extB);
+ readerB->open(inputfileB);
in = opt->getValue("output");
if (in == 0)
@@ -122,7 +143,11 @@
exit(1);
}
}
+ string output_ext;
+ string output_fileroot;
output_filename = in;
+ path_splitext(output_filename, output_fileroot, output_ext);
+ load_writer(&writer, output_ext);
output_name = "epsilon";
Modified: cs/benchmark/cigma/trunk/src/CompareCmd.h
===================================================================
--- cs/benchmark/cigma/trunk/src/CompareCmd.h 2008-01-29 19:47:48 UTC (rev 9181)
+++ cs/benchmark/cigma/trunk/src/CompareCmd.h 2008-01-29 19:47:50 UTC (rev 9182)
@@ -6,8 +6,7 @@
#include "Field.h"
#include "FE_Field.h"
#include "Writer.h"
-#include "VtkUgReader.h"
-//#include "HdfReader.h"
+#include "Reader.h"
namespace cigma
{
@@ -35,9 +34,11 @@
FE_Field *field_a;
FE_Field *field_b;
Field *residuals;
- //Reader readerA, readerB;
- //HdfReader h5_readerA, h5_readerB;
- VtkUgReader readerA, readerB;
+ Reader *readerA;
+ Reader *readerB;
+ Reader *readerQ;
+ Reader *readerM;
+ Writer *writer;
public:
std::string locationA, locationB;
More information about the cig-commits
mailing list