Delta.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _Delta_h_
  2. #define _Delta_h_
  3. /* Delta.h
  4. *
  5. * Copyright (C) 1992-2005,2007,2011,2015-2017 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "Thing.h"
  21. typedef struct structDelta_Tube *Delta_Tube;
  22. struct structDelta_Tube
  23. {
  24. /* Structure: static. */
  25. Delta_Tube left1; // if null: closed at left edge
  26. Delta_Tube left2; // if not null: two merging streams
  27. Delta_Tube right1; // if null: radiation at right edge
  28. Delta_Tube right2; // if not null: a stream splitting into two
  29. integer parallel; // parallel subdivision
  30. /* Controlled by articulation: quasistatic. */
  31. double Dxeq, Dyeq, Dzeq;
  32. double mass, k1, k3, Brel, s1, s3, dy;
  33. double k1left1, k1left2, k1right1, k1right2; // linear coupling factors
  34. double k3left1, k3left2, k3right1, k3right2; // cubic coupling factors
  35. /* Dynamic. */
  36. double Jhalf, Jleft, Jleftnew, Jright, Jrightnew;
  37. double Qhalf, Qleft, Qleftnew, Qright, Qrightnew;
  38. double Dx, Dxnew, dDxdt, dDxdtnew, Dxhalf;
  39. double Dy, Dynew, dDydt, dDydtnew;
  40. double Dz;
  41. double A, Ahalf, Anew, V, Vnew;
  42. double e, ehalf, eleft, eleftnew, eright, erightnew, ehalfold;
  43. double p, phalf, pleft, pleftnew, pright, prightnew;
  44. double Kleft, Kleftnew, Kright, Krightnew, Pturbright, Pturbrightnew;
  45. double B, r, R, DeltaP, v;
  46. };
  47. Thing_define (Delta, Thing) {
  48. integer numberOfTubes; // >= 1
  49. struct structDelta_Tube *tube; // tube [1..numberOfTubes]
  50. void v_destroy () noexcept
  51. override;
  52. };
  53. void Delta_init (Delta me, integer numberOfTubes);
  54. autoDelta Delta_create (integer numberOfTubes);
  55. /*
  56. Function:
  57. return a new Delta.
  58. Preconditions:
  59. numberOfTubes >= 1;
  60. Postconditions:
  61. result -> numberOfTubes = numberOfTubes;
  62. all members of result -> tube [1..numberOfTubes] are zero or null,
  63. except 'parallel', which is 1.
  64. */
  65. /* End of file Delta.h */
  66. #endif