// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set et ts=4 sw=2 sts=2: // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception #ifndef BASISPRINT #define BASISPRINT #include #include namespace Dune { /********************************************** * Methods for printing a PolynomialBasis. * Is achieved by using the MultiIndex class as * Field type and printing the results. * The basis and higher order derivatives can be * printed. This could be the basis for printing * routings providing C++ or matlab methods * for computing the basisfunctions for given * orders or reference elements. **********************************************/ // default argument does not work for gcc 4.1.2 // template template void basisPrint(std::ostream &out, typename BasisFactory::Object &basis) { typedef typename BasisFactory::Object Basis; const int dimension = Basis::dimension; typedef MultiIndex< dimension, PrintField > Field; typedef typename BasisFactory::template EvaluationBasisFactory::Type MIBasisFactory; typedef typename MIBasisFactory::Object MIBasis; typedef typename Basis::CoefficientMatrix CMatrix; typedef PolynomialBasis, CMatrix, double, double > PrintBasis; MIBasis *miBasis = MIBasisFactory::template create( basis.basis().order()); PrintBasis printBasis(*miBasis,basis.matrix(),basis.size()); unsigned int size = printBasis.size(); out << "% Number of base functions: " << size << std::endl; out << "% Derivative order: " << deriv << std::endl; std::vector< FieldVector< FieldVector::size>, PrintBasis::dimRange> > y( size ); FieldVector< Field, dimension > x; for( int i = 0; i < dimension; ++i ) x[ i ].set( i, 1 ); printBasis.template evaluateSingle( x, y ); for (unsigned int i=0; i void basisPrint(std::ostream &out, typename BasisFactory::Key &key) { typename BasisFactory::Object *basis = BasisFactory::create(key); basisPrint(out,*basis); BasisFactory::release(basis); } } #endif // BASISPRINT