100 switch (elmE->
T().n()) {
102 c = elmE->
vertex(0); r = 0.0;
123 std::ostream& operator<<(std::ostream& os,
const Cluster<F>& clst);
165 inline uint
nleaf()
const {
return nlf_;}
167 inline uint
index()
const {
return idx_;}
168 std::ostream& info(std::ostream& os)
const;
171 friend std::ostream& operator<< <>(std::ostream& os,
198 while (c && j) {c = c->
link(); j--;}
213 inline std::ostream& operator<<(std::ostream& os,
const Cluster<F>& clst) {
214 return clst.info(os);
220 : lnk_(0), idx_(idx), nlf_(nlf), c_(c), r_(r) {
225 for(
const Cluster<F>* c = &chld; c != 0; c = c->lnk_)
226 nlf_ += c->nlf_ ? c->nlf_ : 1;
232 : lnk_(lnk), idx_(0), nlf_(0) {
240 os <<
concepts::typeOf(*
this) <<
"(idx = " << idx_ <<
", r = " << r_ <<
", c = " << c_;
241 os <<
", nleaf = " << nlf_ <<
", lnk = " << lnk_;
242 os <<
", chld = " << child() <<
')';
255 typedef typename Node::CF
F;
257 static Node* child(
const Node* nd, uint j) {
return nd->child(j);}
259 return nd->element();
262 return nd->center();}
267 static uint nleaf(
const Node* nd) {
return nd->nleaf();}
268 static uint index(
const Node* nd) {
return nd->index();}
273 template<
class CNode>
276 template<
class CNode>
277 inline std::ostream& operator<<(std::ostream& os,
const Tree<CNode>& t) {
284 template<
class CNode>
286 friend std::ostream& operator<< <>(std::ostream& os,
const Tree<CNode>& t);
302 virtual std::ostream& info(std::ostream& os)
const;
329 template<
class CNode>
330 void Tree<CNode>::info_(
const CNode* clst,
concepts::Real& rhomin,
334 const CNode* chld = Traits::child(clst, j);
337 if (Traits::nleaf(chld)) {
339 info_(chld, rhomin, rhomax, taumin, taumax, hh);
344 if (rho < rhomin) rhomin = rho;
345 if (rho > rhomax) rhomax = rho;
349 if (tau < taumin) taumin = tau;
350 if (tau > taumax) taumax = tau;
353 std::cout << *clst << std::endl;
354 std::cout << *chld << std::endl;
358 chld = Traits::child(clst, ++j);
363 template<
class CNode>
364 std::ostream& Tree<CNode>::info(std::ostream& os)
const {
370 info_(root(), rhomin, rhomax, taumin, taumax, h);
372 os <<
"cluster::" <<
concepts::typeOf(*
this) <<
"(nclst = " << nclst() <<
", nleaf = " << nleaf();
376 os <<
", rho in [" << rhomin <<
", " << rhomax;
377 os <<
"], tau in [" << taumin <<
", " << taumax <<
"])";
#define conceptsException(exc)
const concepts::Real3d & vertex(uint i) const
const concepts::Real3d & vertex(uint i) const
const concepts::Real3d & vertex(uint i) const
const concepts::Real3d & vertex(uint i) const
const concepts::TMatrixBase< F > & T() const
Returns T matrix of the element.
const concepts::Real3d & vertex(uint i) const
void operator()(const concepts::Element< F > &elm, concepts::Real3d &c, concepts::Real &r) const
virtual void operator()(const concepts::Element< F > &elm, concepts::Real3d &c, concepts::Real &r) const =0
const concepts::Real3d & center() const
Center of the cluster.
concepts::Real radius() const
Radius of the cluster.
uint nleaf() const
Number of leafs of the cluster.
Cluster< F > * link() const
Neighbouring cluster.
uint index() const
Index (number) of the cluster.
Cluster< F > * child() const
First child of the cluster if the cluster is not a leaf.
Cluster(const concepts::Element< F > &elm, const BBall< F > &ball, Cluster< F > *lnk)
const concepts::Element< F > * element() const
Returns element if the cluster is a leaf.
F CF
Typedef used for interface (trait) of the cluster tree.
Node::CF F
Field of the node (Real or Cmplx)
TreeTraits< CNode > Traits
Interface of the tree.
virtual uint nleaf() const =0
Number of leafs.
virtual const Node * root() const =0
Root node of the tree.
const concepts::Space< F > & space() const
Space of the tree.
virtual uint nclst() const =0
Number of clusters.
Tree(const concepts::Space< F > &spc)
Traits::F F
Field (Real or Cmplx)
CNode Node
Node type of the tree used for the interface of the far field matrices.
void cebysev(const concepts::Real3d &x0, const concepts::Real3d &x1, concepts::Real3d &c, concepts::Real &r)
Computes the Cebysev ball of two or three points.
std::string typeOf(const T &t)