#ifndef ADMM_INIT_H #define ADMM_INIT_H #include #include #include #include #include #include "AdmmSimulation.h" namespace ZIRAN { template class AdmmInitBase { public: using TV = Vector; using TVI = Vector; AdmmSimulation& sim; // This contains the real scene data. SceneInitialization scene; // This stores a reference to the scene. MpmInitializationHelper init_helper; const int test_number; AdmmInitBase(AdmmSimulation& sim, const int test_number) : sim(sim) , scene(sim.scene) , init_helper(sim) , test_number(test_number) { } // Normal start call. void start() { printBasicInfo(); initialize(); sim.simulate(); } // Restart call. void restart(int frame) { initialize(); sim.restart(frame); sim.simulate(); } void initialize() { reload(); sim.initialize(); sim.reinitialize(); } virtual void reload() = 0; void printBasicInfo() { bool is_double = std::is_same(); ZIRAN_INFO("Simulation using double:", is_double); ZIRAN_INFO("Simulation dimension:", dim); } }; } // namespace ZIRAN #endif