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// Copyright (C) 2006-2024 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Header file for multi-domain functions, including the class
27 // ElementWithExternalElement which stores pointers to external elements
28 
29 // Temporary flag to enable full annotation of multi domain
30 // comms (but keep alive because it would be such a bloody pain to
31 // rewrite it if things ever go wrong again...)
32 //#define ANNOTATE_MULTI_DOMAIN_COMMUNICATION
33 
34 // Include guards to prevent multiple inclusion of the header
35 #ifndef OOMPH_MISSING_MASTERS_HEADER
36 #define OOMPH_MISSING_MASTERS_HEADER
37 
38 // Config header generated by autoconfig
39 #ifdef HAVE_CONFIG_H
40 #include <oomph-lib-config.h>
41 #endif
42 
43 // Oomph-lib headers
44 #include "geom_objects.h"
45 #include "problem.h"
46 #include "shape.h"
47 
48 #include "mesh.h"
50 #include "algebraic_elements.h"
52 #include "Qelements.h"
54 
55 
56 namespace oomph
57 {
58  //======================================================================
59  // Namespace for global missing master constructing functions
60  //======================================================================
61  namespace Missing_masters_functions
62  {
63 #ifdef ANNOTATE_MISSING_MASTERS_COMMUNICATION
64 
65  // Temporary vector of strings to enable full annotation of multi domain
66  // comms (but keep alive because it would be such a bloody pain to
67  // rewrite it if things ever go wrong again...)
68  // This is left over from the multi-domain stuff and should work
69  // in the same way, but it has not been tested.
70  extern Vector<std::string> Flat_packed_unsigneds_string;
71 
72 #endif
73 
74  /// Boolean to indicate whether to doc timings or not.
75  extern bool Doc_timings;
76 
77  /// Boolean to indicate whether to document basic info (to screen)
78  /// during setup_multi_domain_interaction() routines
79  extern bool Doc_stats;
80 
81  /// Boolean to indicate whether to document further info (to screen)
82  /// during setup_multi_domain_interaction() routines
83  extern bool Doc_full_stats;
84 
85 
86  // Functions for multi-domain method
87 
88 #ifdef OOMPH_HAS_MPI
89  // Helper functions for external haloed node identification
90 
91 
92  /// Helper function to add external haloed nodes, inc. masters
93  /// of external haloed nodes
95  Node* nod_pt,
96  Mesh* const& mesh_pt,
97  int& n_cont_inter_values,
98  Vector<unsigned>& send_unsigneds,
99  Vector<double>& send_doubles);
100 
101 
102  /// Recursively add any master nodes (and their master nodes etc)
103  /// of external haloed nodes
105  int& iproc,
106  Node* nod_pt,
107  Mesh* const& mesh_pt,
108  int& n_cont_inter_values,
109  Vector<unsigned>& send_unsigneds,
110  Vector<double>& send_doubles);
111 
112 
113  /// Helper function to add external haloed node that is not a master
114  void add_external_haloed_node_helper(int& iproc,
115  Node* nod_pt,
116  Mesh* const& mesh_pt,
117  int& n_cont_inter_values,
118  Vector<unsigned>& send_unsigneds,
119  Vector<double>& send_doubles);
120 
121  /// Helper function to add external haloed node that is a master
123  int& iproc,
124  Node* master_nod_pt,
125  Mesh* const& mesh_pt,
126  int& n_cont_inter_values,
127  Vector<unsigned>& send_unsigneds,
128  Vector<double>& send_doubles);
129 
130  /// Helper function to get the required nodal information from an
131  /// external haloed node so that a fully-functional external halo
132  /// node (and therefore element) can be created on the receiving process
134  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  /// 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,
145  Node* master_nod_pt,
146  Mesh* const& mesh_pt,
147  int& n_cont_inter_values,
148  Vector<unsigned>& send_unsigneds,
149  Vector<double>& send_doubles);
150 
151  // Helper functions for external halo node identification
152 
153  /// Helper function to add external halo nodes, including any
154  /// masters, based on information received from the haloed process
155  template<class EXT_ELEMENT>
156  void add_external_halo_node_to_storage(Node*& new_nod_pt,
157  Mesh* const& mesh_pt,
158  unsigned& loc_p,
159  unsigned& node_index,
160  FiniteElement* const& new_el_pt,
161  int& n_cont_inter_values,
162  unsigned& counter_for_recv_unsigneds,
163  Vector<unsigned>& recv_unsigneds,
164  unsigned& counter_for_recv_doubles,
165  Vector<double>& recv_doubles);
166 
167  /// Recursively add masters of external halo nodes (and their
168  /// masters, etc) based on information received from the haloed process
169  template<class EXT_ELEMENT>
171  Node*& new_nod_pt,
172  Mesh* const& mesh_pt,
173  unsigned& loc_p,
174  unsigned& node_index,
175  int& n_cont_inter_values,
176  unsigned& counter_for_recv_unsigneds,
177  Vector<unsigned>& recv_unsigneds,
178  unsigned& counter_for_recv_doubles,
179  Vector<double>& recv_doubles);
180 
181 
182  /// Helper function to add external halo node that is not a master
183  void add_external_halo_node_helper(Node*& new_nod_pt,
184  Mesh* const& mesh_pt,
185  unsigned& loc_p,
186  unsigned& node_index,
187  FiniteElement* const& new_el_pt,
188  int& n_cont_inter_values,
189  unsigned& counter_for_recv_unsigneds,
190  Vector<unsigned>& recv_unsigneds,
191  unsigned& counter_for_recv_doubles,
192  Vector<double>& recv_doubles);
193 
194  /// Helper function to add external halo node that is a master
195  template<class EXT_ELEMENT>
197  Node*& new_master_nod_pt,
198  Node*& new_nod_pt,
199  Mesh* const& mesh_pt,
200  unsigned& loc_p,
201  int& n_cont_inter_values,
202  unsigned& counter_for_recv_unsigneds,
203  Vector<unsigned>& recv_unsigneds,
204  unsigned& counter_for_recv_doubles,
205  Vector<double>& recv_doubles);
206 
207 
208  /// Helper function which constructs a new external halo node
209  /// (on an element) with the information sent from the haloed process
211  Node*& new_nod_pt,
212  unsigned& loc_p,
213  unsigned& node_index,
214  FiniteElement* const& new_el_pt,
215  Mesh* const& mesh_pt,
216  unsigned& counter_for_recv_unsigneds,
217  Vector<unsigned>& recv_unsigneds,
218  unsigned& counter_for_recv_doubles,
219  Vector<double>& recv_doubles);
220 
221  /// Helper function which constructs a new external halo master node
222  /// with the information sent from the haloed process
223  template<class EXT_ELEMENT>
225  Node*& new_master_nod_pt,
226  Node*& nod_pt,
227  unsigned& loc_p,
228  Mesh* const& mesh_pt,
229  unsigned& counter_for_recv_unsigneds,
230  Vector<unsigned>& recv_unsigneds,
231  unsigned& counter_for_recv_doubles,
232  Vector<double>& recv_doubles);
233 
234 #endif
235 
236  } // namespace Missing_masters_functions
237 
238 
239 } // namespace oomph
240 
241 #endif
bool Doc_full_stats
Boolean to indicate whether to output further info during setup_multi_domain_interaction() routines.
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 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 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.
bool Doc_stats
Boolean to indicate whether to output basic info during setup_multi_domain_interaction() routines.
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.
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...
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 nodes.
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...
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 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_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.
bool Doc_timings
Boolean to indicate whether to doc timings or not.
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 new element) with the required informat...
Vector< std::string > Flat_packed_unsigneds_string
//////////////////////////////////////////////////////////////////// ////////////////////////////////...