Add auto-build support for function 'mex_ifsh'. Also, add auto-build

support for function 'mex_compute_coarse_contrib', even if this
  function is entirely for testing/development purposese.
This commit is contained in:
Bård Skaflestad 2010-09-17 20:54:13 +00:00
parent 5d0278ba1b
commit 8879c1fd7c
2 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,60 @@
function varargout = mex_generate_coarse_contrib(varargin)
%Generate contributions to coarse-scale linsys using compiled C code.
%
% SYNOPSIS:
% [cell_ip, Binv] = ...
% mex_generate_coarse_contrib(BIf, Psi, p, pconn, dof_pos, blk_ncf)
%
% PARAMETERS:
% BIf - Fine-scale (inverse) inner product matrices.
%
% Psi - Basis function values. Non-zeros only. Ordered by blocks.
%
% p - Partition vector.
%
% pconn - Fine-scale indirection array into connection table.
% Typically corresponds to G.cells.facePos.
%
% dof_pos - Coarse-scale indirection array into (coarse) connection
% table. Roughly equivalent to CG.cells.facePos, but only
% for active faces.
%
% blk_ncf - Number of (fine-scale) half-contacts per block.
%
% RETURNS:
% cell_ip - Cell contributions to coarse-scale (block) inner products.
%
% Binv - Coarse-scale inverse inner product. Semantically
% equivalent to 'BI' output of 'mex_ip_simple', but for the
% coarse grid represented by 'p'.
%
% NOTE:
% This function is only intended for testing/developing a compiled
% language implementation of the MsMFE method.
%
% SEE ALSO:
% mex_ip_simple.
%{
#COPYRIGHT#
%}
% $Date$
% $Revision$
buildmex CFLAGS="\$CFLAGS -Wall -Wextra -ansi -pedantic ...
-Wformat-nonliteral -Wcast-align -Wpointer-arith ...
-Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes ...
-Wmissing-declarations -Winline -Wundef -Wnested-externs ...
-Wcast-qual -Wshadow -Wconversion -Wwrite-strings ...
-Wno-conversion -Wchar-subscripts -Wredundant-decls" ...
...
-O -largeArrayDims -DTIME_LOCAL=1 ...
...
mex_compute_coarse_contrib.c coarse_sys.c partition.c dfs.c ...
...
-lmwlapack -lmwblas
% Call MEX'ed edition.
[varargout{1:nargout}] = mex_generate_coarse_contrib(varargin{:});
end

56
mex_ifsh.m Normal file
View File

@ -0,0 +1,56 @@
function varargout = mex_ifsh(varargin)
%Discretise and solve flow equation using compiled C code.
%
% SYNOPSIS:
% state = mex_ifsh(state, G, rock, bc, src)
%
% DESCRIPTION:
% Equivalent to the standard MRST call sequence
%
% fluid = initSingleFluid('mu', 1, 'rho', 1)
% S = computeMimeticIP(G, rock)
% state = solveIncompFlow(state, G, S, fluid, 'src', src, 'bc', bc)
%
% Note in particular that the inner products are computed at each call.
%
% PARAMETERS:
% state - Reservori state.
%
% G, rock - Grid and rock data structures, respectivelly
%
% bc, src - Boundary condition and source data structures as defined by
% 'addBC' and 'addSource', respectively. Either may be empty.
%
% RETURNS:
% state - Updated reservoir state. Contains new values for
% 'state.pressure' and 'state.flux'.
%
% SEE ALSO:
% mex_ip_simple, mex_schur_comp_symm, test_mex_schur_comp_symm.
%{
#COPYRIGHT#
%}
% $Date$
% $Revision$
buildmex CFLAGS="\$CFLAGS -Wall -Wextra -ansi -pedantic ...
-Wformat-nonliteral -Wcast-align -Wpointer-arith ...
-Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes ...
-Wmissing-declarations -Winline -Wundef -Wnested-externs ...
-Wcast-qual -Wshadow -Wconversion -Wwrite-strings ...
-Wno-conversion -Wchar-subscripts -Wredundant-decls" ...
...
-O -largeArrayDims ...
-I/usr/include/suitesparse ...
...
mex_ifsh.c ifsh.c hybsys.c hybsys_global.c sparse_sys.c ...
call_umfpack.c flow_bc.c well.c hash_set.c mimetic.c ...
mrst_api.c ...
...
-lmwumfpack -lmwamd -lmwlapack -lmwblas
% Call MEX'ed edition.
[varargout{1:nargout}] = mex_ifsh(varargin{:});
end