Discrete Element Methods (Alpha)
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.

DEMParticle.cpp 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 05/31/2016 12:27:31 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 "DEMParticle.h"
  18. namespace Lemma {
  19. // ==================== FRIEND METHODS =====================
  20. #ifdef HAVE_YAMLCPP
  21. std::ostream &operator << (std::ostream &stream, const DEMParticle &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 DEMParticle& ob) {
  27. stream << *(LemmaObject*)(&ob);
  28. return stream;
  29. }
  30. #endif
  31. // ==================== LIFECYCLE =======================
  32. //--------------------------------------------------------------------------------------
  33. // Class: DEMParticle
  34. // Method: DEMParticle
  35. // Description: constructor (protected)
  36. //--------------------------------------------------------------------------------------
  37. DEMParticle::DEMParticle (const std::string& name) : LemmaObject(name) {
  38. } // ----- end of method DEMParticle::DEMParticle (constructor) -----
  39. #ifdef HAVE_YAMLCPP
  40. //--------------------------------------------------------------------------------------
  41. // Class: DEMParticle
  42. // Method: DEMParticle
  43. // Description: DeSerializing constructor (protected)
  44. //--------------------------------------------------------------------------------------
  45. DEMParticle::DEMParticle (const YAML::Node& node) : LemmaObject(node) {
  46. } // ----- end of method DEMParticle::DEMParticle (constructor) -----
  47. #endif
  48. //--------------------------------------------------------------------------------------
  49. // Class: DEMParticle
  50. // Method: New()
  51. // Description: public constructor
  52. //--------------------------------------------------------------------------------------
  53. DEMParticle* DEMParticle::New() {
  54. DEMParticle* Obj = new DEMParticle("DEMParticle");
  55. Obj->AttachTo(Obj);
  56. return Obj;
  57. }
  58. //--------------------------------------------------------------------------------------
  59. // Class: DEMParticle
  60. // Method: ~DEMParticle
  61. // Description: destructor (protected)
  62. //--------------------------------------------------------------------------------------
  63. DEMParticle::~DEMParticle () {
  64. } // ----- end of method DEMParticle::~DEMParticle (destructor) -----
  65. //--------------------------------------------------------------------------------------
  66. // Class: DEMParticle
  67. // Method: Delete
  68. // Description: public destructor
  69. //--------------------------------------------------------------------------------------
  70. void DEMParticle::Delete() {
  71. this->DetachFrom(this);
  72. }
  73. //--------------------------------------------------------------------------------------
  74. // Class: DEMParticle
  75. // Method: Release
  76. // Description: destructor (protected)
  77. //--------------------------------------------------------------------------------------
  78. void DEMParticle::Release() {
  79. delete this;
  80. }
  81. #ifdef HAVE_YAMLCPP
  82. //--------------------------------------------------------------------------------------
  83. // Class: DEMParticle
  84. // Method: Serialize
  85. //--------------------------------------------------------------------------------------
  86. YAML::Node DEMParticle::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 DEMParticle::Serialize -----
  92. //--------------------------------------------------------------------------------------
  93. // Class: DEMParticle
  94. // Method: DeSerialize
  95. //--------------------------------------------------------------------------------------
  96. DEMParticle* DEMParticle::DeSerialize ( const YAML::Node& node ) {
  97. DEMParticle* Object = new DEMParticle(node);
  98. Object->AttachTo(Object);
  99. DESERIALIZECHECK( node, Object )
  100. return Object ;
  101. } // ----- end of method DEMParticle::DeSerialize -----
  102. #endif
  103. } // ----- end of Lemma name -----