Surface NMR forward modelling
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LoopInteractions.cpp 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 11/11/2016 01:47:25 PM
  11. * @author Trevor Irons (ti)
  12. * @email tirons@egi.utah.edu
  13. * @copyright Copyright (c) 2016, University of Utah
  14. * @copyright Copyright (c) 2016, Lemma Software, LLC
  15. * @copyright Copyright (c) 2008, Colorado School of Mines
  16. */
  17. #include "LoopInteractions.h"
  18. namespace Lemma {
  19. std::string enum2String(const INTERACTION& type) {
  20. std::string t;
  21. switch (type) {
  22. case COUPLING:
  23. t = std::string("COUPLING");
  24. break;
  25. case INTERFERENCE:
  26. t = std::string("INTERFERENCE");
  27. break;
  28. case PHASE:
  29. t = std::string("PHASE");
  30. break;
  31. }
  32. return t;
  33. }
  34. //--------------------------------------------------------------------------------------
  35. // Class: LoopInteractions
  36. // Method: f
  37. //--------------------------------------------------------------------------------------
  38. template <>
  39. Complex LoopInteractions<COUPLING>::f( const Vector3r& r, const Real& volume, const Vector3cr& Ht, const Vector3cr& Hr ) {
  40. return volume * ( Ht.dot(Hr) ); // coupling
  41. }
  42. template <>
  43. Complex LoopInteractions<INTERFERENCE>::f( const Vector3r& r, const Real& volume, const Vector3cr& Ht, const Vector3cr& Hr ) {
  44. //return volume * (1.-((Ht+Hr).norm()/(Hr.norm() + Ht.norm()))); // normalized interference
  45. return volume * ( (Ht+Hr).norm() - std::max(Hr.norm(), Ht.norm()) ); // interference emphisized
  46. //return volume * (Ht+Hr).norm(); // interference not normalized
  47. }
  48. template <>
  49. Complex LoopInteractions<PHASE>::f( const Vector3r& r, const Real& volume, const Vector3cr& Ht, const Vector3cr& Hr ) {
  50. return volume * std::acos( (Ht.dot(Hr) / (Ht.norm()*Hr.norm())) ); // angle
  51. }
  52. } // ---- end of namespace Lemma ----
  53. /* vim: set tabstop=4 expandtab */
  54. /* vim: set filetype=cpp */