OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestFM2DDynamic.cpp File Reference

Unit tests for FM2DDynamic fieldmap class. More...

#include <gtest/gtest.h>
#include "Fields/FM2DDynamic.h"
#include "Fields/Fieldmap.h"
#include "Ippl.h"
#include "Physics/Units.h"
#include "Utilities/GeneralOpalException.h"
#include <cmath>
#include <filesystem>
#include <fstream>
#include <vector>
Include dependency graph for TestFM2DDynamic.cpp:

Go to the source code of this file.

Classes

class  FM2DDynamicTest
 

Functions

 TEST_F (FM2DDynamicTest, ParseXZOrientation)
 
 TEST_F (FM2DDynamicTest, ParseZXOrientation)
 
 TEST_F (FM2DDynamicTest, FrequencyParsing)
 
 TEST_F (FM2DDynamicTest, UniformFieldStrength)
 
 TEST_F (FM2DDynamicTest, OutsideZRange)
 
 TEST_F (FM2DDynamicTest, OutsideRadialRange)
 
 TEST_F (FM2DDynamicTest, IsInside)
 
 TEST_F (FM2DDynamicTest, SwapToggle)
 
 TEST_F (FM2DDynamicTest, Normalization)
 
 TEST_F (FM2DDynamicTest, BilinearInterpolation)
 
 TEST_F (FM2DDynamicTest, ComputeFieldStatic)
 
 TEST_F (FM2DDynamicTest, GetFieldDerivativeThrows)
 
 TEST_F (FM2DDynamicTest, GetFieldDimensions6ArgThrows)
 
 TEST_F (FM2DDynamicTest, GetInfoNoCrash)
 
 TEST_F (FM2DDynamicTest, MissingFile)
 
 TEST_F (FM2DDynamicTest, DictionaryCaching)
 
 TEST_F (FM2DDynamicTest, ReadFreeCycle)
 
 TEST_F (FM2DDynamicTest, GridPointAccuracy)
 
 TEST_F (FM2DDynamicTest, XZvsZXConsistency)
 
 TEST_F (FM2DDynamicTest, FieldProjection)
 
 TEST_F (FM2DDynamicTest, FieldAccumulation)
 

Detailed Description

Unit tests for FM2DDynamic fieldmap class.

Tests cover:

Parsing & metadata:

  • File parsing (XZ and ZX orientations)
  • Frequency parsing and conversion (MHz → angular frequency)
  • Field dimension retrieval (z-bounds)

Field evaluation:

  • Point field evaluation via getFieldstrength()
  • Uniform field correctness (on-axis behaviour)
  • Bilinear interpolation for spatially varying fields
  • Exact values at grid points (GridPointAccuracy)

Geometry & bounds:

  • Behaviour outside z-range (no modification, outside flag)
  • Behaviour outside radial range
  • isInside() helper (including boundary semantics)

Physical behaviour:

  • Normalization and scaling:
    • Electric field: MV/m → V/m
    • Magnetic field: Bt → μ0 scaling
  • Projection of cylindrical components (Er, Bt) into Cartesian (x,y)
  • Consistency between XZ and ZX orientations

Low-level kernel:

  • Static computeField() correctness (host views, interpolation, projection)

API behaviour:

  • swap() toggle (orientation handling)
  • getFieldDerivative() throws (not implemented)
  • getFieldDimensions(6-arg) throws
  • getFrequency() correctness
  • getInfo() does not crash

Robustness:

  • Missing / invalid file handling
  • Fieldmap dictionary caching (singleton behaviour)
  • readMap() / freeMap() lifecycle correctness

Semantics:

  • Field accumulation: E and B are accumulated, not overwritten

Definition in file TestFM2DDynamic.cpp.

Function Documentation

◆ TEST_F() [1/21]

TEST_F ( FM2DDynamicTest  ,
BilinearInterpolation   
)

Definition at line 474 of file TestFM2DDynamic.cpp.

References Units::cm2m, Fieldmap::getFieldstrength(), Physics::mu_0, and nr.

Here is the call graph for this function:

◆ TEST_F() [2/21]

TEST_F ( FM2DDynamicTest  ,
ComputeFieldStatic   
)

Definition at line 570 of file TestFM2DDynamic.cpp.

◆ TEST_F() [3/21]

TEST_F ( FM2DDynamicTest  ,
DictionaryCaching   
)

Definition at line 730 of file TestFM2DDynamic.cpp.

References nr.

◆ TEST_F() [4/21]

TEST_F ( FM2DDynamicTest  ,
FieldAccumulation   
)

Definition at line 928 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function:

◆ TEST_F() [5/21]

TEST_F ( FM2DDynamicTest  ,
FieldProjection   
)

Definition at line 871 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), Physics::mu_0, and nr.

Here is the call graph for this function:

◆ TEST_F() [6/21]

TEST_F ( FM2DDynamicTest  ,
FrequencyParsing   
)

Definition at line 228 of file TestFM2DDynamic.cpp.

References Units::MHz2Hz, nr, and Physics::two_pi.

◆ TEST_F() [7/21]

TEST_F ( FM2DDynamicTest  ,
GetFieldDerivativeThrows   
)

Definition at line 664 of file TestFM2DDynamic.cpp.

References DX, Fieldmap::getFieldDerivative(), and nr.

Here is the call graph for this function:

◆ TEST_F() [8/21]

TEST_F ( FM2DDynamicTest  ,
GetFieldDimensions6ArgThrows   
)

Definition at line 685 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldDimensions(), and nr.

Here is the call graph for this function:

◆ TEST_F() [9/21]

TEST_F ( FM2DDynamicTest  ,
GetInfoNoCrash   
)

Definition at line 704 of file TestFM2DDynamic.cpp.

References Fieldmap::getInfo(), and nr.

Here is the call graph for this function:

◆ TEST_F() [10/21]

TEST_F ( FM2DDynamicTest  ,
GridPointAccuracy   
)

Definition at line 784 of file TestFM2DDynamic.cpp.

References Units::cm2m, Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function:

◆ TEST_F() [11/21]

TEST_F ( FM2DDynamicTest  ,
IsInside   
)

Definition at line 384 of file TestFM2DDynamic.cpp.

References nr.

◆ TEST_F() [12/21]

TEST_F ( FM2DDynamicTest  ,
MissingFile   
)

Definition at line 722 of file TestFM2DDynamic.cpp.

◆ TEST_F() [13/21]

TEST_F ( FM2DDynamicTest  ,
Normalization   
)

Definition at line 438 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function:

◆ TEST_F() [14/21]

TEST_F ( FM2DDynamicTest  ,
OutsideRadialRange   
)

Definition at line 350 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function:

◆ TEST_F() [15/21]

TEST_F ( FM2DDynamicTest  ,
OutsideZRange   
)

Definition at line 294 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function:

◆ TEST_F() [16/21]

TEST_F ( FM2DDynamicTest  ,
ParseXZOrientation   
)

Definition at line 181 of file TestFM2DDynamic.cpp.

References Units::cm2m, Fieldmap::getFieldDimensions(), Fieldmap::getType(), nr, and T2DDynamic.

Here is the call graph for this function:

◆ TEST_F() [17/21]

TEST_F ( FM2DDynamicTest  ,
ParseZXOrientation   
)

Definition at line 205 of file TestFM2DDynamic.cpp.

References Units::cm2m, Fieldmap::getFieldDimensions(), and nr.

Here is the call graph for this function:

◆ TEST_F() [18/21]

TEST_F ( FM2DDynamicTest  ,
ReadFreeCycle   
)

Definition at line 747 of file TestFM2DDynamic.cpp.

References Fieldmap::freeMap(), Fieldmap::getFieldstrength(), nr, and Fieldmap::readMap().

Here is the call graph for this function:

◆ TEST_F() [19/21]

TEST_F ( FM2DDynamicTest  ,
SwapToggle   
)

Definition at line 417 of file TestFM2DDynamic.cpp.

References nr.

◆ TEST_F() [20/21]

TEST_F ( FM2DDynamicTest  ,
UniformFieldStrength   
)

Definition at line 251 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function:

◆ TEST_F() [21/21]

TEST_F ( FM2DDynamicTest  ,
XZvsZXConsistency   
)

Definition at line 832 of file TestFM2DDynamic.cpp.

References Fieldmap::getFieldstrength(), and nr.

Here is the call graph for this function: