Add PointCloud spatial distribution (#3161)

Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Paul Wilson 2024-11-13 15:39:41 -06:00 committed by GitHub
parent 0ecd45c906
commit 58400cbf10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 306 additions and 12 deletions

View file

@ -136,6 +136,26 @@ private:
//!< mesh element indices
};
//==============================================================================
//! Distribution of points
//==============================================================================
class PointCloud : public SpatialDistribution {
public:
explicit PointCloud(pugi::xml_node node);
explicit PointCloud(
std::vector<Position> point_cloud, gsl::span<const double> strengths);
//! Sample a position from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled position
Position sample(uint64_t* seed) const override;
private:
std::vector<Position> point_cloud_;
DiscreteIndex point_idx_dist_; //!< Distribution of Position indices
};
//==============================================================================
//! Uniform distribution of points over a box
//==============================================================================

View file

@ -50,6 +50,9 @@ xt::xarray<T> get_node_xarray(
return xt::adapt(v, shape);
}
std::vector<Position> get_node_position_array(
pugi::xml_node node, const char* name, bool lowercase = false);
Position get_node_position(
pugi::xml_node node, const char* name, bool lowercase = false);