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 ENGINE_SSE_H 19 #define ENGINE_SSE_H 20 21 #include "engine.h" 22 #include "operator_sse.h" 23 24 class Engine_sse : public Engine 25 { 26 public: 27 static Engine_sse* New(const Operator_sse* op); 28 virtual ~Engine_sse(); 29 30 virtual void Init(); 31 virtual void Reset(); 32 GetNumberOfTimesteps()33 virtual unsigned int GetNumberOfTimesteps() {return numTS;}; 34 35 //this access functions muss be overloaded by any new engine using a different storage model GetVolt(unsigned int n,unsigned int x,unsigned int y,unsigned int z)36 inline virtual FDTD_FLOAT GetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return f4_volt[n][x][y][z%numVectors].f[z/numVectors]; } GetVolt(unsigned int n,const unsigned int pos[3])37 inline virtual FDTD_FLOAT GetVolt( unsigned int n, const unsigned int pos[3] ) const { return f4_volt[n][pos[0]][pos[1]][pos[2]%numVectors].f[pos[2]/numVectors]; } GetCurr(unsigned int n,unsigned int x,unsigned int y,unsigned int z)38 inline virtual FDTD_FLOAT GetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return f4_curr[n][x][y][z%numVectors].f[z/numVectors]; } GetCurr(unsigned int n,const unsigned int pos[3])39 inline virtual FDTD_FLOAT GetCurr( unsigned int n, const unsigned int pos[3] ) const { return f4_curr[n][pos[0]][pos[1]][pos[2]%numVectors].f[pos[2]/numVectors]; } 40 SetVolt(unsigned int n,unsigned int x,unsigned int y,unsigned int z,FDTD_FLOAT value)41 inline virtual void SetVolt( unsigned int n, unsigned int x, unsigned int y, unsigned int z, FDTD_FLOAT value) { f4_volt[n][x][y][z%numVectors].f[z/numVectors]=value; } SetVolt(unsigned int n,const unsigned int pos[3],FDTD_FLOAT value)42 inline virtual void SetVolt( unsigned int n, const unsigned int pos[3], FDTD_FLOAT value ) { f4_volt[n][pos[0]][pos[1]][pos[2]%numVectors].f[pos[2]/numVectors]=value; } SetCurr(unsigned int n,unsigned int x,unsigned int y,unsigned int z,FDTD_FLOAT value)43 inline virtual void SetCurr( unsigned int n, unsigned int x, unsigned int y, unsigned int z, FDTD_FLOAT value) { f4_curr[n][x][y][z%numVectors].f[z/numVectors]=value; } SetCurr(unsigned int n,const unsigned int pos[3],FDTD_FLOAT value)44 inline virtual void SetCurr( unsigned int n, const unsigned int pos[3], FDTD_FLOAT value ) { f4_curr[n][pos[0]][pos[1]][pos[2]%numVectors].f[pos[2]/numVectors]=value; } 45 46 protected: 47 Engine_sse(const Operator_sse* op); 48 const Operator_sse* Op; 49 50 virtual void UpdateVoltages(unsigned int startX, unsigned int numX); 51 virtual void UpdateCurrents(unsigned int startX, unsigned int numX); 52 53 unsigned int numVectors; 54 55 public: //public access to the sse arrays for efficient extensions access... use careful... 56 f4vector**** f4_volt; 57 f4vector**** f4_curr; 58 }; 59 60 #endif // ENGINE_SSE_H 61