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.

DEMGrain.cpp 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 06/16/2016 02:11:21 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, Trevor Irons & Lemma Software, LLC
  16. */
  17. #include "DEMGrain.h"
  18. namespace Lemma {
  19. // ==================== FRIEND METHODS =====================
  20. std::ostream &operator << (std::ostream &stream, const DEMGrain &ob) {
  21. stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
  22. return stream;
  23. }
  24. // ==================== LIFECYCLE =======================
  25. //--------------------------------------------------------------------------------------
  26. // Class: DEMGrain
  27. // Method: DEMGrain
  28. // Description: constructor (protected)
  29. //--------------------------------------------------------------------------------------
  30. DEMGrain::DEMGrain ( ) : DEMParticle( ) {
  31. } // ----- end of method DEMGrain::DEMGrain (constructor) -----
  32. //--------------------------------------------------------------------------------------
  33. // Class: DEMGrain
  34. // Method: DEMGrain
  35. // Description: DeSerializing constructor (protected)
  36. //--------------------------------------------------------------------------------------
  37. DEMGrain::DEMGrain (const YAML::Node& node) : DEMParticle(node) {
  38. } // ----- end of method DEMGrain::DEMGrain (constructor) -----
  39. //--------------------------------------------------------------------------------------
  40. // Class: DEMGrain
  41. // Method: NewSP()
  42. // Description: public constructor returing a shared_ptr
  43. //--------------------------------------------------------------------------------------
  44. std::shared_ptr< DEMGrain > DEMGrain::NewSP() {
  45. std::shared_ptr< DEMGrain > sp(new DEMGrain( ), LemmaObjectDeleter() );
  46. return sp;
  47. }
  48. //--------------------------------------------------------------------------------------
  49. // Class: DEMGrain
  50. // Method: ~DEMGrain
  51. // Description: destructor (protected)
  52. //--------------------------------------------------------------------------------------
  53. DEMGrain::~DEMGrain () {
  54. } // ----- end of method DEMGrain::~DEMGrain (destructor) -----
  55. //--------------------------------------------------------------------------------------
  56. // Class: DEMGrain
  57. // Method: Serialize
  58. //--------------------------------------------------------------------------------------
  59. YAML::Node DEMGrain::Serialize ( ) const {
  60. YAML::Node node = DEMParticle::Serialize();
  61. node.SetTag( GetName() );
  62. // FILL IN CLASS SPECIFICS HERE
  63. return node;
  64. } // ----- end of method DEMGrain::Serialize -----
  65. //--------------------------------------------------------------------------------------
  66. // Class: DEMGrain
  67. // Method: DeSerialize
  68. //--------------------------------------------------------------------------------------
  69. std::shared_ptr<DEMGrain> DEMGrain::DeSerialize ( const YAML::Node& node ) {
  70. if (node.Tag() != "DEMGrain" ) {
  71. throw DeSerializeTypeMismatch( "DEMGrain", node.Tag());
  72. }
  73. std::shared_ptr< DEMGrain > Object(new DEMGrain(node), LemmaObjectDeleter() );
  74. return Object ;
  75. } // ----- end of method DEMGrain::DeSerialize -----
  76. } // ---- end of namespace Lemma ----
  77. /* vim: set tabstop=4 expandtab: */
  78. /* vim: set filetype=cpp: */