waves
Basic FE playground
ContactsList.h
Go to the documentation of this file.
1 #ifndef KATOPTRON_CONTACTSLIST_H
2 #define KATOPTRON_CONTACTSLIST_H
3 
4 #include "katoptron.h"
5 
6 #include "Map.h"
7 #include "NodesList.h"
8 #include "ElementsList.h"
9 
10 #include <Tpetra_Map.hpp>
11 #include <Tpetra_Vector.hpp>
12 #include <Teuchos_RCP.hpp>
13 #include <Kokkos_ViewFactory.hpp>
14 
15 namespace katoptron
16 {
17 
22 {
23 private:
24  bool at_least_one_sticking = false;
25 
28 
29  Kokkos::View<global_ordinal_type **, Kokkos::LayoutRight> contacts;
30  Kokkos::View<global_ordinal_type **, Kokkos::LayoutRight> contacts_dirichlet;
31 
32  Kokkos::View<local_ordinal_type *, Kokkos::LayoutRight> shape_function;
33 
34  Kokkos::View<local_ordinal_type *, Kokkos::LayoutRight> signorini;
35 
36  Kokkos::View<local_ordinal_type *, Kokkos::LayoutRight> initially_open;
37 
38  Kokkos::View<local_ordinal_type *, Kokkos::LayoutRight> no_update;
39  Kokkos::View<local_ordinal_type *, Kokkos::LayoutRight> sticking;
40  Kokkos::View<local_ordinal_type *, Kokkos::LayoutRight> mesh_tying;
41 
42  Kokkos::View<double *, Kokkos::LayoutRight> contacts_scale;
43 
44  Kokkos::View<local_ordinal_type **, Kokkos::LayoutRight> initially_closed_nodes;
45 
46  Kokkos::View<double **, Kokkos::LayoutRight> contacts_normal;
47 
59 
60 public:
61  ContactsList(Problem &pbl, Teuchos::RCP<Map> map, Teuchos::RCP<ElementsList> elementsList,
62  Teuchos::RCP<NodesList> nodesList);
63 
65  {
66  Kokkos::resize(contacts, 0, 0);
67  Kokkos::resize(contacts_normal, 0, 0);
68  Kokkos::resize(shape_function, 0);
69  Kokkos::resize(signorini, 0);
70  Kokkos::resize(initially_open, 0);
71  Kokkos::resize(no_update, 0);
72  Kokkos::resize(sticking, 0);
73  Kokkos::resize(mesh_tying, 0);
74  Kokkos::resize(contacts_scale, 0);
75  Kokkos::resize(contacts_dirichlet, 0, 0);
76  Kokkos::resize(initially_closed_nodes, 0, 0);
77  }
78 
84 
95  {
97  }
98 
109  {
111  }
112 
123  {
125  }
126 
137  {
139  }
140 
152  {
153  return contacts(i, contacts_slave_nodes + n1);
154  }
155 
167  {
168  return contacts(i, contacts_slave_elems + e1);
169  }
170 
182  {
183  return contacts(i, contacts_master_nodes + n1);
184  }
185 
197  {
198  return contacts(i, contacts_master_elems + e1);
199  }
200 
212  {
213  return contacts_normal(i, j);
214  }
215 
227  {
228  return contacts_normal(i, j + 3);
229  }
230 
241  {
242  return shape_function(i) == 1;
243  }
244 
255  {
256  return initially_open(i) == 1;
257  }
258 
269  {
270  return initially_open(i) == 0;
271  }
272 
283  {
284  return no_update(i) == 0;
285  }
286 
297  {
298  return no_update(i) == 1;
299  }
300 
311  {
312  return sticking(i);
313  }
314 
325  {
326  return mesh_tying(i);
327  }
328 
332  inline bool hasAtLeastOneSticking(void)
333  {
334  return at_least_one_sticking;
335  }
336 
347  {
348  return signorini(i) == 1;
349  }
350 
361  {
362  return signorini(i) == 0;
363  }
364 
369  inline bool isSignorini()
370  {
371  for (local_ordinal_type i = 0; i < contacts_number; ++i)
372  if (isSignorini(i))
373  return true;
374  return false;
375  }
376 
381  inline bool isNotSignorini()
382  {
383  for (local_ordinal_type i = 0; i < contacts_number; ++i)
384  if (isSignorini(i))
385  return false;
386  return true;
387  }
388 
399  {
400  return contacts_dirichlet(i, 0);
401  }
402 
413  {
414  return contacts_scale(i);
415  }
416 
428  {
430  if (size == 0)
431  return false;
432  for (auto j2 = 0; j2 < size; ++j2)
433  if (j == getSlaveNode(i, j2))
434  return true;
435  return false;
436  }
437 
448  {
449  for (local_ordinal_type i = 0; i < contacts_number; ++i)
450  if (isASlaveNode(i, j))
451  return i;
452  return 0;
453  }
454 
466  {
468  if (size == 0)
469  return false;
470  for (auto j2 = 0; j2 < size; ++j2)
471  if (j == contacts_dirichlet(i, j2 + 1))
472  return true;
473  return false;
474  }
475 
487  {
489  if (size == 0)
490  return false;
491  for (auto j2 = 0; j2 < size; ++j2)
492  if (j == initially_closed_nodes(i, j2 + 1))
493  return true;
494  return false;
495  }
496 };
497 
498 }; // namespace katoptron
499 
500 #endif //KATOPTRON_CONTACTSLIST_H
katoptron::Map::local_ordinal_type
int local_ordinal_type
Definition: Map.h:27
katoptron::ContactsList::initially_open
Kokkos::View< local_ordinal_type *, Kokkos::LayoutRight > initially_open
Definition: ContactsList.h:36
katoptron::ContactsList::~ContactsList
~ContactsList()
Definition: ContactsList.h:64
katoptron::ContactsList::contacts_master_nodes_size
local_ordinal_type contacts_master_nodes_size
Definition: ContactsList.h:51
katoptron::ContactsList::getSlaveElement
local_ordinal_type getSlaveElement(local_ordinal_type i, local_ordinal_type e1)
Return the local ID of the slave element e1 of a given interface.
Definition: ContactsList.h:166
katoptron::ContactsList::contacts_slave_normal
local_ordinal_type contacts_slave_normal
Definition: ContactsList.h:53
katoptron::ContactsList::isTying
bool isTying(local_ordinal_type i)
Return true if the given interface is a mesh tying interface.
Definition: ContactsList.h:324
katoptron::ContactsList::ContactsList
ContactsList(Problem &pbl, Teuchos::RCP< Map > map, Teuchos::RCP< ElementsList > elementsList, Teuchos::RCP< NodesList > nodesList)
ContactsList constructor.
Definition: ContactsList.cpp:41
katoptron::ContactsList::shape_function
Kokkos::View< local_ordinal_type *, Kokkos::LayoutRight > shape_function
Definition: ContactsList.h:32
katoptron::ContactsList::slaveDirichletSize
local_ordinal_type slaveDirichletSize(local_ordinal_type i)
Return the number of Dirichlet nodes on the slave side for a given interface.
Definition: ContactsList.h:398
katoptron::ContactsList::at_least_one_sticking
bool at_least_one_sticking
Definition: ContactsList.h:24
katoptron::Map::global_ordinal_type
int global_ordinal_type
Definition: Map.h:28
katoptron::ContactsList::contacts_slave_nodes
local_ordinal_type contacts_slave_nodes
Definition: ContactsList.h:55
katoptron::ContactsList::isStandardShapeFunction
bool isStandardShapeFunction(local_ordinal_type i)
Return true if the shape functions of the Lagrange multipliers are the standard shape function for a ...
Definition: ContactsList.h:240
katoptron::ContactsList::isInitiallyClose
bool isInitiallyClose(local_ordinal_type i)
Return true if contact of the given interface is initially close.
Definition: ContactsList.h:268
katoptron::ContactsList::getInterfaceOfSlaveNode
local_ordinal_type getInterfaceOfSlaveNode(local_ordinal_type j)
Return the interface ID associated to a slave node of global ID j.
Definition: ContactsList.h:447
katoptron::ContactsList::isNotSignorini
bool isNotSignorini(local_ordinal_type i)
Return true if the given interface is not a Signorini contact interface.
Definition: ContactsList.h:360
katoptron::ContactsList::isNotUpdated
bool isNotUpdated(local_ordinal_type i)
Return true if the contact status of the given interface should not be checked.
Definition: ContactsList.h:296
katoptron::ContactsList::contacts_dirichlet
Kokkos::View< global_ordinal_type **, Kokkos::LayoutRight > contacts_dirichlet
Definition: ContactsList.h:30
katoptron::ContactsList::getMasterElementsSize
local_ordinal_type getMasterElementsSize(local_ordinal_type i)
Return the number of master elements for a given interface.
Definition: ContactsList.h:136
katoptron::ContactsList::contacts_master_elems
local_ordinal_type contacts_master_elems
Definition: ContactsList.h:58
katoptron::ContactsList::global_ordinal_type
Map::global_ordinal_type global_ordinal_type
Definition: ContactsList.h:27
katoptron::ContactsList::isSignorini
bool isSignorini(local_ordinal_type i)
Return true if the given interface is a Signorini contact interface.
Definition: ContactsList.h:346
katoptron::ContactsList::getMortarScale
double getMortarScale(local_ordinal_type i)
Return the multiplicative scale used to multiply the normals of a given interface.
Definition: ContactsList.h:412
katoptron::ContactsList::getMasterNodesSize
local_ordinal_type getMasterNodesSize(local_ordinal_type i)
Return the number of master nodes for a given interface.
Definition: ContactsList.h:122
katoptron::ContactsList::getMasterElement
local_ordinal_type getMasterElement(local_ordinal_type i, local_ordinal_type e1)
Return the local ID of the master element e1 of a given interface.
Definition: ContactsList.h:196
katoptron::ContactsList::getSlaveNormal
double getSlaveNormal(local_ordinal_type i, local_ordinal_type j)
Return the jth component of the normal vector to the slave side of a given interface.
Definition: ContactsList.h:211
katoptron::ContactsList::contacts
Kokkos::View< global_ordinal_type **, Kokkos::LayoutRight > contacts
Definition: ContactsList.h:29
katoptron::ContactsList::getSlaveElementsSize
local_ordinal_type getSlaveElementsSize(local_ordinal_type i)
Return the number of slave elements for a given interface.
Definition: ContactsList.h:108
katoptron::ContactsList::getMasterNormal
double getMasterNormal(local_ordinal_type i, local_ordinal_type j)
Return the jth component of the normal vector to the master side of a given interface.
Definition: ContactsList.h:226
katoptron::ContactsList::isUpdated
bool isUpdated(local_ordinal_type i)
Return true if the contact status of the given interface should be checked and potentially updated.
Definition: ContactsList.h:282
katoptron::ContactsList::contacts_master_normal
local_ordinal_type contacts_master_normal
Definition: ContactsList.h:54
katoptron::ContactsList::getMasterNode
global_ordinal_type getMasterNode(local_ordinal_type i, local_ordinal_type n1)
Return the global ID of the master node n1 of a given interface.
Definition: ContactsList.h:181
katoptron::ContactsList::contacts_master_elems_size
local_ordinal_type contacts_master_elems_size
Definition: ContactsList.h:52
katoptron::ContactsList::contacts_scale
Kokkos::View< double *, Kokkos::LayoutRight > contacts_scale
Definition: ContactsList.h:42
katoptron::ContactsList
Class which is used to store the list of the contact interfaces.
Definition: ContactsList.h:21
katoptron::ContactsList::isSignorini
bool isSignorini()
Return true if at least one contact interface is a Signorini contact interface.
Definition: ContactsList.h:369
katoptron::ContactsList::local_ordinal_type
Map::local_ordinal_type local_ordinal_type
Definition: ContactsList.h:26
katoptron::ContactsList::isNodeInitiallyClosed
bool isNodeInitiallyClosed(local_ordinal_type i, local_ordinal_type j)
Return true if the Lagrange multiplier associated to the slave node of global ID j on the interface i...
Definition: ContactsList.h:486
ElementsList.h
katoptron
katoptron namespace
Definition: Algebraic.h:18
katoptron::ContactsList::getContactNumber
local_ordinal_type getContactNumber()
Return the number of contact interfaces.
Definition: ContactsList.h:83
katoptron::ContactsList::isASlaveNode
bool isASlaveNode(local_ordinal_type i, global_ordinal_type j)
Return true if the node of global ID j is a slave node of the interface i.
Definition: ContactsList.h:427
katoptron::ContactsList::mesh_tying
Kokkos::View< local_ordinal_type *, Kokkos::LayoutRight > mesh_tying
Definition: ContactsList.h:40
katoptron::ContactsList::contacts_number
local_ordinal_type contacts_number
Definition: ContactsList.h:48
katoptron::ContactsList::contacts_master_nodes
local_ordinal_type contacts_master_nodes
Definition: ContactsList.h:57
NodesList.h
katoptron::ContactsList::signorini
Kokkos::View< local_ordinal_type *, Kokkos::LayoutRight > signorini
Definition: ContactsList.h:34
katoptron::ContactsList::contacts_slave_nodes_size
local_ordinal_type contacts_slave_nodes_size
Definition: ContactsList.h:49
katoptron::ContactsList::isNotSignorini
bool isNotSignorini()
Return true if all the contact interfaces are not Signorini contact interfaces.
Definition: ContactsList.h:381
katoptron::ContactsList::initially_closed_nodes
Kokkos::View< local_ordinal_type **, Kokkos::LayoutRight > initially_closed_nodes
Definition: ContactsList.h:44
katoptron::ContactsList::isSticking
bool isSticking(local_ordinal_type i)
Return true if the given interface is a sticking contact interface.
Definition: ContactsList.h:310
katoptron::ContactsList::getSlaveNodesSize
local_ordinal_type getSlaveNodesSize(local_ordinal_type i)
Return the number of slave nodes for a given interface.
Definition: ContactsList.h:94
katoptron::ContactsList::contacts_slave_elems
local_ordinal_type contacts_slave_elems
Definition: ContactsList.h:56
katoptron::Problem
Class which is used to specify in Python the thermomechanical to solve.
Definition: wProblem.h:19
katoptron::ContactsList::contacts_normal
Kokkos::View< double **, Kokkos::LayoutRight > contacts_normal
Definition: ContactsList.h:46
katoptron.h
katoptron::ContactsList::hasAtLeastOneSticking
bool hasAtLeastOneSticking(void)
Return true if at least one contact interface is sticking.
Definition: ContactsList.h:332
katoptron::ContactsList::contacts_slave_elems_size
local_ordinal_type contacts_slave_elems_size
Definition: ContactsList.h:50
katoptron::ContactsList::getSlaveNode
global_ordinal_type getSlaveNode(local_ordinal_type i, local_ordinal_type n1)
Return the global ID of the slave node n1 of a given interface.
Definition: ContactsList.h:151
Map.h
katoptron::ContactsList::isInitiallyOpen
bool isInitiallyOpen(local_ordinal_type i)
Return true if contact of the given interface is initially open.
Definition: ContactsList.h:254
katoptron::ContactsList::isASlaveDirichletNode
bool isASlaveDirichletNode(local_ordinal_type i, local_ordinal_type j)
Return true if the slave node of global ID j is a Dirichlet node on the interface i.
Definition: ContactsList.h:465
katoptron::ContactsList::no_update
Kokkos::View< local_ordinal_type *, Kokkos::LayoutRight > no_update
Definition: ContactsList.h:38
katoptron::ContactsList::sticking
Kokkos::View< local_ordinal_type *, Kokkos::LayoutRight > sticking
Definition: ContactsList.h:39