gridtmz.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. 2D FDTD simulator
  3. Copyright (C) 2019 Emilia Blåsten
  4. This program is free software: you can redistribute it and/or
  5. modify it under the terms of the GNU Affero General Public License
  6. as published by the Free Software Foundation, either version 3 of
  7. the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public
  13. License along with this program. If not, see
  14. <http://www.gnu.org/licenses/>.
  15. */
  16. /* gridtmz.h: Contents of the header file that defines the 2D Grid
  17. * structure and it's function prototypes. This structure now contains
  18. * pointers for each of the possible field values. However, not all
  19. * these pointers would be used for any particular grid. The pointers
  20. * that are meaningful would be determined by the "type" of the grid.
  21. * The type takes on one of the values of the GRIDTYPE enumeration. */
  22. #ifndef _GRIDTMZ_H
  23. #define _GRIDTMZ_H
  24. enum GRIDTYPE {teZGrid, tmZGrid, threeDGrid};
  25. struct Grid {
  26. double **hx, **hxUpdateHcoeff, **hxUpdateEcoeff;
  27. double *hxCols, *hxUpdateHcoeffCols, *hxUpdateEcoeffCols;
  28. double **hy, **hyUpdateHcoeff, **hyUpdateEcoeff;
  29. double *hyCols, *hyUpdateHcoeffCols, *hyUpdateEcoeffCols;
  30. double *hz, *hzUpdateHcoeff, *hzUpdateEcoeff;
  31. double *ex, *exUpdateHcoeff, *exUpdateEcoeff;
  32. double *ey, *eyUpdateHcoeff, *eyUpdateEcoeff;
  33. double **ez, **ezUpdateHcoeff, **ezUpdateEcoeff;
  34. double *ezCols, *ezUpdateHcoeffCols, *ezUpdateEcoeffCols;
  35. int sizeX, sizeY, sizeZ;
  36. int time, maxTime;
  37. int type;
  38. double cdtds;
  39. };
  40. typedef struct Grid Grid;
  41. void gridInitUpdateCoeff(Grid *g, int choice);
  42. void gridInit(Grid *g, int choice);
  43. Grid *gridCreate(int sizeX, int sizeY);
  44. void gridDestroy(Grid *g);
  45. #endif