<commit_before>#pragma once
#include <geode/array/Field.h>
#include <geode/exact/circle_objects.h>
#include <geode/exact/quantize.h>
#include <geode/exact/circle_csg.h>
#include <geode/exact/VertexSet.h>
#include <geode/mesh/HalfedgeGraph.h>
#include <geode/mesh/ids.h>

namespace geode {

GEODE_DEFINE_ID(CircleId)

// IncidentId combines a VertexId with a ReferenceSide to refer to an intersection point relative to a specific reference circle
GEODE_DEFINE_ID(IncidentId)
inline IncidentId incident_id(const VertexId vid, const ReferenceSide side) { assert(vid.valid()); return IncidentId(vid.idx()<<1 | static_cast<bool>(side)); }
inline IncidentId iid_cl(const VertexId vid)     { return incident_id(vid, ReferenceSide::cl); }
inline IncidentId iid_cr(const VertexId vid)     { return incident_id(vid, ReferenceSide::cr); }
inline IncidentId reversed(const IncidentId iid) { assert(iid.valid()); return IncidentId(iid.idx() ^ 1); }
inline ReferenceSide side(const IncidentId iid)  { assert(iid.valid()); return static_cast<ReferenceSide>(iid.idx() & 1); }
inline VertexId   to_vid(const IncidentId iid)   { assert(iid.valid()); return VertexId(iid.idx() >> 1); }
inline bool is_same_vid(const IncidentId iid0, const IncidentId iid1) { assert(iid0.valid() && iid1.valid()); return (iid0.idx() | 1) == (iid1.idx() | 1); }
inline bool cl_is_reference(const IncidentId iid) { assert(iid.valid()); return cl_is_reference(side(iid)); }

template<Pb PS> class ExactArcGraph {
 public:
  struct EdgeValue {
    int weight; // Total number of times edge was added in any orientation
    int winding; // Total number of times ccw halfedge - cw halfedge was added
    EdgeValue() = default;
    EdgeValue(const int _weight, const int _winding) : weight(_weight), winding(_winding) { }
    void operator+=(const EdgeValue rhs) { weight += rhs.weight; winding += rhs.winding; }
  };

  struct EdgeInfo {
    EdgeValue value;
    ReferenceSide src_side;
    ReferenceSide dst_side;
  };

  // These should be safe to read, but modified at your own risk
  VertexSet<PS> vertices;
  Field<EdgeInfo, EdgeId> edges;
  Ref<HalfedgeGraph> graph; // this->split_edges() must be called before graph will get valid border/face data

  ExactArcGraph();
  ~ExactArcGraph();

  const int n_vertices()  const { assert(vertices.size() == graph->n_vertices()); return vertices.size(); }
  const int n_incidents() const { return 2*n_vertices(); }
  const int n_edges()     const { assert(edges.size() == graph->n_edges()); return edges.size(); }

  Range<IdIter<VertexId>>   vertex_ids()   const { return id_range<VertexId>  (n_vertices()); }
  Range<IdIter<EdgeId>>     edge_ids()     const { return id_range<EdgeId>    (n_edges()); }
  Range<IdIter<IncidentId>> incident_ids() const { return id_range<IncidentId>(n_incidents()); }

  const ExactCircle<PS>& reference(const IncidentId iid) const { return vertices[to_vid(iid)].reference(side(iid)); }
  const IncidentCircle<PS> incident(const IncidentId iid) const { return vertices[to_vid(iid)].incident(side(iid)); }

  const IncidentId src(const EdgeId eid) const { return incident_id(graph->src(eid), edges[eid].src_side); }
  const IncidentId dst(const EdgeId eid) const { return incident_id(graph->dst(eid), edges[eid].dst_side); }

  const IncidentId src(const HalfedgeId hid) const { return HalfedgeGraph::is_forward(hid) ? src(HalfedgeGraph::edge(hid)) : dst(HalfedgeGraph::edge(hid)); }
  const IncidentId dst(const HalfedgeId hid) const { return HalfedgeGraph::is_forward(hid) ? dst(HalfedgeGraph::edge(hid)) : src(HalfedgeGraph::edge(hid)); }
<commit_msg>Fix clang compile<commit_after>#pragma once
#include <geode/array/Field.h>
#include <geode/exact/circle_objects.h>
#include <geode/exact/quantize.h>
#include <geode/exact/circle_csg.h>
#include <geode/exact/VertexSet.h>
#include <geode/mesh/HalfedgeGraph.h>
#include <geode/mesh/ids.h>

namespace geode {

GEODE_DEFINE_ID(CircleId)

// IncidentId combines a VertexId with a ReferenceSide to refer to an intersection point relative to a specific reference circle
GEODE_DEFINE_ID(IncidentId)
inline IncidentId incident_id(const VertexId vid, const ReferenceSide side) { assert(vid.valid()); return IncidentId(vid.idx()<<1 | static_cast<bool>(side)); }
inline IncidentId iid_cl(const VertexId vid)     { return incident_id(vid, ReferenceSide::cl); }
inline IncidentId iid_cr(const VertexId vid)     { return incident_id(vid, ReferenceSide::cr); }
inline IncidentId reversed(const IncidentId iid) { assert(iid.valid()); return IncidentId(iid.idx() ^ 1); }
inline ReferenceSide side(const IncidentId iid)  { assert(iid.valid()); return static_cast<ReferenceSide>(iid.idx() & 1); }
inline VertexId   to_vid(const IncidentId iid)   { assert(iid.valid()); return VertexId(iid.idx() >> 1); }
inline bool is_same_vid(const IncidentId iid0, const IncidentId iid1) { assert(iid0.valid() && iid1.valid()); return (iid0.idx() | 1) == (iid1.idx() | 1); }
inline bool cl_is_reference(const IncidentId iid) { assert(iid.valid()); return cl_is_reference(side(iid)); }

template<Pb PS> class ExactArcGraph {
 public:
  struct EdgeValue {
    int weight; // Total number of times edge was added in any orientation
    int winding; // Total number of times ccw halfedge - cw halfedge was added
    EdgeValue() = default;
    EdgeValue(const int _weight, const int _winding) : weight(_weight), winding(_winding) { }
    void operator+=(const EdgeValue rhs) { weight += rhs.weight; winding += rhs.winding; }
  };

  struct EdgeInfo {
    EdgeValue value;
    ReferenceSide src_side;
    ReferenceSide dst_side;
  };

  // These should be safe to read, but modified at your own risk
  VertexSet<PS> vertices;
  Field<EdgeInfo, EdgeId> edges;
  Ref<HalfedgeGraph> graph; // this->split_edges() must be called before graph will get valid border/face data

  ExactArcGraph();
  ~ExactArcGraph();

  int n_vertices()  const { assert(vertices.size() == graph->n_vertices()); return vertices.size(); }
  int n_incidents() const { return 2*n_vertices(); }
  int n_edges()     const { assert(edges.size() == graph->n_edges()); return edges.size(); }

  Range<IdIter<VertexId>>   vertex_ids()   const { return id_range<VertexId>  (n_vertices()); }
  Range<IdIter<EdgeId>>     edge_ids()     const { return id_range<EdgeId>    (n_edges()); }
  Range<IdIter<IncidentId>> incident_ids() const { return id_range<IncidentId>(n_incidents()); }

  const ExactCircle<PS>& reference(const IncidentId iid) const { return vertices[to_vid(iid)].reference(side(iid)); }
  const IncidentCircle<PS> incident(const IncidentId iid) const { return vertices[to_vid(iid)].incident(side(iid)); }

  const IncidentId src(const EdgeId eid) const { return incident_id(graph->src(eid), edges[eid].src_side); }
  const IncidentId dst(const EdgeId eid) const { return incident_id(graph->dst(eid), edges[eid].dst_side); }

  const IncidentId src(const HalfedgeId hid) const { return HalfedgeGraph::is_forward(hid) ? src(HalfedgeGraph::edge(hid)) : dst(HalfedgeGraph::edge(hid)); }
  const IncidentId dst(const HalfedgeId hid) const { return HalfedgeGraph::is_forward(hid) ? dst(HalfedgeGraph::edge(hid)) : src(HalfedgeGraph::edge(hid)); }

{'fraction_non_alphanumeric': 0.13249651324965134, 'fraction_numerical': 0.0036262203626220364, 'mean_word_length': 5.437163375224417, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '786247', 'n_tokens_mistral': 2419, 'n_tokens_neox': 2354, 'n_words': 597}