Main Lemma Repository
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.

ParticleSwarmOptimizer.cpp 5.1KB

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