Skip to content
Snippets Groups Projects
Commit f86567bf authored by Abhinav Singh's avatar Abhinav Singh
Browse files

Update to Numerics

parent 8473862d
No related branches found
No related tags found
No related merge requests found
-I
\ No newline at end of file
\ No newline at end of file
0
\ No newline at end of file
-I
\ No newline at end of file
\ No newline at end of file
openfpm_numerics @ d17c989e
Subproject commit 5e45e6222266455c71e250a1d3cd1296fd5f343e
Subproject commit d17c989e58980cf056ab2d5753953fcece31bbf4
......@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
if(CUDA_FOUND)
set(CUDA_SOURCES Vector/cuda/vector_dist_gpu_MP_tests.cu Vector/cuda/vector_dist_cuda_func_test.cu Decomposition/cuda/decomposition_cuda_tests.cu Vector/cuda/vector_dist_gpu_unit_tests.cu ../openfpm_devices/src/memory/CudaMemory.cu)
else()
set(CUDA_SOURCES)
set(CUDA_SOURCES Vector/vector_dist_subset.hpp)
endif()
add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp Debug/debug_test.cpp Grid/tests/grid_dist_id_HDF5_chckpnt_restart_test.cpp Grid/tests/grid_dist_id_unit_test.cpp Grid/tests/staggered_grid_dist_unit_test.cpp Vector/tests/vector_dist_cell_list_tests.cpp Vector/tests/vector_dist_complex_prp_unit_test.cpp Vector/tests/vector_dist_HDF5_chckpnt_restart_test.cpp Vector/tests/vector_dist_MP_unit_tests.cpp Vector/tests/vector_dist_NN_tests.cpp Vector/tests/vector_dist_unit_test.cpp pdata_performance.cpp Decomposition/tests/CartDecomposition_unit_test.cpp Decomposition/tests/shift_vect_converter_tests.cpp Vector/performance/vector_dist_performance_util.cpp lib/pdata.cpp test_multiple_o.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp DCPSE/MonomialBasis.hpp DCPSE/Monomial.hpp DCPSE/tests/MonomialBasis_unit_tests.cpp DCPSE/Vandermonde.hpp DCPSE/VandermondeRowBuilder.hpp DCPSE/tests/Vandermonde_unit_tests.cpp DCPSE/SupportBuilder.hpp DCPSE/tests/Support_unit_tests.cpp DCPSE/DcpseRhs.hpp DCPSE/tests/DcpseRhs_unit_tests.cpp DCPSE/Support.hpp DCPSE/DcpseDiagonalScalingMatrix.hpp DCPSE/Dcpse.hpp DCPSE/tests/Dcpse_unit_tests.cpp)
......
//
// Created by Abhinav Singh on 24.02.20.
//
#ifndef OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP
#define OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP
#include "vector_dist.hpp"
template<unsigned int dim,
typename St,
typename prop,
typename Decomposition = CartDecomposition<dim,St>,
typename Memory = HeapMemory,
template<typename> class layout_base = memory_traits_lin>
class vector_dist_subset
{
typedef vector_dist<dim,St,prop,Decomposition,Memory,layout_base> ivector_dist;
ivector_dist & vd;
openfpm::vector<aggregate<int>> & pid;
size_t g_m = 0;
public:
//! property object
typedef typename ivector_dist::value_type value_type;
typedef typename ivector_dist::Decomposition_type Decomposition_type;
typedef typename ivector_dist::CellList_type CellList_type;
//! space type
typedef typename ivector_dist::stype stype;
//! dimensions of space
static const unsigned int dims = ivector_dist::dims;
//!
typedef int yes_i_am_vector_dist;
vector_dist_subset(vector_dist<dim,St,prop,Decomposition,Memory,layout_base> & vd,
openfpm::vector<aggregate<int>> & pid)
:vd(vd),pid(pid)
{
for (size_t i = 0 ; i < pid.size() ; i++)
{
g_m += (pid.template get<0>(i) < vd.size_local())?1:0;
}
}
/*! \brief Get the decomposition
*
* \return
*
*/
inline Decomposition & getDecomposition()
{
return vd.getDecomposition();
}
/*! \brief Get the decomposition
*
* \return
*
*/
inline const Decomposition & getDecomposition() const
{
return vd.getDecomposition();
}
/*! \brief return the local size of the vector
*
* \return local size
*
*/
size_t size_local() const
{
return g_m;
}
#ifndef ONLY_READWRITE_GETTER
/*! \brief Get the position of an element
*
* see the vector_dist iterator usage to get an element key
*
* \param vec_key element
*
* \return the position of the element in space
*
*/
inline auto getPos(vect_dist_key_dx vec_key) -> decltype(vd.getPos(vec_key))
{
return vd.getPos(vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
}
/*! \brief Get the position of an element
*
* see the vector_dist iterator usage to get an element key
*
* \param vec_key element
*
* \return the position of the element in space
*
*/
inline auto getPos(vect_dist_key_dx vec_key) const -> decltype(vd.getPos(vec_key))
{
return vd.getPos(vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
}
/*! \brief Get the property of an element
*
* see the vector_dist iterator usage to get an element key
*
* \tparam id property id
* \param vec_key vector element
*
* \return return the selected property of the vector element
*
*/
template<unsigned int id> inline auto getProp(vect_dist_key_dx vec_key) -> decltype(vd.template getProp<id>(vec_key))
{
return vd.template getProp<id>(vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
}
/*! \brief Get the property of an element
*
* see the vector_dist iterator usage to get an element key
*
* \tparam id property id
* \param vec_key vector element
*
* \return return the selected property of the vector element
*
*/
template<unsigned int id> inline auto getProp(vect_dist_key_dx vec_key) const -> decltype(vd.template getProp<id>(vec_key))
{
return vd.template getProp<id>(vect_dist_key_dx(pid.template get<0>(vec_key.getKey())));
}
#endif
/*! \brief Get an iterator that traverse the particles in the domain
*
* \return an iterator
*
*/
vector_dist_iterator getDomainIterator() const
{
#ifdef SE_CLASS3
se3.getIterator();
#endif
return vector_dist_iterator(0, g_m);
}
};
#endif //OPENFPM_PDATA_VECTOR_DIST_SUBSET_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment