2020-11-23 10:06:45 +01:00
|
|
|
#ifndef REDUCEDMODELOPTIMIZER_HPP
|
|
|
|
#define REDUCEDMODELOPTIMIZER_HPP
|
|
|
|
|
|
|
|
#include "beamformfinder.hpp"
|
|
|
|
#include "edgemesh.hpp"
|
|
|
|
#include "elementalmesh.hpp"
|
2020-12-09 16:58:48 +01:00
|
|
|
#include "matplot/matplot.h"
|
2020-11-23 10:06:45 +01:00
|
|
|
#include <Eigen/Dense>
|
|
|
|
|
2020-12-14 10:07:43 +01:00
|
|
|
using FullPatternVertexIndex = VertexIndex;
|
|
|
|
using ReducedPatternVertexIndex = VertexIndex;
|
2020-11-23 10:06:45 +01:00
|
|
|
|
|
|
|
class ReducedModelOptimizer {
|
2020-12-16 20:31:58 +01:00
|
|
|
std::shared_ptr<SimulationMesh> m_pReducedPatternSimulationMesh;
|
|
|
|
std::shared_ptr<SimulationMesh> m_pFullModelSimulationMesh;
|
2020-12-14 10:07:43 +01:00
|
|
|
std::unordered_map<FullPatternVertexIndex, ReducedPatternVertexIndex>
|
2020-11-27 11:45:20 +01:00
|
|
|
m_fullToReducedInterfaceViMap;
|
2020-12-14 10:07:43 +01:00
|
|
|
std::unordered_map<FullPatternVertexIndex, FullPatternVertexIndex>
|
2020-11-27 11:45:20 +01:00
|
|
|
m_fullPatternOppositeInterfaceViMap;
|
|
|
|
std::unordered_map<size_t, size_t> nodeToSlot;
|
|
|
|
std::unordered_map<size_t, std::unordered_set<size_t>> slotToNode;
|
2020-12-16 20:31:58 +01:00
|
|
|
std::vector<double> initialGuess;
|
2020-11-23 10:06:45 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Eigen::VectorXd optimize();
|
|
|
|
double operator()(const Eigen::VectorXd &x, Eigen::VectorXd &) const;
|
|
|
|
|
2020-11-27 11:45:20 +01:00
|
|
|
ReducedModelOptimizer(const std::vector<size_t> &numberOfNodesPerSlot);
|
2020-11-23 10:06:45 +01:00
|
|
|
void computeReducedModelSimulationJob(
|
|
|
|
const SimulationJob &simulationJobOfFullModel,
|
|
|
|
SimulationJob &simulationJobOfReducedModel);
|
|
|
|
|
|
|
|
SimulationJob
|
|
|
|
getReducedSimulationJob(const SimulationJob &fullModelSimulationJob);
|
|
|
|
|
2020-11-27 11:45:20 +01:00
|
|
|
void initialize(FlatPattern &fullPattern, FlatPattern &reducedPatterm,
|
|
|
|
const std::unordered_set<size_t> &reducedModelExcludedEges);
|
|
|
|
|
2020-12-16 20:31:58 +01:00
|
|
|
void setInitialGuess(std::vector<double> v);
|
|
|
|
|
2020-11-23 10:06:45 +01:00
|
|
|
private:
|
|
|
|
void computeDesiredReducedModelDisplacements(
|
|
|
|
const SimulationResults &fullModelResults,
|
2020-11-27 11:45:20 +01:00
|
|
|
Eigen::MatrixX3d &optimalDisplacementsOfReducedModel);
|
2020-11-23 10:06:45 +01:00
|
|
|
Eigen::VectorXd
|
|
|
|
optimizeForSimulationJob(const SimulationJob &fullModelSimulationJob);
|
|
|
|
std::vector<SimulationJob>
|
2020-11-27 11:45:20 +01:00
|
|
|
createScenarios(const std::shared_ptr<SimulationMesh> &pMesh);
|
|
|
|
void computeMaps(FlatPattern &fullModel, FlatPattern &reducedPattern,
|
|
|
|
const std::unordered_set<size_t> &reducedModelExcludedEges);
|
|
|
|
void createSimulationMeshes(FlatPattern &fullModel,
|
|
|
|
FlatPattern &reducedModel);
|
|
|
|
void initializeStiffnesses();
|
2020-12-09 16:58:48 +01:00
|
|
|
|
|
|
|
static double objective(long n, const double *x);
|
2020-11-23 10:06:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // REDUCEDMODELOPTIMIZER_HPP
|