extruded_macro_element.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 #ifndef OOMPH_EXTRUDED_MACRO_ELEMENT_HEADER
27 #define OOMPH_EXTRUDED_MACRO_ELEMENT_HEADER
28 
29 // Config header generated by autoconfig
30 #ifdef HAVE_CONFIG_H
31 #include <oomph-lib-config.h>
32 #endif
33 
34 #ifdef OOMPH_HAS_MPI
35 #include "mpi.h"
36 #endif
37 
38 // oomph-lib headers
39 #include "Vector.h"
40 #include "macro_element.h"
41 #include "oomph_utilities.h"
42 #include "quadtree.h"
43 #include "octree.h"
44 
45 namespace oomph
46 {
47  class ExtrudedDomain;
48 
49  //===================================================================
57  //===================================================================
58  class ExtrudedMacroElement : public virtual MacroElement
59  {
60  public:
69  unsigned macro_element_number)
72  {
73 #ifdef LEAK_CHECK
74  LeakCheckNames::ExtrudedMacroElement_build += 1;
75 #endif
76  } // End of ExtrudedMacroElement
77 
78 
81  {
82  // Throw an error!
83  throw OomphLibError(
84  "Don't call empty constructor for ExtrudedMacroElement!",
87  } // End of ExtrudedMacroElement
88 
89 
92 
94  void operator=(const ExtrudedMacroElement&) = delete;
95 
98  {
99 #ifdef LEAK_CHECK
100  LeakCheckNames::ExtrudedMacroElement_build -= 1;
101 #endif
102  } // End of ~ExtrudedMacroElement
103 
104 
107  {
108  // Return a pointer to the extruded domain within which this extruded
109  // macro element lies
110  return Extruded_domain_pt;
111  } // End of extruded_domain_pt
112 
113  protected:
116  };
117 
121 
122  //===================================================================
128  //===================================================================
129  template<int DIM>
131  {
132  };
133 
134  //===================================================================
142  //===================================================================
143  template<>
145  {
146  public:
150  const unsigned& macro_element_number)
153  {
154  }
155 
158  {
159  // Create an error message
161  "Don't call empty constructor for QExtrudedMacroElement!";
162 
163  // Throw the error message
164  throw OomphLibError(
166  } // End of QExtrudedMacroElement
167 
168 
171 
173  void operator=(const QExtrudedMacroElement&) = delete;
174 
177 
179  void output(const unsigned& t, std::ostream& outfile, const unsigned& nplot)
180  {
181  // Make sure that t=0 otherwise this doesn't make sense
182  if (t != 0)
183  {
184  // Create an output stream
185  std::ostringstream error_message_stream;
186 
187  // Create an error message
188  error_message_stream << "This output function outputs a space-time\n"
189  << "representation of the solution. As such, it\n"
190  << "does not make sense to output the solution\n"
191  << "at a previous time level!" << std::endl;
192 
193  // Throw an error
194  throw OomphLibError(error_message_stream.str(),
197  }
198 
199  // Storage for the local (space-time) coordinates
200  Vector<double> s(3, 0.0);
201 
202  // Storage for the global (space-time) coordinates
203  Vector<double> x(3, 0.0);
204 
205  // Output the header
206  outfile << "ZONE I=" << nplot << ", J=" << nplot << ", K=" << nplot
207  << std::endl;
208 
209  // Loop over the plot points in the t-direction
210  for (unsigned i = 0; i < nplot; i++)
211  {
212  // Calculate the time value
213  // s[2]=-1.0+2.0*double(i)/double(nplot-1);
214  s[2] = -1.0 + 2.0 * double(i) / double(nplot - 1);
215 
216  // Loop over the plot points in the y-direction
217  for (unsigned j = 0; j < nplot; j++)
218  {
219  // Calculate the y value
220  s[1] = -1.0 + 2.0 * double(j) / double(nplot - 1);
221 
222  // Loop over the plot points in the x-direction
223  for (unsigned k = 0; k < nplot; k++)
224  {
225  // Calculate the x value
226  s[0] = -1.0 + 2.0 * double(k) / double(nplot - 1);
227 
228  // Get the corresponding global space-time coordinates.
229  // NOTE: Calling the macro_map function from the base class requires
230  // the time level. To make the call function normally, we simply
231  // pass the argument t=0 and the appropriate function will be
232  // called.
233  macro_map(t, s, x);
234 
235  // Output the global coordinates
236  outfile << x[0] << " " << x[1] << " " << x[2] << " " << 0.0
237  << std::endl;
238  }
239  } // for (unsigned j=0;j<nplot;j++)
240  } // for (unsigned i=0;i<nplot;i++)
241  } // End of output
242 
243 
245  void macro_map(const unsigned& t,
246  const Vector<double>& s,
247  Vector<double>& r);
248 
249 
251  void output_macro_element_boundaries(std::ostream& outfile,
252  const unsigned& nplot);
253  };
254 } // End of namespace oomph
255 
256 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Definition: extruded_domain.h:58
Definition: extruded_macro_element.h:59
ExtrudedMacroElement()
Default constructor (empty and broken)
Definition: extruded_macro_element.h:80
virtual ~ExtrudedMacroElement()
Empty destructor.
Definition: extruded_macro_element.h:97
ExtrudedDomain * Extruded_domain_pt
Pointer to the extruded domain.
Definition: extruded_macro_element.h:115
ExtrudedDomain *& extruded_domain_pt()
Access function to the ExtrudedDomain.
Definition: extruded_macro_element.h:106
ExtrudedMacroElement(ExtrudedDomain *extruded_domain_pt, unsigned macro_element_number)
Definition: extruded_macro_element.h:68
ExtrudedMacroElement(const ExtrudedMacroElement &dummy)=delete
Broken copy constructor.
void operator=(const ExtrudedMacroElement &)=delete
Broken assignment operator.
Definition: macro_element.h:73
virtual void output_macro_element_boundaries(std::ostream &outfile, const unsigned &nplot)=0
Output all macro element boundaries as tecplot zones.
void macro_map(const Vector< double > &s, Vector< double > &r)
The mapping from local to global coordinates at the current time : r(s)
Definition: macro_element.h:126
Domain *& domain_pt()
Access function to the Domain_pt.
Definition: macro_element.h:229
unsigned & macro_element_number()
Access function to the Macro_element_number.
Definition: macro_element.h:223
Definition: oomph_definitions.h:222
void operator=(const QExtrudedMacroElement &)=delete
Broken assignment operator.
QExtrudedMacroElement(ExtrudedDomain *domain_pt, const unsigned &macro_element_number)
Definition: extruded_macro_element.h:149
virtual ~QExtrudedMacroElement()
Empty destructor.
Definition: extruded_macro_element.h:176
void output(const unsigned &t, std::ostream &outfile, const unsigned &nplot)
Plot: x,y,t in tecplot format.
Definition: extruded_macro_element.h:179
QExtrudedMacroElement()
Default constructor (empty and broken)
Definition: extruded_macro_element.h:157
QExtrudedMacroElement(const QExtrudedMacroElement &dummy)=delete
Broken copy constructor.
Definition: extruded_macro_element.h:131
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374
r
Definition: UniformPSDSelfTest.py:20
int error
Definition: calibrate.py:297
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2