Commit d6302779 authored by incardon's avatar incardon
Browse files

Voromodel

parent 102cb1fa
Pipeline #4769 failed with stages
in 55 seconds
......@@ -76,7 +76,8 @@ if ( CUDA_ON_BACKEND STREQUAL "HIP" AND HIP_FOUND )
SparseGrid/SparseGrid_unit_tests.cpp
SparseGrid/SparseGrid_chunk_copy_unit_tests.cpp
Grid/copy_grid_unit_test.cpp NN/Mem_type/Mem_type_unit_tests.cpp
Grid/Geometry/tests/grid_smb_tests.cpp)
Grid/Geometry/tests/grid_smb_tests.cpp
Space/Shape/Plane_unit_test.cpp)
else()
......@@ -91,7 +92,8 @@ else()
SparseGrid/SparseGrid_unit_tests.cpp
SparseGrid/SparseGrid_chunk_copy_unit_tests.cpp
Grid/copy_grid_unit_test.cpp NN/Mem_type/Mem_type_unit_tests.cpp
Grid/Geometry/tests/grid_smb_tests.cpp)
Grid/Geometry/tests/grid_smb_tests.cpp
Space/Shape/Plane_unit_test.cpp)
endif()
......
......@@ -871,6 +871,26 @@ public:
e_l.resize(e_l.size() + v_slot);
}
/*! \brief add vertex generic
*
* \param vrt Vertex properties
*
*/
template<typename Vtype>
inline void addVertex(const Vtype & vrt)
{
v.add(vrt);
// Set the number of adjacent vertex for this vertex to 0
v_l.add(0ul);
// Add a slot for the vertex adjacency list
e_l.resize(e_l.size() + v_slot);
}
/*! \brief add an empty vertex
*
*/
......@@ -911,6 +931,29 @@ public:
return e.get(id_x_end);
}
/*! \brief add edge on the graph
*
* \param v1 source edge
* \param v2 destination edge
* \param ed edge object to add
*
* \return edge object
*
*/
template<typename Etype, typename CheckPolicy = NoCheck>inline auto addEdge(size_t v1, size_t v2, const Etype & ed) -> decltype(e.get(0))
{
long int id_x_end = addEdge_<CheckPolicy>(v1, v2);
// If there is not edge return an invalid edge, is a kind of stub object
if (id_x_end == NO_EDGE)
return e_invalid.get(0);
// add in e_l the edge properties
e.set(id_x_end, ed);
return e.get(id_x_end);
}
/*! \brief add edge on the graph
*
* add edge on the graph
......
......@@ -2407,6 +2407,10 @@ public:
findNN = true;
}
/*! \brief Count the number or points in this sparse grid
*
*
*/
size_t countExistingElements() const
{
// Here it is crucial to use "auto &" as the type, as we need to be sure to pass the reference to the actual buffers!
......
......@@ -44,6 +44,26 @@
namespace openfpm
{
template<bool is_key>
struct get_id
{
template<typename KeyType>
static auto get(KeyType & key) -> decltype(key.getKey())
{
return key.getKey();
}
};
template<>
struct get_id<true>
{
template<typename KeyType>
static auto get(KeyType & key) -> KeyType
{
return key;
}
};
template<bool active>
struct copy_two_vectors_activate_impl
{
......@@ -1374,7 +1394,7 @@ namespace openfpm
template <unsigned int p,typename KeyType>
inline auto getProp(const KeyType & id) -> decltype(base.template get<p>(grid_key_dx<1>(0)))
{
return this->template get<p>(id.getKey());
return this->template get<p>(get_id<std::is_fundamental<KeyType>::value>::get(id));
}
/*! \brief Get an element of the vector
......@@ -1387,10 +1407,10 @@ namespace openfpm
* \return the element value requested
*
*/
template <unsigned int p, typename keyType>
inline auto getProp(const keyType & id) const -> decltype(base.template get<p>(grid_key_dx<1>(0)))
template <unsigned int p, typename KeyType>
inline auto getProp(const KeyType & id) const -> decltype(base.template get<p>(grid_key_dx<1>(0)))
{
return this->template get<p>(id.getKey());
return this->template get<p>(get_id<std::is_fundamental<KeyType>::value>::get(id));
}
/*! \brief Get an element of the vector
......
......@@ -315,4 +315,15 @@ struct AggregateAppend<BlockT, aggregate<list ...>>
typedef aggregate<list..., BlockT> type;
};
template<typename BlockT, typename T>
struct AggregatePreAppend
{
};
template<typename BlockT, typename ... list>
struct AggregatePreAppend<BlockT, aggregate<list ...>>
{
typedef aggregate<BlockT, list...> type;
};
#endif /* OPENFPM_DATA_SRC_UTIL_AGGREGATE_HPP_ */
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