annotate find_elements.m @ 969:adae8063ea2f
feature/poroelastic
Remove silly getBoundaryOperator* methods in multiblock.DiffOp and make the getBoundaryOperator and getBoundaryQuadrature methods use the scheme.getBoundaryOperator/Quadrature methods instead of properties.
author |
Martin Almquist <malmquist@stanford.edu> |
date |
Tue, 25 Dec 2018 07:21:19 +0100 |
parents |
48b6fb693025 |
children |
|
rev |
line source |
0
|
1 % I = find_elements(a,b)
|
|
2 % Finds the index of elements a in b.
|
|
3 % a and b have to be in the same order.
|
|
4 function I = find_elements(a,b)
|
|
5 I = [];
|
|
6
|
|
7 j = 1;
|
|
8 for i = 1:length(a)
|
|
9 while b(j) ~= a(i)
|
|
10 j = j + 1;
|
|
11 end
|
|
12 I(end+1) = j;
|
|
13 j = j+1;
|
|
14 end
|
|
15
|
|
16 assert(length(I) == length(a),'Expected %d but got %d elements',length(a),length(I))
|
|
17 end |