annotate diracDiscr.m @ 1210:5e7692ed7c7c feature/laplace_curvilinear_test

Add CG interface coupling
author Martin Almquist <malmquist@stanford.edu>
date Sun, 22 Sep 2019 19:05:17 -0700
parents b29892853daf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1128
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 function d = diracDiscr(x_s, x, m_order, s_order, H)
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 % n-dimensional delta function
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4 % x_s: source point coordinate vector, e.g. [x, y] or [x, y, z].
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5 % x: cell array of grid point column vectors for each dimension.
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
6 % m_order: Number of moment conditions
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7 % s_order: Number of smoothness conditions
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8 % H: cell array of 1D norm matrices
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10 dim = length(x_s);
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
11 d_1D = cell(dim,1);
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13 % If 1D, non-cell input is accepted
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 if dim == 1 && ~iscell(x)
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 d = diracDiscr1D(x_s, x, m_order, s_order, H);
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 else
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18 for i = 1:dim
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 d_1D{i} = diracDiscr1D(x_s(i), x{i}, m_order, s_order, H{i});
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20 end
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
21
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
22 d = d_1D{dim};
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
23 for i = dim-1: -1: 1
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
24 % Perform outer product, transpose, and then turn into column vector
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
25 d = (d_1D{i}*d')';
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
26 d = d(:);
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
27 end
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
28 end
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
29 end
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
30
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
31
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
32
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
33
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
34
3a9262c045d0 Copy diracDiscr.m from feature/poroelastic
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
35