annotate +sbp/diagInd.m @ 958:72cd29107a9a feature/poroelastic

Temporary changes in multiblock.DiffOp. Change traction operators in Elastic2dvariable to be true boundary operators. But adjoint FD conv test fails for dirichlet BC so need to debug!
author Martin Almquist <malmquist@stanford.edu>
date Wed, 05 Dec 2018 18:58:10 -0800
parents 32b39dc44474
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
1 function A = diagInd(d,n,m)
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2 A = zeros(n,length(d));
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3 for i = 1:length(d)
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4 i0 = 1;
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
5 j0 = d(i)+1;
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
6
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
7 I = i0 + (0:(n-1))';
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
8 J = j0 + (0:(n-1))';
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
9
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
10 A(:,i) = matInd2VecInd(I,J,n);
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
11
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
12 end
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
13 end
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
14
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
15 function I = matInd2VecInd(i,j,n)
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
16 I = i + (j-1)*n;
32b39dc44474 Removed repository inside +sbp to make it part of the root repo.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
17 end