76 const unsigned n_external_element_storage = n_interaction*n_intpt;
89 for(
unsigned i=0;
i<n_external_element_storage;
i++)
137 Vector<std::set<FiniteElement*> >
const &external_elements_pt,
138 std::set<std::pair<Data*,unsigned> > &paired_interaction_data)
142 for(
unsigned i=0;
i<n_interaction;
i++)
145 for(std::set<FiniteElement*>::const_iterator it=
146 external_elements_pt[
i].begin();
147 it != external_elements_pt[
i].end(); it++)
149 (*it)->identify_field_data_for_interactions(paired_interaction_data);
162 Vector<std::set<FiniteElement*> >
const &external_elements_pt,
163 std::set<Data*> &external_geometric_data_pt)
167 for(
unsigned i=0;
i<n_interaction;
i++)
170 for(std::set<FiniteElement*>::const_iterator it=
171 external_elements_pt[
i].begin();
172 it != external_elements_pt[
i].end(); it++)
174 (*it)->identify_geometric_data(external_geometric_data_pt);
193 for(
unsigned i=0;
i<n_external_field_data;
i++)
195 std::stringstream conversion;
196 conversion<<
" of External Interaction Field Data "<<
i<<current_string;
205 for(
unsigned i=0;
i<n_external_geom_data;
i++)
207 std::stringstream conversion;
208 conversion<<
" of External Interaction Geometric Data "<<
i<<current_string;
227 const bool &store_local_dof_pt)
286 external_interaction_elements_pt(n_interaction);
289 for (
unsigned i=0;
i<n_interaction;
i++)
293 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
296 external_interaction_elements_pt[
i].
300 external_interaction_elements_pt[
i].erase(0);
305 std::set<std::pair<Data*,unsigned> > paired_field_data;
310 external_interaction_elements_pt,paired_field_data);
316 for(
unsigned n=0;n<n_internal;n++)
321 const unsigned n_value = dat_pt->
nvalue();
324 for(
unsigned i=0;
i<n_value;
i++)
326 paired_field_data.erase(std::make_pair(dat_pt,
i));
331 const unsigned n_node = this->
nnode();
332 for(
unsigned n=0;n<n_node;n++)
337 const unsigned n_value = nod_pt->
nvalue();
339 for(
unsigned i=0;
i<n_value;
i++)
341 paired_field_data.erase(std::make_pair(nod_pt,
i));
348 const unsigned n_value = pos_data_pt->
nvalue();
350 for(
unsigned i=0;
i<n_value;
i++)
352 paired_field_data.erase(std::make_pair(pos_data_pt,
i));
359 const unsigned n_external_interaction_field_data = paired_field_data.size();
362 new Data*[n_external_interaction_field_data];
364 new unsigned[n_external_interaction_field_data];
369 for(std::set<std::pair<Data*,unsigned> >::iterator it=
370 paired_field_data.begin();
371 it != paired_field_data.end();it++)
384 std::set<Data*> external_geometric_data_pt;
389 external_interaction_elements_pt, external_geometric_data_pt);
396 for(
unsigned j=0;j<n_geom_data;j++)
407 for(
unsigned j=0;j<n_external;j++)
413 const unsigned n_node = this->
nnode();
414 for(
unsigned n=0;n<n_node;n++)
417 external_geometric_data_pt.erase(nod_pt);
431 external_geometric_data_pt.erase(pos_data_pt);
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++)
443 n_external_interaction_geometric_data += (*it)->
nvalue();
448 n_external_interaction_geometric_data;
450 new Data*[n_external_interaction_geometric_data];
452 new unsigned[n_external_interaction_geometric_data];
457 for(std::set<Data*>::iterator it=external_geometric_data_pt.begin();
458 it != external_geometric_data_pt.end(); it++)
461 unsigned n_value = (*it)->nvalue();
463 for(
unsigned j=0;j<n_value;j++)
481 if(n_external_field_data > 0)
487 new int[n_external_field_data];
493 std::deque<unsigned long> global_eqn_number_queue;
496 for(
unsigned i=0;
i<n_external_field_data;
i++)
515 global_eqn_number_queue.push_back(eqn_number);
517 if(store_local_dof_pt)
539 if(store_local_dof_pt)
547 if(n_external_geom_data > 0)
553 new int[n_external_geom_data];
559 std::deque<unsigned long> global_eqn_number_queue;
562 for(
unsigned i=0;
i<n_external_geom_data;
i++)
573 global_eqn_number_queue.push_back(eqn_number);
575 if(store_local_dof_pt)
597 if(store_local_dof_pt)
615 const unsigned n_external_interaction_field_data =
619 if(n_external_interaction_field_data==0) {
return;}
626 const unsigned n_dof =
ndof();
638 for(
unsigned i=0;
i<n_external_interaction_field_data;
i++)
643 if (local_unknown >= 0)
651 double old_var = *value_pt;
654 *value_pt += fd_step;
663 for(
unsigned m=0;m<n_dof;m++)
666 jacobian(m,local_unknown) = (newres[m] - residuals[m])/fd_step;
697 const unsigned n_external_interaction_geometric_data =
700 if(n_external_interaction_geometric_data==0) {
return;}
707 const unsigned n_dof =
ndof();
719 for(
unsigned i=0;
i<n_external_interaction_geometric_data;
i++)
724 if (local_unknown >= 0)
732 double old_var = *value_pt;
735 *value_pt += fd_step;
744 for(
unsigned m=0;m<n_dof;m++)
747 jacobian(m,local_unknown) = (newres[m] - residuals[m])/fd_step;
771 std::ostream &outfile,
772 const unsigned &interaction_index)
775 unsigned n_dim_el=
dim();
785 outfile <<
"ZONE I=" << n_intpt << std::endl;
786 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
788 for(
unsigned i=0;
i<n_dim_el;
i++)
807 for(
unsigned i=0;
i<n_dim;
i++)
809 outfile << x[
i] <<
" ";
812 for(
unsigned i=0;
i<n_dim;
i++)
814 outfile << x_ext[
i]-x[
i] <<
" ";
816 outfile << std::endl;
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...
Data ** External_interaction_field_data_pt
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 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'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...
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.
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.
unsigned ngeom_data() const
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
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?
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
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).
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...
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.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
unsigned ndof() const
Return the number of equations/dofs in the element.
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
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)
static long Is_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned...
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...
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.
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number...
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 ...
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)
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.
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.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned ninternal_data() const
Return the number of internal data objects.
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.
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'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...
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 ...
Data ** External_interaction_geometric_data_pt
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 ...
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...
unsigned nnode() const
Return the number of nodes.
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
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...