]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
allow choice of output format and set XFig parameter to see id's
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 3 Dec 2003 13:28:30 +0000 (13:28 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 3 Dec 2003 13:28:30 +0000 (13:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@8226 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/utilities/gridio.cc

index 8f01758fed526d66783ddd8f59b3caeaac049577..ac3ffa7fb47513f7274fc54606e3189c3efa248a 100644 (file)
 #include <fstream>
 #include <string>
 
+#include <unistd.h>
+
 using namespace std;
 
-int main(int argc, const char** argv)
+int main(int argc, char** argv)
 {
   if (argc<2)
     {
-      cerr << "Usage: " << argv[0] << " <filename>" << endl;
+      cerr << "Usage: " << argv[0]
+          << " -i informat -o outformat <filename>" << endl;
       exit(1);
     }
 
-  string iname =argv[1];
+  GridOut::OutputFormat oformat;
+  int c;
+  const char* optstring="i:o:";
+  while((c=getopt(argc, argv, optstring)) != -1)
+  {
+      switch (c)
+      {
+         case 'i':
+             break;
+         case 'o':
+             oformat = GridOut::parse_output_format(optarg);
+             break;
+      }
+  }
+  string iname =argv[optind];
 //  if (iname.find_last_of('.') <= 0)
 //    iname.append(".inp");
   
+  GridOutFlags::XFig xfig_flags;
+  xfig_flags.level_depth = false;
+
   Triangulation<2> tr;
 
    ifstream in (iname.c_str());
@@ -36,13 +56,14 @@ int main(int argc, const char** argv)
    gin.read_ucd(in);
 
    GridOut gout;
+   gout.set_flags(xfig_flags);
    
    string oname(iname, 0, iname.find_last_of('.'));  
-   oname.append(".eps");
+   oname.append(GridOut::default_suffix(oformat));
    cout << iname << " -> " << oname << endl;
    ofstream out(oname.c_str());
 
-   gout.write_eps(tr, out);
+   gout.write(tr, out, oformat);
    
 //  GridOut
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.