123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /* This file is part of Lemma, a geophysical modelling and inversion API.
- * More information is available at http://lemmasoftware.org
- */
-
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
- /**
- * @file
- * @date 05/31/2016 12:27:31 PM
- * @version $Id$
- * @author Trevor Irons (ti)
- * @email tirons@egi.utah.edu
- * @copyright Copyright (c) 2016, University of Utah
- * @copyright Copyright (c) 2016, Lemma Software, LLC
- */
-
- #include "DEMParticle.h"
-
- namespace Lemma {
-
- // ==================== FRIEND METHODS =====================
-
- std::ostream &operator << (std::ostream &stream, const DEMParticle &ob) {
- stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
- return stream;
- }
-
- // ==================== LIFECYCLE =======================
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: DEMParticle
- // Description: constructor (protected)
- //--------------------------------------------------------------------------------------
- DEMParticle::DEMParticle (const std::string& name) : LemmaObject(name) {
-
- } // ----- end of method DEMParticle::DEMParticle (constructor) -----
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: DEMParticle
- // Description: DeSerializing constructor (protected)
- //--------------------------------------------------------------------------------------
- DEMParticle::DEMParticle (const YAML::Node& node) : LemmaObject(node) {
- this->centreMass = node["centreMass"].as<Vector3r>();
- } // ----- end of method DEMParticle::DEMParticle (constructor) -----
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: NewSP()
- // Description: public constructor
- //--------------------------------------------------------------------------------------
- std::shared_ptr< DEMParticle > DEMParticle::NewSP() {
- std::shared_ptr<DEMParticle> sp(new DEMParticle("DEMParticle"), LemmaObjectDeleter() );
- return sp;
- }
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: ~DEMParticle
- // Description: destructor (protected)
- //--------------------------------------------------------------------------------------
- DEMParticle::~DEMParticle () {
-
- } // ----- end of method DEMParticle::~DEMParticle (destructor) -----
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: Serialize
- //--------------------------------------------------------------------------------------
- YAML::Node DEMParticle::Serialize ( ) const {
- YAML::Node node = LemmaObject::Serialize();;
- node.SetTag( GetName() );
- // FILL IN CLASS SPECIFICS HERE
- node["centreMass"] = centreMass;
- return node;
- } // ----- end of method DEMParticle::Serialize -----
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: DeSerialize
- //--------------------------------------------------------------------------------------
- std::shared_ptr<DEMParticle> DEMParticle::DeSerialize ( const YAML::Node& node ) {
- if (node.Tag() != "DEMParticle") {
- throw DeSerializeTypeMismatch( "DEMParticle", node.Tag());
- }
- std::shared_ptr<DEMParticle> Object(new DEMParticle(node), LemmaObjectDeleter() );
- return Object ;
- } // ----- end of method DEMParticle::DeSerialize -----
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: GetCentreMass
- //--------------------------------------------------------------------------------------
- Vector3r DEMParticle::GetCentreMass ( ) {
- return centreMass;
- } // ----- end of method DEMParticle::get_CentreMass -----
-
- //--------------------------------------------------------------------------------------
- // Class: DEMParticle
- // Method: SetCentreMass
- //--------------------------------------------------------------------------------------
- void DEMParticle::SetCentreMass ( const Vector3r& pos ) {
- centreMass = pos;
- return ;
- } // ----- end of method DEMParticle::set_CentreMass -----
-
-
- } // ----- end of Lemma name -----
-
- /* vim: set tabstop=4 expandtab: */
- /* vim: set filetype=cpp: */
|