/usr/include/dune/localfunctions/utility/basisprint.hh is in libdune-localfunctions-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #ifndef BASISPRINT
#define BASISPRINT
#include <dune/localfunctions/utility/multiindex.hh>
#include <dune/localfunctions/utility/polynomialbasis.hh>
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 <int deriv,class BasisFactory,class PrintField=typename BasisFactory::StorageField>
template <int deriv,class BasisFactory,class PrintField>
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<dimension,Field>::Type
MIBasisFactory;
typedef typename MIBasisFactory::Object MIBasis;
typedef typename Basis::CoefficientMatrix CMatrix;
typedef PolynomialBasis<StandardEvaluator<MIBasis>, CMatrix > PrintBasis;
MIBasis *miBasis = MIBasisFactory::create( Dune::GeometryType( basis.basis().topologyId(),dimension ),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<
LFETensor<Field,dimension,deriv>,PrintBasis::dimRange> >
y( size );
*/
std::vector< FieldVector<
FieldVector<Field,LFETensor<Field,dimension,deriv>::size>,
PrintBasis::dimRange> > y( size );
FieldVector< Field, dimension > x;
for( int i = 0; i < dimension; ++i )
x[ i ].set( i, 1 );
printBasis.template evaluateSingle<deriv>( x, y );
for (unsigned int i=0;i<size;++i)
{
out << "$\\varphi_" << i << "(a,b,c)$&$=$&$" << std::endl;
out << "( ";
for (unsigned int r=0;r<PrintBasis::dimRange;++r)
out << y[i][r] << (r<PrintBasis::dimRange-1?" , $ \\\\ && $":" )$ \\\\");
out << std::endl;
}
MIBasisFactory::release(miBasis);
}
// template <int deriv,class BasisFactory,class PrintField=typename BasisFactory::StorageField>
template <int deriv,class BasisFactory,class PrintField>
void basisPrint(std::ostream &out,
typename BasisFactory::Key &key)
{
typename BasisFactory::Object *basis = BasisFactory::create(key);
basisPrint<deriv,BasisFactory,PrintField>(out,*basis);
BasisFactory::release(basis);
}
}
#endif // BASISPRINT
|