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