DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
test_ArrayDOF.cpp File Reference

Comprehensive doctest-based unit tests for DNDS::ArrayDof (degree-of-freedom array) vector-space operations. More...

#include "doctest.h"
#include "DNDS/ArrayDOF.hpp"
#include <cmath>
Include dependency graph for test_ArrayDOF.cpp:

Go to the source code of this file.

Classes

struct  DofTag< M >
 

Macros

#define DOCTEST_CONFIG_IMPLEMENT
 

Functions

int main (int argc, char **argv)
 
 TEST_CASE ("ArrayDOF setup and setConstant")
 
 TEST_CASE ("ArrayDOF operator+= scalar and array")
 
 TEST_CASE ("ArrayDOF addTo")
 
 TEST_CASE ("ArrayDOF norm2")
 
 TEST_CASE ("ArrayDOF dot")
 
 TEST_CASE ("ArrayDOF min and max")
 
 TEST_CASE ("ArrayDOF sum")
 
 TEST_CASE ("ArrayDOF componentWiseNorm1")
 
 TEST_CASE ("ArrayDOF componentWiseNorm1 difference")
 
 TEST_CASE ("ArrayDOF element-wise multiply and divide")
 
dof2 clone (dof1)
 
 for (DNDS::index i=0;i< dof2.father->Size();i++)
 
dof1 setConstant (0.0)
 
 CHECK (dof2[0](0, 0)==doctest::Approx(7.0))
 
 TEST_CASE ("ArrayDOF scalar array multiply")
 
 TEST_CASE ("ArrayDOF norm2 zero array")
 
 TEST_CASE ("ArrayDOF dot self equals norm2 squared")
 
 TYPE_TO_STRING (DofTag< 1 >)
 
 TYPE_TO_STRING (DofTag< 3 >)
 
 TYPE_TO_STRING (DofTag< 5 >)
 
 TYPE_TO_STRING (DofTag< DNDS::DynamicSize >)
 
 TEST_CASE_TEMPLATE ("ArrayDOF parametric over nVars", T, DofTag< 1 >, DofTag< 3 >, DofTag< 5 >, DofTag< DNDS::DynamicSize >)
 

Variables

constexpr DNDS::index N = 40
 
auto dof1 = makeDof<5, 1>(mpi, N)
 
auto dof2 = makeDof<5, 1>(mpi, N)
 
Eigen::Matrix< real, 5, 1 > v = Scalar::BisectSolveLower(F, 0.0, 1.0, 0.75, 100)
 

Detailed Description

Comprehensive doctest-based unit tests for DNDS::ArrayDof (degree-of-freedom array) vector-space operations.

Run under mpirun with 1, 2, and 4 ranks. All MPI-global reductions (norm2, dot, min, max, sum, componentWiseNorm1) are tested with rank-aware expected values that scale correctly at any process count.

See also
DNDS Core Unit Tests for the full test-suite overview.
Test:
setConstant, operator+= (scalar/array/matrix), operator-=, operator*= (scalar/element-wise/matrix), operator/=, addTo, norm2, dot, min, max, sum, componentWiseNorm1, operator= (copy), clone, scalar-array multiply, identity dot(x,x)==norm2(x)^2.

Definition in file test_ArrayDOF.cpp.

Macro Definition Documentation

◆ DOCTEST_CONFIG_IMPLEMENT

#define DOCTEST_CONFIG_IMPLEMENT

Definition at line 17 of file test_ArrayDOF.cpp.

Function Documentation

◆ CHECK()

CHECK ( dof2(0, 0)  [0] = =doctest::Approx(7.0))
Here is the caller graph for this function:

◆ clone()

dof2 clone ( dof1  )

◆ for()

for ( DNDS::index  i = 0; i < dof2.father->Size(); i++)

Definition at line 513 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file test_ArrayDOF.cpp.

◆ setConstant()

dof1 setConstant ( 0.  0)
Here is the caller graph for this function:

◆ TEST_CASE() [1/13]

TEST_CASE ( "ArrayDOF addTo"  )

Definition at line 199 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [2/13]

TEST_CASE ( "ArrayDOF componentWiseNorm1 difference"  )

Definition at line 378 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [3/13]

TEST_CASE ( "ArrayDOF componentWiseNorm1"  )

Definition at line 356 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [4/13]

TEST_CASE ( "ArrayDOF dot self equals norm2 squared"  )

Definition at line 566 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [5/13]

TEST_CASE ( "ArrayDOF dot"  )

Definition at line 283 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [6/13]

TEST_CASE ( "ArrayDOF element-wise multiply and divide"  )

Definition at line 403 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [7/13]

TEST_CASE ( "ArrayDOF min and max"  )

Definition at line 317 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [8/13]

TEST_CASE ( "ArrayDOF norm2 zero array"  )

Definition at line 554 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [9/13]

TEST_CASE ( "ArrayDOF norm2"  )

Definition at line 221 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [10/13]

TEST_CASE ( )

Definition at line 98 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [11/13]

TEST_CASE ( "ArrayDOF scalar array multiply"  )

Definition at line 527 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [12/13]

TEST_CASE ( "ArrayDOF setup and setConstant"  )

Definition at line 61 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [13/13]

TEST_CASE ( "ArrayDOF sum"  )

Definition at line 341 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TEST_CASE_TEMPLATE()

TEST_CASE_TEMPLATE ( "ArrayDOF parametric over nVars"  ,
,
DofTag< 1 >  ,
DofTag< 3 >  ,
DofTag< 5 >  ,
DofTag< DNDS::DynamicSize  
)

Definition at line 597 of file test_ArrayDOF.cpp.

Here is the call graph for this function:

◆ TYPE_TO_STRING() [1/4]

TYPE_TO_STRING ( DofTag< 1 >  )

◆ TYPE_TO_STRING() [2/4]

TYPE_TO_STRING ( DofTag< 3 >  )

◆ TYPE_TO_STRING() [3/4]

TYPE_TO_STRING ( DofTag< 5 >  )

◆ TYPE_TO_STRING() [4/4]

TYPE_TO_STRING ( DofTag< DNDS::DynamicSize )

Variable Documentation

◆ dof1

auto dof1 = makeDof<5, 1>(mpi, N)

Definition at line 465 of file test_ArrayDOF.cpp.

◆ dof2

v<< 7.0, 8.0, 9.0; dof1.setConstant(v); ArrayDof<3, 1> dof2 = makeDof<5, 1>(mpi, N)

Definition at line 466 of file test_ArrayDOF.cpp.

◆ N

constexpr DNDS::index N = 40
constexpr

Definition at line 463 of file test_ArrayDOF.cpp.

◆ v

double v = Scalar::BisectSolveLower(F, 0.0, 1.0, 0.75, 100)

Definition at line 468 of file test_ArrayDOF.cpp.