MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / TestFiniteElement

Function TestFiniteElement

tests/catch/finiteelement.cpp:69–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68template<typename T>
69void TestFiniteElement(T fel)
70{
71 IntegrationRule ir(fel.ElementType(),fel.Order());
72
73 SECTION ("Evaluate", "[evaluate]")
74 {
75 Vector<> coefs(fel.GetNDof()), values(ir.Size());
76 for (auto i : Range(coefs.Size()))
77 coefs[i] = i*0.5;
78
79 fel.Evaluate(ir,coefs,values);
80
81 SECTION ("SIMD", "[SIMD]")
82 {
83 SIMD_IntegrationRule simdir(fel.ElementType(),fel.Order());
84 Vector<SIMD<double>> simd_values(simdir.Size());
85
86 try
87 {
88 fel.Evaluate(simdir,coefs,simd_values);
89 FlatVector<double> values_ref(values.Size(),(double*)&simd_values[0]);
90 SECTION("SIMD correctness", "[SIMD]")
91 {
92 CHECK(L2Norm(values-values_ref) < 1e-10);
93 }
94 }
95 catch(const Exception & ex)
96 {
97 CHECK(typeid(ex) == typeid(ExceptionNOSIMD));
98 WARN("SIMD not implemented");
99 }
100 }
101 }
102}
103
104TEST_CASE ("FiniteElement", "[fem][finiteelement]")
105{

Callers 1

finiteelement.cppFile · 0.85

Calls 7

RangeFunction · 0.50
L2NormFunction · 0.50
ElementTypeMethod · 0.45
OrderMethod · 0.45
GetNDofMethod · 0.45
SizeMethod · 0.45
EvaluateMethod · 0.45

Tested by

no test coverage detected