<commit_before>#ifndef CHC_DATASTRUCTURES_H
#define CHC_DATASTRUCTURES_H

#include "chrono_parallel/math/ChParallelMath.h"

namespace chrono {
namespace collision {

struct ConvexShape {
  shape_type type;  // type of shape
  real3 A;  // location
  real3 B;  // dimensions
  real3 C;  // extra
  quaternion R;  // rotation
  real3* convex;  // pointer to convex data;
  real margin;
};

struct ContactPoint {
  real3 pointA, pointB, normal;
  real depth;
  ContactPoint() {}
  ContactPoint(real3 pa, real3 pb, real3 norm, real d) {
    pointA = pa;
    pointB = pb;
    normal = norm;
    depth = d;
  }
};

#define MANIFOLD_SIZE 3

struct ContactManifold {
  ContactPoint points[MANIFOLD_SIZE];

  unsigned int num_contact_points;
  ContactManifold() { num_contact_points = 0; }

  int getCacheEntry(ContactPoint& newPoint) {
    real shortestDist = ZERO_EPSILON * 2;  // TODO: SHOULD THIS BE SOMETHIGN ELSE
    int size = num_contact_points;
    int nearestPoint = -1;
    for (int i = 0; i < size; i++) {
      const ContactPoint& mp = points[i];

      real3 diffA = mp.pointA - newPoint.pointA;
      const real distToManiPoint = diffA.dot(diffA);
      if (distToManiPoint < shortestDist) {
        shortestDist = distToManiPoint;
        nearestPoint = i;
      }<commit_msg>pass real3 as const reference<commit_after>#ifndef CHC_DATASTRUCTURES_H
#define CHC_DATASTRUCTURES_H

#include "chrono_parallel/math/ChParallelMath.h"

namespace chrono {
namespace collision {

struct ConvexShape {
  shape_type type;  // type of shape
  real3 A;  // location
  real3 B;  // dimensions
  real3 C;  // extra
  quaternion R;  // rotation
  real3* convex;  // pointer to convex data;
  real margin;
};

struct ContactPoint {
  real3 pointA, pointB, normal;
  real depth;
  ContactPoint() {}
  ContactPoint(const real3 &pa, const real3 &pb, const real3 &norm, const real d) {
    pointA = pa;
    pointB = pb;
    normal = norm;
    depth = d;
  }
};

#define MANIFOLD_SIZE 3

struct ContactManifold {
  ContactPoint points[MANIFOLD_SIZE];

  unsigned int num_contact_points;
  ContactManifold() { num_contact_points = 0; }

  int getCacheEntry(ContactPoint& newPoint) {
    real shortestDist = ZERO_EPSILON * 2;  // TODO: SHOULD THIS BE SOMETHIGN ELSE
    int size = num_contact_points;
    int nearestPoint = -1;
    for (int i = 0; i < size; i++) {
      const ContactPoint& mp = points[i];

      real3 diffA = mp.pointA - newPoint.pointA;
      const real distToManiPoint = diffA.dot(diffA);
      if (distToManiPoint < shortestDist) {
        shortestDist = distToManiPoint;
        nearestPoint = i;
      }
{'fraction_non_alphanumeric': 0.09543886546569567, 'fraction_numerical': 0.011115369873514757, 'mean_word_length': 3.176, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '3428162', 'n_tokens_mistral': 915, 'n_tokens_neox': 888, 'n_words': 248}