oomph::AlgebraicElementBase Class Reference

#include <algebraic_elements.h>

+ Inheritance diagram for oomph::AlgebraicElementBase:

Public Member Functions

 AlgebraicElementBase ()
 Empty constructor. More...
 
 AlgebraicElementBase (const AlgebraicElementBase &)=delete
 Broken copy constructor. More...
 
void operator= (const AlgebraicElementBase &)=delete
 Broken assignment operator. More...
 
void setup_algebraic_node_update (Node *&node_pt, const Vector< double > &s_father, FiniteElement *father_el_pt) const
 

Detailed Description

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Base class for algebraic elements.

Constructor & Destructor Documentation

◆ AlgebraicElementBase() [1/2]

oomph::AlgebraicElementBase::AlgebraicElementBase ( )
inline

Empty constructor.

509 {}

◆ AlgebraicElementBase() [2/2]

oomph::AlgebraicElementBase::AlgebraicElementBase ( const AlgebraicElementBase )
delete

Broken copy constructor.

Member Function Documentation

◆ operator=()

void oomph::AlgebraicElementBase::operator= ( const AlgebraicElementBase )
delete

Broken assignment operator.

◆ setup_algebraic_node_update()

void oomph::AlgebraicElementBase::setup_algebraic_node_update ( Node *&  node_pt,
const Vector< double > &  s_father,
FiniteElement father_el_pt 
) const

Set up node update info for (newly created) algebraic node: I.e. work out its node update information by interpolation from the father element. Pass pointer to father element and the newly created node's local coordinate in the father element.

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Set up node update info for (newly created) algebraic node: Work out its node update information by interpolation from its father element, based on pointer to father element and its local coordinate in the father element. We're creating the node update info for update functions that are shared by all nodes in the father element.

Now loop over the ids and check if they appear in all nodes

52  {
53  // Turn node into algebraic node
54  AlgebraicNode* alg_node_pt = dynamic_cast<AlgebraicNode*>(node_pt);
55 
56  // Get number of nodes in father element
57  unsigned nnod_father = father_el_pt->nnode();
58 
59  // Create map that stores the number of times a node update fct id
60  // has been encountered
61  std::map<int, unsigned> id_count;
62 
63  // Loop over all nodes in father element to extract node update ids
64  Vector<int> id;
65  for (unsigned j = 0; j < nnod_father; j++)
66  {
67  // Get vector of ids and add them to map
68  dynamic_cast<AlgebraicNode*>(father_el_pt->node_pt(j))
69  ->node_update_fct_id(id);
70  unsigned n_id = id.size();
71  for (unsigned i = 0; i < n_id; i++)
72  {
73  id_count[id[i]]++;
74  }
75  }
76 
78  Vector<int> shared_ids;
79  typedef std::map<int, unsigned>::iterator IT;
80  for (IT it = id_count.begin(); it != id_count.end(); it++)
81  {
82  if (it->second == nnod_father)
83  {
84  shared_ids.push_back(it->first);
85  }
86  }
87 
88 
89  // How many update functions we have?
90  unsigned n_update_id = shared_ids.size();
91 
92  // Loop over all node udate functions -- since it's shared by
93  // nodes we may as well read the required data from the first
94  // node in the father.
95  AlgebraicNode* father_node_pt =
96  dynamic_cast<AlgebraicNode*>(father_el_pt->node_pt(0));
97  for (unsigned i = 0; i < n_update_id; i++)
98  {
99  // Actual id:
100  int id = shared_ids[i];
101 
102  // Is this a real update fct or the default dummy one?
103  if (id >= 0)
104  {
105  // Get vector of geometric objects involved in specified node update
106  // function (create vector by copy operation)
107  Vector<GeomObject*> geom_obj_pt(
108  father_node_pt->vector_geom_object_pt(id));
109 
110  // Loop over reference values and obtain the
111  // ones for the current (son) element by interpolation from
112  // the father
113 
114  // Number of reference values for this udpate function
115  unsigned nvalue = father_node_pt->nref_value(id);
116  Vector<double> ref_value(nvalue);
117 
118  // Set up the shape functions in father element
119  Shape psi(nnod_father);
120 
121  // Get shape functions in father element
122  father_el_pt->shape(s_father, psi);
123 
124  // Initialise reference values
125  for (unsigned ivalue = 0; ivalue < nvalue; ivalue++)
126  {
127  ref_value[ivalue] = 0.0;
128  }
129 
130  // Loop over all nodes in father element for
131  // interpolation of nodes -- don't need to
132  // worry about hanging nodes here as reference values
133  // are only assigned once and then in a consistent way
134  for (unsigned j_father = 0; j_father < nnod_father; j_father++)
135  {
136  // Get reference values at node in father by copy operation
137  Vector<double> father_ref_value(
138  dynamic_cast<AlgebraicNode*>(father_el_pt->node_pt(j_father))
139  ->vector_ref_value(id));
140 
141  // Loop over reference values
142  for (unsigned ivalue = 0; ivalue < nvalue; ivalue++)
143  {
144  ref_value[ivalue] += father_ref_value[ivalue] * psi(j_father);
145  }
146  }
147 
148  // Get mesh that implements the update operation
149  AlgebraicMesh* mesh_pt = father_node_pt->mesh_pt(id);
150 
151 
152  // Setup node update info for node
153  alg_node_pt->add_node_update_info(id, // id
154  mesh_pt, // mesh
155  geom_obj_pt, // vector of geom objects
156  ref_value); // vector of ref. values
157 
158  // Update the geometric references (e.g. in FSI) if required
159  mesh_pt->update_node_update(alg_node_pt);
160 
161  } // endif for real vs. default dummy node update fct
162 
163  } // end of loop over different update fcts
164 
165  // Update the node at its current and previous positions
166  bool update_all_time_levels_for_new_node = true;
167  alg_node_pt->node_update(update_all_time_levels_for_new_node);
168  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References oomph::AlgebraicNode::add_node_update_info(), i, j, oomph::AlgebraicNode::mesh_pt(), oomph::FiniteElement::nnode(), oomph::FiniteElement::node_pt(), oomph::AlgebraicNode::node_update(), oomph::AlgebraicNode::nref_value(), oomph::FiniteElement::shape(), oomph::AlgebraicMesh::update_node_update(), oomph::AlgebraicNode::vector_geom_object_pt(), and oomph::AlgebraicNode::vector_ref_value().

Referenced by oomph::RefineableQElement< 3 >::build(), oomph::RefineableQElement< 1 >::build(), oomph::RefineableQElement< 2 >::build(), oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::p_refine(), oomph::PRefineableQElement< 2, INITIAL_NNODE_1D >::p_refine(), and oomph::PRefineableQElement< 3, INITIAL_NNODE_1D >::p_refine().


The documentation for this class was generated from the following files: