exact.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // Copyright 2010 Intel Corporation
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #include "applu_share.h"
  17. #define ce(m,n) ce[m-1+5*(n-1)]
  18. #define u000ijk(m) u000ijk[m-1]
  19. void exact( int i, int j, int k, double *u000ijk ) {
  20. // compute the exact solution at (i,j,k)
  21. int m;
  22. double xi, eta, zeta;
  23. xi = ( double ) (i - 1) / (nx0 - 1);
  24. eta = ( double ) (j - 1) / (ny0 - 1);
  25. zeta = ( double ) (k - 1) / (nz0 - 1);
  26. for (m=1; m<=5; m++)
  27. u000ijk(m) = ce(m,1)
  28. + ce(m,2) * xi
  29. + ce(m,3) * eta
  30. + ce(m,4) * zeta
  31. + ce(m,5) * xi * xi
  32. + ce(m,6) * eta * eta
  33. + ce(m,7) * zeta * zeta
  34. + ce(m,8) * xi * xi * xi
  35. + ce(m,9) * eta * eta * eta
  36. + ce(m,10) * zeta * zeta * zeta
  37. + ce(m,11) * xi * xi * xi * xi
  38. + ce(m,12) * eta * eta * eta * eta
  39. + ce(m,13) * zeta * zeta * zeta * zeta;
  40. return;
  41. }