From: Guido Kanschat Date: Tue, 17 Jan 2006 15:39:11 +0000 (+0000) Subject: split text and binary tecplot X-Git-Tag: v8.0.0~12611 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=477a7c81820bed8204d341d002422e003e18b258;p=dealii.git split text and binary tecplot git-svn-id: https://svn.dealii.org/trunk@12059 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/data_out_base_povray.cc b/tests/base/data_out_base_povray.cc new file mode 100644 index 0000000000..c1104bacd3 --- /dev/null +++ b/tests/base/data_out_base_povray.cc @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// $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 + +#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 0 + + +template +void check(DataOutBase::PovrayFlags 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_povray(patches, names, flags, out); +} + + +template +void check_cont(unsigned int ncells, + unsigned int nsub, + DataOutBase::PovrayFlags flags, + std::ostream& out) +{ + std::vector > patches; + + create_continuous_patches(patches, ncells, nsub); + + std::vector names(1); + names[0] = "CutOff"; + DataOutBase::write_povray(patches, names, flags, out); +} + + +template +void check_all(std::ostream& log) +{ +#if SEPARATE_FILES == 0 + std::ostream& out = log; +#endif + + char name[100]; + const char* format = "data_out_base_povray/%d%d%d%s.povray"; + DataOutBase::PovrayFlags flags; + + if (true) + { + sprintf(name, "data_out_base_povray/cont%d%d%d.povray", dim, 4, 4); +#if SEPARATE_FILES==1 + std::ofstream out(name); +#else + out << "==============================\n" + << name + << "\n==============================\n"; +#endif + check_cont(4, 4, flags, out); + } +} + +int main() +{ + std::ofstream logfile("data_out_base_povray/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 index e6d2824b38..d5539defcd 100644 --- a/tests/base/data_out_base_tecplot.cc +++ b/tests/base/data_out_base_tecplot.cc @@ -26,7 +26,7 @@ // 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 +#define SEPARATE_FILES 0 template @@ -49,26 +49,6 @@ void check(DataOutBase::TecplotFlags flags, } -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) { @@ -89,22 +69,12 @@ void check_all(std::ostream& log) #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"); + std::ofstream logfile("data_out_base_tecplot/output", + std::ios_base::trunc | std::ios_base::binary); check_all<1,1>(logfile); check_all<1,2>(logfile); check_all<2,2>(logfile);