int main (int argc, char* argv[]) { LOGOG_INITIALIZE(); logog::Cout* logog_cout (new logog::Cout); BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter); logog_cout->SetFormatter(*custom_format); TCLAP::CmdLine cmd("Converts TIN file into VTU file.", ' ', BaseLib::BuildInfo::git_describe); TCLAP::ValueArg<std::string> inArg("i", "input-tin-file", "the name of the file containing the input TIN", true, "", "string"); cmd.add(inArg); TCLAP::ValueArg<std::string> outArg("o", "output-vtu-file", "the name of the file the mesh will be written to", true, "", "string"); cmd.add(outArg); cmd.parse(argc, argv); INFO("reading the TIN file..."); const std::string tinFileName(inArg.getValue()); auto pnt_vec = std::unique_ptr<std::vector<GeoLib::Point*>>( new std::vector<GeoLib::Point*>); GeoLib::PointVec point_vec("SurfacePoints", std::move(pnt_vec)); std::unique_ptr<GeoLib::Surface> sfc(FileIO::TINInterface::readTIN(tinFileName, point_vec)); if (!sfc) return 1; INFO("TIN read: %d points, %d triangles", pnt_vec->size(), sfc->getNTriangles()); INFO("converting to mesh data"); std::unique_ptr<MeshLib::Mesh> mesh(MeshLib::convertSurfaceToMesh(*sfc, BaseLib::extractBaseNameWithoutExtension(tinFileName), std::numeric_limits<double>::epsilon())); INFO("Mesh created: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements()); INFO("Write it into VTU"); FileIO::VtuInterface writer(mesh.get()); writer.writeToFile(outArg.getValue()); delete custom_format; delete logog_cout; LOGOG_SHUTDOWN(); return 0; }
int main (int argc, char* argv[]) { ApplicationsLib::LogogSetup logog_setup; TCLAP::CmdLine cmd( "Converts TIN file into VTU file.\n\n" "OpenGeoSys-6 software, version " + BaseLib::BuildInfo::git_describe + ".\n" "Copyright (c) 2012-2018, OpenGeoSys Community " "(http://www.opengeosys.org)", ' ', BaseLib::BuildInfo::git_describe); TCLAP::ValueArg<std::string> inArg("i", "input-tin-file", "the name of the file containing the input TIN", true, "", "string"); cmd.add(inArg); TCLAP::ValueArg<std::string> outArg("o", "output-vtu-file", "the name of the file the mesh will be written to", true, "", "string"); cmd.add(outArg); cmd.parse(argc, argv); INFO("reading the TIN file..."); const std::string tinFileName(inArg.getValue()); auto pnt_vec = std::make_unique<std::vector<GeoLib::Point*>>(); GeoLib::PointVec point_vec("SurfacePoints", std::move(pnt_vec)); std::unique_ptr<GeoLib::Surface> sfc( GeoLib::IO::TINInterface::readTIN(tinFileName, point_vec)); if (!sfc) return EXIT_FAILURE; INFO("TIN read: %d points, %d triangles", pnt_vec->size(), sfc->getNumberOfTriangles()); INFO("converting to mesh data"); std::unique_ptr<MeshLib::Mesh> mesh(MeshLib::convertSurfaceToMesh(*sfc, BaseLib::extractBaseNameWithoutExtension(tinFileName), std::numeric_limits<double>::epsilon())); INFO("Mesh created: %d nodes, %d elements.", mesh->getNumberOfNodes(), mesh->getNumberOfElements()); INFO("Write it into VTU"); MeshLib::IO::VtuInterface writer(mesh.get()); writer.writeToFile(outArg.getValue()); return EXIT_SUCCESS; }