Mercurial > repos > public > sbplib
changeset 735:eac5fb4b63db feature/poroelastic
Make bcSetup work for cell penalties and data from several BC per boundary. Should probably be changed before merge.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Wed, 25 Apr 2018 14:47:54 -0700 |
parents | eebe24a636c7 |
children | d991f8a0b61c |
files | +scheme/bcSetup.m |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/+scheme/bcSetup.m Wed Apr 25 14:46:24 2018 -0700 +++ b/+scheme/bcSetup.m Wed Apr 25 14:47:54 2018 -0700 @@ -25,10 +25,17 @@ if isempty(bc{i}.data) continue end - assertType(bc{i}.data, 'function_handle'); coord = diffOp.grid.getBoundary(bc{i}.boundary); - assertNumberOfArguments(bc{i}.data, 1+size(coord,2)); + if iscell(bc{i}.data) + for j = 1:length(bc{i}.data) + assertType(bc{i}.data{j}, 'function_handle'); + assertNumberOfArguments(bc{i}.data{j}, 1+size(coord,2)); + end + else + assertType(bc{i}.data, 'function_handle'); + assertNumberOfArguments(bc{i}.data, 1+size(coord,2)); + end penalties{end+1} = penalty; dataFunctions{end+1} = bc{i}.data; @@ -39,7 +46,13 @@ function v = S_fun(t) v = O; for i = 1:length(dataFunctions) - v = v + penalties{i}*dataFunctions{i}(t, dataParams{i}{:}); + if iscell(penalties{i}) + for j = 1:length(penalties{i}) + v = v + penalties{i}{j}*dataFunctions{i}{j}(t, dataParams{i}{:}); + end + else + v = v + penalties{i}*dataFunctions{i}(t, dataParams{i}{:}); + end end v = S_sign * v;