21 #ifndef bempp_extended_bem_cluster_hpp
22 #define bempp_extended_bem_cluster_hpp
24 #include "bempp/common/config_ahmed.hpp"
28 #include "../common/common.hpp"
29 #include "ahmed_aux_fwd.hpp"
31 #include <bbxbemcluster.h>
40 typedef bbxbemcluster<T> Base;
50 double extMinmax[2 * Dim];
55 unsigned int maximumBlockSize =
56 std::numeric_limits<unsigned int>::max(),
57 bool strongAdmissibility =
false) :
59 m_maximumBlockSize(maximumBlockSize),
60 m_strongAdmissibility(strongAdmissibility) {
62 this->xminmax =
new double[2*Dim];
64 for (
int i = 0; i < Dim; ++i)
65 this->xminmax[i] = std::numeric_limits<double>::max();
66 for (
int i = 0; i < Dim; ++i)
67 this->xminmax[Dim + i] = -std::numeric_limits<double>::max();
69 for (
int i = 0; i < Dim; ++i)
70 this->extMinmax[i] = std::numeric_limits<double>::max();
71 for (
int i = 0; i < Dim; ++i)
72 this->extMinmax[Dim + i] = -std::numeric_limits<double>::max();
75 for (
unsigned j = this->nbeg; j < this->nend; ++j) {
76 const T* v = this->dofs + op_perm[j];
77 for (
int i = 0; i < Dim; ++i) {
78 this->xminmax[i] = std::min<double>(this->xminmax[i], v->getcenter(i));
79 this->xminmax[Dim + i] =
80 std::max<double>(this->xminmax[Dim + i], v->getcenter(i));
81 this->extMinmax[i] = std::min<double>(this->extMinmax[i], v->getlbound(i));
82 this->extMinmax[Dim + i] =
83 std::max<double>(this->extMinmax[Dim + i], v->getubound(i));
90 double maxExtent = 0.;
91 for (
int i = 0; i < Dim; ++i) {
92 const double e = this->xminmax[Dim + i] - this->xminmax[i];
101 this->cntrdir = 0.5 * (this->xminmax[this->maindir] +
102 this->xminmax[Dim + this->maindir]);
107 this->seticom(op_perm[this->nbeg]);
111 for (
int j = 0; j < Dim; ++j) {
112 const double e = this->getcom(j) - dofs[op_perm[this->nbeg]].getcenter(j);
116 for (
int i = this->nbeg + 1; i < this->nend; ++i) {
118 for (
int j = 0; j < Dim; ++j) {
119 const double e = this->getcom(j) - dofs[op_perm[i]].getcenter(j);
123 this->seticom(op_perm[i]);
131 unsigned int end)
const {
133 m_maximumBlockSize, m_strongAdmissibility);
136 virtual unsigned dim()
const {
return Dim; }
138 virtual bool isadm(
double eta2, cluster* cl, bl_info& info) {
139 if (this->size() > m_maximumBlockSize ||
140 cl->size() > m_maximumBlockSize)
141 return (info.is_adm =
false);
148 const double d2 = std::min(this->diam2, p->diam2);
150 bool strongAdmissibility = m_strongAdmissibility ||
151 p->usingStrongAdmissibilityCondition();
153 (!strongAdmissibility || 0 < this->
extDist2(p)))
154 return (info.is_adm =
true);
156 return (info.is_adm =
false);
162 virtual void createClusterTree(
const unsigned bmin,
163 unsigned* op_perm,
unsigned* po_perm) {
164 Base::createClusterTree(bmin, op_perm, po_perm);
165 this->seticom(po_perm[this->geticom()]);
168 double getcom(
unsigned i)
const {
169 return (this->xminmax[i + 3] + this->xminmax[i]) / 2.;
176 const unsigned n = dim();
178 for (
unsigned i = 0; i<n; ++i) {
179 const double e = cl->extMinmax[i] - extMinmax[i+n];
183 const double e1 = extMinmax[i] - cl->extMinmax[i+n];
195 const unsigned n = cl->dim();
197 for (
unsigned j=0; j<n; ++j) {
198 const double d = this->getcom(j) - cl->getcom(j);
206 std::cout <<
"Cluster with " << this->nend - this->nbeg
208 for (
int i = 0; i < Dim; ++i)
209 std::cout << this->xminmax[i] <<
" -- "
210 << this->xminmax[i + Dim] <<
"; ";
211 std::cout <<
"\nexterior bbox: ";
212 for (
int i = 0; i < Dim; ++i)
213 std::cout << this->extMinmax[i] <<
" -- "
214 << this->extMinmax[i + Dim] <<
"; ";
215 std::cout << std::endl;
218 unsigned int maximumBlockSize()
const {
219 return m_maximumBlockSize;
222 bool usingStrongAdmissibilityCondition()
const {
223 return m_strongAdmissibility;
226 void useStrongAdmissibilityCondition(
bool value =
true) {
227 m_strongAdmissibility = value;
228 for (
int i = 0; i < this->getns(); ++i) {
229 cluster* son = this->getson(i);
230 if (ExtendedBemCluster* exbemson =
231 dynamic_cast<ExtendedBemCluster*>(son))
232 exbemson->useStrongAdmissibilityCondition(value);
236 void clearDofPointers() {
238 for (
int i = 0; i < this->getns(); ++i) {
239 cluster* son = this->getson(i);
240 if (ExtendedBemCluster* exbemson =
241 dynamic_cast<ExtendedBemCluster*>(son))
242 exbemson->clearDofPointers();
247 unsigned int m_maximumBlockSize;
248 bool m_strongAdmissibility;
Definition: extended_bem_cluster.hpp:37
double extDist2(const ExtendedBemCluster *cl) const
Definition: extended_bem_cluster.hpp:174
double centerToCenterDist2(const ExtendedBemCluster *cl)
returns square of the distance between centres of this cluster and cl
Definition: extended_bem_cluster.hpp:192
void printBboxes() const
debug routine: print bounding boxes of all dofs contained in this cluster
Definition: extended_bem_cluster.hpp:205