an efficient C++ finite element environment
|
|
Go to the documentation of this file. 1 # ifndef _RHEO_BASIC_POINT_H
2 # define _RHEO_BASIC_POINT_H
79 #include "rheolef/compiler_mpi.h"
141 std::istream&
get (std::istream& s,
int d = 3);
142 std::ostream&
put (std::ostream& s,
int d = 3)
const;
147 const T&
x()
const {
return _x[0]; }
148 const T&
y()
const {
return _x[1]; }
149 const T&
z()
const {
return _x[2]; }
174 template <
class T,
class U>
177 details::is_rheolef_arithmetic<U>::value
245 template<
class T,
size_t d>
251 template <
class T,
class U>
255 details::is_rheolef_arithmetic<U>::value
270 v[0]*w[1]-v[1]*w[0]);
277 return x[0]*y[0]+x[1]*y[1]+x[2]*y[2];
289 return sqrt(
norm2(x));
312 template<
class T,
size_t d>
318 if (
a[i] <
b[i])
return true;
319 if (
a[i] >
b[i])
return false;
364 typedef typename std::initializer_list<T>::const_iterator
const_iterator;
365 check_macro (il.size() <= 3,
"unexpected initializer list size=" << il.size() <<
" > 3");
367 for (
const_iterator iter = il.begin(); iter != il.end(); ++iter, ++i) {
370 for (i = il.size(); i < 3; ++i) {
380 case 0 : _x[0] = _x[1] = _x[2] =
T(0);
return s;
381 case 1 : _x[1] = _x[2] =
T(0);
return s >> _x[0];
382 case 2 : _x[2] =
T(0);
return s >> _x[0] >> _x[1];
383 default:
return s >> _x[0] >> _x[1] >> _x[2];
393 case 1 :
return s << _x[0];
394 case 2 :
return s << _x[0] <<
" " << _x[1];
395 default:
return s << _x[0] <<
" " << _x[1] <<
" " << _x[2];
403 return s >>
p[0] >>
p[1] >>
p[2];
410 return s <<
p[0] <<
" " <<
p[1] <<
" " <<
p[2];
416 std::ostringstream ostrstr;
418 return ostrstr.str();
423 #define def_point_function2(f,F) \
427 f (const point_basic<T>& x) \
430 for (size_t i = 0; i < 3; i++) \
435 #define def_point_function(f) def_point_function2(f,f)
442 #undef def_point_function2
443 #undef def_point_function
449 return _x[0] == v[0] && _x[1] == v[1] && _x[2] == v[2];
517 template<
class T1,
class T2>
523 for (
size_t i = 0; i < 3; i++)
524 if (x[i] != 0) y[i] =
a/x[i];
531 details::is_rheolef_arithmetic<U>::value
574 #ifdef _RHEOLEF_HAVE_MPI
575 #include <boost/serialization/serialization.hpp>
578 namespace serialization {
579 template<
class Archive,
class T>
595 struct is_mpi_datatype<
rheolef::point_basic<double> > : mpl::true_ { };
598 #endif // _RHEOLEF_HAVE_MPI
bool operator!=(const point_basic< T > &v) const
helper for std::complex<T>: get basic T type
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
point_basic(const std::initializer_list< T > &il)
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
dot(x,y): see the expression page for the full documentation
point_basic< T > & operator+=(const point_basic< T > &v)
std::istream & get(std::istream &s, int d=3)
point_basic(const point_basic< T1 > &p)
csr< T, sequential > operator*(const T &lambda, const csr< T, sequential > &a)
const T & operator[](int i_coord) const
point_basic< T > operator-() const
point_basic< T > & operator-=(const point_basic< T > &v)
void serialize(Archive &ar, class rheolef::point_basic< T > &x, const unsigned int version)
dia< T, M > operator/(const T &lambda, const dia< T, M > &d)
T dist_infty(const point_basic< T > &x, const point_basic< T > &y)
T norm(const vec< T, M > &x)
norm(x): see the expression page for the full documentation
bool operator==(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
def_point_function(sqr) def_point_function(sqrt) def_point_function(log) def_point_function(log10) def_point_function(exp) template< class T > bool point_basic< T >
T norm2(const vec< T, M > &x)
norm2(x): see the expression page for the full documentation
point_basic< T > & operator/=(const T &a)
std::ostream & put(std::ostream &s, int d=3) const
point_basic< T > operator+(const point_basic< T > &v) const
bool operator==(const point_basic< T > &v) const
point_basic< T > & operator*=(const T &a)
int sign_orient3d(const point_basic< T > &a, const point_basic< T > &b, const point_basic< T > &c, const point_basic< T > &d)
T vect2d(const point_basic< T > &v, const point_basic< T > &w)
T mixt(const point_basic< T > &u, const point_basic< T > &v, const point_basic< T > &w)
tensor_basic< T > exp(const tensor_basic< T > &a, size_t d)
point_basic< T > operator/(const T &a) const
int sign_orient2d(const point_basic< T > &a, const point_basic< T > &b, const point_basic< T > &c)
T & operator[](int i_coord)
std::istream & operator>>(std::istream &is, const catchmark &m)
This file is part of Rheolef.
float_traits< T >::type type
point_basic< Float > point
bool lexicographically_less(const point_basic< T > &a, const point_basic< T > &b)
std::string ptos(const point_basic< T > &x, int d=3)
T orient3d(const point_basic< T > &a, const point_basic< T > &b, const point_basic< T > &c, const point_basic< T > &d)
T & operator()(int i_coord)
helper for point_basic<T> & tensor_basic<T>: get basic T type
std::enable_if< details::is_rheolef_arithmetic< U >::value,point_basic< T > >::type operator*(const U &a) const
std::ostream & operator<<(std::ostream &os, const catchmark &m)
const T & operator()(int i_coord) const
point_basic< T > & operator=(const point_basic< T1 > &p)
T dist2(const point_basic< T > &x, const point_basic< T > &y)
static T _my_abs(const T &x)
point_basic< T > vect(const point_basic< T > &v, const point_basic< T > &w)
T orient2d(const point_basic< T > &a, const point_basic< T > &b, const point_basic< T > &c)
T dist(const point_basic< T > &x, const point_basic< T > &y)