deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\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\}}\)
Loading...
Searching...
No Matches
output.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2010 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13
14#ifndef dealii_mesh_worker_output_h
15#define dealii_mesh_worker_output_h
16
17#include <deal.II/base/config.h>
18
22
24
26
27
29
30namespace MeshWorker
31{
32 namespace Assembler
33 {
55 {
56 public:
61
71 void
72 initialize(const unsigned int n_points, const unsigned int n_vectors);
73
78 void
79 initialize_stream(std::ostream &stream);
80
88 template <int dim>
89 void
90 initialize_info(DoFInfo<dim> &info, bool face);
91
95 template <int dim>
96 void
97 assemble(const DoFInfo<dim> &info);
98
102 template <int dim>
103 void
104 assemble(const DoFInfo<dim> &info1, const DoFInfo<dim> &info2);
105
106 private:
111 template <typename T>
112 void
113 write(const T &t) const;
114
120 void
121 write_endl() const;
122
126 unsigned int n_vectors;
130 unsigned int n_points;
131
135 std::ostream *os;
136 };
137
138 //----------------------------------------------------------------------//
139
140 template <typename T>
141 inline void
142 GnuplotPatch::write(const T &d) const
143 {
144 if (os == nullptr)
145 deallog << d;
146 else
147 (*os) << d;
148 }
149
150
151 inline void
153 {
154 if (os == nullptr)
155 deallog << std::endl;
156 else
157 (*os) << std::endl;
158 }
159
160
162 : n_vectors(numbers::invalid_unsigned_int)
163 , n_points(numbers::invalid_unsigned_int)
164 , os(nullptr)
165 {}
166
167
168 inline void
169 GnuplotPatch::initialize(const unsigned int np, const unsigned int nv)
170 {
171 n_vectors = nv;
172 n_points = np;
173 }
174
175
176 inline void
178 {
179 os = &stream;
180 }
181
182
183 template <int dim>
184 inline void
186 {
187 if (face)
188 info.initialize_quadrature(Utilities::fixed_power<dim - 1>(n_points),
189 n_vectors + dim);
190 else
191 info.initialize_quadrature(Utilities::fixed_power<dim>(n_points),
192 n_vectors + dim);
193 }
194
195
196 template <int dim>
197 inline void
199 {
200 const unsigned int np = info.n_quadrature_points();
201 const unsigned int nv = info.n_quadrature_values();
202 const unsigned int patch_dim =
203 (info.face_number == numbers::invalid_unsigned_int) ? dim : (dim - 1);
204 const unsigned int row_length = n_points;
205 // If patches are 1d, end the
206 // patch after a row, else end
207 // it after a square
208 const unsigned int row_length2 =
209 (patch_dim == 1) ? row_length : (row_length * row_length);
210
211 // AssertDimension(np, Utilities::fixed_power<dim>(n_points));
212 AssertDimension(nv, n_vectors + dim);
213
214
215 for (unsigned int k = 0; k < np; ++k)
216 {
217 if (k % row_length == 0)
218 write_endl();
219 if (k % row_length2 == 0)
220 write_endl();
221
222 for (unsigned int i = 0; i < nv; ++i)
223 {
224 write(info.quadrature_value(k, i));
225 write('\t');
226 }
227 write_endl();
228 }
229 }
230
231
232 template <int dim>
233 inline void
235 {
236 assemble(info1);
237 assemble(info2);
238 }
239 } // namespace Assembler
240} // namespace MeshWorker
241
243
244#endif
void write(const T &t) const
Definition output.h:142
void initialize_stream(std::ostream &stream)
Definition output.h:177
void assemble(const DoFInfo< dim > &info)
Definition output.h:198
void initialize_info(DoFInfo< dim > &info, bool face)
Definition output.h:185
void initialize(const unsigned int n_points, const unsigned int n_vectors)
Definition output.h:169
unsigned int face_number
Definition dof_info.h:87
unsigned int n_quadrature_values() const
number & quadrature_value(const unsigned int k, const unsigned int i)
void initialize_quadrature(const unsigned int np, const unsigned int nv)
unsigned int n_quadrature_points() const
#define DEAL_II_DEPRECATED
Definition config.h:294
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define AssertDimension(dim1, dim2)
LogStream deallog
Definition logstream.cc:36
constexpr unsigned int invalid_unsigned_int
Definition types.h:228