classdef Node < handle properties ID coordinates translation rotation cell_begin duplicate first_instance Top_Nodes end methods function obj = Node(nodelist,cells,sf) if nargin ~=0 R = size(nodelist,1); obj(R) = Node; nodelist = nodelist * sf; [~,ia,ic] = unique(nodelist,'rows'); zmin_indxs = find(nodelist(:,3)==0); zmax_indxs = find(nodelist(:,3)==max(nodelist(:,3))); zindx = 1; ztindx = 1; celli = 1; for i = 1:R obj(i).ID = i; obj(i).coordinates = nodelist(i,1:3); if ia(ic(i)) < i obj(i).duplicate = 'yes'; obj(i).first_instance = ia(ic(i)); else obj(i).duplicate = 'no'; obj(i).first_instance = []; end if i == cells(celli) obj(i).cell_begin = 'yes'; celli = celli + 1; else obj(i).cell_begin = 'no'; end if i == zmin_indxs(zindx) obj(i).translation = 7; obj(i).rotation = 7; %disp('Constrained node') if zindx < length(zmin_indxs) zindx = zindx + 1; end else obj(i).translation = 0; obj(i).rotation = 0; end if i == zmax_indxs(ztindx) obj(i).Top_Nodes = 'yes'; if ztindx < length(zmax_indxs) ztindx = ztindx + 1; end end end end end function TNL = Make_Top_Node_List(obj) tnlidx = 1; for i = 1:length(obj) if strcmp(obj(i).Top_Nodes,'yes') && ~strcmp(obj(i).duplicate,'yes') TNL(tnlidx) = obj(i).ID; tnlidx = tnlidx + 1; end end end end end