xda_tet_mesh.template.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$
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 #ifndef OOMPH_XDA_TET_MESH_HEADER
31 #define OOMPH_XDA_TET_MESH_HEADER
32 
33 // Config header generated by autoconfig
34 #ifdef HAVE_CONFIG_H
35  #include <oomph-lib-config.h>
36 #endif
37 
38 
39 #ifdef OOMPH_HAS_MPI
40 //mpi headers
41 #include "mpi.h"
42 #endif
43 
44 #include<string>
45 #include<iterator>
46 #include<algorithm>
47 
48 #include "../generic/mesh.h"
49 #include "../generic/tet_mesh.h"
50 
51 namespace oomph
52 {
53 
54 
55 //========================================================================
56 /// Tet mesh made of quadratic (ten node) tets built from xda input file.
57 //========================================================================
58  template<class ELEMENT>
59  class XdaTetMesh : public virtual TetMeshBase
60  {
61 
62  public:
63 
64  /// \short Constructor: Pass name of xda file. Note that
65  /// all boundary elements get their own ID -- this is required for
66  /// FSI problems. In this case; the vector containing the oomph-lib
67  /// boundary IDs of all oomph-lib boundaries that collectively form
68  /// a given boundary as specified in the xda input file can be
69  /// obtained from the access function oomph_lib_boundary_ids(...).
70  /// Timestepper defaults to steady pseudo-timestepper.
71  XdaTetMesh(const std::string xda_file_name,
72  TimeStepper* time_stepper_pt=
73  &Mesh::Default_TimeStepper);
74 
75  /// \short Setup boundary coordinate on boundary b while is
76  /// temporarily flattened to simplex faces. Boundary coordinates are the
77  /// x-y coordinates in the plane of that boundary with the
78  /// x-axis along the line from the (lexicographically)
79  /// "lower left" to the "upper right" node. The y axis
80  /// is obtained by taking the cross-product of the positive
81  /// x direction with the outer unit normal computed by
82  /// the face elements (or its negative if switch_normal is set
83  /// to true).
84  void setup_boundary_coordinates(const unsigned& b,
85  const bool& switch_normal)
86  {
87  std::ofstream outfile;
88  setup_boundary_coordinates(b,switch_normal,outfile);
89  }
90 
91 
92  /// Setup boundary coordinate on boundary b while is
93  /// temporarily flattened to simplex faces. Boundary coordinates are the
94  /// x-y coordinates in the plane of that boundary with the
95  /// x-axis along the line from the (lexicographically)
96  /// "lower left" to the "upper right" node. The y axis
97  /// is obtained by taking the cross-product of the positive
98  /// x direction with the outer unit normal computed by
99  /// the face elements (or its negative if switch_normal is set
100  /// to true). Doc faces in output file.
101  void setup_boundary_coordinates(const unsigned& b,
102  const bool& switch_normal,
103  std::ofstream& outfile);
104 
105  /// \short Access function to the number of distinct boundaries specified
106  /// in the original xda enumeration.
107  unsigned nxda_boundary()
108  {
109  return Boundary_id.size();
110  }
111 
112  /// \short Access functions to the Vector of oomph-lib boundary ids
113  /// that make up boundary b in the original xda enumeration
114  Vector<unsigned> oomph_lib_boundary_ids(const unsigned& xda_boundary_id)
115  {
116  return Boundary_id[xda_boundary_id];
117  }
118 
119  private:
120 
121  /// \short Vector of vectors containing the boundary IDs of
122  /// the overall boundary specified in the xda file.
123  Vector<Vector<unsigned> > Boundary_id;
124 
125  };
126 
127 
128 
129 ////////////////////////////////////////////////////////////////////
130 ////////////////////////////////////////////////////////////////////
131 ////////////////////////////////////////////////////////////////////
132 
133 
134 
135  //==========================================================================
136  /// Xda-based tet mesh upgraded to become a solid mesh.
137  //=========================================================================
138  template<class ELEMENT>
139  class SolidXdaTetMesh : public virtual XdaTetMesh<ELEMENT>,
140  public virtual SolidMesh
141  {
142 
143  public:
144 
145  /// \short Constructor. Boundary coordinates are setup
146  /// automatically.
147  SolidXdaTetMesh(const std::string xda_file_name,
148  TimeStepper* time_stepper_pt=
149  &Mesh::Default_TimeStepper) :
150  XdaTetMesh<ELEMENT>(xda_file_name, time_stepper_pt)
151  {
152  //Assign the Lagrangian coordinates
153  set_lagrangian_nodal_coordinates();
154  }
155 
156 
157  /// Empty Destructor
158  virtual ~SolidXdaTetMesh() {}
159 
160  };
161 
162 
163 
164 ////////////////////////////////////////////////////////////////////
165 ////////////////////////////////////////////////////////////////////
166 ////////////////////////////////////////////////////////////////////
167 
168 
169 
170 }
171 
172 #endif
173 
void setup_boundary_coordinates(const unsigned &b, const bool &switch_normal)
Setup boundary coordinate on boundary b while is temporarily flattened to simplex faces...
unsigned nxda_boundary()
Access function to the number of distinct boundaries specified in the original xda enumeration...
Xda-based tet mesh upgraded to become a solid mesh.
XdaTetMesh(const std::string xda_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass name of xda file. Note that all boundary elements get their own ID – this is requi...
Vector< Vector< unsigned > > Boundary_id
Vector of vectors containing the boundary IDs of the overall boundary specified in the xda file...
Vector< unsigned > oomph_lib_boundary_ids(const unsigned &xda_boundary_id)
Access functions to the Vector of oomph-lib boundary ids that make up boundary b in the original xda ...
Tet mesh made of quadratic (ten node) tets built from xda input file.
SolidXdaTetMesh(const std::string xda_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor. Boundary coordinates are setup automatically.
virtual ~SolidXdaTetMesh()
Empty Destructor.