20 #include <boost/iterator/indirect_iterator.hpp>
59 template<
class TDataType >
79 using iterator = boost::indirect_iterator<typename TContainerType::iterator>;
80 using const_iterator = boost::indirect_iterator<typename TContainerType::const_iterator>;
81 using reverse_iterator = boost::indirect_iterator<typename TContainerType::reverse_iterator>;
84 using size_type =
typename TContainerType::size_type;
110 template <
class TContainerType>
113 this->
reserve(rContainer.size());
114 for (
auto& r_item : rContainer) {
134 auto end_it = mData.end();
136 this->
erase(new_end_it, end_it);
144 mData.shrink_to_fit();
158 mData = rOther.mData;
211 if (
size() != r.size())
214 return std::equal(mData.begin(), mData.end(), r.mData.begin(), this->EqualKeyTo());
255 return mData.begin();
259 return mData.begin();
271 return mData.rbegin();
275 return mData.rbegin();
288 assert( !mData.empty() );
289 return *(mData.front());
293 assert( !mData.empty() );
294 return *(mData.front());
298 assert( !mData.empty() );
299 return *(mData.back());
303 assert( !mData.empty() );
304 return *(mData.back());
314 return mData.max_size();
319 mData.swap(rOther.mData);
341 return iterator(mData.insert(Position, pData));
344 template <
class InputIterator>
345 void insert(InputIterator First, InputIterator Last)
347 for(; First != Last; ++First)
353 return iterator(mData.erase(pos.base()));
358 return iterator( mData.erase( first.base(), last.base() ) );
368 return mData.resize(new_dim);
372 mData.resize(new_dim);
382 return mData.capacity();
400 std::stringstream buffer;
401 buffer <<
"GlobalPointersVector" ;
408 rOStream <<
"GlobalPointersVector";
487 rSerializer.
save(
"Size", this->
size());
489 for (std::size_t
i = 0;
i < this->
size();
i++) {
490 rSerializer.
save(
"Data", mData[
i]);
503 rSerializer.load(
"Size",
size);
505 for (std::size_t
i = 0;
i <
size;
i++) {
506 GlobalPointer<TDataType>
p(
nullptr);
507 rSerializer.load(
"Data",
p);
540 template<
class TDataType >
548 template<
class TDataType >
553 rOStream << std::endl;
This class is a wrapper for a pointer to a data that is located in a different rank.
Definition: global_pointer.h:44
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
ptr_iterator ptr_begin()
Definition: global_pointers_vector.h:253
reverse_iterator rbegin()
Definition: global_pointers_vector.h:237
TDataType & reference
Definition: global_pointers_vector.h:75
const_reverse_iterator rbegin() const
Definition: global_pointers_vector.h:241
reference front()
Definition: global_pointers_vector.h:286
ptr_reverse_iterator ptr_rend()
Definition: global_pointers_vector.h:277
size_type max_size() const
Definition: global_pointers_vector.h:312
~GlobalPointersVector()
Destructor.
Definition: global_pointers_vector.h:103
const_iterator end() const
Definition: global_pointers_vector.h:233
boost::indirect_iterator< typename TContainerType::const_iterator > const_iterator
Definition: global_pointers_vector.h:80
const_reference front() const
Definition: global_pointers_vector.h:291
TDataType & operator[](const size_type &i)
Access an element in the container by index.
Definition: global_pointers_vector.h:167
bool operator==(const GlobalPointersVector &r) const
Equality comparison operator to check if two GlobalPointersVector objects are equal.
Definition: global_pointers_vector.h:209
TDataType data_type
Definition: global_pointers_vector.h:71
void Sort()
Sort the elements in the container.
Definition: global_pointers_vector.h:122
iterator insert(iterator Position, const TPointerType pData)
Definition: global_pointers_vector.h:339
KRATOS_CLASS_POINTER_DEFINITION(GlobalPointersVector)
Pointer definition of GlobalPointersVector.
iterator erase(iterator pos)
Definition: global_pointers_vector.h:351
typename TContainerType::size_type size_type
Definition: global_pointers_vector.h:84
void swap(GlobalPointersVector &rOther)
Definition: global_pointers_vector.h:317
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
const TContainerType & GetContainer() const
Definition: global_pointers_vector.h:425
boost::indirect_iterator< typename TContainerType::const_reverse_iterator > const_reverse_iterator
Definition: global_pointers_vector.h:82
typename TContainerType::const_reverse_iterator ptr_const_reverse_iterator
Definition: global_pointers_vector.h:88
typename TContainerType::const_iterator ptr_const_iterator
Definition: global_pointers_vector.h:86
iterator begin()
Definition: global_pointers_vector.h:221
TDataType const & operator[](const size_type &i) const
Access a constant element in the container by index.
Definition: global_pointers_vector.h:177
typename TContainerType::difference_type difference_type
Definition: global_pointers_vector.h:89
ptr_const_iterator ptr_end() const
Definition: global_pointers_vector.h:265
TContainerType ContainerType
Definition: global_pointers_vector.h:77
void shrink_to_fit()
Reduce the capacity of the container to fit its size.
Definition: global_pointers_vector.h:142
GlobalPointersVector()
Default constructor.
Definition: global_pointers_vector.h:96
const_reference back() const
Definition: global_pointers_vector.h:301
ptr_const_reverse_iterator ptr_rbegin() const
Definition: global_pointers_vector.h:273
std::string Info() const
Turn back information as a string.
Definition: global_pointers_vector.h:398
void clear()
Definition: global_pointers_vector.h:361
pointer & operator()(const size_type &i)
Access an element in the container by index.
Definition: global_pointers_vector.h:187
int capacity()
Definition: global_pointers_vector.h:380
iterator erase(iterator first, iterator last)
Definition: global_pointers_vector.h:356
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: global_pointers_vector.h:406
ptr_reverse_iterator ptr_rbegin()
Definition: global_pointers_vector.h:269
void reserve(int dim)
Definition: global_pointers_vector.h:375
TContainerType & GetContainer()
Definition: global_pointers_vector.h:419
void FillFromContainer(TContainerType &rContainer)
Fill the container from another container.
Definition: global_pointers_vector.h:111
const_iterator begin() const
Definition: global_pointers_vector.h:225
size_type size() const
Definition: global_pointers_vector.h:307
void resize(size_type new_dim)
Definition: global_pointers_vector.h:370
GlobalPointersVector(const std::initializer_list< GlobalPointer< TDataType >> &l)
Definition: global_pointers_vector.h:98
typename TContainerType::iterator ptr_iterator
Definition: global_pointers_vector.h:85
ptr_const_iterator ptr_begin() const
Definition: global_pointers_vector.h:257
void insert(InputIterator First, InputIterator Last)
Definition: global_pointers_vector.h:345
ptr_const_reverse_iterator ptr_rend() const
Definition: global_pointers_vector.h:281
reverse_iterator rend()
Definition: global_pointers_vector.h:245
const_pointer & operator()(const size_type &i) const
Access a constant element in the container by index.
Definition: global_pointers_vector.h:197
typename TContainerType::reverse_iterator ptr_reverse_iterator
Definition: global_pointers_vector.h:87
void Unique()
Remove duplicate elements from the container.
Definition: global_pointers_vector.h:131
GlobalPointersVector & operator=(const GlobalPointersVector &rOther)
Assignment operator to copy the contents of another GlobalPointersVector.
Definition: global_pointers_vector.h:156
boost::indirect_iterator< typename TContainerType::reverse_iterator > reverse_iterator
Definition: global_pointers_vector.h:81
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: global_pointers_vector.h:412
const_reverse_iterator rend() const
Definition: global_pointers_vector.h:249
friend class Serializer
Definition: global_pointers_vector.h:478
GlobalPointer< TDataType > TPointerType
Definition: global_pointers_vector.h:70
void resize(size_type new_dim) const
Definition: global_pointers_vector.h:366
const TDataType & const_reference
Definition: global_pointers_vector.h:76
ptr_iterator ptr_end()
Definition: global_pointers_vector.h:261
iterator end()
Definition: global_pointers_vector.h:229
reference back()
Definition: global_pointers_vector.h:296
std::vector< GlobalPointer< TDataType > > TContainerType
Definition: global_pointers_vector.h:69
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
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
def load(f)
Definition: ode_solve.py:307
tuple const
Definition: ode_solve.py:403
p
Definition: sensitivityMatrix.py:52
x
Definition: sensitivityMatrix.py:49
int dim
Definition: sensitivityMatrix.py:25
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
This is a key compare between two pointers to the object object.
Definition: global_pointer.h:464
This is a key comparer between two dof pointers checking for equal keys.
Definition: global_pointer.h:441