1 /* 2 * Copyright (C) 2010 Thorsten Liebig (Thorsten.Liebig@gmx.de) 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef OPERATOR_EXTENSION_H 19 #define OPERATOR_EXTENSION_H 20 21 #include <string> 22 23 #include <iostream> 24 #include <stdio.h> 25 #include <stdlib.h> 26 27 #include "tools/global.h" 28 29 class Operator; 30 class Operator_Cylinder; 31 class Engine_Extension; 32 33 //! Abstract base-class for all operator extensions 34 class Operator_Extension 35 { 36 friend class Engine_Extension; 37 public: 38 virtual ~Operator_Extension(); 39 40 //! Create a clone of this extension, will return NULL if this is impossible 41 /*! 42 Create a clone of this extension, will return NULL if this is impossible (e.g. derived extension has no clone method and copy-constructor)... 43 BuildExtension has to be called separatly! 44 */ Clone(Operator * op)45 virtual Operator_Extension* Clone(Operator* op) {UNUSED(op); return NULL;} 46 BuildExtension()47 virtual bool BuildExtension() {return true;} 48 CreateEngineExtention()49 virtual Engine_Extension* CreateEngineExtention() {return 0;} GetEngineExtention()50 virtual Engine_Extension* GetEngineExtention() {return m_Eng_Ext;} 51 52 //! The cylindrical operator will check whether the extension is save to use. Default is false. Derive this method to override. IsCylinderCoordsSave(bool closedAlpha,bool R0_included)53 virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return false;} 54 55 //! The cylindrical multi grid operator will check whether the extension is save to use. Default is false. Derive this method to override. IsCylindricalMultiGridSave(bool child)56 virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return false;} 57 58 //! The MPI operator (if enabled) will check whether the extension is compatible with MPI. Default is false. Derive this method to override. IsMPISave()59 virtual bool IsMPISave() const {return false;} 60 GetExtensionName()61 virtual std::string GetExtensionName() const {return std::string("Abstract Operator Extension Base Class");} 62 63 virtual void ShowStat(std::ostream &ostr) const; 64 IsActive()65 virtual bool IsActive() const {return m_Active;} 66 virtual void SetActive(bool active=true) {m_Active=active;} 67 Init()68 virtual void Init() {} Reset()69 virtual void Reset() {} 70 71 protected: 72 Operator_Extension(Operator* op); 73 //! Copy constructor 74 Operator_Extension(Operator* op, Operator_Extension* op_ext); 75 76 bool m_Active; 77 78 //FDTD Operator 79 Operator* m_Op; 80 Engine_Extension* m_Eng_Ext; 81 82 //Cylindrical FDTD Operator (not NULL if a cylindrical FDTD is used) 83 Operator_Cylinder* m_Op_Cyl; 84 bool m_CC_R0_included; 85 }; 86 87 #endif // OPERATOR_EXTENSION_H 88