Document 'expected_nconn' parameter. Export topo->subfacepos and

topo->subfaces if expected_nconn>0.
This commit is contained in:
Bård Skaflestad 2010-08-31 13:15:52 +00:00
parent c324097c63
commit 25d4faadc7
2 changed files with 54 additions and 1 deletions

View File

@ -127,6 +127,7 @@ generate_coarse_faces(struct coarse_topology *topo)
mxArray *faces;
mxArray *fld;
int fld_no;
size_t f;
int *pi;
@ -164,6 +165,30 @@ generate_coarse_faces(struct coarse_topology *topo)
mxSetField(faces, 0, "tag", fld);
}
if (topo->subfacepos != NULL) {
fld_no = mxAddField(faces, "subfacePos");
if (fld_no >= 0) {
fld = mxCreateNumericMatrix(topo->nfaces + 1, 1,
mxINT32_CLASS, mxREAL);
if (fld != NULL) {
assign_int_vec(topo->subfacepos, fld);
mxSetFieldByNumber(faces, 0, fld_no, fld);
}
}
}
if (topo->subfaces != NULL) {
fld_no = mxAddField(faces, "subfaces");
if (fld_no >= 0) {
fld = mxCreateNumericMatrix(topo->subfacepos[topo->nfaces], 1,
mxINT32_CLASS, mxREAL);
if (fld != NULL) {
assign_int_vec(topo->subfaces, fld);
mxSetFieldByNumber(faces, 0, fld_no, fld);
}
}
}
}
return faces;
@ -238,6 +263,10 @@ mexFunction(int nlhs, mxArray *plhs[],
expct_nconn = mxGetScalar(prhs[2]);
}
if (expct_nconn < 0) {
expct_nconn = 0;
}
topo = coarse_topology_create(nc, nf, expct_nconn,
p, fneighbours);

View File

@ -3,6 +3,7 @@ function varargout = mex_generate_coarsegrid(varargin)
%
% SYNOPSIS:
% CG = mex_generate_coarsegrid(G, p)
% CG = mex_generate_coarsegrid(G, p, expected_nconn)
%
% PARAMETERS:
% G - Grid data structure as described in 'grid_structure'.
@ -10,6 +11,19 @@ function varargout = mex_generate_coarsegrid(varargin)
% p - Partition vector as defined by, e.g., functions 'partitionUI' or
% 'partitionNonUniform'.
%
% expected_nconn -
% Number (non-negative integer) of expected fine-scale faces
% constituting a coarse-scale face. If expected_nconn==0, then
% constituent fine-scale faces will not be computed. On the other
% hand, if expected_nconn > 0, then constituent fine-scale faces will
% be derived (similarly to the output of function 'subFaces'). Any
% positive number may be used, but the implementation is most
% efficient if 'expected_nconn' is in the same order of magnitude as
% the typical number of constituent fine-scale faces.
%
% OPTIONAL. Default value: expected_nconn=0 (don't compute
% constituent fine-scale faces (sub-faces)).
%
% RETURNS:
% CG - Coarse grid data structure as described in 'generateCoarseGrid'.
% There is, however, a number of subtle differences in the details
@ -19,8 +33,18 @@ function varargout = mex_generate_coarsegrid(varargin)
% the 'subFaces' function does not produce meaningful results on
% outer faces.
%
% If expected_nconn>0, then the 'faces' structure has two additional
% fields 'subfacePos', and 'subfaces'. This indirection/data array
% pair is related such that the sub-faces for coarse face 'i' is
% located in
%
% subfaces(subfacePos(i) : subfacePos(i+1) - 1)
%
% The constituent sub-faces of a particular coarse face may occur in
% any order.
%
% SEE ALSO:
% generateCoarseGrid.
% generateCoarseGrid, subFaces.
%{
#COPYRIGHT#