#include <iostream>
int main(int argc, char* argv[])
{
std::string input("curves3d/bspline3d_curve_01.xml");
std::string output("");
bool bezier=false;
cmd.addPlainString("filename", "G+Smo input geometry file.", input);
cmd.addString("o", "output", "Name of the output file", output);
cmd.addSwitch("b","bezier", "Output using Bezier elements", bezier);
try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }
std::string ext;
ext = (bezier) ? ".vtu" : ".vtp";
{
gsWarn <<
"The file cannot be found!\n";
return EXIT_FAILURE;
}
gsInfo <<
"Read file \"" << input <<
"\"\n";
{
}
else
{
gsWarn <<
"Input file doesn't have a geometry.\n";
return EXIT_FAILURE;
}
gsInfo <<
"The file contains: \n" << *pGeom <<
"\n";
if ( output.empty() )
{
gsInfo <<
"Call program with option -o <basename> to write data to files\n";
gsInfo <<
"<basename>Paraview"+ext+
", <basename>Paraview.pvd, <basename>.xml, <basename>ControlPoints.csv\n";
return EXIT_SUCCESS;
}
const std::string out = output + "Paraview";
{
if (!bezier)
{
gsWriteParaview(*pGeom, out);
}
else
{
}
gsInfo <<
"Wrote ParaView files: " << out << ext <<
", " << out <<
".pvd\n";
}
else
{
fileData.getFirst(mPatch);
if (!bezier)
{
gsWriteParaview(mPatch, out);
}
else
{
}
gsInfo <<
"Wrote ParaView file: " << out <<
".pvd\n";
}
fd << *pGeom;
fd.save(output);
gsInfo <<
"Wrote G+Smo file: " << output <<
".xml \n";
if (pGeom->targetDim()==2)
gsWriteCsv(output+
".csv", pGeom->coefs(), {
"X",
"Y"});
else if (pGeom->targetDim()==3)
gsWriteCsv(output+
".csv", pGeom->coefs(), {
"X",
"Y",
"Z"});
gsInfo <<
"Wrote CSV file: " << output+
".csv \n";
return EXIT_SUCCESS;
}
Class for command-line argument parsing.
Definition gsCmdLine.h:57
This class represents an XML data tree which can be read from or written to a (file) stream.
Definition gsFileData.h:34
static bool fileExists(const std::string &name)
Checks if the file exists.
Definition gsFileManager.cpp:62
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
memory::unique_ptr< gsGeometry > uPtr
Unique pointer for gsGeometry.
Definition gsGeometry.h:100
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
index_t addPatch(typename gsGeometry< T >::uPtr g)
Add a patch from a gsGeometry<T>::uPtr.
Definition gsMultiPatch.hpp:211
Main header to be included by clients using the G+Smo library.
void gsWriteCsv(std::string const &filename, const gsMatrix< T > &matrix, const std::vector< std::string > &headers=std::vector< std::string >())
Export a gsMatrix to a .csv (comma separated values) file.
Definition gsCsv.h:31
#define gsWarn
Definition gsDebug.h:50
#define gsInfo
Definition gsDebug.h:43
The G+Smo namespace, containing all definitions for the library.
void gsWriteParaviewBezier(const gsMultiPatch< T > &mPatch, std::string const &filename, bool ctrlNet=false)
Export a multipatch Geometry (without scalar information) to paraview file using Bezier elements.
Definition gsWriteParaview.hpp:984