|
@@ -0,0 +1,124 @@
|
|
1
|
+/* This file is part of Lemma, a geophysical modelling and inversion API.
|
|
2
|
+ * More information is available at http://lemmasoftware.org
|
|
3
|
+ */
|
|
4
|
+
|
|
5
|
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
8
|
+ */
|
|
9
|
+
|
|
10
|
+/**
|
|
11
|
+ * @file
|
|
12
|
+ * @date 05/31/2016 12:27:31 PM
|
|
13
|
+ * @version $Id$
|
|
14
|
+ * @author Trevor Irons (ti)
|
|
15
|
+ * @email tirons@egi.utah.edu
|
|
16
|
+ * @copyright Copyright (c) 2016, University of Utah
|
|
17
|
+ * @copyright Copyright (c) 2016, Lemma Software, LLC
|
|
18
|
+ */
|
|
19
|
+
|
|
20
|
+#include "DEMParticle.h"
|
|
21
|
+
|
|
22
|
+namespace Lemma {
|
|
23
|
+
|
|
24
|
+// ==================== FRIEND METHODS =====================
|
|
25
|
+#ifdef HAVE_YAMLCPP
|
|
26
|
+std::ostream &operator << (std::ostream &stream, const DEMParticle &ob) {
|
|
27
|
+ stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
|
|
28
|
+ return stream;
|
|
29
|
+}
|
|
30
|
+#else
|
|
31
|
+std::ostream &operator<<(std::ostream &stream, const DEMParticle& ob) {
|
|
32
|
+ stream << *(LemmaObject*)(&ob);
|
|
33
|
+ return stream;
|
|
34
|
+}
|
|
35
|
+#endif
|
|
36
|
+
|
|
37
|
+// ==================== LIFECYCLE =======================
|
|
38
|
+
|
|
39
|
+//--------------------------------------------------------------------------------------
|
|
40
|
+// Class: DEMParticle
|
|
41
|
+// Method: DEMParticle
|
|
42
|
+// Description: constructor (protected)
|
|
43
|
+//--------------------------------------------------------------------------------------
|
|
44
|
+DEMParticle::DEMParticle (const std::string& name) : LemmaObject(name) {
|
|
45
|
+
|
|
46
|
+} // ----- end of method DEMParticle::DEMParticle (constructor) -----
|
|
47
|
+
|
|
48
|
+#ifdef HAVE_YAMLCPP
|
|
49
|
+//--------------------------------------------------------------------------------------
|
|
50
|
+// Class: DEMParticle
|
|
51
|
+// Method: DEMParticle
|
|
52
|
+// Description: DeSerializing constructor (protected)
|
|
53
|
+//--------------------------------------------------------------------------------------
|
|
54
|
+DEMParticle::DEMParticle (const YAML::Node& node) : LemmaObject(node) {
|
|
55
|
+
|
|
56
|
+} // ----- end of method DEMParticle::DEMParticle (constructor) -----
|
|
57
|
+#endif
|
|
58
|
+
|
|
59
|
+//--------------------------------------------------------------------------------------
|
|
60
|
+// Class: DEMParticle
|
|
61
|
+// Method: New()
|
|
62
|
+// Description: public constructor
|
|
63
|
+//--------------------------------------------------------------------------------------
|
|
64
|
+DEMParticle* DEMParticle::New() {
|
|
65
|
+ DEMParticle* Obj = new DEMParticle("DEMParticle");
|
|
66
|
+ Obj->AttachTo(Obj);
|
|
67
|
+ return Obj;
|
|
68
|
+}
|
|
69
|
+
|
|
70
|
+//--------------------------------------------------------------------------------------
|
|
71
|
+// Class: DEMParticle
|
|
72
|
+// Method: ~DEMParticle
|
|
73
|
+// Description: destructor (protected)
|
|
74
|
+//--------------------------------------------------------------------------------------
|
|
75
|
+DEMParticle::~DEMParticle () {
|
|
76
|
+
|
|
77
|
+} // ----- end of method DEMParticle::~DEMParticle (destructor) -----
|
|
78
|
+
|
|
79
|
+//--------------------------------------------------------------------------------------
|
|
80
|
+// Class: DEMParticle
|
|
81
|
+// Method: Delete
|
|
82
|
+// Description: public destructor
|
|
83
|
+//--------------------------------------------------------------------------------------
|
|
84
|
+void DEMParticle::Delete() {
|
|
85
|
+ this->DetachFrom(this);
|
|
86
|
+}
|
|
87
|
+
|
|
88
|
+//--------------------------------------------------------------------------------------
|
|
89
|
+// Class: DEMParticle
|
|
90
|
+// Method: Release
|
|
91
|
+// Description: destructor (protected)
|
|
92
|
+//--------------------------------------------------------------------------------------
|
|
93
|
+void DEMParticle::Release() {
|
|
94
|
+ delete this;
|
|
95
|
+}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+#ifdef HAVE_YAMLCPP
|
|
99
|
+//--------------------------------------------------------------------------------------
|
|
100
|
+// Class: DEMParticle
|
|
101
|
+// Method: Serialize
|
|
102
|
+//--------------------------------------------------------------------------------------
|
|
103
|
+YAML::Node DEMParticle::Serialize ( ) const {
|
|
104
|
+ YAML::Node node = LemmaObject::Serialize();;
|
|
105
|
+ node.SetTag( this->Name );
|
|
106
|
+ // FILL IN CLASS SPECIFICS HERE
|
|
107
|
+ return node;
|
|
108
|
+} // ----- end of method DEMParticle::Serialize -----
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+//--------------------------------------------------------------------------------------
|
|
112
|
+// Class: DEMParticle
|
|
113
|
+// Method: DeSerialize
|
|
114
|
+//--------------------------------------------------------------------------------------
|
|
115
|
+DEMParticle* DEMParticle::DeSerialize ( const YAML::Node& node ) {
|
|
116
|
+ DEMParticle* Object = new DEMParticle(node);
|
|
117
|
+ Object->AttachTo(Object);
|
|
118
|
+ DESERIALIZECHECK( node, Object )
|
|
119
|
+ return Object ;
|
|
120
|
+} // ----- end of method DEMParticle::DeSerialize -----
|
|
121
|
+#endif
|
|
122
|
+
|
|
123
|
+} // ----- end of Lemma name -----
|
|
124
|
+
|