]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new gridio utility
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 May 2003 11:12:47 +0000 (11:12 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 May 2003 11:12:47 +0000 (11:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@7652 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/utilities/Makefile.in
deal.II/contrib/utilities/gridio.cc [new file with mode: 0644]

index c0a7887246b236d0282bc315bebad4abdae71af3..66dce65bd9d64db49403456c8a95c8c5615b8328 100644 (file)
@@ -11,18 +11,20 @@ D = @DEAL2_DIR@
 include $D/common/Make.global_options
 debug-mode = off
 
-libraries = $(lib-deal2-1d.o) \
-            $(lib-deal2-2d.o) \
-            $(lib-deal2-3d.o) \
-            $(lib-lac.o)  \
-            $(lib-base.o)
+o = g.o
+l = g
+libraries = $(lib-deal2-1d.$l) \
+            $(lib-deal2-2d.$l) \
+            $(lib-deal2-3d.$l) \
+            $(lib-lac.$l)  \
+            $(lib-base.$l)
 
 ############################################################
 # First how to create executables, including all necessary
 # flags:
 ############################################################
 
-flags     = $(CXXFLAGS.o)
+flags     = $(CXXFLAGS.$l)
 
 ifeq ($(findstring gcc,$(GXX_VERSION)),gcc)
 flags += -Wno-missing-noreturn
@@ -34,17 +36,18 @@ endif
 %.o : %.cc Makefile
        @echo =====optimized===== $<
        @$(CXX) $(CXXFLAGS.o) -c $< -o $@
-%.exe :
+%.exe : %.o
        @echo =====linking======= $@
-       @$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
+       @$(CXX) $(LDFLAGS) -o $@ $^
 
 
 default: embedding.exe interpolation.exe
 
 ############################################################
 
-embedding.exe    : embedding.o  $(libraries)
-interpolation.exe: interpolation.o $(libraries)
+embedding.exe    : embedding.$o  $(libraries)
+interpolation.exe: interpolation.$o $(libraries)
+gridio.exe    : gridio.$o  $(libraries)
 
 ############################################################
 # Automatic generation of dependencies
diff --git a/deal.II/contrib/utilities/gridio.cc b/deal.II/contrib/utilities/gridio.cc
new file mode 100644 (file)
index 0000000..8f01758
--- /dev/null
@@ -0,0 +1,48 @@
+// $Id$
+// (c) Guido Kanschat
+
+// A little program reading a grid *.inp and writing it to *.eps.
+// Some more functionality should be added som time.
+
+#include <grid/tria.h>
+#include <grid/grid_in.h>
+#include <grid/grid_out.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+int main(int argc, const char** argv)
+{
+  if (argc<2)
+    {
+      cerr << "Usage: " << argv[0] << " <filename>" << endl;
+      exit(1);
+    }
+
+  string iname =argv[1];
+//  if (iname.find_last_of('.') <= 0)
+//    iname.append(".inp");
+  
+  Triangulation<2> tr;
+
+   ifstream in (iname.c_str());
+   AssertThrow(in, ExcFileNotOpen(argv[1]));
+
+   GridIn<2> gin;
+   gin.attach_triangulation(tr);
+   gin.read_ucd(in);
+
+   GridOut gout;
+   
+   string oname(iname, 0, iname.find_last_of('.'));  
+   oname.append(".eps");
+   cout << iname << " -> " << oname << endl;
+   ofstream out(oname.c_str());
+
+   gout.write_eps(tr, out);
+   
+//  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.