1 /** @file gsExprAssembler_test.cpp
2 
3     @brief Tests for gsExprAssembler
4 
5     This file is part of the G+Smo library.
6 
7     This Source Code Form is subject to the terms of the Mozilla Public
8     License, v. 2.0. If a copy of the MPL was not distributed with this
9     file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11     Author(s): R. Schneckenleitner
12 */
13 
14 #include "gismo_unittest.h"
15 
16 
SUITE(gsExprAssembler_test)17 SUITE(gsExprAssembler_test)
18 {
19          TEST(InterfaceExpression)
20                 {
21                     const index_t numRef = 2;
22                     gsVector<> translation(2);
23                     translation << -0.5, -1;
24                     gsFunctionExpr<> ff("if(x>0,1,-1)", 2); // function with jump
25                     gsMultiPatch<> patches = gsNurbsCreator<>::BSplineSquareGrid(1,2,1);
26                     patches.patch(0).translate(translation);
27                     patches.patch(1).translate(translation);
28 
29                     gsMultiBasis<> mb(patches);
30 
31                     for(index_t i = 0; i < numRef; i++)
32                         mb.uniformRefine();
33 
34                     gsExprEvaluator<> ev;
35                     ev.setIntegrationElements(mb);
36                     gsExprEvaluator<>::geometryMap G = ev.getMap(patches);
37                     gsExprEvaluator<>::variable f = ev.getVariable(ff, G);
38 
39                     ev.integral(f);
40 
41                     const real_t v = ev.value();
42                     CHECK( v*v < 1e-10 );
43                 }
44         }
45