Commit 1f565435 authored by incardon's avatar incardon

Fixing compilation for SE1

parent af8adc53
......@@ -234,6 +234,19 @@ fi
AX_LIB_HILBERT([],[echo "Cannot detect libhilbert, use the --with-libhilbert option if it is not installed in the default location"
exit 210])
#########
## Check for quadmath
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(quadmath.h, , [])
AC_CHECK_LIB(quadmath, sinq, [ AC_DEFINE(HAVE_LIBQUADMATH,[],[Have quad math lib])
LIBQUADMATH=" -lquadmath "
], [])
AC_LANG_POP([C++])
####### include openfpm_devices include path
INCLUDES_PATH+="-I. -Iconfig -I../../openfpm_devices/src -I../../openfpm_io/src"
......
......@@ -370,83 +370,72 @@ class CellDecomposer_sm
return id;
}
/*! \Check if a particle is outside the domain of the cell-list
*
* \param pos position of the particle
* \param s coordinate to check
*
*/
template<typename Ele> inline void check_and_print_error(const Ele & pos ,size_t s) const
{
#ifdef SE_CLASS1
if (tot_n_cell == 0)
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " using an uninitialized CellDecomposer";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
if (pos[0] < box.getLow(s) - off[s]*box_unit.getP2()[s] || pos[s] > box.getHigh(s) + off[s]*box_unit.getP2()[s])
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " point " << Point<dim,T>(pos).toString() << " is not inside the cell space";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
#endif
}
template<typename Ele> inline size_t getCellDom_impl(const Ele & pos) const
{
#ifdef SE_CLASS1
if (tot_n_cell == 0)
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " using an uninitialized CellDecomposer";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
check_and_print_error(pos,0);
if (pos[0] < box.getLow(0) - off[0]*box_unit.getP2()[0] || pos[0] > box.getHigh(0) + off[0]*box_unit.getP2()[0])
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " point " << toPointString(pos) << " is not inside the cell space";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
#endif
size_t cell_id = ConvertToID(pos,0);
cell_id = (cell_id == gr_cell.size(0) - off[0])?gr_cell.size(0) - off[0] - 1:cell_id;
cell_id = (cell_id == off[0]-1)?off[0]:cell_id;
size_t cell_id = ConvertToID(pos,0);
cell_id = (cell_id == gr_cell.size(0) - off[0])?gr_cell.size(0) - off[0] - 1:cell_id;
cell_id = (cell_id == off[0]-1)?off[0]:cell_id;
for (size_t s = 1 ; s < dim ; s++)
{
check_and_print_error(pos,s);
for (size_t s = 1 ; s < dim ; s++)
{
#ifdef SE_CLASS1
if (pos[s] < box.getLow(s) - off[s]*box_unit.getP2()[s] || pos[s] > box.getHigh(s) + off[s]*box_unit.getP2()[s])
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " point " << toPointString(pos) << " is not inside the cell space";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
#endif
size_t cell_idt = ConvertToID(pos,s);
cell_idt = (cell_idt == gr_cell.size(s) - off[s])?gr_cell.size(s) - off[s] - 1:cell_idt;
cell_idt = (cell_idt == off[s]-1)?off[s]:cell_idt;
size_t cell_idt = ConvertToID(pos,s);
cell_idt = (cell_idt == gr_cell.size(s) - off[s])?gr_cell.size(s) - off[s] - 1:cell_idt;
cell_idt = (cell_idt == off[s]-1)?off[s]:cell_idt;
cell_id += gr_cell2.size_s(s-1) * cell_idt;
}
cell_id += gr_cell2.size_s(s-1) * cell_idt;
}
return cell_id;
return cell_id;
}
template<typename Ele> inline size_t getCellPad_impl(const Ele & pos) const
{
#ifdef SE_CLASS1
if (tot_n_cell == 0)
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " using an uninitialized CellDecomposer";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
check_and_print_error(pos,0);
if (pos[0] < box.getLow(0) - off[0]*box_unit.getP2()[0] || pos[0] > box.getHigh(0) + off[0]*box_unit.getP2()[0])
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " point " << toPointString(pos) << " is not inside the cell space";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
#endif
size_t cell_id = ConvertToID(pos,0);
cell_id = (cell_id == off[0])?off[0]-1:cell_id;
cell_id = (cell_id == gr_cell.size(0) - off[0] - 1)?gr_cell.size(0) - off[0]:cell_id;
size_t cell_id = ConvertToID(pos,0);
cell_id = (cell_id == off[0])?off[0]-1:cell_id;
cell_id = (cell_id == gr_cell.size(0) - off[0] - 1)?gr_cell.size(0) - off[0]:cell_id;
for (size_t s = 1 ; s < dim ; s++)
{
check_and_print_error(pos,s);
for (size_t s = 1 ; s < dim ; s++)
{
#ifdef SE_CLASS1
if (pos[s] < box.getLow(s) - off[s]*box_unit.getP2()[s] || pos[s] > box.getHigh(s) + off[s]*box_unit.getP2()[s])
{
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " point " << toPointString(pos) << " is not inside the cell space";
ACTION_ON_ERROR(CELL_DECOMPOSER);
}
#endif
size_t cell_idt = ConvertToID(pos,s);
cell_idt = (cell_idt == off[s])?off[s]-1:cell_idt;
cell_idt = (cell_idt == gr_cell.size(s) - off[s] - 1)?gr_cell.size(s) - off[s]:cell_idt;
size_t cell_idt = ConvertToID(pos,s);
cell_idt = (cell_idt == off[s])?off[s]-1:cell_idt;
cell_idt = (cell_idt == gr_cell.size(s) - off[s] - 1)?gr_cell.size(s) - off[s]:cell_idt;
cell_id += gr_cell2.size_s(s-1) * cell_idt;
}
cell_id += gr_cell2.size_s(s-1) * cell_idt;
}
return cell_id;
return cell_id;
}
protected:
......
......@@ -134,7 +134,7 @@ template<unsigned int dim ,typename T> class Point
*
*/
inline T get(int i) const
inline const T & get(int i) const
{
return boost::fusion::at_c<x>(data)[i];
}
......@@ -164,6 +164,8 @@ template<unsigned int dim ,typename T> class Point
}
/*! \brief Get the component i
*
* \param i component
*
* \return the i-component
*
......@@ -174,6 +176,19 @@ template<unsigned int dim ,typename T> class Point
return get(i);
}
/*! \brief Get the component i
*
* \param i component
*
* \return the i-component
*
*/
inline const T& operator[](size_t i) const
{
return get(i);
}
/*! \Brief norm of the vector
*
* \return the norm of the vector
......
......@@ -576,20 +576,14 @@ namespace openfpm
{
#ifdef SE_CLASS2
check_valid(this,8);
#endif
#ifdef SE_CLASS1
if (v.size() != opart.size())
std::cerr << __FILE__ << ":" << __LINE__ << " error merge_prp: v.size()=" << v.size() << " must be the same as o_part.size()" << opart.size() << std::endl;
#endif
//! Add the element of v
for (size_t i = 0 ; i < v.size() ; i++)
{
#ifdef SE_CLASS1
if (i >= opart.size())
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " try to access element " << opart.template get<0>(i) << " but the vector has size " << size() << std::endl;
if (start + i >= v_size)
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " try to access element " << start+i << " but the vector has size " << size() << std::endl;
#endif
// write the object in the last element
......
#ifndef MATHUTIL_HPP
#define MATHUTIL_HPP
#ifdef HAVE_LIBQUADMATH
#include <boost/multiprecision/float128.hpp>
#endif
namespace openfpm
{
......@@ -188,6 +190,8 @@ namespace openfpm
return i - ( i > x ); /* convert trunc to floor */
}
#ifdef HAVE_LIBQUADMATH
/*! \brief floor math function
*
*
......@@ -197,6 +201,8 @@ namespace openfpm
size_t i = (long int)x; /* truncate */
return i - ( i > x ); /* convert trunc to floor */
}
#endif
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment