refineable_line_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// 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 LMESH2OOMPH_D_HEADER
27 #define LMESH2OOMPH_D_HEADER
28 
29 #include "line_mesh.h"
30 #include "refineable_mesh.h"
32 // Include to fill in additional_setup_shared_node_scheme() function
34 
35 namespace oomph
36 {
37  //===========================================================================
38  /// Intermediate mesh class that implements the mesh adaptation functions
39  /// specified in the RefineableMesh class for meshes that contain the
40  /// refineable variant of QElement s [The class ELEMENT provided as the
41  /// template parameter must be of type RefineableQElement<1>].
42  ///
43  /// Mesh adaptation/refinement is implemented by BinaryTree procedures
44  /// and any concrete implementation of this class needs to provide a
45  /// BinaryTreeForest representation of the initial (coarse) mesh.
46  //===========================================================================
47  template<class ELEMENT>
48  class RefineableLineMesh : public virtual TreeBasedRefineableMesh<ELEMENT>,
49  public virtual LineMeshBase
50  {
51  public:
52  /// Constructor: Set up static binary tree data
54  {
55  // BinaryTree static data needs to be setup before binary tree-based
56  // mesh refinement works
58  }
59 
60  /// Broken copy constructor
61  RefineableLineMesh(const RefineableLineMesh& dummy) = delete;
62 
63  /// Broken assignment operator
64  void operator=(const RefineableLineMesh&) = delete;
65 
66  /// Destructor:
67  virtual ~RefineableLineMesh() {}
68 
69  /// Set up the tree forest associated with the Mesh.
70  /// Forwards call to setup_binary_tree_forest().
71  virtual void setup_tree_forest()
72  {
74  }
75 
76  /// Set up BinaryTreeForest. Wipes any existing tree structure and
77  /// regards the currently active elements as the root trees in the forest.
79  {
80  // This wipes all elements/binary trees in the tree representation
81  // but leaves the leaf elements alone
82  if (this->Forest_pt != 0) delete this->Forest_pt;
83 
84  // Each finite element in the coarse base mesh gets associated with
85  // (the root of) a BinaryTree. Store BinaryTreeRoots in vector:
86  Vector<TreeRoot*> trees_pt;
87 
88  // Determine number of elements in mesh
89  const unsigned n_element = this->nelement();
90 
91  // Loop over all elements, build corresponding BinaryTree and store
92  // BinaryTreeRoots in vector:
93  for (unsigned e = 0; e < n_element; e++)
94  {
95  // Get pointer to full element type
96  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(this->element_pt(e));
97 
98  // Build associated binary tree(root) -- pass pointer to corresponding
99  // finite element and add the pointer to vector of binary tree (roots):
100  trees_pt.push_back(new BinaryTreeRoot(el_pt));
101  }
102 
103  // Plant BinaryTreeRoots in BinaryTreeForest
104  this->Forest_pt = new BinaryTreeForest(trees_pt);
105  }
106  };
107 
108 } // namespace oomph
109 
110 #endif
e
Definition: cfortran.h:571
A BinaryTreeForest consists of a collection of BinaryTreeRoots. Each member tree can have neighbours ...
Definition: binary_tree.h:286
BinaryTreeRoot is a BinaryTree that forms the root of a (recursive) binary tree. The "root node" is s...
Definition: binary_tree.h:231
static void setup_static_data()
Set up the static data, reflection schemes, etc.
Definition: binary_tree.cc:86
Base class for line meshes (meshes made of 1D line elements)
Definition: line_mesh.h:54
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Intermediate mesh class that implements the mesh adaptation functions specified in the RefineableMesh...
virtual void setup_tree_forest()
Set up the tree forest associated with the Mesh. Forwards call to setup_binary_tree_forest().
RefineableLineMesh(const RefineableLineMesh &dummy)=delete
Broken copy constructor.
virtual ~RefineableLineMesh()
Destructor:
RefineableLineMesh()
Constructor: Set up static binary tree data.
void operator=(const RefineableLineMesh &)=delete
Broken assignment operator.
void setup_binary_tree_forest()
Set up BinaryTreeForest. Wipes any existing tree structure and regards the currently active elements ...
TreeForest * Forest_pt
Forest representation of the mesh.
///////////////////////////////////////////////////////////////// ///////////////////////////////////...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
Definition: Vector.h:58
//////////////////////////////////////////////////////////////////// ////////////////////////////////...