Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
output.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_mesh_worker_output_h
18 #define dealii_mesh_worker_output_h
19 
20 #include <deal.II/base/config.h>
21 
24 #include <deal.II/base/utilities.h>
25 
27 
29 
30 
32 
33 namespace MeshWorker
34 {
35  namespace Assembler
36  {
61  {
62  public:
66  GnuplotPatch();
67 
77  void
78  initialize(const unsigned int n_points, const unsigned int n_vectors);
79 
84  void
85  initialize_stream(std::ostream &stream);
86 
94  template <int dim>
95  void
96  initialize_info(DoFInfo<dim> &info, bool face);
97 
101  template <int dim>
102  void
103  assemble(const DoFInfo<dim> &info);
104 
108  template <int dim>
109  void
110  assemble(const DoFInfo<dim> &info1, const DoFInfo<dim> &info2);
111 
112  private:
117  template <typename T>
118  void
119  write(const T &t) const;
120 
126  void
127  write_endl() const;
128 
132  unsigned int n_vectors;
136  unsigned int n_points;
137 
141  std::ostream *os;
142  };
143 
144  //----------------------------------------------------------------------//
145 
146  template <typename T>
147  inline void
148  GnuplotPatch::write(const T &d) const
149  {
150  if (os == nullptr)
151  deallog << d;
152  else
153  (*os) << d;
154  }
155 
156 
157  inline void
159  {
160  if (os == nullptr)
161  deallog << std::endl;
162  else
163  (*os) << std::endl;
164  }
165 
166 
168  : n_vectors(numbers::invalid_unsigned_int)
169  , n_points(numbers::invalid_unsigned_int)
170  , os(nullptr)
171  {}
172 
173 
174  inline void
175  GnuplotPatch::initialize(const unsigned int np, const unsigned int nv)
176  {
177  n_vectors = nv;
178  n_points = np;
179  }
180 
181 
182  inline void
183  GnuplotPatch::initialize_stream(std::ostream &stream)
184  {
185  os = &stream;
186  }
187 
188 
189  template <int dim>
190  inline void
192  {
193  if (face)
194  info.initialize_quadrature(Utilities::fixed_power<dim - 1>(n_points),
195  n_vectors + dim);
196  else
197  info.initialize_quadrature(Utilities::fixed_power<dim>(n_points),
198  n_vectors + dim);
199  }
200 
201 
202  template <int dim>
203  inline void
205  {
206  const unsigned int np = info.n_quadrature_points();
207  const unsigned int nv = info.n_quadrature_values();
208  const unsigned int patch_dim =
209  (info.face_number == numbers::invalid_unsigned_int) ? dim : (dim - 1);
210  const unsigned int row_length = n_points;
211  // If patches are 1D, end the
212  // patch after a row, else end
213  // it after a square
214  const unsigned int row_length2 =
215  (patch_dim == 1) ? row_length : (row_length * row_length);
216 
217  // AssertDimension(np, Utilities::fixed_power<dim>(n_points));
218  AssertDimension(nv, n_vectors + dim);
219 
220 
221  for (unsigned int k = 0; k < np; ++k)
222  {
223  if (k % row_length == 0)
224  write_endl();
225  if (k % row_length2 == 0)
226  write_endl();
227 
228  for (unsigned int i = 0; i < nv; ++i)
229  {
230  write(info.quadrature_value(k, i));
231  write('\t');
232  }
233  write_endl();
234  }
235  }
236 
237 
238  template <int dim>
239  inline void
241  {
242  assemble(info1);
243  assemble(info2);
244  }
245  } // namespace Assembler
246 } // namespace MeshWorker
247 
249 
250 #endif
MeshWorker::Assembler::GnuplotPatch::os
std::ostream * os
Definition: output.h:141
MeshWorker
Definition: assemble_flags.h:30
utilities.h
Physics::Elasticity::Kinematics::d
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
deallog
LogStream deallog
Definition: logstream.cc:37
MeshWorker::LocalResults< double >::initialize_quadrature
void initialize_quadrature(const unsigned int np, const unsigned int nv)
Definition: local_results.h:527
LAPACKSupport::T
static const char T
Definition: lapack_support.h:163
MeshWorker::Assembler::GnuplotPatch::GnuplotPatch
GnuplotPatch()
Definition: output.h:167
MeshWorker::Assembler::GnuplotPatch::assemble
void assemble(const DoFInfo< dim > &info)
Definition: output.h:204
block_vector.h
MeshWorker::Assembler::GnuplotPatch
Definition: output.h:60
MeshWorker::Assembler::GnuplotPatch::write_endl
void write_endl() const
Definition: output.h:158
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
MeshWorker::Assembler::GnuplotPatch::initialize_info
void initialize_info(DoFInfo< dim > &info, bool face)
Definition: output.h:191
MeshWorker::LocalResults< double >::quadrature_value
double & quadrature_value(const unsigned int k, const unsigned int i)
Definition: local_results.h:608
MeshWorker::Assembler::GnuplotPatch::n_vectors
unsigned int n_vectors
Definition: output.h:132
MeshWorker::Assembler::GnuplotPatch::n_points
unsigned int n_points
Definition: output.h:136
AssertDimension
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1579
smartpointer.h
mg_level_object.h
numbers
Definition: numbers.h:207
dof_info.h
MeshWorker::LocalResults< double >::n_quadrature_values
unsigned int n_quadrature_values() const
Definition: local_results.h:568
MeshWorker::Assembler::GnuplotPatch::initialize_stream
void initialize_stream(std::ostream &stream)
Definition: output.h:183
MeshWorker::DoFInfo::face_number
unsigned int face_number
Definition: dof_info.h:91
numbers::invalid_unsigned_int
static const unsigned int invalid_unsigned_int
Definition: types.h:191
config.h
MeshWorker::Assembler::GnuplotPatch::write
void write(const T &t) const
Definition: output.h:148
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
MeshWorker::DoFInfo
Definition: dof_info.h:76
MeshWorker::LocalResults< double >::n_quadrature_points
unsigned int n_quadrature_points() const
Definition: local_results.h:560
MeshWorker::Assembler::GnuplotPatch::initialize
void initialize(const unsigned int n_points, const unsigned int n_vectors)
Definition: output.h:175