diff --git a/examples/goalOrientedAFEM.m b/examples/goalOrientedAFEM.m
index 12f719a03eae6c9dda6ee7e045e39120acb714f5..e966ffa0bc7ff92cf2f609649d2436c66ea0e58c 100644
--- a/examples/goalOrientedAFEM.m
+++ b/examples/goalOrientedAFEM.m
@@ -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;
diff --git a/examples/iterativeLinearization.m b/examples/iterativeLinearization.m
index 9424a5ebf82bd9258f25fb0d480a5a1b36d55c27..9c9ea5efaf0902140faec7b93cc08eefcb30ef3e 100644
--- a/examples/iterativeLinearization.m
+++ b/examples/iterativeLinearization.m
@@ -27,7 +27,7 @@ for k = 1:length(linearizations)
u.setData(0);
%% nested iteration
- P = LoH1Prolongation(fes);
+ P = LoFeProlongation(fes);
%% adaptive algorithm
i = 1;
diff --git a/lib/spaces/interpolation/GeneralFeProlongation.m b/lib/spaces/interpolation/FeProlongation.m
similarity index 93%
rename from lib/spaces/interpolation/GeneralFeProlongation.m
rename to lib/spaces/interpolation/FeProlongation.m
index d9f57cfc0d77f3f3ae608d73a8fb37b1269c78f5..4dc5d6b97ac4e223403a4794c378ad118f6e3a8a 100644
--- a/lib/spaces/interpolation/GeneralFeProlongation.m
+++ b/lib/spaces/interpolation/FeProlongation.m
@@ -1,13 +1,13 @@
-% 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
diff --git a/lib/spaces/interpolation/LoH1Prolongation.m b/lib/spaces/interpolation/LoFeProlongation.m
similarity index 59%
rename from lib/spaces/interpolation/LoH1Prolongation.m
rename to lib/spaces/interpolation/LoFeProlongation.m
index 67b41282e546480925506411e281c838a6f4e64f..2c2603e8cf42a7371dabb010b93874d389047f30 100644
--- a/lib/spaces/interpolation/LoH1Prolongation.m
+++ b/lib/spaces/interpolation/LoFeProlongation.m
@@ -1,24 +1,54 @@
-% 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);
diff --git a/lib/spaces/interpolation/LoL2Prolongation.m b/lib/spaces/interpolation/LoL2Prolongation.m
deleted file mode 100644
index 33bc3888611710bbcb29faa3db6f59d97c8a4fa1..0000000000000000000000000000000000000000
--- a/lib/spaces/interpolation/LoL2Prolongation.m
+++ /dev/null
@@ -1,31 +0,0 @@
-% 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
diff --git a/tests/TestFiniteElementFunctions.m b/tests/TestFiniteElementFunctions.m
index 37e7432064fa6fc2f40a24d3c583763946d06683..f208227e5759ddeef015997f8a24a3eea1b81e43 100644
--- a/tests/TestFiniteElementFunctions.m
+++ b/tests/TestFiniteElementFunctions.m
@@ -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));