// ------------------------------------------------------------------------ // // SPDX-License-Identifier: LGPL-2.1-or-later // Copyright (C) 2006 - 2019 by the deal.II authors // // This file is part of the deal.II library. // // Part of the source code is dual licensed under Apache-2.0 WITH // LLVM-exception OR LGPL-2.1-or-later. Detailed license information // governing the source code and code contributions can be found in // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. // // ------------------------------------------------------------------------ #ifndef dealii_operator_templates_h #define dealii_operator_templates_h #include #include #include #include DEAL_II_NAMESPACE_OPEN namespace Algorithms { template OutputOperator::OutputOperator() : step(numbers::invalid_unsigned_int) , os(nullptr) {} template void OutputOperator::initialize_stream(std::ostream &stream) { os = &stream; } template OutputOperator & OutputOperator::operator<<(const AnyData &vectors) { if (os == nullptr) { deallog << "Step " << step << std::endl; for (unsigned int i = 0; i < vectors.size(); ++i) { const VectorType *v = vectors.try_read_ptr(i); if (v == nullptr) continue; deallog << vectors.name(i); for (unsigned int j = 0; j < v->size(); ++j) deallog << ' ' << ::dealii::internal::ElementAccess::get(*v, j); deallog << std::endl; } deallog << std::endl; } else { (*os) << ' ' << step; for (unsigned int i = 0; i < vectors.size(); ++i) { const VectorType *v = vectors.try_read_ptr(i); if (v == nullptr) continue; for (unsigned int j = 0; j < v->size(); ++j) (*os) << ' ' << ::dealii::internal::ElementAccess::get(*v, j); } (*os) << std::endl; } return *this; } } // namespace Algorithms DEAL_II_NAMESPACE_CLOSE #endif