15 #if !defined(KRATOS_WEAK_POINTER_VECTOR_H_INCLUDED )
16 #define KRATOS_WEAK_POINTER_VECTOR_H_INCLUDED
63 template<
class TDataType,
64 class TPointerType =
typename TDataType::WeakPointer,
65 class TContainerType = std::vector<TPointerType> >
89 typedef typename TContainerType::size_type
size_type;
102 template <
class TInputIteratorType>
124 mData = rOther.mData;
130 return *(mData[
i].lock());
135 return *(mData[
i].lock());
150 if(
size() != r.size() )
153 return std::equal(mData.begin(), mData.end(), r.mData.begin());
194 return mData.begin();
198 return mData.begin();
210 return mData.rbegin();
214 return mData.rbegin();
228 return *((mData.front()).lock());
233 return *((mData.front()).lock());
238 return *((mData.back()).lock());
243 return *((mData.back()).lock());
252 return mData.resize(new_dim);
256 mData.resize(new_dim);
261 return mData.max_size();
266 mData.swap(rOther.mData);
281 return iterator(mData.insert(Position, TPointerType(
new TDataType(rData))));
286 return iterator(mData.insert(Position, pData));
289 template <
class InputIterator>
290 void insert(InputIterator First, InputIterator Last)
292 for(; First != Last; ++First)
299 return iterator(mData.erase(pos.base()));
304 return iterator( mData.erase( first.base(), last.base() ) );
320 return mData.capacity();
347 return mData.empty();
357 std::stringstream buffer;
358 buffer <<
"WeakPointerVector (size = " <<
size() <<
") : ";
372 std::copy(
begin(),
end(), std::ostream_iterator<TDataType>(rOStream,
"\t "));
430 TContainerType mData;
473 template<
class TDataType,
475 class TContainerType>
480 template<
class TDataType,
482 class TContainerType>
487 rOStream << std::endl;
WeakPointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: weak_pointer_vector.h:67
const_reverse_iterator rend() const
Definition: weak_pointer_vector.h:188
void swap(WeakPointerVector &rOther)
Definition: weak_pointer_vector.h:264
TDataType & operator[](const size_type &i)
Definition: weak_pointer_vector.h:128
void insert(InputIterator First, InputIterator Last)
Definition: weak_pointer_vector.h:290
WeakPointerVectorIterator< typename TContainerType::const_iterator, TDataType > const_iterator
Definition: weak_pointer_vector.h:85
ptr_reverse_iterator ptr_rend()
Definition: weak_pointer_vector.h:216
const TPointerType const_pointer
Definition: weak_pointer_vector.h:79
iterator end()
Definition: weak_pointer_vector.h:168
void push_back(const_reference x)
Definition: weak_pointer_vector.h:274
reverse_iterator rbegin()
Definition: weak_pointer_vector.h:176
void clear()
Definition: weak_pointer_vector.h:308
reference back()
Definition: weak_pointer_vector.h:235
WeakPointerVector & operator=(const WeakPointerVector &rOther)
Definition: weak_pointer_vector.h:122
void push_back(TPointerType x)
Definition: weak_pointer_vector.h:269
size_type max_size() const
Definition: weak_pointer_vector.h:259
TDataType & reference
Definition: weak_pointer_vector.h:80
TDataType const & operator[](const size_type &i) const
Definition: weak_pointer_vector.h:133
iterator erase(iterator pos)
Definition: weak_pointer_vector.h:297
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: weak_pointer_vector.h:364
TContainerType::reverse_iterator ptr_reverse_iterator
Definition: weak_pointer_vector.h:92
void reserve(int dim)
Definition: weak_pointer_vector.h:313
WeakPointerVector(const TContainerType &rContainer)
Definition: weak_pointer_vector.h:110
WeakPointerVector(const WeakPointerVector &rOther)
Definition: weak_pointer_vector.h:108
reverse_iterator rend()
Definition: weak_pointer_vector.h:184
iterator begin()
Definition: weak_pointer_vector.h:160
const TDataType & const_reference
Definition: weak_pointer_vector.h:81
iterator insert(iterator Position, const TDataType &rData)
Definition: weak_pointer_vector.h:279
reference front()
Definition: weak_pointer_vector.h:225
iterator erase(iterator first, iterator last)
Definition: weak_pointer_vector.h:302
ptr_iterator ptr_end()
Definition: weak_pointer_vector.h:200
std::string Info() const
Turn back information as a string.
Definition: weak_pointer_vector.h:355
iterator insert(iterator Position, const TPointerType pData)
Definition: weak_pointer_vector.h:284
TContainerType ContainerType
Definition: weak_pointer_vector.h:82
const_iterator end() const
Definition: weak_pointer_vector.h:172
KRATOS_CLASS_POINTER_DEFINITION(WeakPointerVector)
Pointer definition of WeakPointerVector.
TDataType data_type
data type stores in this container.
Definition: weak_pointer_vector.h:76
~WeakPointerVector()
Destructor.
Definition: weak_pointer_vector.h:115
ptr_reverse_iterator ptr_rbegin()
Definition: weak_pointer_vector.h:208
const_reverse_iterator rbegin() const
Definition: weak_pointer_vector.h:180
ptr_const_iterator ptr_end() const
Definition: weak_pointer_vector.h:204
TContainerType::size_type size_type
Definition: weak_pointer_vector.h:89
ptr_const_reverse_iterator ptr_rbegin() const
Definition: weak_pointer_vector.h:212
WeakPointerVectorIterator< typename TContainerType::reverse_iterator, TDataType > reverse_iterator
Definition: weak_pointer_vector.h:86
TPointerType pointer
Definition: weak_pointer_vector.h:78
ptr_const_iterator ptr_begin() const
Definition: weak_pointer_vector.h:196
WeakPointerVectorIterator< typename TContainerType::const_reverse_iterator, TDataType > const_reverse_iterator
Definition: weak_pointer_vector.h:87
ptr_iterator ptr_begin()
Definition: weak_pointer_vector.h:192
TContainerType & GetContainer()
Definition: weak_pointer_vector.h:328
const_reference front() const
Definition: weak_pointer_vector.h:230
size_type size() const
Definition: weak_pointer_vector.h:246
ptr_const_reverse_iterator ptr_rend() const
Definition: weak_pointer_vector.h:220
WeakPointerVector(TInputIteratorType First, TInputIteratorType Last)
Definition: weak_pointer_vector.h:103
const_iterator begin() const
Definition: weak_pointer_vector.h:164
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: weak_pointer_vector.h:370
bool operator==(const WeakPointerVector &r) const
Definition: weak_pointer_vector.h:148
TContainerType::const_iterator ptr_const_iterator
Definition: weak_pointer_vector.h:91
int capacity()
Definition: weak_pointer_vector.h:318
const_reference back() const
Definition: weak_pointer_vector.h:240
WeakPointerVector()
Default constructor.
Definition: weak_pointer_vector.h:100
const TContainerType & GetContainer() const
Definition: weak_pointer_vector.h:334
pointer & operator()(const size_type &i)
Definition: weak_pointer_vector.h:138
TPointerType value_type
Definition: weak_pointer_vector.h:77
void resize(size_type new_dim) const
Definition: weak_pointer_vector.h:250
void resize(size_type new_dim)
Definition: weak_pointer_vector.h:254
bool empty() const
Definition: weak_pointer_vector.h:345
WeakPointerVectorIterator< typename TContainerType::iterator, TDataType > iterator
Definition: weak_pointer_vector.h:84
TContainerType::const_reverse_iterator ptr_const_reverse_iterator
Definition: weak_pointer_vector.h:93
const_pointer & operator()(const size_type &i) const
Definition: weak_pointer_vector.h:143
TContainerType::iterator ptr_iterator
Definition: weak_pointer_vector.h:90
Short class definition.
Definition: weak_pointer_vector_iterator.h:63
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
tuple const
Definition: ode_solve.py:403
x
Definition: sensitivityMatrix.py:49
int dim
Definition: sensitivityMatrix.py:25
integer i
Definition: TensorModule.f:17