[cig-commits] [commit] master: Add text based stress output (853acf3)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Dec 2 13:56:17 PST 2014
Repository : https://github.com/geodynamics/vq
On branch : master
Link : https://github.com/geodynamics/vq/compare/06902a05cf4d70bc94c85d1c195c073d4e74cdad...c935dfd33f870a081b6c01cce97a060ad1cbdbda
>---------------------------------------------------------------
commit 853acf3704a027f2e43aa13e2a238d97394265b1
Author: Eric Heien <emheien at ucdavis.edu>
Date: Wed Nov 26 19:44:48 2014 -0800
Add text based stress output
>---------------------------------------------------------------
853acf3704a027f2e43aa13e2a238d97394265b1
src/core/Simulation.cpp | 34 +++++++++++++++++++++++++---------
src/core/Simulation.h | 2 +-
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/core/Simulation.cpp b/src/core/Simulation.cpp
index 0a8eafe..56b07f0 100644
--- a/src/core/Simulation.cpp
+++ b/src/core/Simulation.cpp
@@ -85,8 +85,8 @@ void Simulation::output_stress(quakelib::UIndex event_num, quakelib::UIndex swee
num_stress_recs += numGlobalBlocks();
// Write the stress state details
- stress_state.write_ascii(stress_state_outfile);
- stress_state_outfile.flush();
+ stress_state.write_ascii(stress_index_outfile);
+ stress_index_outfile.flush();
// Write the stress details
stress.write_ascii(stress_outfile);
@@ -122,16 +122,32 @@ void Simulation::init(void) {
#endif
SimFramework::init();
- stress_state_outfile.open("stress_state_outfile.txt");
- stress_outfile.open("stress.txt");
+ if (getStressOutfileType() == "text") {
+ if (getStressOutfile() == "" || getStressIndexOutfile() == "") {
+ errConsole() << "ERROR: Stress file names cannot be blank." << std::endl;
+ exit(-1);
+ }
+ stress_index_outfile.open(getStressIndexOutfile());
+ stress_outfile.open(getStressOutfile());
+
+ if (!stress_index_outfile.good()) {
+ errConsole() << "ERROR: Could not open output file " << getStressIndexOutfile() << std::endl;
+ exit(-1);
+ }
- if (!stress_state_outfile.good() || !stress_outfile.good()) {
- errConsole() << "ERROR: Could not open output file " << std::endl;
+ if (!stress_outfile.good()) {
+ errConsole() << "ERROR: Could not open output file " << getStressOutfile() << std::endl;
+ exit(-1);
+ }
+
+ quakelib::ModelStressState::write_ascii_header(stress_index_outfile);
+ quakelib::ModelStress::write_ascii_header(stress_outfile);
+ } else if (getStressOutfileType() == "hdf5") {
+
+ } else if (!(getStressOutfileType() == "")) {
+ errConsole() << "ERROR: Unknown stress output file type " << getStressOutfileType() << std::endl;
exit(-1);
}
-
- quakelib::ModelStressState::write_ascii_header(stress_state_outfile);
- quakelib::ModelStress::write_ascii_header(stress_outfile);
num_stress_recs = 0;
}
diff --git a/src/core/Simulation.h b/src/core/Simulation.h
index 9770ccf..43fa9e1 100644
--- a/src/core/Simulation.h
+++ b/src/core/Simulation.h
@@ -255,7 +255,7 @@ class Simulation : public SimFramework, public VCParams, public VCSimData, publi
GREEN_VAL *decompress_buf;
//! Files to write stress records to
- std::ofstream stress_state_outfile, stress_outfile;
+ std::ofstream stress_index_outfile, stress_outfile;
//! Number of stress records written to files, used for keeping track of indices
unsigned int num_stress_recs;
More information about the CIG-COMMITS
mailing list