AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

Adding constexpr keywords for constructors and some members. #1820

Open dbiswas2808 opened 4 months ago

dbiswas2808 commented 4 months ago

More coord constructors can be constexpr. Have found this useful for writing complex finite difference operations using neighboring cells. A simple example of usage:

Coord p; // Some input coord

// Find this pattern much easier to debug and follow for even larger number of neighbors.
constexpr Coord n0Off{1, 0};
constexpr Coord n1Off{-1, 0};
constexpr Coord n2Off{0, 1};
constexpr Coord n3Off{0, -1};

auto dx  = ((p + n0Off) - (p + n1Off)) / 2 ;
auto dy  = ((p + n2Off) - (p + n3Off)) / 2 ;
linux-foundation-easycla[bot] commented 4 months ago

CLA Missing ID CLA Not Signed

dbiswas2808 commented 4 months ago

/easycla

dbiswas2808 commented 4 months ago

Not sure why easyCLA is not getting retriggered.