diff --git a/src/main.cpp b/src/main.cpp index 4acea72..d8523d2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,10 +9,11 @@ int main(int argc, char *argv[]) { using namespace polyhedralGravity; - SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Model Version: " + std::string(POLYHEDRAL_GRAVITY_VERSION)); - SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Commit Hash: " + std::string(POLYHEDRAL_GRAVITY_COMMIT_HASH)); - SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Model Parallelization Backend: " + std::string(POLYHEDRAL_GRAVITY_PARALLELIZATION)); - SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Logging Level: " + std::string(POLYHEDRAL_GRAVITY_LOGGING_LEVEL)); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "####################################################################################"); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Model Version: {}", POLYHEDRAL_GRAVITY_VERSION); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Commit Hash: {}", POLYHEDRAL_GRAVITY_COMMIT_HASH); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Model Parallelization Backend: {}", POLYHEDRAL_GRAVITY_PARALLELIZATION); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Polyhedral Gravity Logging Level: {}", POLYHEDRAL_GRAVITY_LOGGING_LEVEL); if (argc != 2) { SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Wrong program call! " @@ -22,20 +23,28 @@ int main(int argc, char *argv[]) { } try { - std::shared_ptr config = std::make_shared(argv[1]); - auto polyhedralSource = config->getDataSource()->getPolyhedralSource(); - auto density = config->getDensity(); - auto computationPoints = config->getPointsOfInterest(); - auto outputFileName = config->getOutputFileName(); - PolyhedronIntegrity checkPolyhedralInput = config->getMeshInputCheckStatus() ? PolyhedronIntegrity::HEAL : PolyhedronIntegrity::DISABLE; + const std::shared_ptr config = std::make_shared(argv[1]); + const auto polyhedralSource = config->getDataSource()->getPolyhedralSource(); + const auto density = config->getDensity(); + const auto computationPoints = config->getPointsOfInterest(); + const auto outputFileName = config->getOutputFileName(); + const PolyhedronIntegrity checkPolyhedralInput = config->getMeshInputCheckStatus() ? PolyhedronIntegrity::HEAL : PolyhedronIntegrity::DISABLE; + + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "####################################################################################"); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Number of Vertices: {}", std::get<0>(polyhedralSource).size()); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Number of Faces: {}", std::get<1>(polyhedralSource).size()); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Number of Computation Points: {}", computationPoints.size()); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Mesh Check Enabled: {}", config->getMeshInputCheckStatus()); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Output File: {}", outputFileName); + SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "####################################################################################"); SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "The calculation started..."); - auto start = std::chrono::high_resolution_clock::now(); - Polyhedron polyhedron{polyhedralSource, density, NormalOrientation::OUTWARDS, checkPolyhedralInput}; - auto result = GravityModel::evaluate(polyhedron, computationPoints, true); - auto end = std::chrono::high_resolution_clock::now(); - auto duration = end - start; - auto ms = std::chrono::duration_cast(duration); + const auto start = std::chrono::high_resolution_clock::now(); + const Polyhedron polyhedron{polyhedralSource, density, NormalOrientation::OUTWARDS, checkPolyhedralInput}; + const auto result = GravityModel::evaluate(polyhedron, computationPoints, true); + const auto end = std::chrono::high_resolution_clock::now(); + const auto duration = end - start; + const auto ms = std::chrono::duration_cast(duration); SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "The calculation finished. It took {} microseconds.", ms.count()); SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), @@ -46,7 +55,7 @@ int main(int argc, char *argv[]) { if (!outputFileName.empty()) { SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Writing results to specified output file {}", outputFileName); - CSVWriter csvWriter{outputFileName}; + const CSVWriter csvWriter{outputFileName}; csvWriter.printResult(computationPoints, result); SPDLOG_LOGGER_INFO(PolyhedralGravityLogger::DEFAULT_LOGGER.getLogger(), "Writing finished!");