--- /dev/null
+//-----------------------------------------------------------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2007 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.
+//
+//-----------------------------------------------------------------------------
+
+// Plot functions in library and check their consistency
+
+#include "../tests.h"
+#include <base/data_out_base.h>
+#include <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <base/function_lib.h>
+#include <base/flow_function.h>
+#include <lac/vector.h>
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+
+
+template<int dim>
+void
+check_function(const Function<dim>& f,
+ unsigned int sub,
+ std::ostream& out)
+{
+ // Prepare a vector with a single
+ // patch stretching over the cube
+ // [-1,1]^dim
+ std::vector<DataOutBase::Patch<dim,dim> > patches(1);
+ unsigned int vertex_number = 0;
+ for (unsigned int iz=0;iz < ((dim>2) ? 2 : 1) ;++iz)
+ for (unsigned int iy=0;iy < ((dim>1) ? 2 : 1) ;++iy)
+ for (unsigned int ix=0;ix < 2 ;++ix)
+ {
+ if (dim>0) patches[0].vertices[vertex_number](0) = -1. + 2.*ix;
+ if (dim>1) patches[0].vertices[vertex_number](1) = -1. + 2.*iy;
+ if (dim>2) patches[0].vertices[vertex_number](2) = -1. + 2.*iz;
+ ++vertex_number;
+ }
+ for (unsigned int i=0;i<GeometryInfo<dim>::faces_per_cell;++i)
+ patches[0].neighbors[i] = deal_II_numbers::invalid_unsigned_int;
+ patches[0].patch_index = 0;
+ patches[0].n_subdivisions = sub;
+ patches[0].points_are_available = false;
+
+ vertex_number = 1;
+ for (unsigned int d=0;d<dim;++d)
+ vertex_number *= (sub+1);
+ patches[0].data.reinit(f.n_components, vertex_number);
+
+ // Build the vector of quadrature points;
+ std::vector<Point<dim> > points(vertex_number);
+ const double h = 2./sub;
+ vertex_number = 0;
+ for (unsigned int iz=0;iz <= ((dim>2) ? sub : 0) ;++iz)
+ for (unsigned int iy=0;iy <= ((dim>1) ? sub : 0) ;++iy)
+ for (unsigned int ix=0;ix <= sub ;++ix)
+ {
+ if (dim>0) points[vertex_number](0) = -1.+ix*h;
+ if (dim>1) points[vertex_number](1) = -1.+iy*h;
+ if (dim>2) points[vertex_number](2) = -1.+iz*h;
+ ++vertex_number;
+ }
+
+ std::vector<Vector<double> > values(points.size(), Vector<double>(f.n_components));
+ f.vector_value_list(points, values);
+ for (unsigned int i=0;i<values.size();++i)
+ for (unsigned int j=0;j<values[i].size();++j)
+ {
+// deallog << points[i] << '\t' << values[i](j) << std::endl;
+ patches[0].data(j, i) = values[i](j);
+ }
+
+ std::vector<std::string> names(f.n_components);
+ for (unsigned int i=0;i<names.size();++i)
+ {
+ names[i] = std::string("comp");
+ }
+
+
+ DataOutBase dout;
+ DataOutBase::DXFlags flags;
+ dout.write_dx(patches, names, flags, out);
+}
+
+
+int main()
+{
+ std::ofstream logfile("functions_01/output");
+
+ if (true)
+ {
+ Functions::PoisseuilleFlow<2> f(.8, 10.);
+ check_function(f, 4, logfile);
+ }
+ if (true)
+ {
+ Functions::PoisseuilleFlow<3> f(.8, 10.);
+ check_function(f, 4, logfile);
+ }
+}
--- /dev/null
+object "vertices" class array type float rank 1 shape 2 items 25 data follows
+-1 -1
+-0.5 -1
+0 -1
+0.5 -1
+1 -1
+-1 -0.5
+-0.5 -0.5
+0 -0.5
+0.5 -0.5
+1 -0.5
+-1 0
+-0.5 0
+0 0
+0.5 0
+1 0
+-1 0.5
+-0.5 0.5
+0 0.5
+0.5 0.5
+1 0.5
+-1 1
+-0.5 1
+0 1
+0.5 1
+1 1
+object "cells" class array type int rank 1 shape 4 items 16 data follows
+0 5 1 6
+1 6 2 7
+2 7 3 8
+3 8 4 9
+5 10 6 11
+6 11 7 12
+7 12 8 13
+8 13 9 14
+10 15 11 16
+11 16 12 17
+12 17 13 18
+13 18 14 19
+15 20 16 21
+16 21 17 22
+17 22 18 23
+18 23 19 24
+
+attribute "element type" string "quads"
+attribute "ref" string "positions"
+object "data" class array type float rank 1 shape 3 items 25 data follows
+ -0.5625 0 0.3125
+ -0.5625 0 0.15625
+ -0.5625 0 0
+ -0.5625 0 -0.15625
+ -0.5625 0 -0.3125
+ 0.609375 0 0.3125
+ 0.609375 0 0.15625
+ 0.609375 0 0
+ 0.609375 0 -0.15625
+ 0.609375 0 -0.3125
+ 1 0 0.3125
+ 1 0 0.15625
+ 1 0 0
+ 1 0 -0.15625
+ 1 0 -0.3125
+ 0.609375 0 0.3125
+ 0.609375 0 0.15625
+ 0.609375 0 0
+ 0.609375 0 -0.15625
+ 0.609375 0 -0.3125
+ -0.5625 0 0.3125
+ -0.5625 0 0.15625
+ -0.5625 0 0
+ -0.5625 0 -0.15625
+ -0.5625 0 -0.3125
+attribute "dep" string "positions"
+object "deal data" class field
+component "positions" value "vertices"
+component "connections" value "cells"
+component "data" value "data"
+attribute
+end
+object "vertices" class array type float rank 1 shape 3 items 125 data follows
+-1 -1 -1
+-0.5 -1 -1
+0 -1 -1
+0.5 -1 -1
+1 -1 -1
+-1 -0.5 -1
+-0.5 -0.5 -1
+0 -0.5 -1
+0.5 -0.5 -1
+1 -0.5 -1
+-1 0 -1
+-0.5 0 -1
+0 0 -1
+0.5 0 -1
+1 0 -1
+-1 0.5 -1
+-0.5 0.5 -1
+0 0.5 -1
+0.5 0.5 -1
+1 0.5 -1
+-1 1 -1
+-0.5 1 -1
+0 1 -1
+0.5 1 -1
+1 1 -1
+-1 -1 -0.5
+-0.5 -1 -0.5
+0 -1 -0.5
+0.5 -1 -0.5
+1 -1 -0.5
+-1 -0.5 -0.5
+-0.5 -0.5 -0.5
+0 -0.5 -0.5
+0.5 -0.5 -0.5
+1 -0.5 -0.5
+-1 0 -0.5
+-0.5 0 -0.5
+0 0 -0.5
+0.5 0 -0.5
+1 0 -0.5
+-1 0.5 -0.5
+-0.5 0.5 -0.5
+0 0.5 -0.5
+0.5 0.5 -0.5
+1 0.5 -0.5
+-1 1 -0.5
+-0.5 1 -0.5
+0 1 -0.5
+0.5 1 -0.5
+1 1 -0.5
+-1 -1 0
+-0.5 -1 0
+0 -1 0
+0.5 -1 0
+1 -1 0
+-1 -0.5 0
+-0.5 -0.5 0
+0 -0.5 0
+0.5 -0.5 0
+1 -0.5 0
+-1 0 0
+-0.5 0 0
+0 0 0
+0.5 0 0
+1 0 0
+-1 0.5 0
+-0.5 0.5 0
+0 0.5 0
+0.5 0.5 0
+1 0.5 0
+-1 1 0
+-0.5 1 0
+0 1 0
+0.5 1 0
+1 1 0
+-1 -1 0.5
+-0.5 -1 0.5
+0 -1 0.5
+0.5 -1 0.5
+1 -1 0.5
+-1 -0.5 0.5
+-0.5 -0.5 0.5
+0 -0.5 0.5
+0.5 -0.5 0.5
+1 -0.5 0.5
+-1 0 0.5
+-0.5 0 0.5
+0 0 0.5
+0.5 0 0.5
+1 0 0.5
+-1 0.5 0.5
+-0.5 0.5 0.5
+0 0.5 0.5
+0.5 0.5 0.5
+1 0.5 0.5
+-1 1 0.5
+-0.5 1 0.5
+0 1 0.5
+0.5 1 0.5
+1 1 0.5
+-1 -1 1
+-0.5 -1 1
+0 -1 1
+0.5 -1 1
+1 -1 1
+-1 -0.5 1
+-0.5 -0.5 1
+0 -0.5 1
+0.5 -0.5 1
+1 -0.5 1
+-1 0 1
+-0.5 0 1
+0 0 1
+0.5 0 1
+1 0 1
+-1 0.5 1
+-0.5 0.5 1
+0 0.5 1
+0.5 0.5 1
+1 0.5 1
+-1 1 1
+-0.5 1 1
+0 1 1
+0.5 1 1
+1 1 1
+object "cells" class array type int rank 1 shape 8 items 64 data follows
+0 25 5 30 1 26 6 31
+1 26 6 31 2 27 7 32
+2 27 7 32 3 28 8 33
+3 28 8 33 4 29 9 34
+5 30 10 35 6 31 11 36
+6 31 11 36 7 32 12 37
+7 32 12 37 8 33 13 38
+8 33 13 38 9 34 14 39
+10 35 15 40 11 36 16 41
+11 36 16 41 12 37 17 42
+12 37 17 42 13 38 18 43
+13 38 18 43 14 39 19 44
+15 40 20 45 16 41 21 46
+16 41 21 46 17 42 22 47
+17 42 22 47 18 43 23 48
+18 43 23 48 19 44 24 49
+25 50 30 55 26 51 31 56
+26 51 31 56 27 52 32 57
+27 52 32 57 28 53 33 58
+28 53 33 58 29 54 34 59
+30 55 35 60 31 56 36 61
+31 56 36 61 32 57 37 62
+32 57 37 62 33 58 38 63
+33 58 38 63 34 59 39 64
+35 60 40 65 36 61 41 66
+36 61 41 66 37 62 42 67
+37 62 42 67 38 63 43 68
+38 63 43 68 39 64 44 69
+40 65 45 70 41 66 46 71
+41 66 46 71 42 67 47 72
+42 67 47 72 43 68 48 73
+43 68 48 73 44 69 49 74
+50 75 55 80 51 76 56 81
+51 76 56 81 52 77 57 82
+52 77 57 82 53 78 58 83
+53 78 58 83 54 79 59 84
+55 80 60 85 56 81 61 86
+56 81 61 86 57 82 62 87
+57 82 62 87 58 83 63 88
+58 83 63 88 59 84 64 89
+60 85 65 90 61 86 66 91
+61 86 66 91 62 87 67 92
+62 87 67 92 63 88 68 93
+63 88 68 93 64 89 69 94
+65 90 70 95 66 91 71 96
+66 91 71 96 67 92 72 97
+67 92 72 97 68 93 73 98
+68 93 73 98 69 94 74 99
+75 100 80 105 76 101 81 106
+76 101 81 106 77 102 82 107
+77 102 82 107 78 103 83 108
+78 103 83 108 79 104 84 109
+80 105 85 110 81 106 86 111
+81 106 86 111 82 107 87 112
+82 107 87 112 83 108 88 113
+83 108 88 113 84 109 89 114
+85 110 90 115 86 111 91 116
+86 111 91 116 87 112 92 117
+87 112 92 117 88 113 93 118
+88 113 93 118 89 114 94 119
+90 115 95 120 91 116 96 121
+91 116 96 121 92 117 97 122
+92 117 97 122 93 118 98 123
+93 118 98 123 94 119 99 124
+
+attribute "element type" string "cubes"
+attribute "ref" string "positions"
+object "data" class array type float rank 1 shape 4 items 125 data follows
+ -2.125 0 0 0.625
+ -2.125 0 0 0.3125
+ -2.125 0 0 0
+ -2.125 0 0 -0.3125
+ -2.125 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ -0.5625 0 0 0.625
+ -0.5625 0 0 0.3125
+ -0.5625 0 0 0
+ -0.5625 0 0 -0.3125
+ -0.5625 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ -2.125 0 0 0.625
+ -2.125 0 0 0.3125
+ -2.125 0 0 0
+ -2.125 0 0 -0.3125
+ -2.125 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ 0.21875 0 0 0.625
+ 0.21875 0 0 0.3125
+ 0.21875 0 0 0
+ 0.21875 0 0 -0.3125
+ 0.21875 0 0 -0.625
+ 0.609375 0 0 0.625
+ 0.609375 0 0 0.3125
+ 0.609375 0 0 0
+ 0.609375 0 0 -0.3125
+ 0.609375 0 0 -0.625
+ 0.21875 0 0 0.625
+ 0.21875 0 0 0.3125
+ 0.21875 0 0 0
+ 0.21875 0 0 -0.3125
+ 0.21875 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ -0.5625 0 0 0.625
+ -0.5625 0 0 0.3125
+ -0.5625 0 0 0
+ -0.5625 0 0 -0.3125
+ -0.5625 0 0 -0.625
+ 0.609375 0 0 0.625
+ 0.609375 0 0 0.3125
+ 0.609375 0 0 0
+ 0.609375 0 0 -0.3125
+ 0.609375 0 0 -0.625
+ 1 0 0 0.625
+ 1 0 0 0.3125
+ 1 0 0 0
+ 1 0 0 -0.3125
+ 1 0 0 -0.625
+ 0.609375 0 0 0.625
+ 0.609375 0 0 0.3125
+ 0.609375 0 0 0
+ 0.609375 0 0 -0.3125
+ 0.609375 0 0 -0.625
+ -0.5625 0 0 0.625
+ -0.5625 0 0 0.3125
+ -0.5625 0 0 0
+ -0.5625 0 0 -0.3125
+ -0.5625 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ 0.21875 0 0 0.625
+ 0.21875 0 0 0.3125
+ 0.21875 0 0 0
+ 0.21875 0 0 -0.3125
+ 0.21875 0 0 -0.625
+ 0.609375 0 0 0.625
+ 0.609375 0 0 0.3125
+ 0.609375 0 0 0
+ 0.609375 0 0 -0.3125
+ 0.609375 0 0 -0.625
+ 0.21875 0 0 0.625
+ 0.21875 0 0 0.3125
+ 0.21875 0 0 0
+ 0.21875 0 0 -0.3125
+ 0.21875 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ -2.125 0 0 0.625
+ -2.125 0 0 0.3125
+ -2.125 0 0 0
+ -2.125 0 0 -0.3125
+ -2.125 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ -0.5625 0 0 0.625
+ -0.5625 0 0 0.3125
+ -0.5625 0 0 0
+ -0.5625 0 0 -0.3125
+ -0.5625 0 0 -0.625
+ -0.953125 0 0 0.625
+ -0.953125 0 0 0.3125
+ -0.953125 0 0 0
+ -0.953125 0 0 -0.3125
+ -0.953125 0 0 -0.625
+ -2.125 0 0 0.625
+ -2.125 0 0 0.3125
+ -2.125 0 0 0
+ -2.125 0 0 -0.3125
+ -2.125 0 0 -0.625
+attribute "dep" string "positions"
+object "deal data" class field
+component "positions" value "vertices"
+component "connections" value "cells"
+component "data" value "data"
+attribute
+end