/* 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 06/16/2016 02:10:28 PM * @version $Id$ * @author Trevor Irons (ti) * @email tirons@egi.utah.edu * @copyright Copyright (c) 2016, University of Utah * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC */ #ifndef DEMGRAIN_INC #define DEMGRAIN_INC #pragma once #include "DEMParticle.h" #include #include namespace Lemma { /** \brief \details */ class DEMGrain : public DEMParticle { friend std::ostream &operator<<(std::ostream &stream, const DEMGrain &ob); public: // ==================== LIFECYCLE ======================= /* * Factory method for generating concrete class. * @return a std::shared_ptr of type DEMGrain */ static std::shared_ptr< DEMGrain > NewSP(); /** * Uses YAML to serialize this object. * @return a YAML::Node * @see DEMGrain::DeSerialize */ YAML::Node Serialize() const; /** * Constructs an DEMGrain object from a YAML::Node. * @see DEMGrain::Serialize */ static std::shared_ptr DeSerialize(const YAML::Node& node); // ==================== OPERATORS ======================= // ==================== OPERATIONS ======================= /** * Constructs the DEMGrain with random angular points. The points * are called from normal distribution * @param[input] npoints the number points to build a grain out of * @param[input] sigma is the variance of the random distribution */ void RandomPointCloud ( const int& npoints, const Real& sigma ); // ==================== ACCESS ======================= // ==================== INQUIRY ======================= virtual inline std::string GetName () const { return std::string(this->CName); } protected: /** * Performs a convex hull on the point cloud, uses a brute force approach */ void ConvexHull(); // ==================== LIFECYCLE ======================= /** * Default protected constructor, use NewSP methods to construct * @see DEMGrain::NewSP */ DEMGrain ( ); /** * Protected DeDerializing constructor, use factory DeSerialize method. * @see DEMGrain::DeSerialize */ DEMGrain (const YAML::Node& node); /** Default protected destructor, use smart pointers (std::shared_ptr) */ ~DEMGrain (); // ==================== DATA MEMBERS ========================= private: static constexpr auto CName = "DEMGrain"; /** The points defining the angular grain */ Vector3Xr Points; /** The connections between the points */ MatrixXi Connections; }; // ----- end of class DEMGrain ----- } // ----- end of namespace Lemma ---- /* vim: set tabstop=4 expandtab: */ /* vim: set filetype=cpp: */ #endif // ----- #ifndef DEMGRAIN_INC -----