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// 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 LMESH2OOMPH_D_HEADER
31 #define LMESH2OOMPH_D_HEADER
32 
33 #include "line_mesh.h"
34 #include "refineable_mesh.h"
36 //Include to fill in additional_setup_shared_node_scheme() function
38 
39 namespace oomph
40 {
41 
42  //===========================================================================
43  /// Intermediate mesh class that implements the mesh adaptation functions
44  /// specified in the RefineableMesh class for meshes that contain the
45  /// refineable variant of QElement s [The class ELEMENT provided as the
46  /// template parameter must be of type RefineableQElement<1>].
47  ///
48  /// Mesh adaptation/refinement is implemented by BinaryTree procedures
49  /// and any concrete implementation of this class needs to provide a
50  /// BinaryTreeForest representation of the initial (coarse) mesh.
51  //===========================================================================
52  template <class ELEMENT>
53  class RefineableLineMesh : public virtual TreeBasedRefineableMesh<ELEMENT>,
54  public virtual LineMeshBase
55  {
56 
57  public:
58 
59  /// Constructor: Set up static binary tree data
61  {
62  // BinaryTree static data needs to be setup before binary tree-based
63  // mesh refinement works
65  }
66 
67  /// Broken copy constructor
69  {
70  BrokenCopy::broken_copy("RefineableLineMesh");
71  }
72 
73  /// Broken assignment operator
75  {
76  BrokenCopy::broken_assign("RefineableLineMesh");
77  }
78 
79  /// Destructor:
80  virtual ~RefineableLineMesh() {}
81 
82  /// \short Set up the tree forest associated with the Mesh.
83  /// Forwards call to setup_binary_tree_forest().
84  virtual void setup_tree_forest()
85  {
87  }
88 
89  /// Set up BinaryTreeForest. Wipes any existing tree structure and
90  /// regards the currently active elements as the root trees in the forest.
92  {
93  // This wipes all elements/binary trees in the tree representation
94  // but leaves the leaf elements alone
95  if (this->Forest_pt!=0) delete this->Forest_pt;
96 
97  // Each finite element in the coarse base mesh gets associated with
98  // (the root of) a BinaryTree. Store BinaryTreeRoots in vector:
99  Vector<TreeRoot*> trees_pt;
100 
101  // Determine number of elements in mesh
102  const unsigned n_element=this->nelement();
103 
104  // Loop over all elements, build corresponding BinaryTree and store
105  // BinaryTreeRoots in vector:
106  for (unsigned e=0;e<n_element;e++)
107  {
108  // Get pointer to full element type
109  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(this->element_pt(e));
110 
111  // Build associated binary tree(root) -- pass pointer to corresponding
112  // finite element and add the pointer to vector of binary tree (roots):
113  trees_pt.push_back(new BinaryTreeRoot(el_pt));
114  }
115 
116  // Plant BinaryTreeRoots in BinaryTreeForest
117  this->Forest_pt = new BinaryTreeForest(trees_pt);
118  }
119 
120  };
121 
122 } // End of namespace
123 
124 #endif
virtual ~RefineableLineMesh()
Destructor:
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
e
Definition: cfortran.h:575
TreeForest * Forest_pt
Forest representation of the mesh.
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:587
static void setup_static_data()
Set up the static data, reflection schemes, etc.
Definition: binary_tree.cc:90
virtual void setup_tree_forest()
Set up the tree forest associated with the Mesh. Forwards call to setup_binary_tree_forest().
Base class for line meshes (meshes made of 1D line elements)
Definition: line_mesh.h:58
void operator=(const RefineableLineMesh &)
Broken assignment operator.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
RefineableLineMesh()
Constructor: Set up static binary tree data.
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:470
RefineableLineMesh(const RefineableLineMesh &dummy)
Broken copy constructor.