3#include "AttributeComputerDomain.hpp"
4#include "AttributeComputerFamily.hpp"
5#include "../detail/AttributeKernelSupport.hpp"
6#include "detail/ContourSideAttributeMaterialization.hpp"
7#include "detail/ContourSideFiniteWindowComputation.hpp"
15namespace mmcfilters::attributes::computers {
26template <std::
floating_po
int Real>
27inline void computeContourSideAttributes(
const AttributeComputeContext<Real>& context,
const ContourSideRequest& request) {
32 const std::vector<ContourSideCounts> sideCounts = computeContourSideCounts(context.tree);
33 materializeContourSideAttributes(context, request, sideCounts);
38template <std::
floating_po
int Real>
inline void validateContourSideContext(
const AttributeComputeContext<Real>& context) {
39 requireAttributeBufferShape(context.tree, context.buffer, context.attrNames);
40 requireRequestedAttributeColumns(context);
41 local_attributes::detail::validateFiniteWindowLocalAttributeInput(context.tree);
65 static constexpr std::string_view
familyName =
"contour-side";
68 static constexpr AttributeComputerFamily
family = AttributeComputerFamily::ContourSide;
71 static constexpr AttributeComputerDomain
domain = AttributeComputerDomain::Topology;
76 inline static constexpr std::array<Attribute, 6>
producedAttributes{ContourPixels, ContourPerimeter, ContourSideNorth,
77 ContourSideWest, ContourSideEast, ContourSideSouth};
91 template <std::
floating_po
int Real>
static void compute(
const AttributeComputeContext<Real>& context) {
92 const detail::ContourSideRequest request = detail::ContourSideRequest::from(context.requestedAttributes);
94 detail::kernel::computeContourSideAttributes(context, request);
106 template <std::
floating_po
int Real>
static void computeUnitRows(
const UnitAttributeComputeContext<Real>& context) {
107 requireUnitAttributeBufferShape(context.tree, context.unitPixels, context.buffer, context.attrNames);
108 computeUnitRowsEstablished(context);
118 template <
class Computer,
class Context>
friend void mmcfilters::detail::kernel::computeUnitRows(
const Context& context);
121 template <std::
floating_po
int Real>
static void computeUnitRowsEstablished(
const UnitAttributeComputeContext<Real>& context) {
122 detail::ContourSideAttributeMaterialization::materializeUnitContourSideAttributes(context.unitPixels, context.buffer,
123 context.attrNames, context.requestedAttributes);
Compile-time policy for defensive checks at untrusted API boundaries.
#define MMCFILTERS_CONTRACT_CHECKED_ONLY(...)
Executes validation statements only when defensive checks are enabled.
Scalar computer backed by local contour-side counts.
static constexpr std::array< Attribute, 6 > producedAttributes
Canonical list of scalar contour attributes materialized by this computer.
static constexpr AttributeComputerDomain domain
Execution domain required by the computer.
static void computeUnitRows(const UnitAttributeComputeContext< Real > &context)
Materializes contour-side attributes for one-pixel unit supports.
static void compute(const AttributeComputeContext< Real > &context)
Computes requested contour-side scalar attributes for live nodes.
static constexpr std::string_view familyName
Family name used in dependency-plan diagnostics.
static constexpr AttributeComputerFamily family
Stable family id used by the scheduler.