> I have a simple domain having nodal coordinate as follows:
> node 1: (0,0)
> node 2: (1,0)
> node 3: (1,1)
> node 4: (0,1)
> I want to fix node 1 in the x and y directions, and node 2 in only the y
> direction.
What you need to do is find out which vertex contains the node you care
about, then which DoFs are associated with that vertex, and then which
one of these corresponds to the x or y direction.
You'd do this as follows:
for(auto& cell: triangulation.active_cell_iterators())
for (unsigned int v = 0; v<cell->n_vertices(); ++v)
if (cell->vertex(v) = {0,0})
{
const types::global_dof_index i
= cell->vertex_dof_index(v,0); // x-DoF at that vertex
constraints.add_line(i);
constraints.add_inhomogeneity(i, 42); // constrain x-DoF to 42
}
else if (cell->vertex(v) = {1,0})
{
const types::global_dof_index i
= cell->vertex_dof_index(v,1); // y-DoF at that vertex
constraints.add_line(i);
constraints.add_inhomogeneity(i, 84); // constrain y-DoF to 84
}
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/