From: guido Date: Fri, 16 May 2003 11:12:47 +0000 (+0000) Subject: new gridio utility X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f35ec12c7670836c34b4045d7aad566c3895239;p=dealii-svn.git new gridio utility git-svn-id: https://svn.dealii.org/trunk@7652 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/contrib/utilities/Makefile.in b/deal.II/contrib/utilities/Makefile.in index c0a7887246..66dce65bd9 100644 --- a/deal.II/contrib/utilities/Makefile.in +++ b/deal.II/contrib/utilities/Makefile.in @@ -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 index 0000000000..8f01758fed --- /dev/null +++ b/deal.II/contrib/utilities/gridio.cc @@ -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 +#include +#include + +#include +#include +#include + +using namespace std; + +int main(int argc, const char** argv) +{ + if (argc<2) + { + cerr << "Usage: " << argv[0] << " " << 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 +}