missing_masters.h
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 //Header file for multi-domain functions, including the class
31 //ElementWithExternalElement which stores pointers to external elements
32 
33 // Temporary flag to enable full annotation of multi domain
34 // comms (but keep alive because it would be such a bloody pain to
35 // rewrite it if things ever go wrong again...)
36 //#define ANNOTATE_MULTI_DOMAIN_COMMUNICATION
37 
38 //Include guards to prevent multiple inclusion of the header
39 #ifndef OOMPH_MISSING_MASTERS_HEADER
40 #define OOMPH_MISSING_MASTERS_HEADER
41 
42 // Config header generated by autoconfig
43 #ifdef HAVE_CONFIG_H
44 #include <oomph-lib-config.h>
45 #endif
46 
47 //Oomph-lib headers
48 #include "geom_objects.h"
49 #include "problem.h"
50 #include "shape.h"
51 
52 #include "mesh.h"
54 #include "algebraic_elements.h"
56 #include "Qelements.h"
58 
59 
60 namespace oomph
61 {
62 
63 //======================================================================
64 // Namespace for global missing master constructing functions
65 //======================================================================
66 namespace Missing_masters_functions
67  {
68 
69 #ifdef ANNOTATE_MISSING_MASTERS_COMMUNICATION
70 
71  // Temporary vector of strings to enable full annotation of multi domain
72  // comms (but keep alive because it would be such a bloody pain to
73  // rewrite it if things ever go wrong again...)
74  // This is left over from the multi-domain stuff and should work
75  // in the same way, but it has not been tested.
76  extern Vector<std::string> Flat_packed_unsigneds_string;
77 
78 #endif
79 
80  /// \short Boolean to indicate whether to doc timings or not.
81  extern bool Doc_timings;
82 
83  /// \short Boolean to indicate whether to document basic info (to screen)
84  /// during setup_multi_domain_interaction() routines
85  extern bool Doc_stats;
86 
87  /// \short Boolean to indicate whether to document further info (to screen)
88  /// during setup_multi_domain_interaction() routines
89  extern bool Doc_full_stats;
90 
91 
92  // Functions for multi-domain method
93 
94 #ifdef OOMPH_HAS_MPI
95  // Helper functions for external haloed node identification
96 
97 
98  /// \short Helper function to add external haloed nodes, inc. masters
99  /// of external haloed nodes
100  void add_external_haloed_node_to_storage(int& iproc, Node* nod_pt,
101  Mesh* const &mesh_pt,
102  int& n_cont_inter_values,
103  Vector<unsigned>& send_unsigneds,
104  Vector<double>& send_doubles);
105 
106 
107  /// \short Recursively add any master nodes (and their master nodes etc)
108  /// of external haloed nodes
110  int& iproc, Node* nod_pt,
111  Mesh* const &mesh_pt,
112  int& n_cont_inter_values,
113  Vector<unsigned>& send_unsigneds,
114  Vector<double>& send_doubles);
115 
116 
117  /// \short Helper function to add external haloed node that is not a master
118  void add_external_haloed_node_helper(int& iproc, Node* nod_pt,
119  Mesh* const &mesh_pt,
120  int& n_cont_inter_values,
121  Vector<unsigned>& send_unsigneds,
122  Vector<double>& send_doubles);
123 
124  /// \short Helper function to add external haloed node that is a master
125  void add_external_haloed_master_node_helper(int& iproc,Node* master_nod_pt,
126  Mesh* const &mesh_pt,
127  int& n_cont_inter_values,
128  Vector<unsigned>& send_unsigneds,
129  Vector<double>& send_doubles);
130 
131  /// \short Helper function to get the required nodal information from an
132  /// external haloed node so that a fully-functional external halo
133  /// node (and therefore element) can be created on the receiving process
134  void get_required_nodal_information_helper(int& iproc, Node* nod_pt,
135  Mesh* const &mesh_pt,
136  int& n_cont_inter_values,
137  Vector<unsigned>& send_unsigneds,
138  Vector<double>& send_doubles);
139 
140  /// \short Helper function to get the required master nodal information from
141  /// an external haloed master node so that a fully-functional external halo
142  /// master node (and possible element) can be created on the receiving proc
144  (int& iproc, Node* master_nod_pt,
145  Mesh* const &mesh_pt, int& n_cont_inter_values,
146  Vector<unsigned>& send_unsigneds,
147  Vector<double>& send_doubles);
148 
149  // Helper functions for external halo node identification
150 
151  /// \short Helper function to add external halo nodes, including any masters,
152  /// based on information received from the haloed process
153  template<class EXT_ELEMENT>
154  void add_external_halo_node_to_storage(Node* &new_nod_pt,
155  Mesh* const &mesh_pt,
156  unsigned& loc_p,
157  unsigned& node_index,
158  FiniteElement* const &new_el_pt,
159  int& n_cont_inter_values,
160  unsigned &counter_for_recv_unsigneds,
161  Vector<unsigned>& recv_unsigneds,
162  unsigned &counter_for_recv_doubles,
163  Vector<double>& recv_doubles);
164 
165  /// \short Recursively add masters of external halo nodes (and their
166  /// masters, etc) based on information received from the haloed process
167  template<class EXT_ELEMENT>
169  (Node* &new_nod_pt, Mesh* const &mesh_pt, unsigned& loc_p,
170  unsigned& node_index, int& n_cont_inter_values,
171  unsigned &counter_for_recv_unsigneds,
172  Vector<unsigned>& recv_unsigneds,
173  unsigned &counter_for_recv_doubles,
174  Vector<double>& recv_doubles);
175 
176 
177  /// \short Helper function to add external halo node that is not a master
178  void add_external_halo_node_helper(Node* &new_nod_pt,
179  Mesh* const &mesh_pt,
180  unsigned& loc_p,
181  unsigned& node_index,
182  FiniteElement* const &new_el_pt,
183  int& n_cont_inter_values,
184  unsigned &counter_for_recv_unsigneds,
185  Vector<unsigned>& recv_unsigneds,
186  unsigned &counter_for_recv_doubles,
187  Vector<double>& recv_doubles);
188 
189  /// \short Helper function to add external halo node that is a master
190  template<class EXT_ELEMENT>
191  void add_external_halo_master_node_helper(Node* &new_master_nod_pt,
192  Node* &new_nod_pt,
193  Mesh* const &mesh_pt,
194  unsigned& loc_p,
195  int& n_cont_inter_values,
196  unsigned &counter_for_recv_unsigneds,
197  Vector<unsigned>& recv_unsigneds,
198  unsigned &counter_for_recv_doubles,
199  Vector<double>& recv_doubles);
200 
201 
202  /// \short Helper function which constructs a new external halo node
203  /// (on an element) with the information sent from the haloed process
204  void construct_new_external_halo_node_helper(Node* &new_nod_pt,
205  unsigned& loc_p,
206  unsigned& node_index,
207  FiniteElement* const
208  &new_el_pt,
209  Mesh* const &mesh_pt,
210  unsigned &counter_for_recv_unsigneds,
211  Vector<unsigned>& recv_unsigneds,
212  unsigned &counter_for_recv_doubles,
213  Vector<double>& recv_doubles);
214 
215  /// \short Helper function which constructs a new external halo master node
216  /// with the information sent from the haloed process
217  template<class EXT_ELEMENT>
219  (Node* &new_master_nod_pt,Node* &nod_pt,unsigned& loc_p,
220  Mesh* const &mesh_pt,
221  unsigned &counter_for_recv_unsigneds,
222  Vector<unsigned>& recv_unsigneds,
223  unsigned &counter_for_recv_doubles,
224  Vector<double>& recv_doubles);
225 
226 #endif
227 
228  }
229 
230 
231 }
232 
233 #endif
234 
235 
236 
237 
238 
void add_external_haloed_node_helper(int &iproc, Node *nod_pt, Mesh *const &mesh_pt, int &n_cont_inter_values, Vector< unsigned > &send_unsigneds, Vector< double > &send_doubles)
Helper to add external haloed node that is not a master.
void recursively_add_masters_of_external_haloed_node(int &iproc, Node *nod_pt, Mesh *const &mesh_pt, int &n_cont_inter_values, Vector< unsigned > &send_unsigneds, Vector< double > &send_doubles)
Recursively add any master nodes (and their master nodes etc) of external haloed nodes.
Vector< std::string > Flat_packed_unsigneds_string
bool Doc_full_stats
Boolean to indicate whether to output further info during setup_multi_domain_interaction() routines...
void get_required_nodal_information_helper(int &iproc, Node *nod_pt, Mesh *const &mesh_pt, int &n_cont_inter_values, Vector< unsigned > &send_unsigneds, Vector< double > &send_doubles)
Helper function to get the required nodal information from an external haloed node so that a fully-fu...
void add_external_halo_node_to_storage(Node *&new_nod_pt, Mesh *const &mesh_pt, unsigned &loc_p, unsigned &node_index, FiniteElement *const &new_el_pt, int &n_cont_inter_values, unsigned &counter_for_recv_unsigneds, Vector< unsigned > &recv_unsigneds, unsigned &counter_for_recv_doubles, Vector< double > &recv_doubles)
Helper function to add external halo nodes, including any masters, based on information received from...
bool Doc_timings
Boolean to indicate whether to doc timings or not.
void add_external_halo_master_node_helper(Node *&new_master_nod_pt, Node *&new_nod_pt, Mesh *const &mesh_pt, unsigned &loc_p, int &n_cont_inter_values, unsigned &counter_for_recv_unsigneds, Vector< unsigned > &recv_unsigneds, unsigned &counter_for_recv_doubles, Vector< double > &recv_doubles)
Helper function to add external halo node that is a master.
void add_external_halo_node_helper(Node *&new_nod_pt, Mesh *const &mesh_pt, unsigned &loc_p, unsigned &node_index, FiniteElement *const &new_el_pt, int &n_cont_inter_values, unsigned &counter_for_recv_unsigneds, Vector< unsigned > &recv_unsigneds, unsigned &counter_for_recv_doubles, Vector< double > &recv_doubles)
Helper functiono to add external halo node that is not a master.
void get_required_master_nodal_information_helper(int &iproc, Node *master_nod_pt, Mesh *const &mesh_pt, int &n_cont_inter_values, Vector< unsigned > &send_unsigneds, Vector< double > &send_doubles)
Helper function to get the required master nodal information from an external haloed master node so t...
void add_external_haloed_master_node_helper(int &iproc, Node *master_nod_pt, Mesh *const &mesh_pt, int &n_cont_inter_values, Vector< unsigned > &send_unsigneds, Vector< double > &send_doubles)
Helper function to add external haloed node that is a master.
void add_external_haloed_node_to_storage(int &iproc, Node *nod_pt, Mesh *const &mesh_pt, int &n_cont_inter_values, Vector< unsigned > &send_unsigneds, Vector< double > &send_doubles)
Helper function to add external haloed nodes, including any masters.
bool Doc_stats
Boolean to indicate whether to output basic info during setup_multi_domain_interaction() routines...
void construct_new_external_halo_node_helper(Node *&new_nod_pt, unsigned &loc_p, unsigned &node_index, FiniteElement *const &new_el_pt, Mesh *const &mesh_pt, unsigned &counter_for_recv_unsigneds, Vector< unsigned > &recv_unsigneds, unsigned &counter_for_recv_doubles, Vector< double > &recv_doubles)
Helper function which constructs a new external halo node (on an element) with the information sent f...
void recursively_add_masters_of_external_halo_node_to_storage(Node *&new_nod_pt, Mesh *const &mesh_pt, unsigned &loc_p, unsigned &node_index, int &n_cont_inter_values, unsigned &counter_for_recv_unsigneds, Vector< unsigned > &recv_unsigneds, unsigned &counter_for_recv_doubles, Vector< double > &recv_doubles)
Recursively add masters of external halo nodes (and their masters, etc) based on information received...
void construct_new_external_halo_master_node_helper(Node *&new_master_nod_pt, Node *&nod_pt, unsigned &loc_p, Mesh *const &mesh_pt, unsigned &counter_for_recv_unsigneds, Vector< unsigned > &recv_unsigneds, unsigned &counter_for_recv_doubles, Vector< double > &recv_doubles)
Helper function which constructs a new external halo master node with the information sent from the h...