NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble_contact_entity.h
Go to the documentation of this file.
1/*
2//@HEADER
3// ************************************************************************
4//
5// NimbleSM
6// Copyright 2018
7// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
8//
9// Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
10// retains certain rights in this software.
11//
12// Redistribution and use in source and binary forms, with or without
13// modification, are permitted provided that the following conditions are
14// met:
15//
16// 1. Redistributions of source code must retain the above copyright
17// notice, this list of conditions and the following disclaimer.
18//
19// 2. Redistributions in binary form must reproduce the above copyright
20// notice, this list of conditions and the following disclaimer in the
21// documentation and/or other materials provided with the distribution.
22//
23// 3. Neither the name of the Corporation nor the names of the
24// contributors may be used to endorse or promote products derived from
25// this software without specific prior written permission.
26//
27// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY EXPRESS OR IMPLIED
28// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
30// NO EVENT SHALL NTESS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
32// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact David Littlewood (djlittl@sandia.gov)
39//
40// ************************************************************************
41//@HEADER
42*/
43
44#ifndef NIMBLE_CONTACTENTITY_H
45#define NIMBLE_CONTACTENTITY_H
46
47#include <cfloat>
48#include <cmath>
49#include <cstring>
50#include <set>
51#include <string>
52#include <tuple>
53#include <vector>
54
55#include "nimble_defs.h"
56#include "nimble_utils.h"
57
58#ifdef NIMBLE_HAVE_BVH
59#include <bvh/kdop.hpp>
60#include <bvh/types.hpp>
61#endif
62
63namespace nimble {
64
66double
68 double pt_1_x,
69 double pt_1_y,
70 double pt_1_z,
71 double pt_2_x,
72 double pt_2_y,
73 double pt_2_z,
74 double pt_3_x,
75 double pt_3_y,
76 double pt_3_z)
77{
78 double a[3], b[3], cross[3], area;
79 a[0] = pt_2_x - pt_1_x;
80 a[1] = pt_2_y - pt_1_y;
81 a[2] = pt_2_z - pt_1_z;
82 b[0] = pt_3_x - pt_1_x;
83 b[1] = pt_3_y - pt_1_y;
84 b[2] = pt_3_z - pt_1_z;
85 CrossProduct(b, a, cross);
86 area = 0.5 * std::sqrt(cross[0] * cross[0] + cross[1] * cross[1] + cross[2] * cross[2]);
87 return area;
88}
89
91double
92PointEdgeClosestPointFindT(double const p1[], double const p2[], double const p[])
93{
94 return ((p[0] - p1[0]) * (p2[0] - p1[0]) + (p[1] - p1[1]) * (p2[1] - p1[1]) + (p[2] - p1[2]) * (p2[2] - p1[2])) /
95 ((p2[0] - p1[0]) * (p2[0] - p1[0]) + (p2[1] - p1[1]) * (p2[1] - p1[1]) + (p2[2] - p1[2]) * (p2[2] - p1[2]));
96}
97
99double
100PointEdgeClosestPointFindDistanceSquared(double const p1[], double const p2[], double const p[], double t)
101{
102 double temp1 = p1[0] + (p2[0] - p1[0]) * t - p[0];
103 double temp2 = p1[1] + (p2[1] - p1[1]) * t - p[1];
104 double temp3 = p1[2] + (p2[2] - p1[2]) * t - p[2];
105 return (temp1 * temp1 + temp2 * temp2 + temp3 * temp3);
106}
107
108void
110 std::string const& command,
111 std::vector<std::string>& primary_block_names,
112 std::vector<std::string>& secondary_block_names,
113 double& penalty_parameter);
114
116{
117 public:
124
125 class vertex
126 {
127 public:
129 vertex() = default;
131 ~vertex() = default;
133 vertex(const vertex& rhs) // copy constructor
134 {
135 for (int ii = 0; ii < 3; ++ii) coords_[ii] = rhs.coords_[ii];
136 }
138 vertex&
139 operator=(const vertex& rhs) // copy assignment
140 {
141 if (this != &rhs)
142 for (int ii = 0; ii < 3; ++ii) coords_[ii] = rhs.coords_[ii];
143 return *this;
144 }
146 double&
148 {
149 return coords_[i];
150 }
152 double
153 operator[](int i) const
154 {
155 return coords_[i];
156 }
157 //
158 double coords_[3] = {0.0, 0.0, 0.0};
159 };
160
162 ContactEntity() = default;
163
164 // FOr compatibility with older code
167 CONTACT_ENTITY_TYPE entity_type,
169 double const coord[],
170 double characteristic_length,
171 int node_id_for_node_1,
172 int node_id_for_node_2 = 0,
173 const int node_ids_for_fictitious_node[4] = 0)
175 entity_type,
177 -1,
178 coord,
179 characteristic_length,
180 node_id_for_node_1,
181 node_id_for_node_2,
182 node_ids_for_fictitious_node)
183 {
184 }
185
188 CONTACT_ENTITY_TYPE entity_type,
190 int contact_entity_local_id,
191 double const coord[],
192 double characteristic_length,
193 int node_id_for_node_1,
194 int node_id_for_node_2 = 0,
195 const int node_ids_for_fictitious_node[4] = 0)
196 : entity_type_(entity_type),
197 char_len_(characteristic_length),
199 local_id_(contact_entity_local_id)
200 {
201 // contact entities must be either nodes (one node) or trianglular faces
202 // (three nodes)
203 if (entity_type_ == NODE) {
204 num_nodes_ = 1;
205 node_id_for_node_1_ = node_id_for_node_1;
206 } else if (entity_type_ == TRIANGLE) {
207 num_nodes_ = 3;
208 node_id_for_node_1_ = node_id_for_node_1;
209 node_id_for_node_2_ = node_id_for_node_2;
210 node_id_1_for_fictitious_node_ = node_ids_for_fictitious_node[0];
211 node_id_2_for_fictitious_node_ = node_ids_for_fictitious_node[1];
212 node_id_3_for_fictitious_node_ = node_ids_for_fictitious_node[2];
213 node_id_4_for_fictitious_node_ = node_ids_for_fictitious_node[3];
214 } else {
215 printf("\n**** Error in ContactEntity constructor, invalid entity type.\n");
216 }
217
218 coord_1_x_ = coord[0];
219 coord_1_y_ = coord[1];
220 coord_1_z_ = coord[2];
221 if (entity_type_ == TRIANGLE) {
222 coord_2_x_ = coord[3];
223 coord_2_y_ = coord[4];
224 coord_2_z_ = coord[5];
225 coord_3_x_ = coord[6];
226 coord_3_y_ = coord[7];
227 coord_3_z_ = coord[8];
228 }
230 }
231
233 ~ContactEntity() = default;
234
235 template <typename ArgT>
237 SetCoordinates(ArgT coord)
238 {
239 int n0 = 3 * node_id_for_node_1_;
240 coord_1_x_ = coord[n0];
241 coord_1_y_ = coord[n0 + 1];
242 coord_1_z_ = coord[n0 + 2];
243 if (entity_type_ == TRIANGLE) {
244 n0 = 3 * node_id_for_node_2_;
245 coord_2_x_ = coord[n0];
246 coord_2_y_ = coord[n0 + 1];
247 coord_2_z_ = coord[n0 + 2];
252 coord_3_x_ = (coord[n0] + coord[n1] + coord[n2] + coord[n3]) / 4.0;
253 coord_3_y_ = (coord[n0 + 1] + coord[n1 + 1] + coord[n2 + 1] + coord[n3 + 1]) / 4.0;
254 coord_3_z_ = (coord[n0 + 2] + coord[n1 + 2] + coord[n2 + 2] + coord[n3 + 2]) / 4.0;
255 }
257 }
258
259 template <typename ArgT>
262 {
263 int n = 3 * node_id_for_node_1_;
264#ifdef NIMBLE_HAVE_KOKKOS
265 Kokkos::atomic_add(&force[n], force_1_x_);
266 Kokkos::atomic_add(&force[n + 1], force_1_y_);
267 Kokkos::atomic_add(&force[n + 2], force_1_z_);
268#else
269 force[n] += force_1_x_;
270 force[n + 1] += force_1_y_;
271 force[n + 2] += force_1_z_;
272#endif
273 if (entity_type_ == TRIANGLE) {
274 n = 3 * node_id_for_node_2_;
275#ifdef NIMBLE_HAVE_KOKKOS
276 Kokkos::atomic_add(&force[n], force_2_x_);
277 Kokkos::atomic_add(&force[n + 1], force_2_y_);
278 Kokkos::atomic_add(&force[n + 2], force_2_z_);
279#else
280 force[n] += force_2_x_;
281 force[n + 1] += force_2_y_;
282 force[n + 2] += force_2_z_;
283#endif
284 std::vector<int> list{
289 for (const auto n : list) {
290#ifdef NIMBLE_HAVE_KOKKOS
291 Kokkos::atomic_add(&force[n], force_3_x_ / 4.0);
292 Kokkos::atomic_add(&force[n + 1], force_3_y_ / 4.0);
293 Kokkos::atomic_add(&force[n + 2], force_3_z_ / 4.0);
294#else
295 force[n] += force_3_x_ / 4.0;
296 force[n + 1] += force_3_y_ / 4.0;
297 force[n + 2] += force_3_z_ / 4.0;
298#endif
299 }
300 }
301 }
302
303 // functions required for NimbleSMExtras contact search
305 double
306 get_x_min() const
307 {
308 return bounding_box_x_min_;
309 }
311 double
312 get_x_max() const
313 {
314 return bounding_box_x_max_;
315 }
317 double
318 get_y_min() const
319 {
320 return bounding_box_y_min_;
321 }
323 double
324 get_y_max() const
325 {
326 return bounding_box_y_max_;
327 }
329 double
330 get_z_min() const
331 {
332 return bounding_box_z_min_;
333 }
335 double
336 get_z_max() const
337 {
338 return bounding_box_z_max_;
339 }
340
341 // Functions for bvh contact search
343 int
348
350 int
351 local_id() const noexcept
352 {
353 return local_id_;
354 }
355
357 vertex
358 centroid() const
359 {
360 return centroid_;
361 }
362
363 void
364 ExportGeometryInto(ContactEntity& xerox) const;
365
367 bool
368 contact_status() const noexcept
369 {
370 return contact_status_;
371 }
372
374 void
375 set_contact_status(bool status) noexcept
376 {
377#ifdef NIMBLE_HAVE_KOKKOS
378 Kokkos::atomic_store(&contact_status_, status);
379#else
380 contact_status_ = status;
381#endif
382 }
383
384#ifdef NIMBLE_HAVE_BVH
385 bvh::bphase_kdop kdop_;
386
387 void
388 RecomputeKdop()
389 {
390 const double inflation_length = inflation_factor * char_len_;
391 if (entity_type_ == NODE) {
392 vertex v;
393 v[0] = coord_1_x_;
394 v[1] = coord_1_y_;
395 v[2] = coord_1_z_;
396 kdop_ = bvh::bphase_kdop::from_vertices(&v, &v + 1, inflation_length);
397 } else {
398 // entity_type_ == TRIANGLE
399 vertex v[3];
400 v[0][0] = coord_1_x_;
401 v[0][1] = coord_1_y_;
402 v[0][2] = coord_1_z_;
403 v[1][0] = coord_2_x_;
404 v[1][1] = coord_2_y_;
405 v[1][2] = coord_2_z_;
406 v[2][0] = coord_3_x_;
407 v[2][1] = coord_3_y_;
408 v[2][2] = coord_3_z_;
409 kdop_ = bvh::bphase_kdop::from_vertices(v, v + 3, inflation_length);
410 }
411 }
412
413 bvh::bphase_kdop
414 Kdop() const
415 {
416 return kdop_;
417 }
418#endif
419
420 /// \brief Distribute input force among node(s) of the entity
421 ///
422 /// \param contact_force Input force to distribute
423 /// \param N Array of barycentric coordinates when entity is triangular face
424 ///
425 /// \note Array N is not accessed when the entity is a node.
426 /// \note Indices for node(s) of the entity are not accessed.
428 void
429 SetNodalContactForces(const double* const contact_force, const double* const N = nullptr)
430 {
431 switch (entity_type_) {
432 default: break;
433 case NODE:
434 force_1_x_ = -contact_force[0];
435 force_1_y_ = -contact_force[1];
436 force_1_z_ = -contact_force[2];
437 break;
438 case TRIANGLE:
439 if (N == nullptr) {
440 throw std::invalid_argument("\n Null pointer provided.\n\n");
441 }
442 force_1_x_ = N[0] * contact_force[0];
443 force_1_y_ = N[0] * contact_force[1];
444 force_1_z_ = N[0] * contact_force[2];
445 force_2_x_ = N[1] * contact_force[0];
446 force_2_y_ = N[1] * contact_force[1];
447 force_2_z_ = N[1] * contact_force[2];
448 force_3_x_ = N[2] * contact_force[0];
449 force_3_y_ = N[2] * contact_force[1];
450 force_3_z_ = N[2] * contact_force[2];
451 break;
452 }
453 }
454
455 // DEPRECATED
457 void
458 ComputeNodalContactForces(const double* const contact_force, const double* const closest_point_projection)
459 {
460 double N[3] = {0.0, 0.0, 0.0};
461
462 if (entity_type_ == NODE) {
463 N[0] = 1.0;
464 } else if (entity_type_ == TRIANGLE) {
465 // Find the natural coordinates of the closest_point_projection
466 double area_1 = TriangleArea(
467 closest_point_projection[0],
468 closest_point_projection[1],
469 closest_point_projection[2],
475 coord_3_z_);
476 double area_2 = TriangleArea(
480 closest_point_projection[0],
481 closest_point_projection[1],
482 closest_point_projection[2],
485 coord_3_z_);
486 double full_area = TriangleArea(
488 N[0] = area_1 / full_area;
489 N[1] = area_2 / full_area;
490 N[2] = 1.0 - N[0] - N[1];
491 }
492
493 force_1_x_ = N[0] * contact_force[0];
494 force_1_y_ = N[0] * contact_force[1];
495 force_1_z_ = N[0] * contact_force[2];
496 if (entity_type_ == TRIANGLE) {
497 force_2_x_ = N[1] * contact_force[0];
498 force_2_y_ = N[1] * contact_force[1];
499 force_2_z_ = N[1] * contact_force[2];
500 force_3_x_ = N[2] * contact_force[0];
501 force_3_y_ = N[2] * contact_force[1];
502 force_3_z_ = N[2] * contact_force[2];
503 }
504 }
505
506 void
508 {
509 contact_status_ = false;
510 }
511
512 protected:
513 /// \brief Create a bounding box centered around the entity
514 ///
515 /// \note This function is only called within the class ContactEntity
516 void
518
519 public:
520 //--- List of friend functions
521 template <typename ArgT>
522 friend void
523 SerializeContactFaces(int num_entities, ArgT contact_entities, std::vector<char>& buffer);
524
525 template <typename ArgT>
526 friend void
527 UnserializeContactFaces(int num_entities, ArgT contact_entities, std::vector<char>& buffer);
528
529 public:
530 // positions of nodes that define triangular contact patch
532 int num_nodes_ = 0;
533 double coord_1_x_ = 0.0;
534 double coord_1_y_ = 0.0;
535 double coord_1_z_ = 0.0;
536 double coord_2_x_ = 0.0;
537 double coord_2_y_ = 0.0;
538 double coord_2_z_ = 0.0;
539 double coord_3_x_ = 0.0;
540 double coord_3_y_ = 0.0;
541 double coord_3_z_ = 0.0;
542 double force_1_x_ = 0.0;
543 double force_1_y_ = 0.0;
544 double force_1_z_ = 0.0;
545 double force_2_x_ = 0.0;
546 double force_2_y_ = 0.0;
547 double force_2_z_ = 0.0;
548 double force_3_x_ = 0.0;
549 double force_3_y_ = 0.0;
550 double force_3_z_ = 0.0;
551
552 /// \brief Factor multiplying characteristic length to inflate bounding box
553 ///
554 /// \note Empirical default value 0.15
555 double inflation_factor = 0.15;
556
557 double char_len_ = 0.0;
558
559 // bounding box for NimbleSMExtras contact search routines
560 double bounding_box_x_min_ = -DBL_MAX;
561 double bounding_box_x_max_ = DBL_MAX;
562 double bounding_box_y_min_ = -DBL_MAX;
563 double bounding_box_y_max_ = DBL_MAX;
564 double bounding_box_z_min_ = -DBL_MAX;
565 double bounding_box_z_max_ = DBL_MAX;
566
567 // centroid for bvh search routines
569
570 // map for moving displacement/forces to/from the contact manager data
571 // structures
574 // fictitious node maps to multiple real nodes
579
580 // store a unique global id
581 // NODE:
582 // the contact_entity_global_id_ is the exodus global node id in the parent
583 // FEM mesh
584 // FACE:
585 // the contact_entity_global_id_ is a bit-wise combination of the global
586 // element id, the face ordinal, and the triangle ordinal first 2 bits are
587 // the triangle ordinal (range is 1-4) next 3 bits are the face ordinal
588 // (range is 1-6) remaining bits are the genesis element id from the parent
589 // FEM mesh (e.g., the global id of the hex from which the face was
590 // extracted)
592
593 int local_id_ = -1;
594
595 bool contact_status_ = false;
596};
597
598template <typename ArgT>
599void
600SerializeContactFaces(int num_entities, ArgT contact_entities, std::vector<char>& buffer)
601{
602 constexpr size_t size_int = sizeof(int);
603 constexpr size_t size_double = sizeof(double);
604 size_t entity_size = 10 * sizeof(double) + 8 * sizeof(int);
605 buffer.resize(entity_size * num_entities);
606 char* scan = &buffer[0];
607 for (int i = 0; i < num_entities; i++) {
608 memcpy(scan, &contact_entities[i].coord_1_x_, size_double);
609 scan += size_double;
610 memcpy(scan, &contact_entities[i].coord_1_y_, size_double);
611 scan += size_double;
612 memcpy(scan, &contact_entities[i].coord_1_z_, size_double);
613 scan += size_double;
614 memcpy(scan, &contact_entities[i].coord_2_x_, size_double);
615 scan += size_double;
616 memcpy(scan, &contact_entities[i].coord_2_y_, size_double);
617 scan += size_double;
618 memcpy(scan, &contact_entities[i].coord_2_z_, size_double);
619 scan += size_double;
620 memcpy(scan, &contact_entities[i].coord_3_x_, size_double);
621 scan += size_double;
622 memcpy(scan, &contact_entities[i].coord_3_y_, size_double);
623 scan += size_double;
624 memcpy(scan, &contact_entities[i].coord_3_z_, size_double);
625 scan += size_double;
626 memcpy(scan, &contact_entities[i].char_len_, size_double);
627 scan += size_double;
628 memcpy(scan, &contact_entities[i].contact_entity_global_id_, size_int);
629 scan += size_int;
630 memcpy(scan, &contact_entities[i].node_id_for_node_1_, size_int);
631 scan += size_int;
632 memcpy(scan, &contact_entities[i].node_id_for_node_2_, size_int);
633 scan += size_int;
634 memcpy(scan, &contact_entities[i].node_id_1_for_fictitious_node_, size_int);
635 scan += size_int;
636 memcpy(scan, &contact_entities[i].node_id_2_for_fictitious_node_, size_int);
637 scan += size_int;
638 memcpy(scan, &contact_entities[i].node_id_3_for_fictitious_node_, size_int);
639 scan += size_int;
640 memcpy(scan, &contact_entities[i].node_id_4_for_fictitious_node_, size_int);
641 scan += size_int;
642 }
643}
644
645template <typename ArgT>
646void
647UnserializeContactFaces(int num_entities, ArgT contact_entities, std::vector<char>& buffer)
648{
649 constexpr size_t size_int = sizeof(int);
650 constexpr size_t size_double = sizeof(double);
651 ContactEntity entity;
653 entity.num_nodes_ = 3;
654 entity.force_1_x_ = 0.0;
655 entity.force_1_y_ = 0.0;
656 entity.force_1_z_ = 0.0;
657 entity.force_2_x_ = 0.0;
658 entity.force_2_y_ = 0.0;
659 entity.force_2_z_ = 0.0;
660 entity.force_3_x_ = 0.0;
661 entity.force_3_y_ = 0.0;
662 entity.force_3_z_ = 0.0;
663 char* scan = &buffer[0];
664 for (int i = 0; i < num_entities; i++) {
665 memcpy(&entity.coord_1_x_, scan, size_double);
666 scan += size_double;
667 memcpy(&entity.coord_1_y_, scan, size_double);
668 scan += size_double;
669 memcpy(&entity.coord_1_z_, scan, size_double);
670 scan += size_double;
671 memcpy(&entity.coord_2_x_, scan, size_double);
672 scan += size_double;
673 memcpy(&entity.coord_2_y_, scan, size_double);
674 scan += size_double;
675 memcpy(&entity.coord_2_z_, scan, size_double);
676 scan += size_double;
677 memcpy(&entity.coord_3_x_, scan, size_double);
678 scan += size_double;
679 memcpy(&entity.coord_3_y_, scan, size_double);
680 scan += size_double;
681 memcpy(&entity.coord_3_z_, scan, size_double);
682 scan += size_double;
683 memcpy(&entity.char_len_, scan, size_double);
684 scan += size_double;
685 memcpy(&entity.contact_entity_global_id_, scan, size_int);
686 scan += size_int;
687 memcpy(&entity.node_id_for_node_1_, scan, size_int);
688 scan += size_int;
689 memcpy(&entity.node_id_for_node_2_, scan, size_int);
690 scan += size_int;
691 memcpy(&entity.node_id_1_for_fictitious_node_, scan, size_int);
692 scan += size_int;
693 memcpy(&entity.node_id_2_for_fictitious_node_, scan, size_int);
694 scan += size_int;
695 memcpy(&entity.node_id_3_for_fictitious_node_, scan, size_int);
696 scan += size_int;
697 memcpy(&entity.node_id_4_for_fictitious_node_, scan, size_int);
698 scan += size_int;
699 entity.SetBoundingBox();
700 contact_entities[i] = entity;
701 }
702}
703
704#ifdef NIMBLE_HAVE_BVH
705// Free functions for accessing entity info for bvh
706bvh::bphase_kdop
707get_entity_kdop(const ContactEntity& _entity);
708std::size_t
709get_entity_global_id(const ContactEntity& _entity);
710bvh::m::vec3d
711get_entity_centroid(const ContactEntity& _entity);
712#endif
713
714} // namespace nimble
715
716#endif // NIMBLE_CONTACTENTITY_H
Definition nimble_contact_entity.h:126
NIMBLE_INLINE_FUNCTION vertex()=default
NIMBLE_INLINE_FUNCTION vertex(const vertex &rhs)
Definition nimble_contact_entity.h:133
NIMBLE_INLINE_FUNCTION double operator[](int i) const
Definition nimble_contact_entity.h:153
NIMBLE_INLINE_FUNCTION double & operator[](int i)
Definition nimble_contact_entity.h:147
NIMBLE_INLINE_FUNCTION vertex & operator=(const vertex &rhs)
Definition nimble_contact_entity.h:139
double coords_[3]
Definition nimble_contact_entity.h:158
NIMBLE_INLINE_FUNCTION ~vertex()=default
Definition nimble_contact_entity.h:116
double coord_1_y_
Definition nimble_contact_entity.h:534
double coord_2_z_
Definition nimble_contact_entity.h:538
double force_1_y_
Definition nimble_contact_entity.h:543
int node_id_4_for_fictitious_node_
Definition nimble_contact_entity.h:578
double force_3_y_
Definition nimble_contact_entity.h:549
double bounding_box_y_max_
Definition nimble_contact_entity.h:563
int node_id_for_node_1_
Definition nimble_contact_entity.h:572
int node_id_for_node_2_
Definition nimble_contact_entity.h:573
double bounding_box_z_min_
Definition nimble_contact_entity.h:564
double force_3_z_
Definition nimble_contact_entity.h:550
double force_2_x_
Definition nimble_contact_entity.h:545
enum nimble::ContactEntity::ContactEntityType CONTACT_ENTITY_TYPE
NIMBLE_INLINE_FUNCTION ContactEntity(CONTACT_ENTITY_TYPE entity_type, int contact_entity_global_id, int contact_entity_local_id, double const coord[], double characteristic_length, int node_id_for_node_1, int node_id_for_node_2=0, const int node_ids_for_fictitious_node[4]=0)
Definition nimble_contact_entity.h:187
void SetBoundingBox()
Create a bounding box centered around the entity.
Definition nimble_contact_entity.cc:76
int contact_entity_global_id_
Definition nimble_contact_entity.h:591
friend void UnserializeContactFaces(int num_entities, ArgT contact_entities, std::vector< char > &buffer)
Definition nimble_contact_entity.h:647
bool contact_status_
Definition nimble_contact_entity.h:595
NIMBLE_INLINE_FUNCTION void ComputeNodalContactForces(const double *const contact_force, const double *const closest_point_projection)
Definition nimble_contact_entity.h:458
NIMBLE_INLINE_FUNCTION bool contact_status() const noexcept
Definition nimble_contact_entity.h:368
double bounding_box_z_max_
Definition nimble_contact_entity.h:565
NIMBLE_INLINE_FUNCTION void SetNodalContactForces(const double *const contact_force, const double *const N=nullptr)
Distribute input force among node(s) of the entity.
Definition nimble_contact_entity.h:429
NIMBLE_INLINE_FUNCTION double get_x_max() const
Definition nimble_contact_entity.h:312
double force_1_x_
Definition nimble_contact_entity.h:542
ContactEntityType
Definition nimble_contact_entity.h:119
@ TRIANGLE
Definition nimble_contact_entity.h:122
@ NONE
Definition nimble_contact_entity.h:120
@ NODE
Definition nimble_contact_entity.h:121
double coord_3_x_
Definition nimble_contact_entity.h:539
double coord_1_x_
Definition nimble_contact_entity.h:533
double coord_3_z_
Definition nimble_contact_entity.h:541
double char_len_
Definition nimble_contact_entity.h:557
double bounding_box_y_min_
Definition nimble_contact_entity.h:562
vertex centroid_
Definition nimble_contact_entity.h:568
void ExportGeometryInto(ContactEntity &xerox) const
Definition nimble_contact_entity.cc:50
NIMBLE_INLINE_FUNCTION ContactEntity(CONTACT_ENTITY_TYPE entity_type, int contact_entity_global_id, double const coord[], double characteristic_length, int node_id_for_node_1, int node_id_for_node_2=0, const int node_ids_for_fictitious_node[4]=0)
Definition nimble_contact_entity.h:166
NIMBLE_INLINE_FUNCTION int local_id() const noexcept
Definition nimble_contact_entity.h:351
double coord_2_x_
Definition nimble_contact_entity.h:536
NIMBLE_INLINE_FUNCTION vertex centroid() const
Definition nimble_contact_entity.h:358
NIMBLE_INLINE_FUNCTION int contact_entity_global_id() const
Definition nimble_contact_entity.h:344
double force_2_z_
Definition nimble_contact_entity.h:547
friend void SerializeContactFaces(int num_entities, ArgT contact_entities, std::vector< char > &buffer)
Definition nimble_contact_entity.h:600
int local_id_
Definition nimble_contact_entity.h:593
double bounding_box_x_max_
Definition nimble_contact_entity.h:561
double coord_2_y_
Definition nimble_contact_entity.h:537
int node_id_2_for_fictitious_node_
Definition nimble_contact_entity.h:576
NIMBLE_INLINE_FUNCTION ~ContactEntity()=default
double inflation_factor
Factor multiplying characteristic length to inflate bounding box.
Definition nimble_contact_entity.h:555
double force_1_z_
Definition nimble_contact_entity.h:544
NIMBLE_INLINE_FUNCTION double get_y_min() const
Definition nimble_contact_entity.h:318
void ResetContactData()
Definition nimble_contact_entity.h:507
CONTACT_ENTITY_TYPE entity_type_
Definition nimble_contact_entity.h:531
NIMBLE_INLINE_FUNCTION void SetCoordinates(ArgT coord)
Definition nimble_contact_entity.h:237
int node_id_1_for_fictitious_node_
Definition nimble_contact_entity.h:575
int node_id_3_for_fictitious_node_
Definition nimble_contact_entity.h:577
double force_3_x_
Definition nimble_contact_entity.h:548
NIMBLE_INLINE_FUNCTION double get_y_max() const
Definition nimble_contact_entity.h:324
NIMBLE_INLINE_FUNCTION void ScatterForceToContactManagerForceVector(ArgT &force) const
Definition nimble_contact_entity.h:261
double coord_3_y_
Definition nimble_contact_entity.h:540
NIMBLE_INLINE_FUNCTION ContactEntity()=default
NIMBLE_INLINE_FUNCTION double get_x_min() const
Definition nimble_contact_entity.h:306
NIMBLE_INLINE_FUNCTION void set_contact_status(bool status) noexcept
Definition nimble_contact_entity.h:375
double coord_1_z_
Definition nimble_contact_entity.h:535
NIMBLE_INLINE_FUNCTION double get_z_max() const
Definition nimble_contact_entity.h:336
double force_2_y_
Definition nimble_contact_entity.h:546
int num_nodes_
Definition nimble_contact_entity.h:532
double bounding_box_x_min_
Definition nimble_contact_entity.h:560
NIMBLE_INLINE_FUNCTION double get_z_min() const
Definition nimble_contact_entity.h:330
Definition kokkos_contact_manager.h:49
void SerializeContactFaces(int num_entities, ArgT contact_entities, std::vector< char > &buffer)
Definition nimble_contact_entity.h:600
void ParseContactCommand(std::string const &command, std::vector< std::string > &primary_block_names, std::vector< std::string > &secondary_block_names, double &penalty_parameter)
Definition nimble_contact_manager.cc:96
void UnserializeContactFaces(int num_entities, ArgT contact_entities, std::vector< char > &buffer)
Definition nimble_contact_entity.h:647
NIMBLE_INLINE_FUNCTION double PointEdgeClosestPointFindDistanceSquared(double const p1[], double const p2[], double const p[], double t)
Definition nimble_contact_entity.h:100
NIMBLE_INLINE_FUNCTION double PointEdgeClosestPointFindT(double const p1[], double const p2[], double const p[])
Definition nimble_contact_entity.h:92
NIMBLE_INLINE_FUNCTION double TriangleArea(double pt_1_x, double pt_1_y, double pt_1_z, double pt_2_x, double pt_2_y, double pt_2_z, double pt_3_x, double pt_3_y, double pt_3_z)
Definition nimble_contact_entity.h:67
@ NODE
Definition nimble_data_utils.h:60
#define NIMBLE_INLINE_FUNCTION
Definition nimble_defs.h:50
NIMBLE_INLINE_FUNCTION void CrossProduct(const ScalarT *const u, const ScalarT *const v, ScalarT *const result)
Definition nimble_utils.h:395