changeset 804:1f1d2a271d61 feature/poroelastic

Move blockEvalOn to multiblock package
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 26 Jul 2018 18:33:01 -0700
parents 031d6db97270
children 1caeb4dffdf9
files +grid/blockEvalOn.m +multiblock/evalOn.m
diffstat 2 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/+grid/blockEvalOn.m	Thu Jul 26 18:25:10 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-% Useful for evaulating forcing functions with different functional expressions for each block
-% f: cell array of function handles fi
-% f_i = f_i(x1,y,...,t)
-% t: time point. If not specified, it is assumed that the functions take only spatial arguments.
-function gf = blockEvalOn(g, f, t)
-default_arg('t',[]);
-
-grids = g.grids;
-nBlocks = length(grids);
-gf = cell(nBlocks,1);
-
-if isempty(t)
-	for i = 1:nBlocks
-		grid.evalOn(grids{i}, f{i} );
-	end
-else
-	dim = nargin(f{1}) - 1;
-	for i = 1:nBlocks
-		switch dim
-		case 1
-			gf{i} = grid.evalOn(grids{i}, @(x)f{i}(x,t) );
-		case 2
-			gf{i} = grid.evalOn(grids{i}, @(x,y)f{i}(x,y,t) );
-		case 3
-			gf{i} = grid.evalOn(grids{i}, @(x,y,z)f{i}(x,y,z,t) );
-		end
-	end
-end
-
-gf = blockmatrix.toMatrix(gf);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+multiblock/evalOn.m	Thu Jul 26 18:33:01 2018 -0700
@@ -0,0 +1,30 @@
+% Useful for evaulating forcing functions with different functional expressions for each block
+% f: cell array of function handles fi
+% f_i = f_i(x1,y,...,t)
+% t: time point. If not specified, it is assumed that the functions take only spatial arguments.
+function gf = evalOn(g, f, t)
+default_arg('t',[]);
+
+grids = g.grids;
+nBlocks = length(grids);
+gf = cell(nBlocks,1);
+
+if isempty(t)
+	for i = 1:nBlocks
+		grid.evalOn(grids{i}, f{i} );
+	end
+else
+	dim = nargin(f{1}) - 1;
+	for i = 1:nBlocks
+		switch dim
+		case 1
+			gf{i} = grid.evalOn(grids{i}, @(x)f{i}(x,t) );
+		case 2
+			gf{i} = grid.evalOn(grids{i}, @(x,y)f{i}(x,y,t) );
+		case 3
+			gf{i} = grid.evalOn(grids{i}, @(x,y,z)f{i}(x,y,z,t) );
+		end
+	end
+end
+
+gf = blockmatrix.toMatrix(gf);
\ No newline at end of file