brick_mesh.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// Version 1.0; svn revision $LastChangedRevision: 1182 $
7 //LIC//
8 //LIC// $LastChangedDate: 2016-05-20 16:50:20 +0100 (Fri, 20 May 2016) $
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 // Common base class for all BrickMeshes
31 
32 #ifndef OOMPH_BRICKMESH_HEADER
33 #define OOMPH_BRICKMESH_HEADER
34 
35 // Config header generated by autoconfig
36 #ifdef HAVE_CONFIG_H
37  #include <oomph-lib-config.h>
38 #endif
39 
40 #ifdef OOMPH_HAS_MPI
41 //mpi headers
42 #include "mpi.h"
43 #endif
44 
45 //oomphlib includes
46 #include "Vector.h"
47 #include "nodes.h"
48 #include "matrices.h"
49 #include "mesh.h"
50 #include "Qelements.h"
51 
52 namespace oomph
53 {
54 
55 ///////////////////////////////////////////////////////////////////////
56 ///////////////////////////////////////////////////////////////////////
57 ///////////////////////////////////////////////////////////////////////
58 
59 
60 //====================================================================
61 /// Helper namespace for generation of brick from tet mesh
62 //====================================================================
63 namespace BrickFromTetMeshHelper
64 {
65 
66  /// Tolerance for mismatch during setup of boundary coordinates
67  extern double Face_position_tolerance;
68 
69 }
70 
71 
72 ///////////////////////////////////////////////////////////////////
73 ///////////////////////////////////////////////////////////////////
74 ///////////////////////////////////////////////////////////////////
75 
76 
77 
78 //======================================================================
79 /// Dummy QElement to interpolate local coordinates -- used in
80 /// construction of brickified tet mesh.
81 //======================================================================
82 class DummyBrickElement : public virtual QElement<3,2>
83 {
84 
85  public:
86 
87 
88  ///\short Constructor:
90  {}
91 
92  /// Broken copy constructor
94  {
95  BrokenCopy::broken_copy("DummyElement");
96  }
97 
98  /// Broken assignment operator
99 //Commented out broken assignment operator because this can lead to a conflict warning
100 //when used in the virtual inheritence hierarchy. Essentially the compiler doesn't
101 //realise that two separate implementations of the broken function are the same and so,
102 //quite rightly, it shouts.
103  /*void operator=(const DummyBrickElement&)
104  {
105  BrokenCopy::broken_assign("DummyBrickElement");
106  }*/
107 
108 
109  /// \short Required # of `values' (pinned or dofs)
110  /// at node n
111  inline unsigned required_nvalue(const unsigned &n) const
112  {return 3;}
113 
114 
115  /// \short Compute vector of FE interpolated local coordinate in tet,
116  /// s_tet, evaluated at local coordinate s in current element.
118  {
119  //Find number of nodes
120  unsigned n_node = nnode();
121 
122  //Local shape function
123  Shape psi(n_node);
124 
125  //Find values of shape function
126  shape(s,psi);
127 
128  for (unsigned i=0;i<3;i++)
129  {
130  //Initialise value of u
131  s_tet[i] = 0.0;
132 
133  //Loop over the local nodes and sum
134  for(unsigned l=0;l<n_node;l++)
135  {
136  s_tet[i] += nodal_value(l,i)*psi[l];
137  }
138  }
139  }
140 
141  /// Output interpolated tet local coordinates
142  void output(std::ostream &outfile, const unsigned &nplot=5)
143  {
144  //Vector of local coordinates
145  Vector<double> s(3);
146  Vector<double> s_tet(3);
147 
148  // Tecplot header info
149  outfile << tecplot_zone_string(nplot);
150 
151  // Loop over plot points
152  unsigned num_plot_points=nplot_points(nplot);
153  for (unsigned iplot=0;iplot<num_plot_points;iplot++)
154  {
155 
156  // Get local coordinates of plot point
157  get_s_plot(iplot,nplot,s);
158 
159  // Local coordinates in tet
160  interpolated_s_tet(s,s_tet);
161 
162  // Coordinates
163  for(unsigned i=0;i<3;i++)
164  {
165  outfile << interpolated_x(s,i) << " ";
166  }
167 
168  // Local coordinates in tet
169  for(unsigned i=0;i<3;i++)
170  {
171  outfile << s_tet[i] << " ";
172  }
173 
174  outfile << std::endl;
175  }
176  outfile << std::endl;
177 
178  // Write tecplot footer (e.g. FE connectivity lists)
179  write_tecplot_zone_footer(outfile,nplot);
180 
181 }
182 
183 
184 
185 
186 };
187 
188 ///////////////////////////////////////////////////////////////////////////
189 ///////////////////////////////////////////////////////////////////////////
190 ///////////////////////////////////////////////////////////////////////////
191 
192 
193 
194 //================================================================
195 /// Base class for brick meshes (meshes made of 3D brick elements).
196 //================================================================
197 class BrickMeshBase : public virtual Mesh
198 {
199 
200 public:
201 
202  /// Constructor (empty)
204 
205 
206  /// Broken copy constructor
208  {
209  BrokenCopy::broken_copy("BrickMeshBase");
210  }
211 
212  /// Broken assignment operator
213  /*void operator=(const BrickMeshBase&)
214  {
215  BrokenCopy::broken_assign("BrickMeshBase");
216  }*/
217 
218  /// Destructor (empty)
219  virtual ~BrickMeshBase(){}
220 
221  /// Setup lookup schemes which establish whic elements are located
222  /// next to mesh's boundaries (wrapper to suppress doc).
224  {
225  std::ofstream outfile;
227  }
228 
229  /// \short Setup lookup schemes which establish whic elements are located
230  /// next to mesh's boundaries. Doc in outfile (if it's open).
231  void setup_boundary_element_info(std::ostream &outfile);
232 
233 };
234 
235 }
236 
237 #endif
238 
virtual ~BrickMeshBase()
Broken assignment operator.
Definition: brick_mesh.h:219
void setup_boundary_element_info()
Definition: brick_mesh.h:223
BrickMeshBase()
Constructor (empty)
Definition: brick_mesh.h:203
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
BrickMeshBase(const BrickMeshBase &)
Broken copy constructor.
Definition: brick_mesh.h:207
DummyBrickElement()
Constructor:
Definition: brick_mesh.h:89
Base class for brick meshes (meshes made of 3D brick elements).
Definition: brick_mesh.h:197
cstr elem_len * i
Definition: cfortran.h:607
void interpolated_s_tet(const Vector< double > &s, Vector< double > &s_tet) const
Compute vector of FE interpolated local coordinate in tet, s_tet, evaluated at local coordinate s in ...
Definition: brick_mesh.h:117
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: brick_mesh.h:111
static char t char * s
Definition: cfortran.h:572
void shape(const double &s, double *Psi)
Definition for 1D Lagrange shape functions. The value of all the shape functions at the local coordin...
Definition: shape.h:549
double Face_position_tolerance
Tolerance for mismatch during setup of boundary coordinates.
Definition: brick_mesh.cc:43
void output(std::ostream &outfile, const unsigned &nplot=5)
Output interpolated tet local coordinates.
Definition: brick_mesh.h:142
DummyBrickElement(const DummyBrickElement &dummy)
Broken copy constructor.
Definition: brick_mesh.h:93
A general mesh class.
Definition: mesh.h:74