annotate +multiblock/local2globalPenalty.m @ 1037:2d7ba44340d0 feature/burgers1d

Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 18 Jan 2019 09:02:02 +0100
parents ba10f24bf476
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
899
ba10f24bf476 Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents: 864
diff changeset
1 % Takes the block-local penalty and turns it into a global penalty
864
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2 % local -- The local penalty
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3 % div -- block matrix division for the diffOp
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4 % I -- Index of blockmatrix block
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
5 function penalty = local2globalPenalty(local, div, I)
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
6 penaltyDiv = {div{1}, size(local,2)};
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
7 penalty_bm = blockmatrix.zero(penaltyDiv);
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
8 penalty_bm{I,1} = local;
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
9
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
10 penalty = blockmatrix.toMatrix(penalty_bm);
c51b3f945c65 Add functions for taking local closures and penalties global
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
11 end