3#include "AttributeComputerDomain.hpp"
4#include "AttributeComputerFamily.hpp"
5#include "../detail/AttributeKernelSupport.hpp"
6#include "detail/BitquadAttributeMaterialization.hpp"
7#include "detail/BitquadLocalEventComputation.hpp"
15namespace mmcfilters::attributes::computers {
36 static constexpr std::string_view
familyName =
"bitquad";
39 static constexpr AttributeComputerFamily
family = AttributeComputerFamily::Bitquad;
42 static constexpr AttributeComputerDomain
domain = AttributeComputerDomain::Topology;
49 BITQUADS_NUMBER_EULER,
50 BITQUADS_NUMBER_HOLES,
52 BITQUADS_PERIMETER_CONTINUOUS,
54 BITQUADS_PERIMETER_AVERAGE,
55 BITQUADS_LENGTH_AVERAGE,
56 BITQUADS_WIDTH_AVERAGE};
68 template <std::
floating_po
int Real>
71 const auto familyDeltas = detail::BitquadLocalEventComputation::computeBitquadFamilyDeltas(
context.tree);
73 detail::BitquadAttributeMaterialization::materializeAttributesFromBitquadFamilyCounts(
89 template<std::
floating_po
int Real, AltitudeValue T>
92 const auto familyDeltas = detail::BitquadLocalEventComputation::computeBitquadFamilyDeltas(
context.tree);
94 detail::BitquadAttributeMaterialization::materializeAttributesFromBitquadFamilyCounts(
114 template <std::
floating_po
int Real>
119 throw std::invalid_argument(
"Local-event BitQuads attributes require an adjacency relation.");
126 case BITQUADS_AREA:
return Real{0};
127 case BITQUADS_NUMBER_EULER:
return Real{1};
128 case BITQUADS_NUMBER_HOLES:
return Real{0};
129 case BITQUADS_PERIMETER:
return Real{0};
130 case BITQUADS_PERIMETER_CONTINUOUS:
return Real{0};
131 case BITQUADS_CIRCULARITY:
return Real{0};
132 case BITQUADS_PERIMETER_AVERAGE:
return Real{0};
133 case BITQUADS_LENGTH_AVERAGE:
return Real{0};
134 case BITQUADS_WIDTH_AVERAGE:
return Real{0};
140 case BITQUADS_AREA:
return Real{1};
141 case BITQUADS_NUMBER_EULER:
return Real{0};
142 case BITQUADS_NUMBER_HOLES:
return Real{1};
143 case BITQUADS_PERIMETER:
return Real{4};
144 case BITQUADS_PERIMETER_CONTINUOUS:
return Real{8} /
Real{3};
145 case BITQUADS_CIRCULARITY:
return Real{9} * std::numbers::pi_v<Real> /
Real{16};
146 case BITQUADS_PERIMETER_AVERAGE:
return Real{0};
147 case BITQUADS_LENGTH_AVERAGE:
return Real{0};
148 case BITQUADS_WIDTH_AVERAGE:
return static_cast<Real>(0.75);
151 throw std::runtime_error(
"Unsupported local-event BitQuads unit attribute.");
156 BITQUADS_NUMBER_EULER,
157 BITQUADS_NUMBER_HOLES,
159 BITQUADS_PERIMETER_CONTINUOUS,
160 BITQUADS_CIRCULARITY,
161 BITQUADS_PERIMETER_AVERAGE,
162 BITQUADS_LENGTH_AVERAGE,
163 BITQUADS_WIDTH_AVERAGE};
Two-dimensional adjacency relation with configurable radius and efficient iteration.
Bitquad scalar computer backed by local events.
static constexpr std::array< Attribute, 9 > producedAttributes
Canonical list of scalar bitquad attributes materialized by this computer.
static void computeUnitRows(const UnitAttributeComputeContext< Real > &context)
Materializes bitquad attributes for unit proper-part supports.
static constexpr AttributeComputerDomain domain
Execution domain required by the computer.
static constexpr AttributeComputerFamily family
Stable family id used by the scheduler.
static constexpr std::string_view familyName
Family name used in dependency-plan diagnostics.
static void compute(const AttributeComputeContext< Real > &context)
Computes requested scalar bitquad attributes for every live node.
static void compute(const AltitudeAttributeComputeContext< Real, T > &context)
Computes requested bitquad attributes using a generic altitude span.
Owning result for one computed scalar attribute layout and buffer.