element_element_constraint_elements.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef ELEMENT_ELEMENT_CONSTRAINT_ELEMENTS_HEADER
6 #define ELEMENT_ELEMENT_CONSTRAINT_ELEMENTS_HEADER
7 
8 #include "constraint_elements.h"
9 
10 // TODO these haven't been tested and probably have several issues.
11 
12 namespace oomph
13 {
14  // Helper class containing a single static function.
15  // Get the data of an element and return them in a known order: local nodes, external data
17  {
18  public:
20  };
21 
22  // Constrain two elements. Collects the local and external data of the elements and adds them as
23 
24  // Must call construct_lagrange_multipliers() in the constructor of any derived class
26  {
27  public:
32  {
33  //
34  build(elem_pt);
35  }
36 
37 
38  protected:
39  FiniteElement* elem_pt(const unsigned& i)
40  {
41  #ifdef RANGE_CHECKING
42  if(i>=N_Element)
43  {
44  throw OomphLibError(std::to_string(i) + " is greater than the number of elements " + std::to_string(N_Element),
47  }
48  #endif
49  return Element_pt[i];
50  }
51 
52  // Get the ith data of the eth element
53  Data* node_pt(const unsigned& e, const unsigned& i)
54  {
56  }
57  // Get the ith internal of the eth element
58  Data* extern_data_pt(const unsigned& e, const unsigned& i)
59  {
61  }
62  // Get the ith external of the eth element
63  Data* intern_data_pt(const unsigned& e, const unsigned& i)
64  {
66  }
67 
68  const int node_eqn(const unsigned& e, const unsigned& i, const unsigned& j)
69  {
71  }
72  const int extern_data_eqn(const unsigned& e, const unsigned& i, const unsigned& j)
73  {
75  }
76  const int intern_data_eqn(const unsigned& e, const unsigned& i, const unsigned& j)
77  {
79  }
80 
81  private:
82  // Finish the element build
84  // Number of elements constrained
85  unsigned N_Element;
86  // Pointers to the two elements
88  // The lookup for the external data local index for the nodes of the element
90  // Number of nodes in each element
92  // The lookup for the external data local index for the internal data of the element
94  // Number of internal data in each element
96  // The lookup for the external data local index for the external data of the element
98  // Number of external data in each element
100  };
101 
102 
103 
104 
105 
106 
107  // A specific reimplementation of ElementElementConstraintElement which enforces that interpolated solid dofs at
108  // all specified indicies of the nodes passed to the constructor are identical in value
110  {
111  public:
112  // Pointers to the nodes which own the dofs which are to be pinned. Pass in the list of indices which are to be mortared
113  // for this mortaring element a list of indices must be passed since there is no general way of finding how many values
114  // an element can sensibly interpolate from the nodes
117  const Vector<unsigned>& mortared_dimensions = {0,1,2}) :
119  ElementElementConstraintElement({elem0_pt, elem1_pt}),
120  Local_Coord({s0, s1}),
121  Mortared_Dimensions(mortared_dimensions)
122  {
123  if(elem0_pt->dim() != elem1_pt->dim())
124  {
125  // Throw an error
126  throw OomphLibError("The elements do not have the same dimension",
129  }
130  // There are never more than 3 dimensions
131  if(mortared_dimensions.size()>elem0_pt->dim())
132  {
133  // Throw an error
134  throw OomphLibError("Specified more than " + std::to_string(elem0_pt->dim()) + " dimensions to pin",
137  }
138 
140  }
141 
142  protected:
143  // Generic interface for evaluating constraint functions
144  // - must re-size the error vector to the number of constraints being enforced
145  void evaluate_constraint_functions(Vector<double>& error);
146  private:
149  };
150 } // End namespace
151 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Definition: constraint_elements.h:82
virtual void construct_lagrange_multipliers()
Definition: constraint_elements.cc:76
ConstraintElement(Vector< Data * > &data_pt)
Definition: constraint_elements.h:85
Definition: nodes.h:86
Definition: element_element_constraint_elements.h:17
static Vector< Data * > element_pt_to_data_pt(Vector< FiniteElement * > elem_pt)
Definition: element_element_constraint_elements.cc:14
Definition: element_element_constraint_elements.h:26
const int extern_data_eqn(const unsigned &e, const unsigned &i, const unsigned &j)
Definition: element_element_constraint_elements.h:72
Vector< unsigned > N_External_Data
Definition: element_element_constraint_elements.h:99
Vector< FiniteElement * > Element_pt
Definition: element_element_constraint_elements.h:87
Data * intern_data_pt(const unsigned &e, const unsigned &i)
Definition: element_element_constraint_elements.h:63
const int node_eqn(const unsigned &e, const unsigned &i, const unsigned &j)
Definition: element_element_constraint_elements.h:68
Vector< unsigned > N_Node
Definition: element_element_constraint_elements.h:91
Vector< Vector< unsigned > > Internal_Data_Local_Index
Definition: element_element_constraint_elements.h:93
Vector< unsigned > N_Internal_Data
Definition: element_element_constraint_elements.h:95
const int intern_data_eqn(const unsigned &e, const unsigned &i, const unsigned &j)
Definition: element_element_constraint_elements.h:76
Vector< Vector< unsigned > > Node_Local_Index
Definition: element_element_constraint_elements.h:89
Vector< Vector< unsigned > > External_Data_Local_Index
Definition: element_element_constraint_elements.h:97
unsigned N_Element
Definition: element_element_constraint_elements.h:85
FiniteElement * elem_pt(const unsigned &i)
Definition: element_element_constraint_elements.h:39
Data * node_pt(const unsigned &e, const unsigned &i)
Definition: element_element_constraint_elements.h:53
ElementElementConstraintElement(Vector< FiniteElement * > elem_pt)
Definition: element_element_constraint_elements.h:28
Data * extern_data_pt(const unsigned &e, const unsigned &i)
Definition: element_element_constraint_elements.h:58
void build(Vector< FiniteElement * > &elem_pt)
Definition: element_element_constraint_elements.cc:54
Definition: element_element_constraint_elements.h:110
ElementElementMortaringElement(FiniteElement *elem0_pt, FiniteElement *elem1_pt, Vector< double > &s0, Vector< double > &s1, const Vector< unsigned > &mortared_dimensions={0, 1, 2})
Definition: element_element_constraint_elements.h:115
void evaluate_constraint_functions(Vector< double > &error)
Definition: element_element_constraint_elements.cc:96
Vector< unsigned > Mortared_Dimensions
Definition: element_element_constraint_elements.h:148
Vector< Vector< double > > Local_Coord
Definition: element_element_constraint_elements.h:147
Definition: elements.h:1313
unsigned dim() const
Definition: elements.h:2611
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Definition: elements.h:659
int external_local_eqn(const unsigned &i, const unsigned &j)
Definition: elements.h:311
Definition: oomph_definitions.h:222
int error
Definition: calibrate.py:297
std::string to_string(T object, unsigned float_precision=8)
Definition: oomph_utilities.h:189
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2