Skip to content

Commit

Permalink
added switch to test set_child_aunt
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarce1 committed Jun 16, 2017
1 parent 336e35d commit 2b3548a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/defs.hpp
Expand Up @@ -37,6 +37,8 @@

//#define WD_EOS

#define USE_NIECE_BOOL


#define EXPERIMENT
#ifdef RADIATION
Expand Down Expand Up @@ -64,7 +66,7 @@
#define USE_PPM
//#define USE_MINMOD

#if !defined(OCTOTIGER_FORCEINLINE)
#if !defined(OCTOTIGER_FORCEINLINE)
# if defined(__NVCC__) || defined(__CUDACC__)
# define OCTOTIGER_FORCEINLINE inline
# elif defined(_MSC_VER)
Expand Down
9 changes: 8 additions & 1 deletion src/node_client.hpp
Expand Up @@ -22,6 +22,13 @@ class node_server;
class analytic_t;


#ifdef USE_NIECE_BOOL
typedef bool set_child_aunt_type;
#else
typedef integer set_child_aunt_type;
#endif


namespace hpx {
using mutex = hpx::lcos::local::spinlock;
}
Expand Down Expand Up @@ -73,7 +80,7 @@ class node_client {
hpx::future<analytic_t> compare_analytic() const;
hpx::future<grid::output_list_type> output(std::string dname, std::string fname, int, bool) const;
node_client();
hpx::future<integer> set_child_aunt(const hpx::id_type&, const geo::face&) const;
hpx::future<set_child_aunt_type> set_child_aunt(const hpx::id_type&, const geo::face&) const;
hpx::future<void> set_aunt(const hpx::id_type&, const geo::face&) const;
hpx::future<node_server*> get_ptr() const;
hpx::future<void> form_tree(hpx::id_type&&, hpx::id_type&&, std::vector<hpx::id_type>&& );
Expand Down
3 changes: 1 addition & 2 deletions src/node_server.hpp
Expand Up @@ -25,7 +25,6 @@
#include <map>
#include <vector>


#include <hpx/include/components.hpp>
#include <hpx/include/serialization.hpp>

Expand Down Expand Up @@ -291,7 +290,7 @@ class node_server: public hpx::components::managed_component_base<node_server> {
void set_aunt(const hpx::id_type&, const geo::face& face);
HPX_DEFINE_COMPONENT_DIRECT_ACTION(node_server, set_aunt, set_aunt_action);

integer set_child_aunt(const hpx::id_type&,
set_child_aunt_type set_child_aunt(const hpx::id_type&,
const geo::face& face) const;
HPX_DEFINE_COMPONENT_DIRECT_ACTION(node_server, set_child_aunt, set_child_aunt_action);

Expand Down
18 changes: 15 additions & 3 deletions src/node_server_actions_2.cpp
Expand Up @@ -457,7 +457,11 @@ hpx::future<void> node_client::form_tree(hpx::id_type&& id1, hpx::id_type&& id2,
}

void node_server::form_tree(hpx::id_type self_gid, hpx::id_type parent_gid, std::vector<hpx::id_type> neighbor_gids) {
#ifdef NIECE_BOOL
std::fill(nieces.begin(), nieces.end(), false);
#else
std::fill(nieces.begin(), nieces.end(), 0);
#endif

for (auto& dir : geo::direction::full_set()) {
neighbors[dir] = std::move(neighbor_gids[dir]);
Expand Down Expand Up @@ -520,12 +524,16 @@ void node_server::form_tree(hpx::id_type self_gid, hpx::id_type parent_gid, std:
if (!neighbor.empty()) {
nfuts.push_back(
neighbor.set_child_aunt(me.get_gid(), f ^ 1).then(
[this, f](hpx::future<integer>&& n)
[this, f](hpx::future<set_child_aunt_type>&& n)
{
nieces[f] = n.get();
}));
} else {
#ifdef USE_NIECE_BOOL
nieces[f] = false;
#else
nieces[f] = -2;
#endif
}
}
for (auto& f : nfuts) {
Expand Down Expand Up @@ -596,11 +604,11 @@ hpx::id_type node_server::get_child_client(const geo::octant& ci) {
typedef node_server::set_child_aunt_action set_child_aunt_action_type;
HPX_REGISTER_ACTION (set_child_aunt_action_type);

hpx::future<integer> node_client::set_child_aunt(const hpx::id_type& aunt, const geo::face& f) const {
hpx::future<set_child_aunt_type> node_client::set_child_aunt(const hpx::id_type& aunt, const geo::face& f) const {
return hpx::async<typename node_server::set_child_aunt_action>(get_unmanaged_gid(), aunt, f);
}

integer node_server::set_child_aunt(const hpx::id_type& aunt, const geo::face& face) const {
set_child_aunt_type node_server::set_child_aunt(const hpx::id_type& aunt, const geo::face& face) const {
if (is_refined) {
std::array<hpx::future<void>, geo::octant::count() / 2> futs;
integer index = 0;
Expand All @@ -616,7 +624,11 @@ integer node_server::set_child_aunt(const hpx::id_type& aunt, const geo::face& f
}
}
}
#ifdef NIECE_BOOL
return is_refined;
#else
return is_refined ? +1 : -1;
#endif
}

typedef node_server::get_ptr_action get_ptr_action_type;
Expand Down

0 comments on commit 2b3548a

Please sign in to comment.