Hello all,
I am trying to figure out the correct way to use the function
DoFTools::get_dofs_on_patch documented here
<https://dealii.org/current/doxygen/deal.II/namespaceDoFTools.html#aba4315ae585ff3b55ba9e6d2c26825a3>.
I have attached a bit of code to this message (test.cc) showing a simple
version of what I am attempting.
In test.cc, I am making a 2D unit square domain divided into 4 equal cells.
I am trying to select the DOFs of the two cells in the domain whose centers
lie to the left of the line x=0.5. I have set up a scalar FE system. When
working correctly, this code should select 6 DOFs.
My understanding of the error message is that the type of element in the
std::vector I am passing to get_dofs_on_patch does not match the type of
elements the function is expecting. Could someone please point out the
mistake I am making when creating the patch of cells ?
Best Regards,
Sudip Kunda
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/dealii/9f99d14a-33a7-4765-9838-13ffeb0a9bfen%40googlegroups.com.
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/dofs/dof_tools.h>
#include <deal.II/fe/fe_system.h>
#include <deal.II/fe/fe_q.h>
using namespace dealii;
int main() {
const unsigned int dim = 2;
Triangulation<dim> triangulation;
DoFHandler<dim> dof_handler(triangulation);
GridGenerator::hyper_cube(triangulation);
triangulation.refine_global(1);
FESystem<dim> fe(FE_Q<dim>(1), 1);
dof_handler.distribute_dofs(fe);
std::vector<typename DoFHandler<dim>::active_cell_iterator> patch;
for (auto &cell : dof_handler.active_cell_iterators())
if (cell->center()[0] < 0.5)
patch.push_back(cell);
std::vector<types::global_dof_index> dofs_for_setup = DoFTools::get_dofs_on_patch(patch);
return 0;
}