/* 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 ( ) : LemmaObject( ) { } // ----- 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(); } // ----- end of method DEMParticle::DEMParticle (constructor) ----- //-------------------------------------------------------------------------------------- // Class: DEMParticle // Method: NewSP() // Description: public constructor //-------------------------------------------------------------------------------------- std::shared_ptr< DEMParticle > DEMParticle::NewSP() { std::shared_ptr sp(new 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::DeSerialize ( const YAML::Node& node ) { if (node.Tag() != "DEMParticle") { throw DeSerializeTypeMismatch( "DEMParticle", node.Tag()); } std::shared_ptr 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: GetCentreMass //-------------------------------------------------------------------------------------- Real DEMParticle::GetCentreMass ( const int& icoord ) { return centreMass(icoord); } // ----- 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: */