From 62d9670714c24ea052fc2e57eab513ef9fd7c9f7 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 16 Jan 2006 21:37:23 +0000 Subject: [PATCH] further output formats git-svn-id: https://svn.dealii.org/trunk@12056 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/data_out_base_gmv.cc | 82 ++++++++++++++++++++ tests/base/data_out_base_tecplot.cc | 113 ++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 tests/base/data_out_base_gmv.cc create mode 100644 tests/base/data_out_base_tecplot.cc diff --git a/tests/base/data_out_base_gmv.cc b/tests/base/data_out_base_gmv.cc new file mode 100644 index 0000000000..26eddc8825 --- /dev/null +++ b/tests/base/data_out_base_gmv.cc @@ -0,0 +1,82 @@ +//----------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------------------------------------------------------------- + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include +#include + +#include "patches.h" + +// Output data on repetitions of the unit hypercube + +// define this as 1 to get output into a separate file for each testcase +#define SEPARATE_FILES 1 + + +template +void check(DataOutBase::GmvFlags flags, + std::ostream& out) +{ + const unsigned int np = 4; + + std::vector > patches(np); + + create_patches(patches); + + std::vector names(5); + names[0] = "x1"; + names[1] = "x2"; + names[2] = "x3"; + names[3] = "x4"; + names[4] = "i"; + DataOutBase::write_gmv(patches, names, flags, out); +} + + +template +void check_all(std::ostream& log) +{ +#if SEPARATE_FILES == 0 + std::ostream& out = log; +#endif + + char name[100]; + DataOutBase::GmvFlags flags; + if (true) { + sprintf(name, "data_out_base_gmv/%d%d.gmv", dim, spacedim); +#if SEPARATE_FILES==1 + std::ofstream out(name); +#else + out << "==============================\n" + << name + << "\n==============================\n"; +#endif + check(flags, out); + } +} + +int main() +{ + std::ofstream logfile("data_out_base_gmv/output"); + check_all<1,1>(logfile); + check_all<1,2>(logfile); + check_all<2,2>(logfile); + check_all<2,3>(logfile); + check_all<3,3>(logfile); +} diff --git a/tests/base/data_out_base_tecplot.cc b/tests/base/data_out_base_tecplot.cc new file mode 100644 index 0000000000..e6d2824b38 --- /dev/null +++ b/tests/base/data_out_base_tecplot.cc @@ -0,0 +1,113 @@ +//----------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------------------------------------------------------------- + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include +#include + +#include "patches.h" + +// Output data on repetitions of the unit hypercube + +// define this as 1 to get output into a separate file for each testcase +#define SEPARATE_FILES 1 + + +template +void check(DataOutBase::TecplotFlags flags, + std::ostream& out) +{ + const unsigned int np = 4; + + std::vector > patches(np); + + create_patches(patches); + + std::vector names(5); + names[0] = "x1"; + names[1] = "x2"; + names[2] = "x3"; + names[3] = "x4"; + names[4] = "i"; + DataOutBase::write_tecplot(patches, names, flags, out); +} + + +template +void check_bin(DataOutBase::TecplotFlags flags, + std::ostream& out) +{ + const unsigned int np = 4; + + std::vector > patches(np); + + create_patches(patches); + + std::vector names(5); + names[0] = "x1"; + names[1] = "x2"; + names[2] = "x3"; + names[3] = "x4"; + names[4] = "i"; + DataOutBase::write_tecplot_binary(patches, names, flags, out); +} + + +template +void check_all(std::ostream& log) +{ +#if SEPARATE_FILES == 0 + std::ostream& out = log; +#endif + + char name[100]; + DataOutBase::TecplotFlags flags; + if (true) { + sprintf(name, "data_out_base_tecplot/%d%d.tecplot", dim, spacedim); +#if SEPARATE_FILES==1 + std::ofstream out(name); +#else + out << "==============================\n" + << name + << "\n==============================\n"; +#endif + check(flags, out); + } + if (true) { + sprintf(name, "data_out_base_tecplot/%d%dbin.tecplot", dim, spacedim); +#if SEPARATE_FILES==1 + std::ofstream out(name); +#else + out << "==============================\n" + << name + << "\n==============================\n"; +#endif + check_bin(flags, out); + } +} + +int main() +{ + std::ofstream logfile("data_out_base_tecplot/output"); + check_all<1,1>(logfile); + check_all<1,2>(logfile); + check_all<2,2>(logfile); + check_all<2,3>(logfile); + check_all<3,3>(logfile); +} -- 2.39.5