From: hartmann Date: Wed, 12 Sep 2001 12:33:19 +0000 (+0000) Subject: reverse order of for-loops in gnuplot_output. New file names. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=880eb8150ec8af2fe90cb92ec04c950975d160f8;p=dealii-svn.git reverse order of for-loops in gnuplot_output. New file names. git-svn-id: https://svn.dealii.org/trunk@4969 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-10/step-10.cc b/deal.II/examples/step-10/step-10.cc index f31f41b4d6..f7df1d386e 100644 --- a/deal.II/examples/step-10/step-10.cc +++ b/deal.II/examples/step-10/step-10.cc @@ -21,6 +21,52 @@ static const long double pi=3.141592653589793238462643; + +template +void gnuplot_output() +{ + cout << "Output of grids into gnuplot files:" << std::endl + << "===================================" << std::endl; + + Triangulation triangulation; + GridGenerator::hyper_ball (triangulation); + static const HyperBallBoundary boundary; + triangulation.set_boundary (0, boundary); + + GridOut grid_out; + // on boundary faces plot 30 + // additional points per face. + GridOutFlags::Gnuplot gnuplot_flags(false, 30); + grid_out.set_flags(gnuplot_flags); + + + for (unsigned int refinement=0; refinement<2; + ++refinement, triangulation.refine_global(1)) + { + cout << "Pefinement level: " << refinement << std::endl; + string filename_base="ball"; + filename_base += ('0'+refinement); + + for (unsigned int order=1; order<4; ++order) + { + cout << "Order = " << order; + + const MappingQ mapping (order); + string filename=filename_base+"_mapping_q"; + filename += ('0'+order); + filename += ".dat"; + ofstream gnuplot_file(filename.c_str()); + + cout << ". Writing gnuplot file <" + << filename << ">..." << std::endl; + + grid_out.write_gnuplot(triangulation, gnuplot_file, &mapping); + } + } +} + + + template void compute_pi_by_area () { @@ -140,48 +186,6 @@ void compute_pi_by_perimeter () }; -template -void gnuplot_output() -{ - cout << "Output of grids as gnuplot file:" << std::endl; - - static const HyperBallBoundary boundary; - - GridOut grid_out; - // on boundary faces plot 30 - // additional points per face. - GridOutFlags::Gnuplot gnuplot_flags(false, 30); - grid_out.set_flags(gnuplot_flags); - - - for (unsigned int order=1; order<4; ++order) - { - cout << "Order = " << order << std::endl; - - Triangulation triangulation; - GridGenerator::hyper_ball (triangulation); - triangulation.set_boundary (0, boundary); - - const MappingQ mapping (order); - string filename_base="ball_mapping_q"; - filename_base += ('0'+order); - - - for (unsigned int refinement=0; refinement<2; - ++refinement, triangulation.refine_global(1)) - { - string filename=filename_base+"_ref"; - filename += ('0'+refinement); - filename += ".dat"; - ofstream gnuplot_file(filename.c_str()); - - grid_out.write_gnuplot(triangulation, gnuplot_file, &mapping); - } - } -} - - - int main () { cout.precision (16);