128 {
129 std::size_t num_possible_contacts = _a.elements.extent(0) * _b.elements.extent(0);
130 auto res = bvh::narrowphase_result_pair();
131 res.a = bvh::narrowphase_result(sizeof(NarrowphaseResult), num_possible_contacts);
132 res.b = bvh::narrowphase_result(sizeof(NarrowphaseResult), num_possible_contacts);
133 auto resa = bvh::typed_narrowphase_result<NarrowphaseResult>(res.a);
134 auto resb = bvh::typed_narrowphase_result<NarrowphaseResult>(res.b);
135 auto tree = bvh::build_snapshot_tree_top_down(_a.elements);
136
137 Kokkos::parallel_for(_b.elements.extent(0), KOKKOS_LAMBDA(int i) {
138 auto elb = _b.elements(i);
139 auto ra = resa;
140 auto rb = resb;
141 query_tree_local(tree, elb, [&_a, &_b, &elb, &ra, &rb, this](std::size_t _i) {
142 const auto& face = _a.elements[_i];
143 const auto& node = elb;
144 NarrowphaseResult entry;
145
146 bool hit = false;
147 double norm[3];
149
150 if (hit) {
152
153 entry.local_index = face.local_id();
154 entry.node = false;
155 ra.emplace_back(entry);
156
157 entry.local_index = node.local_id();
158 entry.node = true;
159 rb.emplace_back(entry);
160 }
161 });
162 });
163
164 return res;
165 }
void getContactForce(const double penalty, const double gap, const double normal[3], double contact_force[3])
Definition nimble_contact_manager.h:82