#pragma once#include"robin_hood.h"#include<Eigen/Dense>namespaceshapeworks{structMeshGeoEntry{// in "Full" mode, the entry contains geodesics to every vertex. Access via `data_full`// in "Partial" mode, the entry only contains geodesics upto max_dist. Access via `data_partial`enumMode{Full,Partial,};Modemode{Mode::Partial};doublemax_dist{0.0};robin_hood::unordered_flat_map<int,Eigen::Vector3d>data_partial;std::array<Eigen::VectorXd,3>data_full;voidclear(){mode=Mode::Partial;max_dist=0.0;// calling `data_partial.clear()` doesn't free the backing memory, so we have to swap to an emptyrobin_hood::unordered_flat_map<int,Eigen::Vector3d>new_data_partial;std::swap(new_data_partial,data_partial);data_full[0].resize(0);data_full[1].resize(0);data_full[2].resize(0);}boolis_full_mode()const{returnmode==Mode::Full;}voidupdate_max_dist(){assert(is_full_mode());// the caller most likely has a more efficient way to compute this if partial modeconstautomax0=data_full[0].maxCoeff();constautomax1=data_full[1].maxCoeff();constautomax2=data_full[2].maxCoeff();max_dist=std::max({max0,max1,max2});}boolhas_entry(inttarget){returnis_full_mode()||data_partial.find(target)!=data_partial.end();}};};