hijacked_elements.cc
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-2023 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 // Non inline functions for Hijacked elements
27 #include "hijacked_elements.h"
28 
29 namespace oomph
30 {
31  //======================================================================
32  /// Static default value of the multiplier for the original residuals
33  /// The contribution to the total residuals is the product of the
34  /// multiplier and the original value of the residuals
35  //======================================================================
37 
38  //====================================================================
39  /// Destructor that cleans up any memory allocated by the class
40  //===================================================================
42  {
43  // If the hijacked equation number storage has been alloacted
44  // clear it
46  {
48  }
49 
50  // If the hijacked equation number storage has been alloacted
51  // clear it
53  {
55  }
56  }
57 
58  //======================================================================
59  /// Mark the global equation, addressed by global_eqn_pt,
60  /// as hijacked by this element.
61  //======================================================================
62  void HijackedElementBase::hijack_global_eqn(long* const& global_eqn_pt)
63  {
64  // If the storage has not been allocated, allocate it
66  {
67  Hijacked_global_eqn_number_pt = new std::set<long*>;
68  }
69 
70  // Now insert the value, note that this prevents multiple inclusions,
71  // which is neater, but possibly inefficient.
72  Hijacked_global_eqn_number_pt->insert(global_eqn_pt);
73  }
74 
75  //=====================================================================
76  /// The global equation, addressed by global_eqn_pt,
77  /// is no longer hijacked by this element.
78  //====================================================================
79  void HijackedElementBase::unhijack_global_eqn(long* const& global_eqn_pt)
80  {
81  // Check that the storage has been allocated
83  {
84  Hijacked_global_eqn_number_pt->erase(global_eqn_pt);
85  }
86  }
87 
88 } // namespace oomph
std::set< long * > * Hijacked_global_eqn_number_pt
Pointer to a Set of pointers to the equation numbers that will be hijacked by this element....
void unhijack_global_eqn(long *const &global_eqn_pt)
The global equation, addressed by global_eqn_pt, is no longer hijacked by this element.
void hijack_global_eqn(long *const &global_eqn_pt)
Mark the global equation, addressed by global_eqn_pt, as hijacked by this element.
Vector< int > * Hijacked_local_eqn_number_pt
Pointer to a vector of integers containing the local equation numbers of any hijacked variables in th...
virtual ~HijackedElementBase()
Destructor, destroy the storage for the equation numbers.
static double Default_residual_multiplier
Static default value for the double that multiplies the original residuals.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...