Go to the documentation of this file.
6 #ifndef NIHU_CLUSTER_HPP_INCLUDED
7 #define NIHU_CLUSTER_HPP_INCLUDED
32 template <
class Derived>
39 template <
class Derived>
47 static size_t const dimension = traits_t::dimension;
60 typedef typename traits_t::local_t
local_t;
121 m_src_node_idx = node_idx;
128 template <
class ForwardIt>
139 return m_src_node_idx;
147 return m_src_node_idx.size();
155 m_rec_node_idx = node_idx;
162 template <
class ForwardIt>
173 return m_rec_node_idx;
181 return m_rec_node_idx.size();
191 if (std::find(m_children.begin(), m_children.end(), child) ==
193 m_children.push_back(child);
194 else throw std::logic_error(
"Child already contained");
211 return m_children.empty();
228 return !m_src_node_idx.empty();
237 return !m_rec_node_idx.empty();
245 os <<
"Level:" << this->
get_level() << std::endl;
246 os <<
"Bounding box: " << m_bb << std::endl;
247 std::ostream_iterator<size_t> out_it(os,
", ");
248 os <<
"Source indices:" << std::endl;
251 os <<
"Receiver indices:" << std::endl;
260 return derived().zero_multipole();
268 return derived().zero_local();
286 template <
class Derived>
std::vector< size_t > idx_list_t
Index list type for storing children and contained nodes.
void set_bounding_box(bounding_box_t const &bb)
set the cluster's bounding box
local_t zero_local() const
return a cleared (zero) local contribution
size_t get_n_rec_nodes() const
get number of receiver nodes contained in cluster
const idx_list_t & get_rec_node_idx() const
get indices of receiver nodes
const bounding_box_t & get_bounding_box() const
return cluster's bounding box
static const size_t dimension
Space dimension.
traits_t::local_t local_t
Local type.
std::ostream & operator<<(std::ostream &os, const quadrature_base< Derived > &Q)
print a quadrature into an ouput stream
const idx_list_t & get_children() const
get indices of children
Eigen::Matrix< scalar_t, dimension, 1 > location_t
the location type in the bounding box
void set_src_node_idx(ForwardIt begin, ForwardIt end)
set indices of source nodes with range
void add_child(size_t child)
add a new child to a cluster
bounding_box< dimension, double > bounding_box_t
Bounding box type.
cluster_traits< Derived > traits_t
Traits structure.
Implementation of class NiHu::fmm::bounding_box.
#define NIHU_CRTP_HELPERS
define CRTP helper function
const idx_list_t & get_src_node_idx() const
get indices of source nodes
size_t get_level() const
Get cluster's level.
CRTP traits structure of a cluster.
void set_parent(size_t parent)
Set the parent cluster's index.
void set_rec_node_idx(idx_list_t const &node_idx)
set indices of receiver nodes
CRTP base class of clusters.
Define CRTP helper functions and metafunctions.
void print_debug(std::ostream &os=std::cout) const
prints debug information of the cluster to an output stream
bool is_source() const
indicates if cluster is source
traits_t::multipole_t multipole_t
Multipole type.
void set_src_node_idx(idx_list_t const &node_idx)
set indices of source nodes
multipole_t zero_multipole() const
return a cleared (zero) multipole contribution
NIHU_CRTP_HELPERS void set_level(size_t level)
Set cluster's level.
size_t get_n_src_nodes() const
return number of sources contained in cluster
bounding_box_t::location_t location_t
Location type.
bool is_receiver() const
indicates if cluster is receiver
bool is_leaf() const
indicates if cluster is leaf
void set_rec_node_idx(ForwardIt begin, ForwardIt end)
set indices of receiver nodes with range
bool is_root() const
indicates if cluster is root (0-level)
size_t get_parent() const
return parent cluster's index