.. _program_listing_file_src_mesh.hpp: Program Listing for File mesh.hpp ================================= |exhale_lsh| :ref:`Return to documentation for file ` (``src/mesh.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* This file is part of brille. Copyright © 2019,2020 Greg Tucker brille is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. brille is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with brille. If not, see . */ #ifndef BRILLE_MESH_H_ #define BRILLE_MESH_H_ #include #include "array.hpp" #include "array2.hpp" #include "array_latvec.hpp" // defines bArray #include #include #include #include "interpolation.hpp" #include "interpolatordual.hpp" #include "utilities.hpp" #include "permutation.hpp" #include #include "triangulation_layers.hpp" namespace brille { template class Mesh3{ using ind_t = brille::ind_t; using data_t = DualInterpolator; protected: TetTri mesh; data_t data_; public: //constructors Mesh3(const bArray& verts, const std::vector>& facets, const double max_volume=-1.0, const int num_levels=3, const int max_points=-1 ){ // this->mesh = triangulate(verts, facets, max_volume, min_angle, max_angle, min_ratio, max_points, trellis_fraction); this->mesh = triangulate(verts, facets, max_volume, num_levels, max_points); data_.initialize_permutation_table(this->size(), this->mesh.collect_keys()); } Mesh3(const Mesh3& other){ this->mesh = other.mesh; this->data_ = other.data_; } Mesh3& operator=(const Mesh3& other){ this->mesh = other.mesh; this->data_ = other.data_; return *this; } ind_t size() const { return this->mesh.number_of_vertices(); } ind_t vertex_count() const { return this->mesh.number_of_vertices(); } const bArray& get_mesh_xyz() const{ return this->mesh.get_vertex_positions(); } const bArray& get_mesh_tetrehedra() const{ return this->mesh.get_vertices_per_tetrahedron();} // Get a constant reference to the stored data const data_t& data(void) const {return data_;} // Replace the data stored in the object template void replace_data(A... args) { data_.replace_data(args...); } template void replace_value_data(A... args) { data_.replace_value_data(args...); } template void replace_vector_data(A... args) { data_.replace_vector_data(args...); } template void set_value_cost_info(A... args) { data_.set_value_cost_info(args...); } template void set_vector_cost_info(A... args) {data_.set_vector_cost_info(args...);} size_t bytes_per_point() const {return data_.bytes_per_point(); } // Calculate the Debye-Waller factor for the provided Q points and ion masses template class A> brille::Array debye_waller(const A& Qpts, const std::vector& Masses, const double t_K) const{ return data_.debye_waller(Qpts,Masses,t_K); } template unsigned int check_before_interpolating(const bArray& x) const; template std::tuple,brille::Array> interpolate_at(const LQVec& x) const {return this->interpolate_at(x.get_xyz());} template std::tuple,brille::Array> interpolate_at(const bArray& x) const; template std::tuple,brille::Array> parallel_interpolate_at(const bArray& x, const int nthreads) const; // template std::vector which_neighbours(const std::vector& t, const R value, const ind_t idx) const; std::string to_string(void) const { std::string str= data_.to_string(); str += " for the points of a TetTri[" + mesh.to_string() + "]"; return str; } void sort() {data_.sort();} }; #include "mesh.tpp" } // namespace brille #endif // _MESH_H_