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-2025 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
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
45namespace oomph
46{
47 class ExtrudedDomain;
48
49 //===================================================================
50 ///
51 ///
52 ///
53 /// DRAIG: FILL IN COMPLETE DESCRIPTION ONCE FINISHED...
54 ///
55 ///
56 ///
57 //===================================================================
58 class ExtrudedMacroElement : public virtual MacroElement
59 {
60 public:
61 /// Constructor: Pass pointer to ExtrudedDomain and the ID number
62 /// of the ExtrudedMacroElement within that ExtrudedDomain.
63 /// NOTE: The base class MacroElement requires a pointer to a Domain
64 /// object. However, the ExtrudedDomain class has not yet been defined
65 /// which means the compiler cannot know yet that its derives from Domain.
66 /// To avoid a compiler error a null pointer is passed to the base class
67 /// MacroElement.
69 unsigned macro_element_number)
72 {
73#ifdef LEAK_CHECK
74 LeakCheckNames::ExtrudedMacroElement_build += 1;
75#endif
76 } // End of ExtrudedMacroElement
77
78
79 /// Default constructor (empty and broken)
81 {
82 // Throw an error!
83 throw OomphLibError(
84 "Don't call empty constructor for ExtrudedMacroElement!",
87 } // End of ExtrudedMacroElement
88
89
90 /// Broken copy constructor
92
93 /// Broken assignment operator
94 void operator=(const ExtrudedMacroElement&) = delete;
95
96 /// Empty destructor
98 {
99#ifdef LEAK_CHECK
100 LeakCheckNames::ExtrudedMacroElement_build -= 1;
101#endif
102 } // End of ~ExtrudedMacroElement
103
104
105 /// Access function to the ExtrudedDomain
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:
114 /// Pointer to the extruded domain
116 };
117
118 ///////////////////////////////////////////////////////////////////////////
119 ///////////////////////////////////////////////////////////////////////////
120 ///////////////////////////////////////////////////////////////////////////
121
122 //===================================================================
123 /// QExtrudedMacroElement
124 ///
125 /// QExtrudedMacroElements are ExtrudedMacroElements with
126 /// linear/quadrilateral/hexahedral shape. This class is empty and
127 /// simply establishes the dimension as the template parameter.
128 //===================================================================
129 template<int DIM>
131 {
132 };
133
134 //===================================================================
135 ///
136 ///
137 ///
138 /// DRAIG: FILL IN COMPLETE DESCRIPTION ONCE FINISHED...
139 ///
140 ///
141 ///
142 //===================================================================
143 template<>
145 {
146 public:
147 /// Constructor: Pass the pointer to the domain and the ID
148 /// number of this extruded macro element
155
156 /// Default constructor (empty and broken)
158 {
159 // Create an error message
160 std::string error =
161 "Don't call empty constructor for QExtrudedMacroElement!";
162
163 // Throw the error message
164 throw OomphLibError(
166 } // End of QExtrudedMacroElement
167
168
169 /// Broken copy constructor
171
172 /// Broken assignment operator
173 void operator=(const QExtrudedMacroElement&) = delete;
174
175 /// Empty destructor
177
178 /// Plot: x,y,t in tecplot format
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
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
244 /// Get the global position r(s) at the continuous time, t
245 void macro_map(const unsigned& t,
246 const Vector<double>& s,
248
249
250 /// Output all macro element boundaries as tecplot zones
251 void output_macro_element_boundaries(std::ostream& outfile,
252 const unsigned& nplot);
253 };
254} // End of namespace oomph
255
256#endif
static char t char * s
Definition cfortran.h:568
cstr elem_len * i
Definition cfortran.h:603
char t
Definition cfortran.h:568
Base class for ExtrudedDomains with curvilinear and/or time-dependent boundaries. ExtrudedDomain boun...
DRAIG: FILL IN COMPLETE DESCRIPTION ONCE FINISHED...
ExtrudedMacroElement()
Default constructor (empty and broken)
virtual ~ExtrudedMacroElement()
Empty destructor.
ExtrudedDomain *& extruded_domain_pt()
Access function to the ExtrudedDomain.
ExtrudedDomain * Extruded_domain_pt
Pointer to the extruded domain.
ExtrudedMacroElement(ExtrudedDomain *extruded_domain_pt, unsigned macro_element_number)
Constructor: Pass pointer to ExtrudedDomain and the ID number of the ExtrudedMacroElement within that...
ExtrudedMacroElement(const ExtrudedMacroElement &dummy)=delete
Broken copy constructor.
void operator=(const ExtrudedMacroElement &)=delete
Broken assignment operator.
Base class for MacroElement s that are used during mesh refinement in domains with curvlinear and/or ...
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)
Domain *& domain_pt()
Access function to the Domain_pt.
unsigned & macro_element_number()
Access function to the Macro_element_number.
An OomphLibError object which should be thrown when an run-time error is encountered....
void operator=(const QExtrudedMacroElement &)=delete
Broken assignment operator.
QExtrudedMacroElement(ExtrudedDomain *domain_pt, const unsigned &macro_element_number)
Constructor: Pass the pointer to the domain and the ID number of this extruded macro element.
virtual ~QExtrudedMacroElement()
Empty destructor.
void output(const unsigned &t, std::ostream &outfile, const unsigned &nplot)
Plot: x,y,t in tecplot format.
QExtrudedMacroElement()
Default constructor (empty and broken)
QExtrudedMacroElement(const QExtrudedMacroElement &dummy)=delete
Broken copy constructor.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).