Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14 add compile time variable for the number of vertices stored #15

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# ==============================================
# === Set Some default values for polyhedra ====
# ==============================================
# These values have to be set by exaNBody
set(EXADEM_MAX_VERTICES "8" CACHE STRING "Maximum number of vertices per polyhedron")
message(STATUS "Maximum number of vertices per polyhedron: ${EXADEM_MAX_VERTICES}, default is 8 vertices.")
add_compile_options(-DEXADEM_MAX_VERTICES=${EXADEM_MAX_VERTICES})

# ======================================
# === exaNBody application framework ===
# ======================================
Expand Down Expand Up @@ -87,12 +95,12 @@ endif()
# =======================================
exaNBodyStartApplication()


# ==========================================
# === build application plugins and libs ===
# ==========================================
add_subdirectory(src)


# =============================
# === check exaDEM examples ===
# =============================
Expand Down
2 changes: 1 addition & 1 deletion include/exanb/fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ XSTAMP_DECLARE_FIELD(::exanb::Vec3d , vrot ,"angular velocity"); //
XSTAMP_DECLARE_FIELD(::exanb::Vec3d , arot ,"angular acceleration"); //
XSTAMP_DECLARE_FIELD(::exanb::Vec3d , inertia ,"inertia values (same value in the diagonal)");
XSTAMP_DECLARE_FIELD(::exanb::Vec3d , friction ,"tmp field"); //
typedef ::onika::oarray_t<::exanb::Vec3d, 8> VerticesType;
typedef ::onika::oarray_t<::exanb::Vec3d, EXADEM_MAX_VERTICES> VerticesType;
XSTAMP_DECLARE_FIELD(VerticesType , vertices ,"list to compute vertices"); //


Expand Down
2 changes: 1 addition & 1 deletion src/polyhedra/include/exaDEM/compute_vertices.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace exaDEM
struct PolyhedraComputeVerticesFunctor
{
shapes& shps;
ONIKA_HOST_DEVICE_FUNC inline void operator () (const uint8_t type, const double rx, const double ry, const double rz, const double h, const exanb::Quaternion& orient, ::onika::oarray_t<::exanb::Vec3d, 8>& vertices ) const
ONIKA_HOST_DEVICE_FUNC inline void operator () (const uint8_t type, const double rx, const double ry, const double rz, const double h, const exanb::Quaternion& orient, ::onika::oarray_t<::exanb::Vec3d, EXADEM_MAX_VERTICES>& vertices ) const
{
// h will be used in a next development
const auto& shp = shps[type];
Expand Down
2 changes: 1 addition & 1 deletion src/polyhedra/include/exaDEM/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace exaDEM
double time; ///< Incrementation time value


using signature = std::tuple<bool, double, exanb::Vec3d, exanb::Vec3d> (*)(const onika::oarray_t<exanb::Vec3d, 8>&, int, const exaDEM::shape*, const onika::oarray_t<exanb::Vec3d, 8>&, int, const exaDEM::shape*);
using signature = std::tuple<bool, double, exanb::Vec3d, exanb::Vec3d> (*)(const onika::oarray_t<exanb::Vec3d, EXADEM_MAX_VERTICES>&, int, const exaDEM::shape*, const onika::oarray_t<exanb::Vec3d, EXADEM_MAX_VERTICES>&, int, const exaDEM::shape*);

/**
* @brief Array of function pointers for precomputed detection signatures.
Expand Down
2 changes: 1 addition & 1 deletion src/polyhedra/include/exaDEM/shape/shape_detection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace exaDEM
{
using namespace exanb;
using VertexArray = ::onika::oarray_t<::exanb::Vec3d, 8>;
using VertexArray = ::onika::oarray_t<::exanb::Vec3d, EXADEM_MAX_VERTICES>;

/**
* @brief Normalizes a 3D vector in-place.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace exaDEM
{
using namespace exanb;
using VertexArray = ::onika::oarray_t<::exanb::Vec3d, 8>;
using VertexArray = ::onika::oarray_t<::exanb::Vec3d, EXADEM_MAX_VERTICES>;

// -> First Filters
template<typename Driver>
Expand Down
19 changes: 7 additions & 12 deletions src/polyhedra/include/exaDEM/shape/shape_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@

namespace exaDEM
{
/*
bool adder(std::ifstream& stream, shape& item, std::string in)
{
switch (in)
{
case "name":
default return false;
}
}
*/

void add_shape_from_file_shp(shapes& sphs, const std::string file_name)
{
std::ifstream input( file_name.c_str() );
Expand All @@ -39,7 +28,6 @@ namespace exaDEM
input >> new_shape.m_name;
}


// === keys relative to the OBB
if(key == "obb.center")
{
Expand Down Expand Up @@ -88,6 +76,13 @@ namespace exaDEM
{
int nv = 0;
input >> nv;
if( nv >= EXADEM_MAX_VERTICES )
{
lout << "=== EXADEM ERROR ===
lout << "=== Please, increase the maximum number of vertices: cmake ${Path_To_ExaDEM} -DEXADEM_MAX_VERTICES=" << nv << std::endl;
lout << "=== ABORT ===
std::abort();
}
assert( nv !=0 );
for(int i = 0; i < nv ; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/polyhedra/read_shape_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace exaDEM
inline void execute () override final
{
auto& collection = *shapes_collection;
std::cout << "read file: " << *filename << std::endl;
lout << "Read file= " << *filename << std::endl;
exaDEM::add_shape_from_file_shp(collection, *filename);
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/polyhedra/update_grid_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace exaDEM
{
using namespace exanb;
using VertexArray = ::onika::oarray_t<::exanb::Vec3d, 8>;
using VertexArray = ::onika::oarray_t<::exanb::Vec3d, EXADEM_MAX_VERTICES>;


template<typename GridT
Expand Down
Loading