Support empty grids.
This commit is contained in:
+17
-15
@@ -21,22 +21,24 @@ function G = mcomputeGeometry(G)
|
||||
% $Date$
|
||||
% $Revision$
|
||||
|
||||
if ~isfield(G(1), 'type'),
|
||||
warning(msgid('GridType:Unknown'), ...
|
||||
['Input grid has no known type. ', ...
|
||||
'I''ll assume it arose from the primordial soup...']);
|
||||
if numel(G) > 0,
|
||||
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
|
||||
[ G(:).type ] = deal( {'Primordial Soup'} );
|
||||
end
|
||||
|
||||
for k = 1 : numel(G),
|
||||
[fa,fc,fn,cc,cv] = mex_compute_geometry(G(k));
|
||||
G(k).faces.areas = fa;
|
||||
G(k).faces.centroids = fc';
|
||||
G(k).faces.normals = fn';
|
||||
G(k).cells.centroids = cc';
|
||||
G(k).cells.volumes = cv;
|
||||
|
||||
G(k).type = [ G(k).type, { mfilename } ];
|
||||
for k = 1 : numel(G),
|
||||
[fa,fc,fn,cc,cv] = mex_compute_geometry(G(k));
|
||||
G(k).faces.areas = fa;
|
||||
G(k).faces.centroids = fc';
|
||||
G(k).faces.normals = fn';
|
||||
G(k).cells.centroids = cc';
|
||||
G(k).cells.volumes = cv;
|
||||
|
||||
G(k).type = [ G(k).type, { mfilename } ];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user