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-2022 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  //===========================================================================
46  //===========================================================================
47  template<class ELEMENT>
48  class RefineableLineMesh : public virtual TreeBasedRefineableMesh<ELEMENT>,
49  public virtual LineMeshBase
50  {
51  public:
54  {
55  // BinaryTree static data needs to be setup before binary tree-based
56  // mesh refinement works
58  }
59 
61  RefineableLineMesh(const RefineableLineMesh& dummy) = delete;
62 
64  void operator=(const RefineableLineMesh&) = delete;
65 
67  virtual ~RefineableLineMesh() {}
68 
71  virtual void setup_tree_forest()
72  {
74  }
75 
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
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: binary_tree.h:286
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
Definition: refineable_line_mesh.h:50
virtual void setup_tree_forest()
Definition: refineable_line_mesh.h:71
RefineableLineMesh(const RefineableLineMesh &dummy)=delete
Broken copy constructor.
virtual ~RefineableLineMesh()
Destructor:
Definition: refineable_line_mesh.h:67
RefineableLineMesh()
Constructor: Set up static binary tree data.
Definition: refineable_line_mesh.h:53
void operator=(const RefineableLineMesh &)=delete
Broken assignment operator.
void setup_binary_tree_forest()
Definition: refineable_line_mesh.h:78
TreeForest * Forest_pt
Forest representation of the mesh.
Definition: refineable_mesh.h:768
Definition: refineable_mesh.h:809
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10