Commit f4a04798 authored by incardon's avatar incardon

Fixing run for numerics

parent 58741708
......@@ -2,7 +2,8 @@
echo "RUN numerics test"
source $HOME/openfpm_vars
branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
source $HOME/openfpm_vars_$branch
mpirun -np $3 ./src/numerics
if [ $? -ne 0 ]; then
......
......@@ -134,32 +134,60 @@ public:
private:
// Encapsulation of the b term as constant
//! Encapsulation of the b term as constant
struct constant_b
{
//! scalar
typename Sys_eqs::stype scal;
/*! \brief Constrictor from a scalar
*
* \param scal scalar
*
*/
constant_b(typename Sys_eqs::stype scal)
{
this->scal = scal;
}
/*! \brief Get the b term on a grid point
*
* \note It does not matter the grid point it is a scalar
*
* \param key grid position (unused because it is a constant)
*
* \return the scalar
*
*/
typename Sys_eqs::stype get(grid_dist_key_dx<Sys_eqs::dims> & key)
{
return scal;
}
};
// Encapsulation of the b term as grid
//! Encapsulation of the b term as grid
template<typename grid, unsigned int prp>
struct grid_b
{
//! b term fo the grid
grid & gr;
/*! \brief gr grid that encapsulate
*
* \param gr grid
*
*/
grid_b(grid & gr)
:gr(gr)
{}
/*! \brief Get the value of the b term on a grid point
*
* \param key grid point
*
* \return the value
*
*/
typename Sys_eqs::stype get(grid_dist_key_dx<Sys_eqs::dims> & key)
{
return gr.template get<prp>(key);
......@@ -439,7 +467,7 @@ private:
auto it = it_d;
grid_sm<Sys_eqs::dims,void> gs = g_map.getGridInfoVoid();
std::unordered_map<long int,float> cols;
std::unordered_map<long int,typename Sys_eqs::stype> cols;
// iterate all the grid points
while (it.isNext())
......@@ -699,7 +727,6 @@ public:
*
* The periodicity is given by the grid b_g
*
* \param pd Padding, how many points out of boundary are present
* \param stencil maximum extension of the stencil on each directions
* \param domain the domain
* \param b_g object grid that will store the solution
......
......@@ -26,7 +26,9 @@ class Lap
* stub_or_real it is just for change the argument type when testing, in normal
* conditions it is a distributed map
*
* \param pos position where the laplacian is calculated
* \param g_map map grid
* \param kmap position in the grid
* \param spacing of the grid
* \param gs Grid info
* \param cols non-zero colums calculated by the function
* \param coeff coefficent (constant in front of the derivative)
......@@ -36,19 +38,11 @@ class Lap
* \snippet FDScheme_unit_tests.hpp Laplacian usage
*
*/
inline static void value(const typename stub_or_real<Sys_eqs,Sys_eqs::dims,typename Sys_eqs::stype,typename Sys_eqs::b_grid::decomposition::extended_type>::type & g_map, grid_dist_key_dx<Sys_eqs::dims> & kmap , const grid_sm<Sys_eqs::dims,void> & gs, std::unordered_map<long int,typename Sys_eqs::stype > & cols, typename Sys_eqs::stype coeff)
{
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " only CENTRAL, FORWARD, BACKWARD derivative are defined";
}
/*! \brief Calculate the position where the derivative is calculated
*
* \param position where we are calculating the derivative
* \param gs Grid info
* \param s_pos staggered position of the properties
*
*/
inline static grid_key_dx<Sys_eqs::dims> position(grid_key_dx<Sys_eqs::dims> & pos, const grid_sm<Sys_eqs::dims,void> & gs)
inline static void value(const typename stub_or_real<Sys_eqs,Sys_eqs::dims,typename Sys_eqs::stype,typename Sys_eqs::b_grid::decomposition::extended_type>::type & g_map,
grid_dist_key_dx<Sys_eqs::dims> & kmap ,
const grid_sm<Sys_eqs::dims,void> & gs,
std::unordered_map<long int,typename Sys_eqs::stype > & cols,
typename Sys_eqs::stype coeff)
{
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " only CENTRAL, FORWARD, BACKWARD derivative are defined";
}
......@@ -81,7 +75,9 @@ public:
* stub_or_real it is just for change the argument type when testing, in normal
* conditions it is a distributed map
*
* \param pos position where the laplacian is calculated
* \param g_map map grid
* \param kmap position in the grid
* \param spacing of the grid
* \param gs Grid info
* \param cols non-zero colums calculated by the function
* \param coeff coefficent (constant in front of the derivative)
......@@ -91,7 +87,12 @@ public:
* \snippet FDScheme_unit_tests.hpp Laplacian usage
*
*/
inline static void value(const typename stub_or_real<Sys_eqs,Sys_eqs::dims,typename Sys_eqs::stype,typename Sys_eqs::b_grid::decomposition::extended_type>::type & g_map, grid_dist_key_dx<Sys_eqs::dims> & kmap , const grid_sm<Sys_eqs::dims,void> & gs, typename Sys_eqs::stype (& spacing )[Sys_eqs::dims] , std::unordered_map<long int,typename Sys_eqs::stype > & cols, typename Sys_eqs::stype coeff)
inline static void value(const typename stub_or_real<Sys_eqs,Sys_eqs::dims,typename Sys_eqs::stype,typename Sys_eqs::b_grid::decomposition::extended_type>::type & g_map,
grid_dist_key_dx<Sys_eqs::dims> & kmap ,
const grid_sm<Sys_eqs::dims,void> & gs,
typename Sys_eqs::stype (& spacing )[Sys_eqs::dims] ,
std::unordered_map<long int,typename Sys_eqs::stype > & cols,
typename Sys_eqs::stype coeff)
{
// for each dimension
for (size_t i = 0 ; i < Sys_eqs::dims ; i++)
......@@ -109,22 +110,6 @@ public:
arg::value(g_map,kmap,gs,spacing,cols, - 2.0 * coeff/spacing[i]/spacing[i]);
}
}
/*! \brief Calculate the position where the derivative is calculated
*
* In case of non staggered case this function just return a null grid_key, in case of staggered,
* the CENTRAL Laplacian scheme return the position of the staggered property
*
* \param position where we are calculating the derivative
* \param gs Grid info
* \param s_pos staggered position of the properties
*
*/
inline static grid_key_dx<Sys_eqs::dims> position(grid_key_dx<Sys_eqs::dims> & pos, const grid_sm<Sys_eqs::dims,void> & gs, const comb<Sys_eqs::dims> (& s_pos)[Sys_eqs::nvar])
{
return arg::position(pos,gs,s_pos);
}
};
......@@ -155,7 +140,9 @@ public:
* stub_or_real it is just for change the argument type when testing, in normal
* conditions it is a distributed map
*
* \param pos position where the laplacian is calculated
* \param g_map map grid
* \param kmap position in the grid
* \param spacing of the grid
* \param gs Grid info
* \param cols non-zero colums calculated by the function
* \param coeff coefficent (constant in front of the derivative)
......@@ -183,22 +170,6 @@ public:
arg::value(g_map,kmap,gs,spacing,cols, - 2.0 * coeff/spacing[i]/spacing[i]/4.0);
}
}
/*! \brief Calculate the position where the derivative is calculated
*
* In case of non staggered case this function just return a null grid_key, in case of staggered,
* the CENTRAL Laplacian scheme return the position of the staggered property
*
* \param position where we are calculating the derivative
* \param gs Grid info
* \param s_pos staggered position of the properties
*
*/
inline static grid_key_dx<Sys_eqs::dims> position(grid_key_dx<Sys_eqs::dims> & pos, const grid_sm<Sys_eqs::dims,void> & gs, const comb<Sys_eqs::dims> (& s_pos)[Sys_eqs::nvar])
{
return arg::position(pos,gs,s_pos);
}
};
#endif /* OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_LAPLACIAN_HPP_ */
......@@ -32,32 +32,148 @@ class rval
#define DEFAULT_VECTOR = 0
#endif
/* ! \brief Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support
/*! \brief Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support
*
*/
template<typename T,unsigned int impl DEFAULT_VECTOR >
class Vector
{
//! stub
T stub;
//! stub
int stub_i;
public:
Vector(const Vector<T> & v) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
Vector(Vector<T> && v) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
Vector(size_t n) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
Vector() {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
Vector(size_t n, size_t n_row_local) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub copy constructor
*
* \param v stub
*
*/
Vector(const Vector<T> & v)
:stub(0),stub_i(0)
{std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub copy constructor
*
* \param v vector to copy
*
*/
Vector(Vector<T> && v)
:stub(0),stub_i(0)
{std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub constructor from number of rows
*
* \param n stub
*
*/
Vector(size_t n)
:stub(0),stub_i(0)
{std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
//! stub default constructor
Vector()
:stub(0),stub_i(0)
{std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub constructor
*
* \param n global number of row
* \param n_row_local local number of rows
*
*/
Vector(size_t n, size_t n_row_local)
:stub(0),stub_i(0)
{std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub resize
*
* \param row stub
* \param row_n stub
*
*/
void resize(size_t row, size_t row_n) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub insert
*
* \param i stub
* \param val stub
*
*/
void insert(size_t i, T val) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub insert
*
* \param i stub
*
* \return stub
*
*/
inline T & insert(size_t i) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;return stub;}
/*! \brief stub insert
*
* \param i stub
*
*/
inline const T & insert(size_t i) const {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return stub;}
/*! \brief stub
*
* \param i stub
*
* \return stub
*
*/
const T & operator()(size_t i) const {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;return stub;}
/*! \brief stub
*
* \param i stub
*
* \return stub
*
*/
T & operator()(size_t i) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;return stub;}
/*! \brief scatter
*
*/
void scatter() {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief fromFile
*
* \param file stub
*
*/
void fromFile(std::string file) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
/*! \brief stub operator=
*
* \param v stub
*
* \return itself
*
*/
Vector<T> & operator=(const Vector<T> & v) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return *this;}
/*! \brief stub operator=
*
* \param v stub
*
* \return itself
*
*/
Vector<T> & operator=(Vector<T> && v) {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return *this;}
/*! \brief stub getVec
*
* \return stub
*
*/
int & getVec() {std::cerr << __FILE__ << ":" << __LINE__ << " Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl; return stub_i;}
};
......
......@@ -168,8 +168,8 @@ public:
/*! \brief Create a vector with n elements
*
* \param n number of elements in the vector
* \param n_row_loc number
* \param n global number of elements in the vector
* \param n_row_local number
*
*/
Vector(size_t n, size_t n_row_local)
......
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