ug4
smart_ptr_vector.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013: G-CSC, Goethe University Frankfurt
3  * Author: Martin Rupp
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #include <vector>
34 
35 #ifndef SMART_PTR_VECTOR_H
36 #define SMART_PTR_VECTOR_H
37 
38 namespace ug{
39 template<typename T>
40 class SmartPtrVector : public std::vector<SmartPtr<T> >
41 {
42  typedef std::vector<SmartPtr<T> > super;
43 private:
45 public:
47  SmartPtrVector(size_t size) : super(size)
48  {
49  }
50 
51  const T &operator () (size_t i) const
52  {
53  assert(i < super::size());
54  return *super::operator[](i);
55  }
56  T &operator () (size_t i)
57  {
58  assert(i < super::size());
59  return *super::operator[](i);
60  }
61 };
62 
63 /*
64 {
65 private:
66  SmartPtrVector(SmartPtrVector &);
67 public:
68  SmartPtrVector();
69  SmartPtrVector(size_t size) : m_data(size)
70  {
71  }
72 
73  T &operator [] (size_t i)
74  {
75  assert(i < m_data.size());
76  return *m_data[i];
77  }
78 
79  const T &operator [] (size_t i) const
80  {
81  assert(i < m_data.size());
82  return *m_data[i];
83  }
84 
85  SmartPtr<T> get_smart_ptr(size_t i)
86  {
87  assert(i < m_data.size());
88  return m_data[i];
89  }
90 
91 
92  void push_back(SmartPtr<T> t)
93  {
94  m_data.push_back(t);
95  }
96 
97  size_t size() const
98  {
99  return m_data.size();
100  }
101 
102  void clear()
103  {
104  m_data.clear();
105  }
106 
107 private:
108  std::vector<SmartPtr<T> > m_data;
109 };*/
110 
111 
112 
113 
114 }
115 
116 
117 #endif
Definition: smart_ptr_vector.h:41
SmartPtrVector(size_t size)
Definition: smart_ptr_vector.h:47
SmartPtrVector()
Definition: smart_ptr_vector.h:46
SmartPtrVector(SmartPtrVector &)
const T & operator()(size_t i) const
Definition: smart_ptr_vector.h:51
std::vector< SmartPtr< T > > super
Definition: smart_ptr_vector.h:42
the ug namespace