Commit 2183e1f8 by Francois Gygi

Add output in cube format

parent dc27c68b
......@@ -16,11 +16,14 @@
//
////////////////////////////////////////////////////////////////////////////////
#include<iostream>
#include<iomanip>
#include "Function3d.h"
using namespace std;
// usage: ./testFunction3d file.xml
// Read a Function3d from an XML file and print contents as a cube file
int main(int argc, char** argv)
{
Function3d f;
......@@ -42,12 +45,30 @@ int main(int argc, char** argv)
}
cout << "function norm2: " << sum / f.val.size() << endl;
// modify function
f.name = "output";
f.write("output.xml");
// output data in cube format on stdout
cout << "Created by testFunction3d" << endl;
cout << endl;
cout << "8 0 0 0" << endl;
cout << f.nx << " " << f.a / f.nx << endl;
cout << f.ny << " " << f.b / f.ny << endl;
cout << f.nz << " " << f.c / f.nz << endl;
cout << "1 1 0.0 0.0 0.0" << endl;
cout << "1 1 " << f.a << endl;
cout << "1 1 " << f.b << endl;
cout << "1 1 " << f.c << endl;
cout << "1 1 " << f.a+f.b << endl;
cout << "1 1 " << f.b+f.c << endl;
cout << "1 1 " << f.c+f.a << endl;
cout << "1 1 " << f.a+f.b+f.c << endl;
cout.setf(ios::scientific,ios::floatfield);
cout.precision(5);
for ( int i = 0; i < f.val.size(); i++ )
{
f.val[i] *= 0.5;
cout << setw(13) << f.val[i];
if ( ( (i+1) % 6 ) == 0 )
cout << endl;
}
f.write("output.xml");
cout << endl;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment