-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathLHSintegrator_Mass_Vect.m
57 lines (46 loc) · 1.94 KB
/
LHSintegrator_Mass_Vect.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
classdef LHSintegrator_Mass_Vect < LHSintegrator
methods (Access = public)
function obj = LHSintegrator_Mass_Vect(cParams)
obj@LHSintegrator(cParams)
end
function LHS = compute(obj)
lhs = obj.computeElementalLHS();
LHS = obj.assembleMatrix(lhs);
end
end
methods (Access = private)
function lhs = computeElementalLHS(obj)
quad = obj.quadrature;
xV = quad.posgp;
shapesTest = obj.test.computeShapeFunctions(xV);
shapesTrial = obj.trial.computeShapeFunctions(xV);
dVolu = obj.mesh.computeDvolume(quad);
nGaus = obj.quadrature.ngaus;
nElem = size(dVolu,2);
nDim = obj.mesh.ndim;
nNodeTest = size(shapesTest,1);
nNodeTrial = size(shapesTrial,1);
nDofTest = nNodeTest*obj.test.ndimf;
nDofTrial = nNodeTrial*obj.trial.ndimf;
shapesTestMapped = obj.test.mapFunction(shapesTest, xV);
shapesTrialMapped = obj.trial.mapFunction(shapesTrial, xV);
M = zeros(nDofTest, nDofTrial, nElem);
for igauss = 1 :nGaus
for inode= 1:nNodeTest
for jnode= 1:nNodeTrial
for iunkn= 1:obj.test.ndimf
idof = obj.test.ndimf*(inode-1)+iunkn;
jdof = obj.trial.ndimf*(jnode-1)+iunkn;
dvol = abs(dVolu(igauss,:))';
Ni = reshape(squeeze(shapesTestMapped(inode,igauss,:,:))',nDim,[])';
Nj = reshape(squeeze(shapesTrialMapped(jnode,igauss,:,:))',nDim,[])';
v = sum(Ni.*Nj,2);
M(idof, jdof, :)= squeeze(M(idof,jdof,:)) + v(:).*dvol;
end
end
end
end
lhs = M;
end
end
end