Solve the "No Type" problem more generally.

This commit is contained in:
Bård Skaflestad
2010-08-18 08:46:56 +00:00
parent e7155b332a
commit 1f8773b5e7

View File

@@ -21,7 +21,13 @@ function G = mcomputeGeometry(G)
% $Date$
% $Revision$
warn_no_type = false;
if ~isfield(G(1), 'type'),
warning(msgid('GridType:Unknown'), ...
['Input grid has no known type. ', ...
'I''ll assume it arose from the primordial soup...']);
[ G(:).type ] = deal( {'Primordial Soup'} );
end
for k = 1 : numel(G),
[fa,fc,fn,cc,cv] = mex_compute_geometry(G(k));
@@ -31,17 +37,6 @@ function G = mcomputeGeometry(G)
G(k).cells.centroids = cc';
G(k).cells.volumes = cv;
if ~isfield(G(k), 'type'),
if ~warn_no_type,
warning(msgid('GridType:Unknown'), ...
['Input grid has no known type. ', ...
'I''ll assume it arose from the primordial soup...']);
warn_no_type = true;
end
G(k).type = { 'Primordial Soup' };
end
G(k).type = [ G(k).type, { mfilename } ];
end
end