function node_boundary = node_boundary_set ( nx, ny, node_num ) %% NODE_BOUNDARY_SET stores the boundary status of each node in BOUNDARY_NODE. % % Discussion: % % Every finite element node will is assigned an index which % indicates the finite element basis function and its coefficient % which are associated with that node. % % Example: % % On a simple 5 by 5 grid, where the nodes are numbered starting % at the lower left, and increasing in X first, we would have the % following values of NODE_BOUNDARY: % % 1 1 1 1 1 % 1 0 0 0 1 % 1 0 0 0 1 % 1 0 0 0 1 % 1 1 1 1 1 % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 10 April 2006 % % Author: % % John Burkardt % % Parameters: % % Input, integer NX, NY, the number of elements in the X and Y directions. % % Input, integer NODE_NUM, the number of nodes. % % Output, integer NODE_BOUNDARY(NODE_NUM), is % 0, if a node is an interior node; % 1, if a node is a Dirichlet boundary node. % node = 0; for j = 1 : 2 * ny - 1 for i = 1 : 2 * nx - 1 node = node + 1; if ( j == 1 | ... j == 2 * ny - 1 | ... i == 1 | ... i == 2 * nx - 1 ) node_boundary(node) = 1; else node_boundary(node) = 0; end end end return end