multi_domain.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-2022 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_MULTI_DOMAIN_HEADER
36 #define OOMPH_MULTI_DOMAIN_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 multi-domain functions
60  //======================================================================
61  namespace Multi_domain_functions
62  {
68 
71  extern unsigned Dim;
72 
79  extern Vector<Vector<unsigned>> External_element_located;
80 
85  extern Vector<double> Flat_packed_zetas_not_found_locally;
86 
93  extern Vector<double> Received_flat_packed_zetas_to_be_found;
94 
102  extern Vector<int> Proc_id_plus_one_of_external_element;
103 
109  extern Vector<unsigned> Located_element_status;
110 
113  extern Vector<double> Flat_packed_located_coordinates;
114 
117  extern Vector<double> Flat_packed_doubles;
118 
123  extern unsigned Counter_for_flat_packed_doubles;
124 
129  extern Vector<unsigned> Flat_packed_unsigneds;
130 
131 #ifdef ANNOTATE_MULTI_DOMAIN_COMMUNICATION
132 
133  // Temporary vector of strings to enable full annotation of multi domain
134  // comms (but keep alive because it would be such a bloody pain to
135  // rewrite it if things ever go wrong again...)
136  extern Vector<std::string> Flat_packed_unsigneds_string;
137 
138 #endif
139 
144  extern unsigned Counter_for_flat_packed_unsigneds;
145 
147  enum
148  {
151  Not_found
152  };
153 
157  extern bool Use_bulk_element_as_external;
158 
165 
171 
173  extern bool Doc_timings;
174 
177  extern bool Doc_stats;
178 
181  extern bool Doc_full_stats;
182 
186  extern std::ofstream Doc_boundary_coordinate_file;
187 
188 
189  // Functions for multi-domain method
190 
200  template<class BULK_ELEMENT, unsigned DIM>
202  Problem* problem_pt,
203  Vector<unsigned>& boundary_in_bulk_mesh,
204  Mesh* const& bulk_mesh_pt,
205  Vector<Mesh*>& face_mesh_pt,
206  const unsigned& interaction = 0);
207 
208 
215  template<class BULK_ELEMENT, unsigned DIM>
217  Problem* problem_pt,
218  const unsigned& boundary_in_bulk_mesh,
219  Mesh* const& bulk_mesh_pt,
220  Mesh* const& face_mesh_pt,
221  const unsigned& interaction = 0);
222 
234  template<class ELEMENT_0, class ELEMENT_1>
236  Problem* problem_pt,
237  Mesh* const& first_mesh_pt,
238  Mesh* const& second_mesh_pt,
239  const unsigned& first_interaction = 0,
240  const unsigned& second_interaction = 0);
241 
255  template<class EXT_ELEMENT>
256  void setup_multi_domain_interaction(Problem* problem_pt,
257  Mesh* const& mesh_pt,
258  Mesh* const& external_mesh_pt,
259  const unsigned& interaction_index = 0);
260 
285  template<class EXT_ELEMENT, class FACE_ELEMENT_GEOM_OBJECT>
286  void setup_multi_domain_interaction(Problem* problem_pt,
287  Mesh* const& mesh_pt,
288  Mesh* const& external_mesh_pt,
289  Mesh* const& external_face_mesh_pt,
290  const unsigned& interaction_index = 0);
291 
292 
320  template<class EXT_ELEMENT, class FACE_ELEMENT_GEOM_OBJECT>
322  Problem* problem_pt,
323  const Vector<Mesh*>& mesh_pt,
324  Mesh* const& external_mesh_pt,
325  const Vector<Mesh*>& external_face_mesh_pt,
326  const unsigned& interaction_index = 0);
327 
328 
330  template<class EXT_ELEMENT, class GEOM_OBJECT>
332  Problem* problem_pt,
333  Mesh* const& mesh_pt,
334  Mesh* const& external_mesh_pt,
335  const unsigned& interaction_index,
336  Mesh* const& external_face_mesh_pt = 0);
337 
339  template<class EXT_ELEMENT, class GEOM_OBJECT>
341  Problem* problem_pt,
342  const Vector<Mesh*>& mesh_pt,
343  Mesh* const& external_mesh_pt,
344  const unsigned& interaction_index,
345  const Vector<Mesh*>& external_face_mesh_pt);
346 
351  const Vector<Mesh*>& mesh_pt,
352  Mesh* const& external_mesh_pt,
353  Vector<MeshAsGeomObject*>& mesh_geom_obj_pt,
354  const unsigned& interaction_index);
355 
356 
357 #ifdef OOMPH_HAS_MPI
358 
361  void send_and_receive_missing_zetas(Problem* problem_pt);
362 
366  void locate_zeta_for_missing_coordinates(
367  int& iproc,
368  Mesh* const& external_mesh_pt,
369  Problem* problem_pt,
370  Vector<MeshAsGeomObject*>& mesh_geom_obj_pt);
371 
372 
374  void send_and_receive_located_info(int& iproc,
375  Mesh* const& external_mesh_pt,
376  Problem* problem_pt);
377 
382  template<class EXT_ELEMENT>
383  void create_external_halo_elements(int& iproc,
384  const Vector<Mesh*>& mesh_pt,
385  Mesh* const& external_mesh_pt,
386  Problem* problem_pt,
387  const unsigned& interaction_index);
388 
389  // Helper functions for external haloed node identification
390 
393  void add_external_haloed_node_to_storage(int& iproc,
394  Node* nod_pt,
395  Problem* problem_pt,
396  Mesh* const& external_mesh_pt,
397  int& n_cont_inter_values);
398 
399 
402  void recursively_add_masters_of_external_haloed_node(
403  int& iproc,
404  Node* nod_pt,
405  Problem* problem_pt,
406  Mesh* const& external_mesh_pt,
407  int& n_cont_inter_values);
408 
409 
411  void add_external_haloed_node_helper(int& iproc,
412  Node* nod_pt,
413  Problem* problem_pt,
414  Mesh* const& external_mesh_pt,
415  int& n_cont_inter_values);
416 
418  void add_external_haloed_master_node_helper(int& iproc,
419  Node* master_nod_pt,
420  Problem* problem_pt,
421  Mesh* const& external_mesh_pt,
422  int& n_cont_inter_values);
423 
427  void get_required_nodal_information_helper(int& iproc,
428  Node* nod_pt,
429  Problem* problem_pt,
430  Mesh* const& external_mesh_pt,
431  int& n_cont_inter_values);
432 
436  void get_required_master_nodal_information_helper(
437  int& iproc,
438  Node* master_nod_pt,
439  Problem* problem_pt,
440  Mesh* const& external_mesh_pt,
441  int& n_cont_inter_values);
442 
443  // Helper functions for external halo node identification
444 
447  template<class EXT_ELEMENT>
448  void add_external_halo_node_to_storage(Node*& new_nod_pt,
449  Mesh* const& external_mesh_pt,
450  unsigned& loc_p,
451  unsigned& node_index,
452  FiniteElement* const& new_el_pt,
453  int& n_cont_inter_values,
454  Problem* problem_pt);
455 
458  template<class EXT_ELEMENT>
459  void recursively_add_masters_of_external_halo_node_to_storage(
460  Node*& new_nod_pt,
461  Mesh* const& external_mesh_pt,
462  unsigned& loc_p,
463  unsigned& node_index,
464  FiniteElement* const& new_el_pt,
465  int& n_cont_inter_values,
466  Problem* problem_pt);
467 
468 
470  void add_external_halo_node_helper(Node*& new_nod_pt,
471  Mesh* const& external_mesh_pt,
472  unsigned& loc_p,
473  unsigned& node_index,
474  FiniteElement* const& new_el_pt,
475  int& n_cont_inter_values,
476  Problem* problem_pt);
477 
479  template<class EXT_ELEMENT>
480  void add_external_halo_master_node_helper(Node*& new_master_nod_pt,
481  Node*& new_nod_pt,
482  Mesh* const& external_mesh_pt,
483  unsigned& loc_p,
484  int& n_cont_inter_values,
485  Problem* problem_pt);
486 
487 
490  void construct_new_external_halo_node_helper(
491  Node*& new_nod_pt,
492  unsigned& loc_p,
493  unsigned& node_index,
494  FiniteElement* const& new_el_pt,
495  Mesh* const& external_mesh_pt,
496  Problem* problem_pt);
497 
500  template<class EXT_ELEMENT>
501  void construct_new_external_halo_master_node_helper(
502  Node*& new_master_nod_pt,
503  Node*& nod_pt,
504  unsigned& loc_p,
505  Mesh* const& external_mesh_pt,
506  Problem* problem_pt);
507 
508 #endif
509 
513  void get_dim_helper(Problem* problem_pt,
514  Mesh* const& mesh_pt,
515  Mesh* const& external_mesh_pt);
516 
519  void clean_up();
520 
521  } // namespace Multi_domain_functions
522 
523 
524 } // namespace oomph
525 
526 #endif
Definition: elements.h:1313
Definition: mesh.h:67
Definition: nodes.h:906
Definition: problem.h:151
Vector< int > Proc_id_plus_one_of_external_element
Definition: multi_domain.cc:91
Vector< double > Flat_packed_located_coordinates
Definition: multi_domain.cc:102
unsigned Counter_for_flat_packed_unsigneds
Definition: multi_domain.cc:134
Vector< Vector< unsigned > > External_element_located
Definition: multi_domain.cc:68
unsigned Dim
Definition: multi_domain.cc:60
Vector< double > Flat_packed_doubles
Definition: multi_domain.cc:106
void setup_bulk_elements_adjacent_to_face_mesh(Problem *problem_pt, Vector< unsigned > &boundary_in_bulk_mesh, Mesh *const &bulk_mesh_pt, Vector< Mesh * > &face_mesh_pt, const unsigned &interaction=0)
/ Templated helper functions for multi-domain methods using locate_zeta
Definition: multi_domain.template.cc:72
void clean_up()
Definition: multi_domain.cc:2413
void setup_multi_domain_interactions(Problem *problem_pt, Mesh *const &first_mesh_pt, Mesh *const &second_mesh_pt, const unsigned &first_interaction=0, const unsigned &second_interaction=0)
Definition: multi_domain.template.cc:244
Vector< unsigned > Flat_packed_unsigneds
Definition: multi_domain.cc:118
bool Doc_timings
Boolean to indicate whether to doc timings or not.
Definition: multi_domain.cc:158
void get_dim_helper(Problem *problem_pt, Mesh *const &mesh_pt, Mesh *const &external_mesh_pt)
Definition: multi_domain.cc:2343
std::ofstream Doc_boundary_coordinate_file
Definition: multi_domain.cc:47
Vector< double > Flat_packed_zetas_not_found_locally
Definition: multi_domain.cc:74
void locate_zeta_for_local_coordinates(const Vector< Mesh * > &mesh_pt, Mesh *const &external_mesh_pt, Vector< MeshAsGeomObject * > &mesh_geom_obj_pt, const unsigned &interaction_index)
Definition: multi_domain.cc:2153
bool Allow_use_of_halo_elements_as_external_elements
Definition: multi_domain.cc:149
bool Allow_use_of_halo_elements_as_external_elements_for_projection
Definition: multi_domain.cc:155
bool Doc_stats
Definition: multi_domain.cc:162
bool Doc_full_stats
Definition: multi_domain.cc:166
Vector< double > Received_flat_packed_zetas_to_be_found
Definition: multi_domain.cc:82
@ New
Definition: multi_domain.h:149
@ Not_found
Definition: multi_domain.h:151
@ Exists
Definition: multi_domain.h:150
bool Use_bulk_element_as_external
Definition: multi_domain.cc:142
void setup_multi_domain_interaction(Problem *problem_pt, Mesh *const &mesh_pt, Mesh *const &external_mesh_pt, const unsigned &interaction_index=0)
Definition: multi_domain.template.cc:280
void aux_setup_multi_domain_interaction(Problem *problem_pt, Mesh *const &mesh_pt, Mesh *const &external_mesh_pt, const unsigned &interaction_index, Mesh *const &external_face_mesh_pt=0)
Auxiliary helper function.
Definition: multi_domain.template.cc:485
Vector< unsigned > Located_element_status
Definition: multi_domain.cc:98
unsigned Counter_for_flat_packed_doubles
Definition: multi_domain.cc:112
bool Accept_failed_locate_zeta_in_setup_multi_domain_interaction
Definition: multi_domain.cc:56
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10