element_with_external_element.cc
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Functions for the ElementWithExternalElement class
31 
33 
34 namespace oomph
35 {
36  //======================================================================
37  /// \short Destructor, clean up any memory allocated for the equation
38  /// numbering schemes and storage for the external elements
39  //======================================================================
41  {
42  //If storage has been allocated for external geometric data,
43  //delete it
50 
51  //If storage has been allocated for external field data,
52  //delete it
59 
60  //Flush the storage associated with the external elements
62  }
63 
64  //========================================================================
65  /// \short Initialise storage for source elements and their
66  /// associated local coordinates for the specified number of interactions
67  //========================================================================
69  {
70  //Find the number of interactions
71  const unsigned n_interaction = this->Ninteraction;
72  //Find the number of integration points
73  const unsigned n_intpt = this->integral_pt()->nweight();
74 
75  //Work out the required storage
76  const unsigned n_external_element_storage = n_interaction*n_intpt;
77 
78  //If we have not allocated the correct amount of memory,
79  //then do so
80  if(Nexternal_element_storage != n_external_element_storage)
81  {
82  //Allocate storage for the pointers to the elements
83  //Delete old storage, if needed
85  //Allocate new memory
86  External_element_pt = new FiniteElement*[n_external_element_storage];
87 
88  //Initialise all new pointers to zero
89  for(unsigned i=0;i<n_external_element_storage;i++)
90  {External_element_pt[i] = 0;}
91 
92  //Alloacte storage for local coordinates
93  //Delete old storage, if needed
95  //Allocate the new memory
97  new Vector<double>[n_external_element_storage];
98 
99  //Finally record how much memory we have allocated
100  Nexternal_element_storage = n_external_element_storage;
101  Nintpt = n_intpt;
102  }
103  }
104 
105  //========================================================================
106  /// \short Clear the storage for pointers to external elements and their
107  /// associated local coordinates.
108  //========================================================================
110  {
111  //Delete the memory if it has been allocated
113  {
114  delete[] External_element_pt;
116  }
117 
119  {
122  }
123 
124  //Reset the number of stored values to zero
126  }
127 
128 
129  //================================================================
130  /// \short Function that must return all the data involved
131  /// in the desired interactions from the external element
132  /// Default is to call the identify_field_data_for_interaction()
133  /// for each element.
134  //================================================================
137  Vector<std::set<FiniteElement*> > const &external_elements_pt,
138  std::set<std::pair<Data*,unsigned> > &paired_interaction_data)
139  {
140  //Loop over each interaction
141  const unsigned n_interaction = this->ninteraction();
142  for(unsigned i=0;i<n_interaction;i++)
143  {
144  //Loop over each element in the set
145  for(std::set<FiniteElement*>::const_iterator it=
146  external_elements_pt[i].begin();
147  it != external_elements_pt[i].end(); it++)
148  {
149  (*it)->identify_field_data_for_interactions(paired_interaction_data);
150  }
151  } //End of loop over interactions
152  }
153 
154  //=======================================================================
155  /// \short Function that must return all geometric data involved
156  /// in the desired interactions from the external element
157  /// Default is to add all geometric data for each element for each
158  /// interaction
159  //=======================================================================
162  Vector<std::set<FiniteElement*> > const &external_elements_pt,
163  std::set<Data*> &external_geometric_data_pt)
164  {
165  //Loop over each interaction
166  const unsigned n_interaction = this->ninteraction();
167  for(unsigned i=0;i<n_interaction;i++)
168  {
169  //Loop over each element in the set
170  for(std::set<FiniteElement*>::const_iterator it=
171  external_elements_pt[i].begin();
172  it != external_elements_pt[i].end(); it++)
173  {
174  (*it)->identify_geometric_data(external_geometric_data_pt);
175  }
176  } //End of loop over interactions
177  }
178 
179  /// \short Function to describe the local dofs of the element. The ostream
180  /// specifies the output stream to which the description
181  /// is written; the string stores the currently
182  /// assembled output that is ultimately written to the
183  /// output stream by Data::describe_dofs(...); it is typically
184  /// built up incrementally as we descend through the
185  /// call hierarchy of this function when called from
186  /// Problem::describe_dofs(...)
188  describe_local_dofs(std::ostream& out,const std::string& current_string) const
189  {
190  //Find the number of external field data
191  const unsigned n_external_field_data = nexternal_interaction_field_data();
192  //Now loop over the field data again to assign local equation numbers
193  for(unsigned i=0;i<n_external_field_data;i++)
194  {
195  std::stringstream conversion;
196  conversion<<" of External Interaction Field Data "<<i<<current_string;
197  std::string in(conversion.str());
199  }
200 
201  //Find the number of external geometric data
202  unsigned n_external_geom_data = nexternal_interaction_geometric_data();
203 
204  //Now loop over the field data again assign local equation numbers
205  for(unsigned i=0;i<n_external_geom_data;i++)
206  {
207  std::stringstream conversion;
208  conversion<<" of External Interaction Geometric Data "<<i<<current_string;
209  std::string in(conversion.str());
211  }
212  GeneralisedElement::describe_local_dofs(out,current_string);
213  }
214 
215 //==========================================================================
216 /// This function determines the all Data in external elemetns that
217 /// affects the residuals of the element
218 /// and adds their global equation numbers to the
219 /// local-to-global look-up scheme. Note that we only include
220 /// Data items into the element's External_interaction_data
221 /// if they are not already
222 /// included in the element's nodal positional Data, its internal
223 /// or external Data.
224 //==========================================================================
227  const bool &store_local_dof_pt)
228 {
229  //Reset number of stored field data to zero
231  //Clear all the internal field data storage, if it's been allocated
233  {
236  }
238  {
241  }
243  {
246  }
247 
248  //Reset number of stored geometric data to zero
250  //Clear all internal external data storage, if it's been allocated
252  {
255  }
257  {
260  }
262  {
265  }
266 
267  //Only bother with non-halo elements
268 #ifdef OOMPH_HAS_MPI
269  if(!this->is_halo())
270 #endif
271  {
272  //If desired, determine the Data that affects the interactions but is not
273  //already included in elements other generic Data.
274  //The conditional test is done here, so that the vectors are cleared
275  //and not re-filled if Add_external_interaction_data is false
277  {
278  //Number of interactions
279  const unsigned n_interaction = this->ninteraction();
280  // Number of integration points
281  const unsigned n_intpt = integral_pt()->nweight();
282 
283  //Sets of all (external) FiniteElements that affect the interactions
284  //One set per interaction
286  external_interaction_elements_pt(n_interaction);
287 
288  //Loop over the interactions
289  for (unsigned i=0;i<n_interaction;i++)
290  {
291  //Loop over the integration points and the adjacent element at
292  //each integration point to the set
293  for(unsigned ipt=0;ipt<n_intpt;ipt++)
294  {
295  //Add the element adjacent to the element into the set
296  external_interaction_elements_pt[i].
297  insert(external_element_pt(i,ipt));
298  }
299  //For safety erase any null pointers
300  external_interaction_elements_pt[i].erase(0);
301  }
302 
303  // Storage for a pairs of interaction data (pointer to Data and the index
304  // of the value within this Data object) affecting the element.
305  std::set<std::pair<Data*,unsigned> > paired_field_data;
306 
307  //Determine the field data that affects the external interactions
308  //for all sets of external elements
310  external_interaction_elements_pt,paired_field_data);
311 
312  //It's just possible that some of the field data could be internal
313  //or nodal data, so we should remove it if that's the case
314  //Loop over all internal data
315  const unsigned n_internal = this->ninternal_data();
316  for(unsigned n=0;n<n_internal;n++)
317  {
318  //Cache the data pointer
319  Data* const dat_pt = this->internal_data_pt(n);
320  //Find the number of data values stored in the data object
321  const unsigned n_value = dat_pt->nvalue();
322  //Add the index of each data value and the pointer to the set
323  //of pairs
324  for(unsigned i=0;i<n_value;i++)
325  {
326  paired_field_data.erase(std::make_pair(dat_pt,i));
327  }
328  }
329 
330  //Loop over all the nodes
331  const unsigned n_node = this->nnode();
332  for(unsigned n=0;n<n_node;n++)
333  {
334  //Find the node point
335  Node* const nod_pt = this->node_pt(n);
336  //Find the number of values stored at the node
337  const unsigned n_value = nod_pt->nvalue();
338  //Loop over values and erase all pairs from the set
339  for(unsigned i=0;i<n_value;i++)
340  {
341  paired_field_data.erase(std::make_pair(nod_pt,i));
342  }
343  SolidNode* solid_nod_pt=dynamic_cast<SolidNode*>(nod_pt);
344  if (solid_nod_pt!=0)
345  {
346  Data* pos_data_pt=solid_nod_pt->variable_position_pt();
347  //Find the number of positional values stored at the node
348  const unsigned n_value = pos_data_pt->nvalue();
349  //Loop over values and erase all pairs from the set
350  for(unsigned i=0;i<n_value;i++)
351  {
352  paired_field_data.erase(std::make_pair(pos_data_pt,i));
353  }
354  }
355  }
356 
357  //Now allocate storage for the external field data
358  //associated indices and local equation numbers
359  const unsigned n_external_interaction_field_data = paired_field_data.size();
360  Nexternal_interaction_field_data = n_external_interaction_field_data;
362  new Data*[n_external_interaction_field_data];
364  new unsigned[n_external_interaction_field_data];
365 
366  //Add the pairs of data to the field data vectors
367  {
368  unsigned count=0;
369  for(std::set<std::pair<Data*,unsigned> >::iterator it=
370  paired_field_data.begin();
371  it != paired_field_data.end();it++)
372  {
373  External_interaction_field_data_pt[count] = it->first;
374  External_interaction_field_data_index[count] = it->second;
375  ++count;
376  }
377  }
378 
379 
380  //Only bother to add geometric data if we're told to
382  {
383  //Storage for a set of external geometric Data affecting the element
384  std::set<Data*> external_geometric_data_pt;
385 
386  //Determine the geometric data that affects the external interactions
387  //for all sets of external elements
389  external_interaction_elements_pt, external_geometric_data_pt);
390 
391  // Now loop over any geometric data of the Element itself
392  // and erase them from the external_geometric_data_pt
393  // because these data are actually intrinsic
394  // data of this element and are counted and numbered elsewhere
395  unsigned n_geom_data = ngeom_data();
396  for(unsigned j=0;j<n_geom_data;j++)
397  {
398  external_geometric_data_pt.erase(geom_data_pt(j));
399  }
400 
401  //It is possible that the geometric data may have already been added as
402  //external data. We should erase any common entries from the
403  //External_interaction_data
404  //but not touch the external data that has been set up by a
405  //"knowledgeable" user
406  unsigned n_external = nexternal_data();
407  for(unsigned j=0;j<n_external;j++)
408  {
409  external_geometric_data_pt.erase(external_data_pt(j));
410  }
411 
412  //Loop over all the nodes of present element to avoid double counting
413  const unsigned n_node = this->nnode();
414  for(unsigned n=0;n<n_node;n++)
415  {
416  Node* const nod_pt = this->node_pt(n);
417  external_geometric_data_pt.erase(nod_pt);
418 
419  SolidNode* solid_nod_pt=dynamic_cast<SolidNode*>(nod_pt);
420  if (solid_nod_pt!=0)
421  {
422  Data* pos_data_pt=solid_nod_pt->variable_position_pt();
423 // std::ostringstream junk;
424 // junk << "Erasing ";
425 // unsigned nval=pos_data_pt->nvalue();
426 // for (unsigned i=0;i<nval;i++)
427 // {
428 // junk << pos_data_pt->eqn_number(i) << " ";
429 // }
430 // oomph_info << junk.str() << std::endl;
431  external_geometric_data_pt.erase(pos_data_pt);
432  }
433  }
434 
435 
436  //Next allocate storage for the geometric field data
437  //Find out how many individual data we have
438  unsigned n_external_interaction_geometric_data = 0;
439  for(std::set<Data*>::iterator it=external_geometric_data_pt.begin();
440  it != external_geometric_data_pt.end(); it++)
441  {
442  //Add the number of values stored in each geometric datum
443  n_external_interaction_geometric_data += (*it)->nvalue();
444  }
445 
446  //Now allocate storage
448  n_external_interaction_geometric_data;
450  new Data*[n_external_interaction_geometric_data];
452  new unsigned[n_external_interaction_geometric_data];
453 
454  // Now we can add all the geometric data to the geometric data vectors
455  {
456  unsigned count=0;
457  for(std::set<Data*>::iterator it=external_geometric_data_pt.begin();
458  it != external_geometric_data_pt.end(); it++)
459  {
460  //Find the number of values stored in the geometric data
461  unsigned n_value = (*it)->nvalue();
462  //Loop over the values
463  for(unsigned j=0;j<n_value;j++)
464  {
465  //Add data to the external geometric data
468  ++count;
469  }
470  }
471  }
472  }
473  }
474 
475  //All external interaction data has now been specified
476 
477  //Find the number of external field data
478  const unsigned n_external_field_data = nexternal_interaction_field_data();
479 
480  //If there are interaction data fill in the internal storage
481  if(n_external_field_data > 0)
482  {
483 
484  //Allocate storage for the local equation numbers associated with
485  //external field data
487  new int[n_external_field_data];
488 
489  //Find the number of local equations assigned so far
490  unsigned local_eqn_number = ndof();
491 
492  //A local queue to store the global equation numbers
493  std::deque<unsigned long> global_eqn_number_queue;
494 
495  //Now loop over the field data again to assign local equation numbers
496  for(unsigned i=0;i<n_external_field_data;i++)
497  {
498  //Get the GLOBAL equation number
499  long eqn_number =
502 
503  //If the GLOBAL equation number is positive (i.e. not pinned)
504  if(eqn_number >= 0)
505  {
506 // std::ostringstream junk;
507 // junk << "Adding global eqn " << eqn_number << " (";
508 // if (!(External_interaction_field_data_pt[i]->is_halo()))
509 // {
510 // junk << "not";
511 // }
512 // oomph_info << junk.str() << " halo" << std::endl;
513 
514  //Add the GLOBAL equation number to the local queue
515  global_eqn_number_queue.push_back(eqn_number);
516  //Add pointer to the dof to the queue if required
517  if(store_local_dof_pt)
518  {
522  }
523 
524  //Add the local equation number to the local scheme
526  //Increase the local number
527  local_eqn_number++;
528  }
529  else
530  {
531  //Set the local scheme to be pinned
533  }
534  }
535  //Now add our global equations numbers to the internal element storage
536  add_global_eqn_numbers(global_eqn_number_queue,
538  //Clear the memory used in the deque
539  if(store_local_dof_pt)
540  {std::deque<double*>().swap(GeneralisedElement::Dof_pt_deque);}
541  }
542 
543  //Find the number of external geometric data
544  unsigned n_external_geom_data = nexternal_interaction_geometric_data();
545 
546  //If there are external geometric data fill in the internal storage
547  if(n_external_geom_data > 0)
548  {
549 
550  //Allocate storage for the local equation numbers associated with
551  //external geometric data
553  new int[n_external_geom_data];
554 
555  //Find the number of local equations assigned so far
556  unsigned local_eqn_number = ndof();
557 
558  //A local queue to store the global equation numbers
559  std::deque<unsigned long> global_eqn_number_queue;
560 
561  //Now loop over the field data again assign local equation numbers
562  for(unsigned i=0;i<n_external_geom_data;i++)
563  {
564  //Get the GLOBAL equation number
565  long eqn_number =
568 
569  //If the GLOBAL equation number is positive (a free variable)
570  if(eqn_number >= 0)
571  {
572  //Add the GLOBAL equation number to the local queue
573  global_eqn_number_queue.push_back(eqn_number);
574  //Add pointer to the dof to the queue if required
575  if(store_local_dof_pt)
576  {
580  }
581 
582  //Add the local equation number to the local scheme
584  //Increase the local number
585  local_eqn_number++;
586  }
587  else
588  {
589  //Set the local scheme to be pinned
591  }
592  }
593  //Now add our global equations numbers to the internal element storage
594  add_global_eqn_numbers(global_eqn_number_queue,
596  //Clear the memory used in the deque
597  if(store_local_dof_pt)
598  {std::deque<double*>().swap(GeneralisedElement::Dof_pt_deque);}
599  }
600  }
601 }
602 
603 //============================================================================
604 /// This function calculates the entries of Jacobian matrix, used in
605 /// the Newton method, associated with the external interaction
606 /// degrees of freedom for external fields.
607 /// It does this using finite differences,
608 /// rather than an analytical formulation, so can be done in total generality.
609 //==========================================================================
612  Vector<double> &residuals, DenseMatrix<double> &jacobian)
613  {
614  //Locally cache the number of data
615  const unsigned n_external_interaction_field_data =
617 
618  //If there is no such data return
619  if(n_external_interaction_field_data==0) {return;}
620 
621  //Call the update function to ensure that the element is in a
622  //consistent state before finite differencing
624 
625  //Find the number of dofs in the element
626  const unsigned n_dof = ndof();
627 
628  //Create newres vector
629  Vector<double> newres(n_dof);
630 
631  //Integer storage for local unknown
632  int local_unknown=0;
633 
634  //Use the default finite difference step
635  const double fd_step = Default_fd_jacobian_step;
636 
637  //Loop over the data
638  for(unsigned i=0;i<n_external_interaction_field_data;i++)
639  {
640  //Find the value of the local unknown
642  //If it's not a boundary condition
643  if (local_unknown >= 0)
644  {
645  //Store a pointer to the field value
646  double *value_pt =
649 
650  //Save the old value of the field value
651  double old_var = *value_pt;
652 
653  //Increment the value
654  *value_pt += fd_step;
655 
656  //Now update any slaved variables
658 
659  //Calculate the new residuals
660  get_residuals(newres);
661 
662  //Do forward finite differences
663  for(unsigned m=0;m<n_dof;m++)
664  {
665  //Stick the entry into the Jacobian matrix
666  jacobian(m,local_unknown) = (newres[m] - residuals[m])/fd_step;
667  }
668 
669  // Reset the variables
670  *value_pt = old_var;
671 
672  // Reset any slaved variables
674  }
675  } //End of loop over external interaction data
676 
677  //End of finite difference loop
678  //Final reset of any slaved data
680  }
681 
682 
683 
684 
685 //============================================================================
686 /// This function calculates the entries of Jacobian matrix, used in
687 /// the Newton method, associated with the external interaction
688 /// degrees of freedom for external geometric data.
689 /// It does this using finite differences,
690 /// rather than an analytical formulation, so can be done in total generality.
691 //==========================================================================
694  Vector<double> &residuals, DenseMatrix<double> &jacobian)
695  {
696  //Locally cache the number of data
697  const unsigned n_external_interaction_geometric_data =
699  //If there is no such data return
700  if(n_external_interaction_geometric_data==0) {return;}
701 
702  //Call the update function to ensure that the element is in a
703  //consistent state before finite differencing
705 
706  //Find the number of dofs in the element
707  const unsigned n_dof = ndof();
708 
709  //Create newres vector
710  Vector<double> newres(n_dof);
711 
712  //Integer storage for local unknown
713  int local_unknown=0;
714 
715  //Use the default finite difference step
716  const double fd_step = Default_fd_jacobian_step;
717 
718  //Loop over the data
719  for(unsigned i=0;i<n_external_interaction_geometric_data;i++)
720  {
721  //Find the value of the local unknown
723  //If it's not a boundary condition
724  if (local_unknown >= 0)
725  {
726  //Store a pointer to the geometric value
727  double *value_pt =
730 
731  //Save the old value of the geometric value
732  double old_var = *value_pt;
733 
734  //Increment the value
735  *value_pt += fd_step;
736 
737  //Now update any slaved variables
739 
740  //Calculate the new residuals
741  get_residuals(newres);
742 
743  //Do forward finite differences
744  for(unsigned m=0;m<n_dof;m++)
745  {
746  //Stick the entry into the Jacobian matrix
747  jacobian(m,local_unknown) = (newres[m] - residuals[m])/fd_step;
748  }
749 
750  // Reset the variables
751  *value_pt = old_var;
752 
753  // Reset any slaved variables
755  }
756  } //End of loop over external interaction data
757 
758  //End of finite difference loop
759  //Final reset of any slaved data
761  }
762 
763 
764 
765 //============================================================================
766  /// Output by plotting vector from integration point to
767  /// corresponding point in external element for specified interaction
768  /// index
769 //==========================================================================
771  std::ostream &outfile,
772  const unsigned &interaction_index)
773  {
774  // Dimension of element
775  unsigned n_dim_el=dim();
776  Vector<double> s(n_dim_el);
777 
778  // Vectors for coordintes
779  unsigned n_dim=node_pt(0)->ndim();
780  Vector<double> x(n_dim);
781  Vector<double> x_ext(n_dim);
782 
783  //Loop over the integration points
784  const unsigned n_intpt = this->integral_pt()->nweight();
785  outfile << "ZONE I=" << n_intpt << std::endl;
786  for(unsigned ipt=0;ipt<n_intpt;ipt++)
787  {
788  for(unsigned i=0;i<n_dim_el;i++)
789  {
790  s[i] = integral_pt()->knot(ipt,i);
791  }
792 
793  // Eulerian coordinates of integration point
794  interpolated_x(s,x);
795 
796  // Get pointer to external element
797  FiniteElement* ext_el_pt=external_element_pt(interaction_index,
798  ipt);
799  // Get local coordinate in external element
800  Vector<double> s_ext(external_element_local_coord(interaction_index,
801  ipt));
802 
803  // Eulerian coordinates of point in external element
804  ext_el_pt->interpolated_x(s_ext,x_ext);
805 
806  // Output coords of interation point
807  for(unsigned i=0;i<n_dim;i++)
808  {
809  outfile << x[i] << " ";
810  }
811  // Write vector to point in external element
812  for(unsigned i=0;i<n_dim;i++)
813  {
814  outfile << x_ext[i]-x[i] << " ";
815  }
816  outfile << std::endl;
817  }
818  }
819 
820 
821 }
void initialise_external_element_storage()
Initialise storage for pointers to external elements and their local coordinates. This must be called...
virtual void get_residuals(Vector< double > &residuals)
Calculate the vector of residuals of the equations in the element. By default initialise the vector t...
Definition: elements.h:975
void add_global_eqn_numbers(std::deque< unsigned long > const &global_eqn_numbers, std::deque< double *> const &global_dof_pt)
Add the contents of the queue global_eqn_numbers to the local storage for the local-to-global transla...
Definition: elements.cc:149
virtual void identify_all_field_data_for_external_interaction(Vector< std::set< FiniteElement *> > const &external_elements_pt, std::set< std::pair< Data *, unsigned > > &paired_interaction_data)
Function that must return all the data involved in the desired interactions from the external element...
unsigned Nexternal_interaction_field_data
Number of external interaction field data.
Vector< double > & external_element_local_coord(const unsigned &interaction_index, const unsigned &ipt)
Access function to get source element&#39;s local coords for specified interaction index at specified int...
Data * geom_data_pt(const unsigned &j)
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
Definition: elements.h:2529
int * External_interaction_field_data_local_eqn
Storage for the local equation number associated with the external field data the affect the interact...
void flush_all_external_element_storage()
Flush the storage for external elements.
cstr elem_len * i
Definition: cfortran.h:607
bool Add_external_interaction_data
Boolean flag to indicate whether to include the external data.
virtual void reset_in_external_interaction_field_fd(const unsigned &i)
Function called within the finite difference loop for external interaction data after the values in t...
A general Finite Element class.
Definition: elements.h:1274
unsigned ngeom_data() const
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
Definition: elements.h:2525
virtual void reset_after_external_interaction_geometric_fd()
Function that is call after the finite differencing of the external interaction data associated with ...
bool is_halo() const
Is this element a halo?
Definition: elements.h:1141
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
int * External_interaction_geometric_data_local_eqn
Storage for the local equation number associated with the external geometric data the affect the inte...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:448
virtual void describe_dofs(std::ostream &out, const std::string &current_string) const
Function to describe the dofs of the Node. The ostream specifies the output stream to which the descr...
Definition: nodes.cc:905
unsigned Nexternal_element_storage
Number of entries in the external element storage schemes (Nintergation_pt * Ninteraction) ...
unsigned nexternal_data() const
Return the number of external data objects.
Definition: elements.h:831
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:992
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:834
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition: elements.cc:3881
void output_external_elements(std::ostream &outfile, const unsigned &interaction_index)
Output by plotting vector from integration point to corresponding point in external element for speci...
bool Add_external_geometric_data
Boolean flag to indicate whether to include the external geometric data.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1908
static long Is_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned...
Definition: nodes.h:192
void assign_external_interaction_data_local_eqn_numbers(const bool &store_local_dof_pt)
Assign the local equation numbers for those Data values involved in the external interactions that af...
static char t char * s
Definition: cfortran.h:572
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:623
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number...
Definition: elements.h:709
unsigned Nexternal_interaction_geometric_data
Number of external interaction geometric data.
unsigned * External_interaction_geometric_data_index
Storage for the index of the values in the external geometric data that affect the interactions in th...
A class that represents a collection of data; each Data object may contain many different individual ...
Definition: nodes.h:89
unsigned nexternal_interaction_field_data() const
Return the number of Data items that affect the external interactions in this element. This includes e.g. fluid velocities and pressures in adjacent fluid elements in an FSI problem.
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
Definition: nodes.h:1655
unsigned nexternal_interaction_geometric_data() const
Return the number of geometric Data items that affect the external interactions in this element: i...
virtual void reset_in_external_interaction_geometric_fd(const unsigned &i)
Function called within the finite difference loop for external interaction data after the values in t...
unsigned Ninteraction
Number of interactions.
Vector< double > * External_element_local_coord
Storage for vectors of local coordinates in external elements that correspond to the appropriate inte...
virtual void identify_all_geometric_data_for_external_interaction(Vector< std::set< FiniteElement *> > const &external_elements_pt, std::set< Data *> &external_geometric_data_pt)
Function that must return all geometric data involved in the desired interactions from the external e...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2109
unsigned ninteraction() const
Return the number of interactions in the element.
unsigned * External_interaction_field_data_index
Storage for the index of the values in the external field data that affect the interactions in the el...
FiniteElement ** External_element_pt
Storage for pointers to elements that provide contributions to the residuals of the current element...
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Definition: elements.h:662
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
Definition: elements.h:2482
unsigned ninternal_data() const
Return the number of internal data objects.
Definition: elements.h:828
A Class for nodes that deform elastically (i.e. position is an unknown in the problem). The idea is that the Eulerian positions are stored in a Data object and the Lagrangian coordinates are stored in addition. The pointer that addresses the Eulerian positions is set to the pointer to Value in the Data object. Hence, SolidNode uses knowledge of the internal structure of Data and must be a friend of the Data class. In order to allow a mesh to deform via an elastic-style equation in deforming-domain problems, the positions are stored separately from the values, so that elastic problems may be combined with any other type of problem.
Definition: nodes.h:1569
void fill_in_jacobian_from_external_interaction_geometric_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Calculate the contributions to the jacobian from the external interaction degrees of freedom associat...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual void update_before_external_interaction_field_fd()
Function that is called before the finite differencing of any external interaction data associated wi...
unsigned Nintpt
Number of intergation point in the element.
FiniteElement *& external_element_pt(const unsigned &interaction_index, const unsigned &ipt)
Access function to source element for specified interaction index at specified integration point...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn&#39;t been defined.
void fill_in_jacobian_from_external_interaction_field_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Calculate the contributions to the jacobian from the external interaction degrees of freedom associat...
static std::deque< double * > Dof_pt_deque
Static storage for deque used to add_global_equation_numbers when pointers to the dofs in each elemen...
Definition: elements.h:232
virtual void update_before_external_interaction_geometric_fd()
Function that is called before the finite differencing of.
virtual void reset_after_external_interaction_field_fd()
Function that is call after the finite differencing of the external interaction data associated with ...
void describe_local_dofs(std::ostream &out, const std::string &curr_string) const
Function to describe the local dofs of the element. The ostream specifies the output stream to which ...
virtual void describe_local_dofs(std::ostream &out, const std::string &current_string) const
Function to describe the local dofs of the element. The ostream specifies the output stream to which ...
Definition: elements.cc:545
virtual void update_in_external_interaction_field_fd(const unsigned &i)
Function called within the finite difference loop for external interaction data after a change in any...
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number...
Definition: elements.h:731
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2146
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
Definition: elements.h:1164
virtual ~ElementWithExternalElement()
The destructor, clean up any allocated memory.
virtual void update_in_external_interaction_geometric_fd(const unsigned &i)
Function called within the finite difference loop for external interaction data after a change in any...