|
@@ -52,19 +52,18 @@ DEMParticle::DEMParticle (const std::string& name) : LemmaObject(name) {
|
52
|
52
|
// Description: DeSerializing constructor (protected)
|
53
|
53
|
//--------------------------------------------------------------------------------------
|
54
|
54
|
DEMParticle::DEMParticle (const YAML::Node& node) : LemmaObject(node) {
|
55
|
|
-
|
|
55
|
+ this->centreMass = node["centreMass"].as<Vector3r>();
|
56
|
56
|
} // ----- end of method DEMParticle::DEMParticle (constructor) -----
|
57
|
57
|
#endif
|
58
|
58
|
|
59
|
59
|
//--------------------------------------------------------------------------------------
|
60
|
60
|
// Class: DEMParticle
|
61
|
|
-// Method: New()
|
|
61
|
+// Method: NewSP()
|
62
|
62
|
// Description: public constructor
|
63
|
63
|
//--------------------------------------------------------------------------------------
|
64
|
|
-DEMParticle* DEMParticle::New() {
|
65
|
|
- DEMParticle* Obj = new DEMParticle("DEMParticle");
|
66
|
|
- Obj->AttachTo(Obj);
|
67
|
|
- return Obj;
|
|
64
|
+std::shared_ptr< DEMParticle > DEMParticle::NewSP() {
|
|
65
|
+ std::shared_ptr<DEMParticle> sp(new DEMParticle("DEMParticle"), LemmaObjectDeleter() );
|
|
66
|
+ return sp;
|
68
|
67
|
}
|
69
|
68
|
|
70
|
69
|
//--------------------------------------------------------------------------------------
|
|
@@ -76,25 +75,6 @@ DEMParticle::~DEMParticle () {
|
76
|
75
|
|
77
|
76
|
} // ----- end of method DEMParticle::~DEMParticle (destructor) -----
|
78
|
77
|
|
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
|
78
|
#ifdef HAVE_YAMLCPP
|
99
|
79
|
//--------------------------------------------------------------------------------------
|
100
|
80
|
// Class: DEMParticle
|
|
@@ -102,23 +82,41 @@ void DEMParticle::Release() {
|
102
|
82
|
//--------------------------------------------------------------------------------------
|
103
|
83
|
YAML::Node DEMParticle::Serialize ( ) const {
|
104
|
84
|
YAML::Node node = LemmaObject::Serialize();;
|
105
|
|
- node.SetTag( this->Name );
|
|
85
|
+ node.SetTag( this->GetName() );
|
106
|
86
|
// FILL IN CLASS SPECIFICS HERE
|
|
87
|
+ node["centreMass"] = centreMass;
|
107
|
88
|
return node;
|
108
|
89
|
} // ----- end of method DEMParticle::Serialize -----
|
109
|
90
|
|
110
|
|
-
|
111
|
91
|
//--------------------------------------------------------------------------------------
|
112
|
92
|
// Class: DEMParticle
|
113
|
93
|
// Method: DeSerialize
|
114
|
94
|
//--------------------------------------------------------------------------------------
|
115
|
|
-DEMParticle* DEMParticle::DeSerialize ( const YAML::Node& node ) {
|
116
|
|
- DEMParticle* Object = new DEMParticle(node);
|
117
|
|
- Object->AttachTo(Object);
|
118
|
|
- DESERIALIZECHECK( node, Object )
|
|
95
|
+std::shared_ptr<DEMParticle> DEMParticle::DeSerialize ( const YAML::Node& node ) {
|
|
96
|
+ std::shared_ptr<DEMParticle> Object(new DEMParticle(node), LemmaObjectDeleter() );
|
|
97
|
+ DESERIALIZECHECK( node, Object.get() )
|
119
|
98
|
return Object ;
|
120
|
99
|
} // ----- end of method DEMParticle::DeSerialize -----
|
121
|
100
|
#endif
|
122
|
101
|
|
|
102
|
+
|
|
103
|
+//--------------------------------------------------------------------------------------
|
|
104
|
+// Class: DEMParticle
|
|
105
|
+// Method: GetCentreMass
|
|
106
|
+//--------------------------------------------------------------------------------------
|
|
107
|
+Vector3r DEMParticle::GetCentreMass ( ) {
|
|
108
|
+ return centreMass;
|
|
109
|
+} // ----- end of method DEMParticle::get_CentreMass -----
|
|
110
|
+
|
|
111
|
+//--------------------------------------------------------------------------------------
|
|
112
|
+// Class: DEMParticle
|
|
113
|
+// Method: SetCentreMass
|
|
114
|
+//--------------------------------------------------------------------------------------
|
|
115
|
+void DEMParticle::SetCentreMass ( const Vector3r& pos ) {
|
|
116
|
+ centreMass = pos;
|
|
117
|
+ return ;
|
|
118
|
+} // ----- end of method DEMParticle::set_CentreMass -----
|
|
119
|
+
|
|
120
|
+
|
123
|
121
|
} // ----- end of Lemma name -----
|
124
|
122
|
|