[cig-commits] commit: Set the origin correctly in write_vtk
Mercurial
hg at geodynamics.org
Fri Feb 10 16:00:10 PST 2012
changeset: 12:e61eb71c2e37
user: Walter Landry <wlandry at caltech.edu>
date: Mon Nov 28 14:32:45 2011 -0800
files: write_vtk.hxx
description:
Set the origin correctly in write_vtk
diff -r d3cfe8600192 -r e61eb71c2e37 write_vtk.hxx
--- a/write_vtk.hxx Mon Nov 28 14:10:42 2011 -0800
+++ b/write_vtk.hxx Mon Nov 28 14:32:45 2011 -0800
@@ -8,6 +8,9 @@ void write_vtk(const std::string &name,
boost::filesystem::create_directory("output");
boost::filesystem::ofstream initial("output/"+name+".vtk");
+ const double spacing(1.0/N);
+ const double origin[]={(NX==N ? spacing/2:0),(NY==N ? spacing/2:0)};
+
initial << "# vtk DataFile Version 2.0\n"
<< name << "\n"
<< "ASCII\n"
@@ -16,11 +19,14 @@ void write_vtk(const std::string &name,
<< NX << " "
<< NY << " "
<< "1\n"
- << "ORIGIN 0 0 0\n"
+ << "ORIGIN "
+ << origin[0] << " "
+ << origin[1] << " "
+ << "0 \n"
<< "SPACING "
- << (1.0/N) << " "
- << (1.0/N) << " "
- << (1.0/N) << "\n"
+ << spacing << " "
+ << spacing << " "
+ << spacing << "\n"
<< "POINT_DATA "
<< NX*NY << "\n"
<< "SCALARS " << name << " double 1\n"
More information about the CIG-COMMITS
mailing list