Exporting internal potential energy in the results json. Exporting the full pattern scenarios.
This commit is contained in:
parent
408d1e8c38
commit
fe7ecbcd38
|
@ -30,7 +30,8 @@ int main(int argc, char *argv[]) {
|
|||
////Full pattern
|
||||
const std::string filepath_fullPattern = argv[1];
|
||||
PatternGeometry fullPattern(filepath_fullPattern);
|
||||
fullPattern.scale(0.03,interfaceNodeIndex);
|
||||
// fullPattern.prependToLabel(std::to_string(fullPattern.EN()) + "#");
|
||||
fullPattern.scale(0.03, interfaceNodeIndex);
|
||||
////Reduced pattern
|
||||
const std::string filepath_reducedPattern = argv[2];
|
||||
PatternGeometry reducedPattern(filepath_reducedPattern);
|
||||
|
@ -119,7 +120,7 @@ int main(int argc, char *argv[]) {
|
|||
} else {
|
||||
resultsOutputDir = convergedJobsDirPath.string();
|
||||
}
|
||||
optimizationResults.save(resultsOutputDir);
|
||||
optimizationResults.save(resultsOutputDir, true);
|
||||
|
||||
// Write results in csv
|
||||
csvFile csv_results({}, false);
|
||||
|
@ -132,7 +133,7 @@ int main(int argc, char *argv[]) {
|
|||
optimizationResults.writeHeaderTo(csv_results);
|
||||
settings_optimization.writeHeaderTo(csv_results);
|
||||
csv_results << endrow;
|
||||
csv_results << pairName;
|
||||
csv_results << std::to_string(fullPattern.EN()) + "#" + pairName;
|
||||
optimizationResults.writeResultsTo(settings_optimization, csv_results);
|
||||
settings_optimization.writeSettingsTo(csv_results);
|
||||
csv_results << endrow;
|
||||
|
|
|
@ -237,7 +237,8 @@ double ReducedModelOptimizer::objective(long n, const double *x) {
|
|||
}
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
++global.numberOfFunctionCalls;
|
||||
if (global.numberOfFunctionCalls % (global.optimizationSettings.numberOfFunctionCalls / 100)
|
||||
if (global.optimizationSettings.numberOfFunctionCalls >= 100
|
||||
&& global.numberOfFunctionCalls % (global.optimizationSettings.numberOfFunctionCalls / 100)
|
||||
== 0) {
|
||||
std::cout << "Number of function calls:" << global.numberOfFunctionCalls << std::endl;
|
||||
}
|
||||
|
@ -739,6 +740,7 @@ void ReducedModelOptimizer::getResults(const dlib::function_evaluation &optimiza
|
|||
global.simulationScenarioIndices.size());
|
||||
results.objectiveValue.perSimulationScenario_total.resize(
|
||||
global.simulationScenarioIndices.size());
|
||||
results.perScenario_fullPatternPotentialEnergy.resize(global.simulationScenarioIndices.size());
|
||||
for (int i = 0; i < global.simulationScenarioIndices.size(); i++) {
|
||||
const int simulationScenarioIndex = global.simulationScenarioIndices[i];
|
||||
SimulationResults reducedModelResults = simulator.executeSimulation(
|
||||
|
@ -791,6 +793,8 @@ void ReducedModelOptimizer::getResults(const dlib::function_evaluation &optimiza
|
|||
// assert(test_normalizedTranslationError == normalizedTranslationalError);
|
||||
// assert(test_normalizedRotationalError == normalizedRotationalError);
|
||||
results.objectiveValue.totalRaw += rawTranslationalError + rawRotationalError;
|
||||
results.perScenario_fullPatternPotentialEnergy[i]
|
||||
= global.fullPatternResults[simulationScenarioIndex].internalPotentialEnergy;
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Simulation scenario:"
|
||||
<< global.reducedPatternSimulationJobs[simulationScenarioIndex]->getLabel()
|
||||
|
@ -1479,6 +1483,15 @@ void ReducedModelOptimizer::optimize(
|
|||
simulationSettings);
|
||||
if (!fullPatternResults.converged) {
|
||||
results.wasSuccessful = false;
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
std::cout << "Simulation job " << pFullPatternSimulationJob->getLabel()
|
||||
<< " did not converge." << std::endl;
|
||||
DRMSimulationModel::Settings debugSimulationSettings;
|
||||
debugSimulationSettings.isDebugMode = true;
|
||||
debugSimulationSettings.debugModeStep = 1000;
|
||||
debugSimulationSettings.shouldCreatePlots = true;
|
||||
simulator.executeSimulation(pFullPatternSimulationJob, simulationSettings);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
results.wasSuccessful = true;
|
||||
|
|
Loading…
Reference in New Issue