16 #define MAXELEMENTSPERBLOCK 1
18 #include "../include/bem_fma.h"
19 #include "../include/laplace_kernel.h"
47 trunc_order = prm.
get_integer(
"FMA Truncation Order");
58 std::cout<<
"Computing direct integrals..."<<std::endl;
74 const unsigned int dofs_per_cell = comp_dom.fe.dofs_per_cell;
76 std::vector<QGaussOneOverR<2> > sing_quadratures_3d;
77 for (
unsigned int i=0; i<dofs_per_cell; ++i)
78 sing_quadratures_3d.push_back
80 comp_dom.fe.get_unit_support_points()[i],
true));
88 std::vector<unsigned int> local_dof_indices(dofs_per_cell);
94 Vector<double> local_neumann_matrix_row_i(comp_dom.fe.dofs_per_cell);
95 Vector<double> local_dirichlet_matrix_row_i(comp_dom.fe.dofs_per_cell);
111 ExcMessage(
"The code in this function can only be used for "
112 "the usual Q1 elements."));
121 std::vector<Point<dim> > support_points(comp_dom.dh.n_dofs());
137 cell = comp_dom.dh.begin_active(),
138 endc = comp_dom.dh.end();
161 prec_sparsity_pattern.reinit(comp_dom.dh.n_dofs(),comp_dom.dh.n_dofs(),125*comp_dom.fe.dofs_per_cell);
163 for (
unsigned int kk = 0; kk < comp_dom.childlessList.size(); kk++)
172 unsigned int blockId = comp_dom.childlessList[kk];
178 if (block1Nodes.size() > 0)
188 const std::set<unsigned int> &block1IntList = block1->
GetIntList(intListSubLevs-1);
194 std::set<unsigned int> directNodes;
199 for (std::set<unsigned int>::iterator pos = block1IntList.begin(); pos != block1IntList.end(); pos++)
202 std::map <cell_it, std::vector<unsigned int> >
208 typename std::map <cell_it, std::vector<unsigned int> >::iterator it;
209 for (it = blockQuadPointsList.begin(); it != blockQuadPointsList.end(); it++)
217 cell->get_dof_indices(local_dof_indices);
218 for (
unsigned int j = 0; j < dofs_per_cell; j++)
219 directNodes.insert(local_dof_indices[j]);
230 for (
unsigned int i = 0; i < block1Nodes.size(); i++)
231 for (std::set<unsigned int>::iterator pos = directNodes.begin(); pos != directNodes.end(); pos++)
232 prec_sparsity_pattern.add(block1Nodes[i],*pos);
244 for (
unsigned int level = 1; level < comp_dom.num_octree_levels + 1; level++)
247 std::vector<unsigned int>
248 dofs_filled_blocks = comp_dom.dofs_filled_blocks[level];
249 unsigned int startBlockLevel = comp_dom.startLevel[level];
253 for (
unsigned int jj = 0; jj < dofs_filled_blocks.size(); jj++)
257 const std::vector <unsigned int> &nodesBlk1Ids = block1->
GetBlockNodeList();
261 if (nodesBlk1Ids.size() > 0)
273 std::set <unsigned int> directNodes;
274 const std::set <unsigned int> &nonIntList = block1->
GetNonIntList(subLevel);
279 for (std::set<unsigned int>::iterator pos = nonIntList.begin(); pos !=nonIntList.lower_bound(startBlockLevel); pos++)
282 std::map <cell_it, std::vector<unsigned int> >
288 typename std::map <cell_it, std::vector<unsigned int> >::iterator it;
289 for (it = blockQuadPointsList.begin(); it != blockQuadPointsList.end(); it++)
292 cell->get_dof_indices(local_dof_indices);
293 for (
unsigned int j = 0; j < dofs_per_cell; j++)
294 directNodes.insert(local_dof_indices[j]);
300 for (
unsigned int i = 0; i < nodesBlk1Ids.size(); i++)
301 for (std::set<unsigned int>::iterator pos = directNodes.begin(); pos != directNodes.end(); pos++)
302 prec_sparsity_pattern.add(nodesBlk1Ids[i],*pos);
314 prec_sparsity_pattern.compress();
315 double filling_percentage = double(prec_sparsity_pattern.n_nonzero_elements())/
double(comp_dom.dh.n_dofs()*comp_dom.dh.n_dofs())*100.;
316 std::cout<<prec_sparsity_pattern.n_nonzero_elements()<<
" Nonzeros out of "<<comp_dom.dh.n_dofs()*comp_dom.dh.n_dofs()<<
": "<<filling_percentage<<
"%"<<std::endl;
318 prec_neumann_matrix.reinit(prec_sparsity_pattern);
319 prec_dirichlet_matrix.reinit(prec_sparsity_pattern);
320 preconditioner.reinit(prec_sparsity_pattern);
328 for (
unsigned int kk = 0; kk < comp_dom.childlessList.size(); kk++)
335 unsigned int blockId = comp_dom.childlessList[kk];
343 if (block1Nodes.size() > 0)
352 std::set <unsigned int> block1IntList = block1->
GetIntList(intListNumLevs-1);
354 std::map <cell_it,std::set<unsigned int> > directQuadPoints;
355 for (std::set<unsigned int>::iterator pos = block1IntList.begin(); pos != block1IntList.end(); pos++)
359 std::map <cell_it, std::vector<unsigned int> >
364 typename std::map <cell_it, std::vector<unsigned int> >::iterator it;
365 for (it = blockQuadPointsList.begin(); it != blockQuadPointsList.end(); it++)
367 for (
unsigned int i=0; i<(*it).second.size(); i++)
369 directQuadPoints[(*it).first].insert((*it).second[i]);
void parse_parameters(ParameterHandler &prm)
std::map< cell_it, std::vector< unsigned int > > GetBlockQuadPointsList() const
#define AssertThrow(cond, exc)
unsigned int NumNearNeighLevels() const
std::set< unsigned int > GetIntList(unsigned int sublevel) const
void enter_subsection(const std::string &subsection)
void declare_parameters(ParameterHandler &prm)
static::ExceptionBase & ExcMessage(std::string arg1)
BEMFMA(ComputationalDomain< dim > &comp_dom)
std::vector< unsigned int > GetBlockNodeList() const
DoFHandler< dim-1, dim >::active_cell_iterator cell_it
std::set< unsigned int > GetNonIntList(unsigned int sublevel) const
unsigned int GetIntListSize() const
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
long int get_integer(const std::string &entry_string) const