#include <iostream>
using namespace gismo;
template <typename T>
{
return result;
}
int main(
int argc,
char* argv[])
{
std::string input("bspbasis/tpBSpline2_02.xml");
std::string output("");
cmd.addPlainString("input", "G+Smo input basis file.", input);
cmd.addString("o", "output", "Name of the output file.", output);
try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }
{
}
else
{
gsInfo <<
"Input file doesn't have a basis inside.\n";
return -1;
}
if (!pBasis)
{
gsInfo <<
"Didn't find any basis.\n";
return -1;
}
gsInfo <<
"The file contains: \n" << *pBasis <<
"\n";
gsInfo <<
"Dimension of the parameter space: " << pBasis->dim() <<
"\n"
<< "Number of basis functions: " << pBasis->size() << "\n"
<< "Number of elements: " << pBasis->numElements() << "\n"
<< "Max degree of the basis: " << pBasis->maxDegree() << "\n"
<< "Min degree of the basis: " << pBasis->minDegree() << "\n"
<< "\n";
<< support << "\n\n";
gsMatrix<> u = 0.3 * support.col(0) + 0.7 * support.col(1);
gsInfo <<
"u " << size(u) <<
": \n" << u <<
"\n\n";
gsInfo <<
"Active functions at u " << size(active) <<
": \n"
<< active << "\n\n";
gsInfo <<
"Is number 2 active at the point ? " <<pBasis->isActive(0,u.col(0)) <<
": \n"
<< active << "\n\n";
gsInfo <<
"Values at u " << size(values) <<
": \n"
<< values << "\n\n";
for (
index_t i = 0; i != active.rows(); i++)
{
gsMatrix<> val = pBasis->evalSingle(active(i), u);
gsInfo <<
"basis fun. index: " << active(i)
<< " value: " << val(0, 0) << "\n";
}
gsInfo <<
"Derivatives at u " << size(derivs) <<
": \n"
<< derivs << "\n\n";
for (
index_t i = 0; i != active.rows(); i++)
{
gsMatrix<> der = pBasis->derivSingle(active(i), u);
gsInfo <<
"basis fun. index: " << active(i)
<< " value: " << std::setw(15) << der(0, 0) << "\n";
for (
index_t row = 1; row != der.rows(); row++)
{
gsInfo << std::setw(46) << der(row, 0) <<
"\n";
}
}
gsInfo <<
"Second derivatives at u " << size(derivs2) <<
": \n"
<< derivs2 << "\n\n";
for (
index_t i = 0; i != active.rows(); i++)
{
gsMatrix<> der2 = pBasis->deriv2Single(active(i), u);
gsInfo <<
"basis fun. index: " << active(i)
<< " value: " << std::setw(15) << der2(0, 0) << "\n";
for (
index_t row = 1; row != der2.rows(); row++)
{
gsInfo << std::setw(46) << der2(row, 0) <<
"\n";
}
}
gsInfo <<
"\nFor more information about evaluation "
<< "(and order of derivatives) look at doxygen documentation."
<< "\n\n";
if (output != "")
{
gsInfo <<
"Writing the basis to a paraview file: " << output
<< "\n\n";
gsWriteParaview(*pBasis, output);
}
else
{
gsInfo <<
"Done. No output created, re-run with --output <filename> to get a ParaView "
"file containing the solution.\n";
}
return 0;
}