#include <cmath>
#include <iostream>
using namespace gismo;
const double PI = 3.14159265;
int main(
int argc,
char* argv[])
{
std::string output("");
gsCmdLine cmd(
"Tutorial on gsTensorBSpline class.");
cmd.addInt ("n", "dof1", "Number of basis function in one direction" , n);
cmd.addInt ("m", "dof2", "Number of basis function in other direction", m);
cmd.addInt ("d", "degree", "Degree of a surface", degree);
cmd.addString("o", "output", "Name of the output file.", output);
try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }
degree = math::max( (
index_t)(0), degree );
n = math::max(n, degree + 1);
m = math::max(m, degree + 1);
gsInfo <<
"----------------------\n\n"
<< "n: " << n << "\n\n"
<< "m: " << m << "\n\n"
<< "degree: " << degree << "\n\n"
<< "output: " << output << "\n\n"
<< "----------------------\n\n";
for (
index_t col = 0; col != greville.cols(); col++)
{
real_t x = greville(0, col);
real_t y = greville(1, col);
coefs(col, 0) = x;
coefs(col, 1) = y;
coefs(col, 2) = math::sin(x * 2 * PI) * math::sin(y * 2 * PI);
}
if (output != "")
{
std::string out = output + "Geometry";
gsInfo <<
"Writing the surface to a paraview file: " << out
<< "\n\n";
gsWriteParaview(surface, out);
out = output + "Basis";
gsInfo <<
"Writing the basis to a paraview file: " << out
<< "\n\n";
gsWriteParaview(basis, out);
out = output + "ContolNet";
gsInfo <<
"Writing the control net to a paraview file: " << out
<< "\n" << "\n";
surface.controlNet(mesh);
gsWriteParaview(mesh, out);
}
else
{
gsInfo <<
"Done. No output created, re-run with --output <filename> to get a ParaView "
"file containing the solution.\n";
}
return 0;
}