Refactoring
This commit is contained in:
parent
9884cd175f
commit
1a27ec16a2
|
@ -31,13 +31,13 @@ int main(int argc, char *argv[]) {
|
|||
PatternGeometry fullPattern(filepath_fullPattern);
|
||||
fullPattern.setLabel(
|
||||
std::filesystem::path(filepath_fullPattern).stem().string());
|
||||
fullPattern.scale(0.03);
|
||||
fullPattern.scale(0.03,3);
|
||||
////Reduced pattern
|
||||
const std::string filepath_reducedPattern = argv[2];
|
||||
PatternGeometry reducedPattern(filepath_reducedPattern);
|
||||
reducedPattern.setLabel(
|
||||
std::filesystem::path(filepath_reducedPattern).stem().string());
|
||||
reducedPattern.scale(0.03);
|
||||
reducedPattern.scale(0.03,3);
|
||||
|
||||
// Set the optization settings
|
||||
ReducedModelOptimizer::xRange beamWidth{"B", 0.5, 1.5};
|
||||
|
|
|
@ -174,7 +174,8 @@ double ReducedModelOptimizer::objective(long n, const double *x) {
|
|||
|
||||
// run simulations
|
||||
double totalError = 0;
|
||||
LinearSimulationModel simulator;
|
||||
// LinearSimulationModel simulator;
|
||||
FormFinder simulator;
|
||||
for (const int simulationScenarioIndex : global.simulationScenarioIndices) {
|
||||
SimulationResults reducedModelResults = simulator.executeSimulation(
|
||||
global.reducedPatternSimulationJobs[simulationScenarioIndex]);
|
||||
|
@ -700,20 +701,8 @@ ReducedModelOptimizer::runOptimization(const Settings &settings) {
|
|||
<< std::endl;
|
||||
}
|
||||
|
||||
// Compute raw objective value
|
||||
if (global.optimizationSettings.normalizationStrategy !=
|
||||
Settings::NormalizationStrategy::NonNormalized) {
|
||||
auto temp = global.optimizationSettings.normalizationStrategy;
|
||||
global.optimizationSettings.normalizationStrategy =
|
||||
Settings::NormalizationStrategy::NonNormalized;
|
||||
results.rawObjectiveValue = objective(results.x.size(), results.x.data());
|
||||
global.optimizationSettings.normalizationStrategy = temp;
|
||||
|
||||
} else {
|
||||
results.rawObjectiveValue = results.objectiveValue;
|
||||
}
|
||||
|
||||
// Compute obj value per simulation scenario
|
||||
results.rawObjectiveValue=0;
|
||||
updateMesh(results.x.size(), results.x.data());
|
||||
results.objectiveValuePerSimulationScenario.resize(
|
||||
NumberOfSimulationScenarios);
|
||||
|
@ -730,7 +719,9 @@ ReducedModelOptimizer::runOptimization(const Settings &settings) {
|
|||
global.fullPatternDisplacements[simulationScenarioIndex],
|
||||
global.reducedToFullInterfaceViMap,
|
||||
global.objectiveNormalizationValues[simulationScenarioIndex]);
|
||||
|
||||
results.rawObjectiveValue+=computeRawError(reducedModelResults.displacements,
|
||||
global.fullPatternDisplacements[simulationScenarioIndex],
|
||||
global.reducedToFullInterfaceViMap);
|
||||
results.objectiveValuePerSimulationScenario[simulationScenarioIndex] =
|
||||
error;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue