Galerkin FEM for elliptic PDEs
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.

LinearMag.cpp 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 03/21/2016 02:10:08 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2016, University of Utah
  15. * @copyright Copyright (c) 2016, Lemma Software, LLC
  16. */
  17. #include "LinearMag.h"
  18. namespace Lemma {
  19. // ==================== FRIEND METHODS =====================
  20. #ifdef HAVE_YAMLCPP
  21. std::ostream &operator << (std::ostream &stream, const LinearMag &ob) {
  22. stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapsulate thingy
  23. return stream;
  24. }
  25. #else
  26. std::ostream &operator<<(std::ostream &stream, const LinearMag& ob) {
  27. stream << *(FEM4EllipticPDE*)(&ob);
  28. return stream;
  29. }
  30. #endif
  31. // ==================== LIFECYCLE =======================
  32. //--------------------------------------------------------------------------------------
  33. // Class: LinearMag
  34. // Method: LinearMag
  35. // Description: constructor (protected)
  36. //--------------------------------------------------------------------------------------
  37. LinearMag::LinearMag (const std::string& name) : FEM4EllipticPDE(name) {
  38. } // ----- end of method LinearMag::LinearMag (constructor) -----
  39. #ifdef HAVE_YAMLCPP
  40. //--------------------------------------------------------------------------------------
  41. // Class: LinearMag
  42. // Method: LinearMag
  43. // Description: DeSerializing constructor (protected)
  44. //--------------------------------------------------------------------------------------
  45. LinearMag::LinearMag (const YAML::Node& node) : FEM4EllipticPDE(node) {
  46. } // ----- end of method LinearMag::LinearMag (constructor) -----
  47. #endif
  48. //--------------------------------------------------------------------------------------
  49. // Class: LinearMag
  50. // Method: New()
  51. // Description: public constructor
  52. //--------------------------------------------------------------------------------------
  53. LinearMag* LinearMag::New() {
  54. LinearMag* Obj = new LinearMag("LinearMag");
  55. Obj->AttachTo(Obj);
  56. return Obj;
  57. }
  58. //--------------------------------------------------------------------------------------
  59. // Class: LinearMag
  60. // Method: ~LinearMag
  61. // Description: destructor (protected)
  62. //--------------------------------------------------------------------------------------
  63. LinearMag::~LinearMag () {
  64. } // ----- end of method LinearMag::~LinearMag (destructor) -----
  65. //--------------------------------------------------------------------------------------
  66. // Class: LinearMag
  67. // Method: Delete
  68. // Description: public destructor
  69. //--------------------------------------------------------------------------------------
  70. void LinearMag::Delete() {
  71. this->DetachFrom(this);
  72. }
  73. //--------------------------------------------------------------------------------------
  74. // Class: LinearMag
  75. // Method: Release
  76. // Description: destructor (protected)
  77. //--------------------------------------------------------------------------------------
  78. void LinearMag::Release() {
  79. delete this;
  80. }
  81. #ifdef HAVE_YAMLCPP
  82. //--------------------------------------------------------------------------------------
  83. // Class: LinearMag
  84. // Method: Serialize
  85. //--------------------------------------------------------------------------------------
  86. YAML::Node LinearMag::Serialize ( ) const {
  87. YAML::Node node = FEM4EllipticPDE::Serialize();;
  88. node.SetTag( this->Name );
  89. // FILL IN CLASS SPECIFICS HERE
  90. return node;
  91. } // ----- end of method LinearMag::Serialize -----
  92. //--------------------------------------------------------------------------------------
  93. // Class: LinearMag
  94. // Method: DeSerialize
  95. //--------------------------------------------------------------------------------------
  96. LinearMag* LinearMag::DeSerialize ( const YAML::Node& node ) {
  97. LinearMag* Object = new LinearMag(node);
  98. Object->AttachTo(Object);
  99. DESERIALIZECHECK( node, Object )
  100. return Object ;
  101. } // ----- end of method LinearMag::DeSerialize -----
  102. #endif
  103. } // ----- end of Lemma name -----