void ASMHandler<GridType>::determineAdjacencyPattern() { adjacencyPattern.resize(maxeqn); const LeafIndexSet& set = gv.leafView().indexSet(); LeafIterator itend = gv.leafView().template end<0>(); // iterate over cells for (LeafIterator it = gv.leafView().template begin<0>(); it != itend; ++it) { Dune::GeometryType gt = it->type(); const Dune::template GenericReferenceElement<double,dim>& ref = Dune::GenericReferenceElements<double,dim>::general(gt); int vertexsize = ref.size(dim); for (int i=0; i < vertexsize; i++) { int indexi = set.subIndex(*it,i,dim); for (int k=0;k<dim;++k) { MPC* mpc = getMPC(indexi,k); if (mpc) { for (int l=0;l<mpc->getNoMaster();++l) { nodeAdjacency(it,vertexsize, meqn[mpc->getMaster(l).node*dim+ mpc->getMaster(l).dof-1]); } } else nodeAdjacency(it,vertexsize,meqn[indexi*dim+k]); } } } }
void ASMHandler<GridType>::extractValues(Dune::FieldVector<double,comp>& v, const Vector& u, const LeafIterator& it) { v = 0; const LeafIndexSet& set = gv.leafView().indexSet(); Dune::GeometryType gt = it->type(); const Dune::template GenericReferenceElement<double,dim> &ref = Dune::GenericReferenceElements<double,dim>::general(gt); int vertexsize = ref.size(dim); int l=0; for (int i=0;i<vertexsize;++i) { int indexi = set.subIndex(*it,i,dim); fixIt it2 = fixedNodes.find(indexi); for (int n=0;n<dim;++n) { MPC* mpc = getMPC(indexi,n); if (it2 != fixedNodes.end() && it2->second.first & (1 << n)) v[l++] = it2->second.second[n]; else if (mpc) { for (int m=0;m<mpc->getNoMaster();++m) { int idx = meqn[mpc->getMaster(m).node*dim+mpc->getMaster(m).dof-1]; if (idx != -1) v[l] += u[idx]*mpc->getMaster(m).coeff; } l++; } else v[l++] = u[meqn[indexi*dim+n]]; } } }
void ASMHandler<GridType>::determineAdjacencyPattern() { adjacencyPattern.resize(maxeqn); std::cout << "\tsetting up sparsity pattern..." << std::endl; LoggerHelper help(gv.size(0), 5, 50000); const LeafIndexSet& set = gv.leafView().indexSet(); LeafIterator itend = gv.leafView().template end<0>(); // iterate over cells int cell=0; for (LeafIterator it = gv.leafView().template begin<0>(); it != itend; ++it, ++cell) { Dune::GeometryType gt = it->type(); #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) const Dune::template ReferenceElement<double,dim>& ref = Dune::ReferenceElements<double,dim>::general(gt); #else const Dune::template GenericReferenceElement<double,dim>& ref = Dune::GenericReferenceElements<double,dim>::general(gt); #endif int vertexsize = ref.size(dim); for (int i=0; i < vertexsize; i++) { int indexi = set.subIndex(*it,i,dim); for (int k=0;k<dim;++k) { MPC* mpc = getMPC(indexi,k); if (mpc) { for (size_t l=0;l<mpc->getNoMaster();++l) { nodeAdjacency(it,vertexsize, meqn[mpc->getMaster(l).node*dim+ mpc->getMaster(l).dof-1]); } } else nodeAdjacency(it,vertexsize,meqn[indexi*dim+k]); } } help.log(cell, "\t\t... still processing ... cell "); } }