73 #ifndef SLIP_POINT_HPP
74 #define SLIP_POINT_HPP
81 #include <boost/serialization/access.hpp>
82 #include <boost/serialization/split_member.hpp>
83 #include <boost/serialization/complex.hpp>
84 #include <boost/serialization/version.hpp>
88 template <
typename CoordType, std::
size_t DIM>
91 template <
typename CoordType, std::
size_t DIM>
94 template <
typename CoordType, std::
size_t DIM>
95 std::ostream& operator<<(std::ostream & out, const Point<CoordType,DIM>& p);
108 template <
typename CoordType, std::
size_t DIM>
125 static const std::size_t
SIZE = DIM;
139 Point(
const self& other);
146 Point(
const CoordType* array);
160 friend std::ostream& operator<< <>(std::ostream & out,
const self& p);
294 std::size_t
dim()
const;
300 std::size_t
size()
const;
332 void swap(
self& other);
350 friend class boost::serialization::access;
351 template<
class Archive>
352 void save(Archive & ar,
const unsigned int version)
const
356 template<
class Archive>
357 void load(Archive & ar,
const unsigned int version)
361 BOOST_SERIALIZATION_SPLIT_MEMBER()
369 template<
typename CoordType,std::
size_t DIM>
373 std::fill_n((this->coord_).begin(),DIM,CoordType());
376 template<
typename CoordType,std::
size_t DIM>
382 template<
typename CoordType,std::
size_t DIM>
386 std::copy(array,array+DIM,coord_.begin());
389 template<
typename CoordType,std::
size_t DIM>
399 template<
typename CoordType,std::
size_t DIM>
405 this->coord_ = other.coord_;
411 template<
typename CoordType,std::
size_t DIM>
416 return this->coord_[i];
419 template<
typename CoordType,std::
size_t DIM>
424 return this->coord_[i];
427 template<
typename CoordType,std::
size_t DIM>
431 template<
typename CoordType,std::
size_t DIM>
435 template<
typename CoordType,std::
size_t DIM>
439 template<
typename CoordType,std::
size_t DIM>
444 template<
typename CoordType,std::
size_t DIM>
451 template<
typename CoordType,std::
size_t DIM>
458 template<
typename CoordType,std::
size_t DIM>
462 (this->coord_).swap(other.coord_);
466 template<
typename CoordType,std::
size_t DIM>
470 return this->coord_ == other.coord_;
473 template<
typename CoordType,std::
size_t DIM>
477 return this->coord_ != other.coord_;
481 template<
typename CoordType,std::
size_t DIM>
486 std::transform(coord_.begin(),coord_.end(),(tmp.coord_).begin(),std::negate<CoordType>());
490 template<
typename CoordType,std::
size_t DIM>
495 for(std::size_t i = 0; i < DIM; ++i)
497 this->coord_[i] += dp[i];
503 template<
typename CoordType,std::
size_t DIM>
512 template<
typename CoordType,std::
size_t DIM>
517 for(std::size_t i = 0; i < DIM; ++i)
519 this->coord_[i] -= dp[i];
524 template<
typename CoordType,std::
size_t DIM>
533 template<
typename CoordType,std::
size_t DIM>
538 std::transform(coord_.begin(),coord_.end(),(p.coord_).begin(),tmp.
begin(),std::minus<CoordType>());
544 #endif //SLIP_POINT_HPP
iterator begin()
Returns a read/write iterator that points to the first element in the block. Iteration is done in ord...
Point()
Default constructor.
self & operator+=(const dpoint_type &dp)
Assign a Point to this point plus a deplacement.
std::random_access_iterator_tag iterator_category
DPoint< CoordType, DIM > dpoint_type
const value_type & const_reference
const value_type * const_pointer
block< value_type, DIM > coord_
The coordinates of the point are stored in this block.
void load(Archive &ar, const unsigned int version)
const block< value_type, DIM > & coord() const
Return the coordinates of the Point.
self & operator=(const self &other)
Assign a Point.
bool operator!=(const self &other) const
compare two Point.
Define an abstract Point structure.
self & operator-=(const dpoint_type &dp)
Assign a Point to this point minus a deplacement.
Provides a class to manipulate 1d static and generic arrays.
static const std::size_t SIZE
Define an abstract DPoint structure.
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
void save(Archive &ar, const unsigned int version) const
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
reference operator[](const std::size_t i)
Returns the i'th coordinate of the Point.
std::size_t dim() const
Returns the dimension of the Point.
self operator-() const
negate all the coordinates of a Point
bool empty() const
Returns true if dimension of the Point is 0.
std::size_t max_size() const
Returns the maximal size of the Point.
bool operator==(const self &other) const
compare two Point.
self operator+(const dpoint_type &dp) const
translate a point considering the deplacement a dp
std::size_t size() const
Returns the dimension of the Point.
void swap(self &other)
Swaps two Point.