Skip to content
Snippets Groups Projects
Commit 283faa44 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Do not interpolate vector-valued data using scalar bases

This used to work A Long Time Ago, but the feature was removed
eventually.  Unfortunately, the code still used to build,
but failed to produce the correct result.  More recently,
some other commit in dune-functions apparently now leads to
a build failure when trying to call 'interpolate' for a
vector-valued function and a scalar basis.  This is nice!
It allows to catch errors earlier.
parent 2b8c877d
No related branches found
No related tags found
1 merge request!94Make EmbeddedGlobalGFEFunction a dune-functions function
...@@ -163,12 +163,19 @@ public: ...@@ -163,12 +163,19 @@ public:
// Downsample 3rd-order functions onto a P2-space. That's all VTK can visualize today. // Downsample 3rd-order functions onto a P2-space. That's all VTK can visualize today.
if (order>=3) if (order>=3)
{ {
typedef Dune::Functions::LagrangeBasis<typename GridType::LeafGridView,2> P2Basis; using namespace Dune::Functions::BasisFactory;
P2Basis p2Basis(gridView); auto p2Basis = makeBasis(gridView, lagrange<2>());
auto blockedP2Basis = makeBasis(
gridView,
power<3>(
lagrange<2>(),
blockedInterleaved()
));
std::vector<RigidBodyMotion<double,3> > downsampledConfig; std::vector<RigidBodyMotion<double,3> > downsampledConfig;
downsample(basis, configuration, p2Basis, downsampledConfig); downsample(basis, configuration, blockedP2Basis, downsampledConfig);
write(p2Basis, downsampledConfig, filename); write(p2Basis, downsampledConfig, filename);
return; return;
...@@ -398,16 +405,22 @@ public: ...@@ -398,16 +405,22 @@ public:
} }
std::vector<RealTuple<double,3> > displacementConfiguration = deformationConfiguration; std::vector<RealTuple<double,3> > displacementConfiguration = deformationConfiguration;
typedef typename GridType::LeafGridView GridView;
typedef Dune::Functions::LagrangeBasis<GridView,2> P2DeformationBasis;
P2DeformationBasis p2DeformationBasis(gridView);
if (order == 3) if (order == 3)
{ {
using namespace Dune::Functions::BasisFactory;
auto p2DeformationBasis = makeBasis(
gridView,
power<3>(
lagrange<2>(),
blockedInterleaved()
));
// resample to 2nd order -- vtk can't do anything higher // resample to 2nd order -- vtk can't do anything higher
std::vector<RealTuple<double,3> > p2DeformationConfiguration; std::vector<RealTuple<double,3> > p2DeformationConfiguration;
downsample<DisplacementBasis,P2DeformationBasis>(displacementBasis, displacementConfiguration, downsample(displacementBasis, displacementConfiguration,
p2DeformationBasis, p2DeformationConfiguration); p2DeformationBasis, p2DeformationConfiguration);
displacementConfiguration = p2DeformationConfiguration; displacementConfiguration = p2DeformationConfiguration;
......
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