PatternTillingReducedModel/src/main.cpp

96 lines
5.1 KiB
C++
Executable File

#include "edgemesh.hpp"
#include "hexagonremesher.hpp"
#include "polyscope/curve_network.h"
#include "polyscope/polyscope.h"
#include "polyscope/surface_mesh.h"
#include "reducedmodeloptimizer_structs.hpp"
#include "reducedpatternsimulator.hpp"
#include "simulationmesh.hpp"
#include "trianglepatterngeometry.hpp"
#include <iostream>
int main(int argc, char *argv[])
{
if (argc != 3) {
return 1;
}
// DRMSimulationModel::runUnitTests();
// const std::string tileInto_triMesh_filename("/home/iason/Models/"
// "hexagon_384tri.ply");
const std::string tileInto_triMesh_filename = argv[1];
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/fra/ex5_56.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/fra/ex3_96.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/fra/ex2_230.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/fra/ex1_74.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/fra/ex2_122.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/"
// "instantMeshes_plane_200_big_1x1_100x100.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/"
// "instantMeshes_plane_500_big_1x1_100x100.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/"
// "instantMeshes_plane_1000_big_1x1_100x100.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/"
// "instantMeshes_strip_45.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/"
// "instantMeshes_widerStrip_100.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/Meshes/"
// "instantMeshes_plane_34.ply");
// const std::string tileInto_triMesh_filename(
// "/home/iason/Coding/build/PatternTillingReducedModel/RelWithDebInfo/"
// "instantMeshes_plane4Hexagon_5.ply");
VCGTriMesh tileInto_triMesh;
const bool surfaceLoadSuccessfull = tileInto_triMesh.load(tileInto_triMesh_filename);
assert(surfaceLoadSuccessfull);
std::shared_ptr<VCGPolyMesh> pTileInto_polyMesh = PolygonalRemeshing::remeshWithPolygons(
tileInto_triMesh);
// //Load optimization results
// const size_t numberOfOptimizationResults = argc - 1;
// std::vector<ReducedPatternOptimization::Results> optimizationResults(
// numberOfOptimizationResults);
// for (size_t commandLineParameterIndex = 0;
// commandLineParameterIndex < numberOfOptimizationResults;
// commandLineParameterIndex++)
// optimizationResults[commandLineParameterIndex].load(argv[commandLineParameterIndex + 1]);
const std::filesystem::path optimizationResultsPath = argv[2];
// std::filesystem::path optimizationResultsPath0(
// "/home/iason/Coding/Projects/Approximating shapes with flat "
// "patterns/ReducedModelOptimization/Results/selectionOfPatterns2");
// std::filesystem::path optimizationResultsPath1(
// "/home/iason/Coding/Projects/Approximating shapes with flat "
// "patterns/ReducedModelOptimization/Results/selectionOfPatterns_0.2To1.6/"
// "selectionOfPatterns/1.2/ConvergedJobs");
// std::filesystem::path optimizationResultsPath2(
// "/home/iason/Coding/Projects/Approximating shapes with flat "
// "patterns/ReducedModelOptimization/Results/selectionOfPatterns3");
// std::filesystem::path optimizationResultsPath3(
// "/home/iason/Coding/Projects/Approximating shapes with flat "
// "patterns/ReducedModelOptimization/Results/selectionOfPatterns4");
std::vector<ReducedPatternOptimization::Results> optimizationResults
= ReducedPatternSimulator::loadOptimizationResults(optimizationResultsPath);
//Load reduced
const std::filesystem::path patternFilePath(
"/home/iason/Coding/Projects/Approximating shapes with flat "
"patterns/ReducedModelOptimization/TestSet/ReducedPatterns/single_reduced.ply");
PatternGeometry reducedPattern(patternFilePath.string());
reducedPattern.setLabel(std::filesystem::path(patternFilePath).stem().string());
PolyscopeInterface::init();
ReducedPatternSimulator reducedPatternSimulator(optimizationResults);
reducedPatternSimulator.simulate(pTileInto_polyMesh, optimizationResults, reducedPattern);
return 0;
}