*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit f3530e2a authored by Innerberger, Michael's avatar Innerberger, Michael
Browse files

Rename and summarize prolongation operators

parent 2a7f6fab
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ for p = 1:pmax
lfG.qrfvec = QuadratureRule.ofOrder(max(p-1, 1));
%% set up lifting operators for rhs FEM-data
P = LoL2Prolongation(ncFes);
P = LoFeProlongation(ncFes);
%% adaptive loop
i = 1;
......
......@@ -27,7 +27,7 @@ for k = 1:length(linearizations)
u.setData(0);
%% nested iteration
P = LoH1Prolongation(fes);
P = LoFeProlongation(fes);
%% adaptive algorithm
i = 1;
......
% GeneralFeProlongation (subclass of Prolongation) Provides prolongation
% operator for general FeFunction to a refined mesh.
% FeProlongation (subclass of Prolongation) Provides prolongation operator for
% general FeFunction to a refined mesh.
%
% P = GeneralFeProlongation(fes) returns a handle to the prolongation object
% P = FeProlongation(fes) returns a handle to the prolongation object
% associated to the finite element space fes. The prolongation matrix
% P.matrix is set automatically at mesh refinement.
%
% prolongate(P, u) returns the prolongated data of FeFunction u.
classdef GeneralFeProlongation < Prolongation
classdef FeProlongation < Prolongation
%% properties
properties (Access=private)
postRefineListener
......@@ -15,7 +15,7 @@ classdef GeneralFeProlongation < Prolongation
%% methods
methods (Access=public)
function obj = GeneralFeProlongation(fes)
function obj = FeProlongation(fes)
obj = obj@Prolongation(fes);
obj.postRefineListener = fes.mesh.listener('RefineCompleted', @obj.connectDofs);
......@@ -25,7 +25,7 @@ classdef GeneralFeProlongation < Prolongation
end
methods (Access=protected)
function setupMatrix(obj, mesh, data)
function setupMatrix(obj, ~, data)
% general idea: compute *all* dofs for each new element and store
% them consecutively
% those are connected to the actual new dofs when their numbering
......
% LoH1Prolongation (subclass of Prolongation) Prolongate lowest order H^1
% LoFeProlongation (subclass of Prolongation) Prolongate lowest order L^2/H^1
% conforming finite element function to refined mesh.
%
% P = LoH1Prolongation(fes) returns a handle to the prolongation object
% P = LoFeProlongation(fes) returns a handle to the prolongation object
% associated to the finite element space fes. The prolongation matrix
% P.matrix is set automatically at mesh refinement.
%
% prolongate(P, u) returns the prolongated data of FeFunction u.
classdef LoH1Prolongation < Prolongation
classdef LoFeProlongation < Prolongation
%% properties
properties (Access=protected)
feType
end
%% methods
methods (Access=public)
function obj = LoH1Prolongation(fes)
assert(isa(fes.finiteElement, 'LowestOrderH1Fe'), ...
'LoH1Prolongation needs a lowest order H1 finite element space.')
function obj = LoFeProlongation(fes)
obj = obj@Prolongation(fes);
switch class(fes.finiteElement)
case 'LowestOrderL2Fe'
obj.feType = 'L2';
case 'LowestOrderH1Fe'
obj.feType = 'H1';
otherwise
eid = 'LoFeProlongation:wrongFeType';
msg = 'LoFeProlongation needs a lowest order L2 or H1 finite element space.';
throwAsCaller(MException(eid, msg));
end
end
end
methods (Access=protected)
function setupMatrix(obj, mesh, data)
if isequal(obj.feType, 'L2')
setupMatrixL2(obj, mesh, data);
elseif isequal(obj.feType, 'H1')
setupMatrixH1(obj, mesh, data);
end
end
function setupMatrixL2(obj, mesh, data)
% use that for lowest order L2 elements the dofs correspond to
% elements and indices of new elements is known
nChildren = getNChildrenPerElement(data);
nNewElements = sum(nChildren);
obj.matrix = sparse(1:nNewElements, repelem(1:mesh.nElements, nChildren), ...
ones(nNewElements,1), nNewElements, mesh.nElements);
end
function setupMatrixH1(obj, mesh, data)
% use that for lowest order H1 elements the dofs correspond to
% coordinates and new coordinates reside on edges or on inner nodes
dofs = getDofs(obj.fes);
......
% LoL2Prolongation (subclass of Prolongation) Prolongate lowest order L^2 finite
% element function to refined mesh.
%
% P = LoL2Prolongation(fes) returns a handle to the prolongation object
% associated to the finite element space fes. The prolongation matrix
% P.matrix is set automatically at mesh refinement.
%
% prolongate(P, u) returns the prolongated data of FeFunction u.
classdef LoL2Prolongation < Prolongation
%% methods
methods (Access=public)
function obj = LoL2Prolongation(fes)
assert(isa(fes.finiteElement, 'LowestOrderL2Fe'), ...
'LoL2Prolongation needs a lowest order L2 finite element space.')
obj = obj@Prolongation(fes);
end
end
methods (Access=protected)
function setupMatrix(obj, mesh, data)
% use that for lowest order L2 elements the dofs correspond to
% elements and indices of new elements is known
nChildren = getNChildrenPerElement(data);
nNewElements = sum(nChildren);
obj.matrix = sparse(1:nNewElements, repelem(1:mesh.nElements, nChildren), ...
ones(nNewElements,1), nNewElements, mesh.nElements);
end
end
end
......@@ -81,7 +81,7 @@ methods (Test)
fes = FeSpace(mesh, testCase.u.fes.finiteElement);
qr = QuadratureRule.ofOrder(max(fes.finiteElement.order,1));
v = FeFunction(fes);
P = GeneralFeProlongation(fes);
P = FeProlongation(fes);
for k = 1:min(5, size(getDofs(fes).element2Dofs, 1))
testCase.setToElementwiseBasisFunction(v, k);
before = sum(integrateElement(v, qr));
......@@ -96,12 +96,11 @@ end
methods (Access=private)
function refineAndInterpolate(~, mesh, fes, v, val)
v.setData(val);
if isa(fes.finiteElement, 'LowestOrderH1Fe')
P = LoH1Prolongation(fes);
elseif isa(fes.finiteElement, 'LowestOrderL2Fe')
P = LoL2Prolongation(fes);
if isa(fes.finiteElement, 'LowestOrderH1Fe') ...
|| isa(fes.finiteElement, 'LowestOrderL2Fe')
P = LoFeProlongation(fes);
else
P = GeneralFeProlongation(fes);
P = FeProlongation(fes);
end
mesh.refineUniform();
v.setData(prolongate(P, v));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment