1 //#************************************************************** 2 //# filename: WorkingModuleBaseClass.h 3 //# 4 //# author: Yury Vetyukov 5 //# 6 //# generated: 2003 7 //# description: 8 //# remarks: 9 //# 10 //# Copyright (c) 2003-2013 Johannes Gerstmayr, Linz Center of Mechatronics GmbH, Austrian 11 //# Center of Competence in Mechatronics GmbH, Institute of Technical Mechanics at the 12 //# Johannes Kepler Universitaet Linz, Austria. All rights reserved. 13 //# 14 //# This file is part of HotInt. 15 //# HotInt is free software: you can redistribute it and/or modify it under the terms of 16 //# the HOTINT license. See folder 'licenses' for more details. 17 //# 18 //# bug reports are welcome!!! 19 //# WWW: www.hotint.org 20 //# email: bug_reports@hotint.org or support@hotint.org 21 //#*************************************************************************************** 22 23 #ifndef __SAMPLE_WORKING_MODULE_H_INCLUDED__ 24 #define __SAMPLE_WORKING_MODULE_H_INCLUDED__ 25 26 #include "WinCompDriverInterface.h" 27 #include "UserOutput.h" 28 29 // Default implementation of the working module 30 // the functionality should be added in the derived class 31 32 class WorkingModuleBaseClass: public WCDInterface 33 { 34 35 // these are the functions from the interface 36 void SetUserInterface(UserInterface * pui); 37 virtual void InitializeAfterConfigLoaded(); GetUserInterface()38 virtual UserInterface* GetUserInterface() const 39 { 40 return uo.pUI; 41 } 42 43 ButtonDrawMode(char * & text)44 virtual void ButtonDrawMode(char*& text) {}; 45 public: IsComputationInProgress()46 virtual int IsComputationInProgress() { return bComputationIsInProgress; } 47 private: StopWhenPossible()48 virtual void StopWhenPossible() { bStopWhenPossible = 1; } IsPaused()49 virtual int IsPaused() { return bPause; } Pause()50 virtual void Pause() { bPause = 1; } Resume()51 virtual void Resume() { bPause = 0; } 52 virtual void Go(ComputationFeedBack * p_cfb); SetPCFB(ComputationFeedBack * p_cfb)53 virtual void SetPCFB(ComputationFeedBack * p_cfb) {pCFB = p_cfb;} 54 55 // TODO: 56 // these functions should be redefined in the derived class RenderScene(RenderContext * pRC)57 virtual void RenderScene(RenderContext * pRC) {} RenderControlWindow(ControlWindowContext * pCWC)58 virtual void RenderControlWindow(ControlWindowContext* pCWC) {} //!AD: 2012-12-13 GetSceneMaxAbsCoordinate()59 virtual float GetSceneMaxAbsCoordinate() { return 1;} AllowRotation()60 virtual int AllowRotation() { return 1; } PrintData(const char * pDataSpecification)61 virtual void PrintData(const char * pDataSpecification) {} StoreResultsIsOn()62 virtual int StoreResultsIsOn() { return 0; } StoreResults(DataSaver & storage,double & m_TimePoint)63 virtual void StoreResults(DataSaver & storage, double& m_TimePoint) {} LoadResults(DataLoader & loader,int m_TimePointNumber)64 virtual void LoadResults(DataLoader & loader, int m_TimePointNumber) {} 65 //virtual double GetDrawTime() const { return 0.; } ResetComputation()66 virtual void ResetComputation() {}; PrintTimingList()67 virtual void PrintTimingList() {}; 68 69 protected: 70 mutable UserOutput uo; 71 const char * ENDL; 72 73 int bComputationIsInProgress; 74 int bComputeEigenmodes; 75 int bStopWhenPossible; 76 int bPause; // 0: don't pause, 1: pause calculation when possible, 2: calculation paused 77 InitFirst()78 virtual void InitFirst() {}; 79 ComputationFeedBack * pCFB; 80 81 // TODO: 82 // this function should be redefined with the derived class 83 // with the implementation of the actual computation code PerformComputation()84 virtual void PerformComputation() 85 { 86 while(!bStopWhenPossible && !bPause) 87 ; 88 } 89 PerformComputation2()90 virtual void PerformComputation2() 91 { 92 // while(!bStopWhenPossible && !bPause) 93 // ; 94 } 95 96 public: WorkingModuleBaseClass()97 WorkingModuleBaseClass(): ENDL("\n"), bComputationIsInProgress(0), bComputeEigenmodes(0) {} Get_pCFB()98 ComputationFeedBack* Get_pCFB() {return pCFB;} 99 100 }; 101 102 103 #endif //__SAMPLE_WORKING_MODULE_H_INCLUDED__