Refactoring

This commit is contained in:
Iason 2021-02-09 21:43:49 +02:00
parent 67c2c0c0ac
commit 6ba16b0343
2 changed files with 35 additions and 34 deletions

View File

@ -47,9 +47,11 @@ int main(int argc, char *argv[]) {
ReducedModelOptimizer::xRange beamDimensionsRatio{"bOverh", 0.7, 1.3};
ReducedModelOptimizer::xRange beamE{"E", 0.1, 1.9};
// Test set of full patterns
std::string fullPatternsTestSetDirectory = "TestSet";
if (!std::filesystem::exists(std::filesystem::path(fullPatternsTestSetDirectory))) {
std::cerr << "Full pattern directory does not exist:" << fullPatternsTestSetDirectory << std::endl;
std::string fullPatternsTestSetDirectory = "../TestSet";
if (!std::filesystem::exists(
std::filesystem::path(fullPatternsTestSetDirectory))) {
std::cerr << "Full pattern directory does not exist: "
<< fullPatternsTestSetDirectory << std::endl;
return 1;
}
// "/home/iason/Documents/PhD/Research/Approximating shapes with flat "
@ -132,7 +134,8 @@ int main(int argc, char *argv[]) {
totalError += optimizationResults.objectiveValue;
resultsPerPattern[patternPairIndex] =
std::make_pair(patternPairs[patternPairIndex].first->getLabel(), optimizationResults);
std::make_pair(patternPairs[patternPairIndex].first->getLabel(),
optimizationResults);
totalNumberOfSimulationCrashes +=
optimizationResults.numberOfSimulationCrashes;
// std::cout << "Have optimized " << ++patternsOptimized << "/"
@ -157,8 +160,10 @@ int main(int argc, char *argv[]) {
// resultsPerPattern[patternPairIndex].second.save(saveToPath);
// }
if (!std::filesystem::exists(std::filesystem::path("OptimizationResults/"))) {
std::filesystem::create_directory(std::filesystem::path("OptimizationResults"));
if (!std::filesystem::exists(
std::filesystem::path("OptimizationResults/"))) {
std::filesystem::create_directory(
std::filesystem::path("OptimizationResults"));
}
csvfile statistics(std::filesystem::path("OptimizationResults")

View File

@ -37,15 +37,11 @@ struct GlobalOptimizationVariables {
// static GlobalOptimizationVariables global;
const static int MAX_THREAD = 64;
struct MY_TLS_ITEM
{
std::map<int, int> theMap;
char padding[64 - sizeof(theMap)];
};
#if defined(_MSC_VER)
__declspec(align(64)) GlobalOptimizationVariables tls[MAX_THREAD];
#elif defined(__GNUC__)
GlobalOptimizationVariables tls[MAX_THREAD] __attribute__((aligned(64)));
#endif
//#pragma omp threadprivate(global)
// struct OptimizationCallback {