41 #include <lifev/core/LifeV.hpp> 42 #include <lifev/core/fem/QuadratureRule.hpp> 43 #include <lifev/core/fem/FESpace.hpp> 44 #include <lifev/core/array/VectorEpetra.hpp> 47 #include <boost/bind.hpp> 49 using namespace LifeV;
65 bool check_interpolate ( std::vector< std::shared_ptr < FESpace<MeshType, MapType> > >& originalFeSpaceVecPtr,
66 std::vector< std::shared_ptr < FESpace<MeshType, MapType> > >& finalFeSpaceVecPtr,
67 const MapEpetraType& outputMapType, Fct& function,
68 const Real errorArray [],
const std::string stringArray [], Real eps, Real time, UInt verbose)
70 std::vector< std::shared_ptr <VectorEpetra> > interpVecPtr (originalFeSpaceVecPtr.size() );
73 for (UInt i = 0; i < originalFeSpaceVecPtr.size(); i++)
75 std::shared_ptr <VectorEpetra> tmp (
new VectorEpetra (originalFeSpaceVecPtr[i]->map(), outputMapType) );
76 originalFeSpaceVecPtr[i]->interpolate (
static_cast<
typename FESpace<MeshType, MapType>::function_Type> ( function ), *tmp, time);
77 interpVecPtr[i] = tmp;
81 for (UInt i = 0; i < originalFeSpaceVecPtr.size(); i++)
82 for (UInt j = 0; j < finalFeSpaceVecPtr.size(); j++)
84 VectorEpetra interpolated = finalFeSpaceVecPtr[j]->feToFEInterpolate (*originalFeSpaceVecPtr[i], *interpVecPtr[i], outputMapType);
85 finalFeSpaceVecPtr[j]->l2Error ( function, VectorEpetra (interpolated, Repeated), time, &err_rel );
86 check &= fabs (err_rel - errorArray[finalFeSpaceVecPtr.size() * i + j]) < eps;
90 UInt index = finalFeSpaceVecPtr.size() * i + j;
91 std::cout.precision (7);
92 std::cout << stringArray[index] <<
": " << std::setw (15) << std::setprecision (10) << err_rel <<
" (expected " << errorArray[index] <<
")\t";
98 std::cout << std::endl;
Real linearFunction(const Real &t, const Real &x, const Real &y, const Real &z, const ID &ic)
Real linearBubbleFunction(const Real &t, const Real &x, const Real &y, const Real &z, const ID &ic)
Real bilinearFunction(const Real &, const Real &x, const Real &y, const Real &z, const ID &ic)
double Real
Generic real data.
bool check_interpolate(std::vector< std::shared_ptr< FESpace< MeshType, MapType > > > &originalFeSpaceVecPtr, std::vector< std::shared_ptr< FESpace< MeshType, MapType > > > &finalFeSpaceVecPtr, const MapEpetraType &outputMapType, Fct &function, const Real errorArray [], const std::string stringArray [], Real eps, Real time, UInt verbose)
Interpolate the analytical function into the FE spaces specified in originalFeSpaceVecPtr, obtaining the set of FE vectors.
Real quadraticFunction(const Real &t, const Real &x, const Real &y, const Real &z, const ID &ic)