/* XLiFE++ is an extended library of finite elements written in C++ Copyright (C) 2014 Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file unit_segment.cpp \author N. Kielbasiewicz \since 5 nov 2012 \date 18 dec 2012 Low level tests of refSegment class. */ #include "xlife++-libs.h" #include "testUtils.hpp" #include #include using namespace xlifepp; namespace unit_segment { String unit_segment(bool check) { String rootname = "unit_segment"; trace_p->push(rootname); std::stringstream oss; oss.precision(testPrec); Interpolation* p1 = findInterpolation(_Lagrange, _standard, 1, H1); Interpolation* p2 = findInterpolation(_Lagrange, _standard, 2, H1); Interpolation* p3 = findInterpolation(_Lagrange, _standard, 3, H1); Interpolation* p4 = findInterpolation(_Lagrange, _standard, 4, H1); Interpolation* p5 = findInterpolation(_Lagrange, _standard, 5, H1); RefElement* segmentP1 = findRefElement(_segment, p1); RefElement* segmentP2 = findRefElement(_segment, p2); RefElement* segmentP3 = findRefElement(_segment, p3); RefElement* segmentP4 = findRefElement(_segment, p4); RefElement* segmentP5 = findRefElement(_segment, p5); verboseLevel(10); oss << *(segmentP1) << std::endl; oss << *(segmentP2) << std::endl; oss << *(segmentP3) << std::endl; oss << *(segmentP4) << std::endl; oss << *(segmentP5) << std::endl; //test polynomials representation oss<<"===================== with polynomials representation ========================"<computeShapeFunctions();oss << *(segmentP1) << std::endl; segmentP2->computeShapeFunctions();oss << *(segmentP2) << std::endl; segmentP3->computeShapeFunctions();oss << *(segmentP3) << std::endl; segmentP4->computeShapeFunctions();oss << *(segmentP4) << std::endl; segmentP5->computeShapeFunctions();oss << *(segmentP5) << std::endl; //------------------------------------------------------------------------------------ // save results in a file or compare results with some references value in a file //------------------------------------------------------------------------------------ trace_p->pop(); if (check) { return diffResFile(oss, rootname); } else { return saveResToFile(oss, rootname); } } }