From 3372ba643316b920abffa59a225c033d3f4c03a2 Mon Sep 17 00:00:00 2001 From: heltai Date: Wed, 11 Mar 2009 17:59:21 +0000 Subject: [PATCH] Added test for QGaussLogR in codim_one git-svn-id: https://svn.dealii.org/trunk@18480 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/codim_one/integrate_log_2.cc | 195 ++ tests/codim_one/integrate_log_2/cmp/generic | 3295 +++++++++++++++++++ 2 files changed, 3490 insertions(+) create mode 100644 tests/codim_one/integrate_log_2.cc create mode 100644 tests/codim_one/integrate_log_2/cmp/generic diff --git a/tests/codim_one/integrate_log_2.cc b/tests/codim_one/integrate_log_2.cc new file mode 100644 index 0000000000..d42c1d1b5c --- /dev/null +++ b/tests/codim_one/integrate_log_2.cc @@ -0,0 +1,195 @@ +//---------------------------- template.cc --------------------------- +// $Id: testsuite.html 13373 2006-07-13 13:12:08Z manigrasso $ +// Version: $Name$ +// +// Copyright (C) 2005 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- template.cc --------------------------- + + +// integrates the function x^M ln(|x-x0|/alpha) on different +// situations, to test the QGaussLogR quadrature formula + +#include "../tests.h" +#include +#include + +// all include files needed for the program + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +using namespace std; + +std::ofstream logfile("integrate_log_2/output"); + + +// Returns the following integral: /int_0^1 x^N * ln(|x-point|/alpha) dx +double log_integral(const unsigned int N, const double point, const double alpha); + +int main() +{ + deallog.attach(logfile); + deallog.depth_console(1); + deallog< > origins; + origins.push_back(Point<1>()); + origins.push_back(Point<1>(1.)); + origins.push_back(Point<1>(1./3.)); + origins.push_back(Point<1>(1./2.)); + origins.push_back(Point<1>(1./5.)); + origins.push_back(Point<1>(3./5.)); + + vector alphas; + alphas.push_back(1.); + alphas.push_back(1/3.); + alphas.push_back(3./2.); + + + double exact_integral; + + for(unsigned int nos = 0; nos< origins.size(); ++nos) { + for(unsigned int nas = 0; nas < alphas.size(); ++nas) { + for(unsigned int power = 0; power<13; ++power) { + exact_integral = log_integral(power, origins[nos][0], alphas[nas]); + deallog << "==================================================" << endl; + deallog << "int_0^1 x^" << power + << " ln(|x-" << origins[nos] << "|/" + << alphas[nas] << ") = " + << exact_integral << endl; + for(unsigned int nq = 1; nq < 13; ++nq) { + QGaussLogR<1> quad(nq, origins[nos], alphas[nas]); + + double approx_integral = 0; + for(unsigned int q=0; q