84 const unsigned n_external_element_storage = n_interaction * n_intpt;
100 for (
unsigned i = 0;
i < n_external_element_storage;
i++)
153 Vector<std::set<FiniteElement*>>
const& external_elements_pt,
154 std::set<std::pair<Data*, unsigned>>& paired_interaction_data)
158 for (
unsigned i = 0;
i < n_interaction;
i++)
161 for (std::set<FiniteElement*>::const_iterator it =
162 external_elements_pt[
i].begin();
163 it != external_elements_pt[
i].end();
166 (*it)->identify_field_data_for_interactions(paired_interaction_data);
179 Vector<std::set<FiniteElement*>>
const& external_elements_pt,
180 std::set<Data*>& external_geometric_data_pt)
184 for (
unsigned i = 0;
i < n_interaction;
i++)
187 for (std::set<FiniteElement*>::const_iterator it =
188 external_elements_pt[
i].begin();
189 it != external_elements_pt[
i].end();
192 (*it)->identify_geometric_data(external_geometric_data_pt);
206 std::ostream& out,
const std::string& current_string)
const
211 for (
unsigned i = 0;
i < n_external_field_data;
i++)
213 std::stringstream conversion;
214 conversion <<
" of External Interaction Field Data " <<
i
224 for (
unsigned i = 0;
i < n_external_geom_data;
i++)
226 std::stringstream conversion;
227 conversion <<
" of External Interaction Geometric Data " <<
i
247 const bool& store_local_dof_pt)
309 for (
unsigned i = 0;
i < n_interaction;
i++)
313 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
316 external_interaction_elements_pt[
i].insert(
320 external_interaction_elements_pt[
i].erase(0);
325 std::set<std::pair<Data*, unsigned>> paired_field_data;
330 external_interaction_elements_pt, paired_field_data);
336 for (
unsigned n = 0; n < n_internal; n++)
341 const unsigned n_value = dat_pt->
nvalue();
344 for (
unsigned i = 0;
i < n_value;
i++)
346 paired_field_data.erase(std::make_pair(dat_pt,
i));
351 const unsigned n_node = this->
nnode();
352 for (
unsigned n = 0; n < n_node; n++)
357 const unsigned n_value = nod_pt->
nvalue();
359 for (
unsigned i = 0;
i < n_value;
i++)
361 paired_field_data.erase(std::make_pair(nod_pt,
i));
364 if (solid_nod_pt != 0)
368 const unsigned n_value = pos_data_pt->
nvalue();
370 for (
unsigned i = 0;
i < n_value;
i++)
372 paired_field_data.erase(std::make_pair(pos_data_pt,
i));
379 const unsigned n_external_interaction_field_data =
380 paired_field_data.size();
383 new Data*[n_external_interaction_field_data];
385 new unsigned[n_external_interaction_field_data];
390 for (std::set<std::pair<Data*, unsigned>>::iterator it =
391 paired_field_data.begin();
392 it != paired_field_data.end();
406 std::set<Data*> external_geometric_data_pt;
411 external_interaction_elements_pt, external_geometric_data_pt);
418 for (
unsigned j = 0; j < n_geom_data; j++)
429 for (
unsigned j = 0; j < n_external; j++)
435 const unsigned n_node = this->
nnode();
436 for (
unsigned n = 0; n < n_node; n++)
439 external_geometric_data_pt.erase(nod_pt);
442 if (solid_nod_pt != 0)
453 external_geometric_data_pt.erase(pos_data_pt);
460 unsigned n_external_interaction_geometric_data = 0;
461 for (std::set<Data*>::iterator it =
462 external_geometric_data_pt.begin();
463 it != external_geometric_data_pt.end();
467 n_external_interaction_geometric_data += (*it)->
nvalue();
472 n_external_interaction_geometric_data;
474 new Data*[n_external_interaction_geometric_data];
476 new unsigned[n_external_interaction_geometric_data];
481 for (std::set<Data*>::iterator it =
482 external_geometric_data_pt.begin();
483 it != external_geometric_data_pt.end();
487 unsigned n_value = (*it)->nvalue();
489 for (
unsigned j = 0; j < n_value; j++)
507 if (n_external_field_data > 0)
512 new int[n_external_field_data];
518 std::deque<unsigned long> global_eqn_number_queue;
521 for (
unsigned i = 0;
i < n_external_field_data;
i++)
539 global_eqn_number_queue.push_back(
eqn_number);
541 if (store_local_dof_pt)
563 if (store_local_dof_pt)
573 if (n_external_geom_data > 0)
578 new int[n_external_geom_data];
584 std::deque<unsigned long> global_eqn_number_queue;
587 for (
unsigned i = 0;
i < n_external_geom_data;
i++)
598 global_eqn_number_queue.push_back(
eqn_number);
600 if (store_local_dof_pt)
622 if (store_local_dof_pt)
642 const unsigned n_external_interaction_field_data =
646 if (n_external_interaction_field_data == 0)
656 const unsigned n_dof =
ndof();
662 int local_unknown = 0;
668 for (
unsigned i = 0;
i < n_external_interaction_field_data;
i++)
673 if (local_unknown >= 0)
680 double old_var = *value_pt;
683 *value_pt += fd_step;
692 for (
unsigned m = 0; m < n_dof; m++)
695 jacobian(m, local_unknown) = (newres[m] - residuals[m]) / fd_step;
724 const unsigned n_external_interaction_geometric_data =
727 if (n_external_interaction_geometric_data == 0)
737 const unsigned n_dof =
ndof();
743 int local_unknown = 0;
749 for (
unsigned i = 0;
i < n_external_interaction_geometric_data;
i++)
754 if (local_unknown >= 0)
761 double old_var = *value_pt;
764 *value_pt += fd_step;
773 for (
unsigned m = 0; m < n_dof; m++)
776 jacobian(m, local_unknown) = (newres[m] - residuals[m]) / fd_step;
799 std::ostream& outfile,
const unsigned& interaction_index)
802 unsigned n_dim_el =
dim();
812 outfile <<
"ZONE I=" << n_intpt << std::endl;
813 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
815 for (
unsigned i = 0;
i < n_dim_el;
i++)
833 for (
unsigned i = 0;
i < n_dim;
i++)
835 outfile << x[
i] <<
" ";
838 for (
unsigned i = 0;
i < n_dim;
i++)
840 outfile << x_ext[
i] - x[
i] <<
" ";
842 outfile << std::endl;
A class that represents a collection of data; each Data object may contain many different individual ...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
virtual void describe_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the dofs of the Node. The ostream specifies the output stream to which the descr...
static long Is_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned.
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
virtual void update_before_external_interaction_field_fd()
Function that is called before the finite differencing of any external interaction data associated wi...
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...
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's local coords for specified interaction index at specified int...
void initialise_external_element_storage()
Initialise storage for pointers to external elements and their local coordinates. This must be called...
unsigned Nexternal_element_storage
Number of entries in the external element storage schemes (Nintergation_pt * Ninteraction)
virtual void update_before_external_interaction_geometric_fd()
Function that is called before the finite differencing of any external interaction data associated wi...
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 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...
FiniteElement *& external_element_pt(const unsigned &interaction_index, const unsigned &ipt)
Access function to source element for specified interaction index at specified integration point.
unsigned Nexternal_interaction_geometric_data
Number of external interaction geometric data.
virtual void reset_after_external_interaction_field_fd()
Function that is call after the finite differencing of the external interaction data associated with ...
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...
unsigned nexternal_interaction_geometric_data() const
Return the number of geometric Data items that affect the external interactions in this element: i....
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...
unsigned nexternal_interaction_field_data() const
Return the number of Data items that affect the external interactions in this element....
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...
virtual ~ElementWithExternalElement()
The destructor, clean up any allocated memory.
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...
FiniteElement ** External_element_pt
Storage for pointers to elements that provide contributions to the residuals of the current element....
Data ** External_interaction_field_data_pt
/ Storage for pointers to external field Data that affect the interactions in the elemenet
Vector< double > * External_element_local_coord
Storage for vectors of local coordinates in external elements that correspond to the appropriate inte...
int * External_interaction_field_data_local_eqn
Storage for the local equation number associated with the external field data the affect the interact...
virtual void reset_after_external_interaction_geometric_fd()
Function that is call after the finite differencing of the external interaction data associated with ...
bool Add_external_geometric_data
Boolean flag to indicate whether to include the external geometric data.
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...
Data ** External_interaction_geometric_data_pt
/ Storage for pointers to external geometric Data that affect the interactions in the elemenet
unsigned * External_interaction_geometric_data_index
Storage for the index of the values in the external geometric data that affect the interactions in th...
bool Add_external_interaction_data
Boolean flag to indicate whether to include the external data.
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 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 ninteraction() const
Return the number of interactions in the element.
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...
unsigned Nintpt
Number of intergation point in the element.
unsigned Ninteraction
Number of interactions.
int * External_interaction_geometric_data_local_eqn
Storage for the local equation number associated with the external geometric data the affect the inte...
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...
void flush_all_external_element_storage()
Flush the storage for external elements.
A general Finite Element class.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned nnode() const
Return the number of nodes.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Data * geom_data_pt(const unsigned &j)
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
unsigned ngeom_data() const
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
unsigned nexternal_data() const
Return the number of external data objects.
bool is_halo() const
Is this element a halo?
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
unsigned ndof() const
Return the number of equations/dofs in the element.
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number....
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
virtual void get_residuals(Vector< double > &residuals)
Calculate the vector of residuals of the equations in the element. By default initialise the vector t...
unsigned ninternal_data() const
Return the number of internal data objects.
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...
virtual void describe_local_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the local dofs of the element. The ostream specifies the output stream to which ...
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...
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...