0001 function mdl = fix_boundary(mdl)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 opt.elem2face = 1;
0012 opt.boundary_face = 1;
0013 opt.inner_normal = 1;
0014 tmp = fix_model(mdl,opt);
0015 flip = tmp.elem2face(logical(tmp.boundary_face(tmp.elem2face).*tmp.inner_normal));
0016 tmp.faces(flip,:) = tmp.faces(flip,[1 3 2]);
0017 tmp.normals(flip,:) = -tmp.normals(flip,:);
0018
0019
0020 fields = {'faces', 'normals', 'inner_normal', 'boundary_face'};
0021 for i = 1:numel(fields)
0022 if isfield(mdl, fields{i})
0023 mdl.(fields{i}) = tmp.(fields{i});
0024 end
0025 end
0026 mdl.boundary = tmp.faces(tmp.boundary_face,:);
0027
0028 mdl = eidors_obj('set', mdl);