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