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

Unit tests for Astra1DDynamic fieldmap class. More...

#include <gtest/gtest.h>
#include "Fields/Astra1DDynamic.h"
#include "Fields/Fieldmap.h"
#include "Ippl.h"
#include "PartBunch/PartBunch.h"
#include "Physics/Physics.h"
#include "Physics/Units.h"
#include "Utilities/GeneralOpalException.h"
#include <cmath>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
Include dependency graph for TestAstra1DDynamic.cpp:

Go to the source code of this file.

Classes

class  Astra1DDynamicTest
 

Functions

 TEST_F (Astra1DDynamicTest, ParseAndDimensions)
 
 TEST_F (Astra1DDynamicTest, FrequencyParsing)
 
 TEST_F (Astra1DDynamicTest, IsInside)
 
 TEST_F (Astra1DDynamicTest, UniformFieldStrengthOnAxis)
 
 TEST_F (Astra1DDynamicTest, NoNormalization)
 
 TEST_F (Astra1DDynamicTest, OutsideZRange)
 
 TEST_F (Astra1DDynamicTest, FieldAccumulation)
 
 TEST_F (Astra1DDynamicTest, FieldDerivativeConstantField)
 
 TEST_F (Astra1DDynamicTest, GetOnaxisEzReturnsNormalizedRawProfile)
 
 TEST_F (Astra1DDynamicTest, ComputeFieldStaticConstantCoefficient)
 
 TEST_F (Astra1DDynamicTest, SwapNoCrash)
 
 TEST_F (Astra1DDynamicTest, GetInfoNoCrash)
 
 TEST_F (Astra1DDynamicTest, MissingFile)
 
 TEST_F (Astra1DDynamicTest, DictionaryCaching)
 
 TEST_F (Astra1DDynamicTest, ReadFreeCycle)
 
 TEST_F (Astra1DDynamicTest, ComputeTravelingWaveFieldEntryRegion)
 
 TEST_F (Astra1DDynamicTest, ComputeTravelingWaveFieldCoreRegion)
 
 TEST_F (Astra1DDynamicTest, ComputeTravelingWaveFieldExitRegion)
 
 TEST_F (Astra1DDynamicTest, ComputeTravelingWaveFieldOutsideRange)
 
 TEST_F (Astra1DDynamicTest, ComputeRFFieldInsideRange)
 
 TEST_F (Astra1DDynamicTest, ComputeRFFieldOutsideStartEndRange)
 
 TEST_F (Astra1DDynamicTest, ComputeRFFieldOutsideFieldmapRange)
 

Detailed Description

Unit tests for Astra1DDynamic fieldmap class.

Tests cover:

Parsing & metadata:

  • File parsing
  • Frequency parsing and conversion (MHz -> angular frequency)
  • Field dimension retrieval (z-bounds)

Field evaluation:

  • Point field evaluation via getFieldstrength()
  • Uniform on-axis field correctness
  • Static computeField() correctness for simple coefficients
  • Reconstructed on-axis field via getOnaxisEz()
  • Device-safe RF cavity helper via computeRFField()
  • Device-safe traveling-wave helper via computeTravelingWaveField()

Geometry & bounds:

  • Behaviour outside z-range
  • isInside() helper (boundary semantics)

API behaviour:

  • getFieldDerivative() for simple constant field
  • getFrequency() correctness
  • getInfo() does not crash
  • swap() does not crash

Robustness:

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

Semantics:

  • Field accumulation: E and B are accumulated, not overwritten
    • Notes:
  • The current Astra1DDynamic preprocessing / Fourier reconstruction yields an amplitude factor of (nz - 1) / nz for uniform input fields. The tests reflect the current implementation behaviour.

Definition in file TestAstra1DDynamic.cpp.

Function Documentation

◆ TEST_F() [1/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeFieldStaticConstantCoefficient   
)

Definition at line 410 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [2/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeRFFieldInsideRange   
)

Definition at line 655 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [3/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeRFFieldOutsideFieldmapRange   
)

Definition at line 725 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [4/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeRFFieldOutsideStartEndRange   
)

Definition at line 690 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [5/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeTravelingWaveFieldCoreRegion   
)

Definition at line 553 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [6/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeTravelingWaveFieldEntryRegion   
)

Definition at line 518 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [7/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeTravelingWaveFieldExitRegion   
)

Definition at line 592 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [8/22]

TEST_F ( Astra1DDynamicTest  ,
ComputeTravelingWaveFieldOutsideRange   
)

Definition at line 630 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [9/22]

TEST_F ( Astra1DDynamicTest  ,
DictionaryCaching   
)

Definition at line 476 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [10/22]

TEST_F ( Astra1DDynamicTest  ,
FieldAccumulation   
)

Definition at line 314 of file TestAstra1DDynamic.cpp.

References Fieldmap::getFieldstrength().

Here is the call graph for this function:

◆ TEST_F() [11/22]

TEST_F ( Astra1DDynamicTest  ,
FieldDerivativeConstantField   
)

Definition at line 346 of file TestAstra1DDynamic.cpp.

References DZ.

◆ TEST_F() [12/22]

TEST_F ( Astra1DDynamicTest  ,
FrequencyParsing   
)

Definition at line 170 of file TestAstra1DDynamic.cpp.

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

◆ TEST_F() [13/22]

TEST_F ( Astra1DDynamicTest  ,
GetInfoNoCrash   
)

Definition at line 454 of file TestAstra1DDynamic.cpp.

References Fieldmap::getInfo().

Here is the call graph for this function:

◆ TEST_F() [14/22]

TEST_F ( Astra1DDynamicTest  ,
GetOnaxisEzReturnsNormalizedRawProfile   
)

Definition at line 369 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [15/22]

TEST_F ( Astra1DDynamicTest  ,
IsInside   
)

Definition at line 188 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [16/22]

TEST_F ( Astra1DDynamicTest  ,
MissingFile   
)

Definition at line 468 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [17/22]

TEST_F ( Astra1DDynamicTest  ,
NoNormalization   
)

Definition at line 243 of file TestAstra1DDynamic.cpp.

References Fieldmap::getFieldstrength().

Here is the call graph for this function:

◆ TEST_F() [18/22]

TEST_F ( Astra1DDynamicTest  ,
OutsideZRange   
)

Definition at line 269 of file TestAstra1DDynamic.cpp.

References Fieldmap::getFieldstrength().

Here is the call graph for this function:

◆ TEST_F() [19/22]

TEST_F ( Astra1DDynamicTest  ,
ParseAndDimensions   
)

Definition at line 145 of file TestAstra1DDynamic.cpp.

References Fieldmap::getFieldDimensions(), Fieldmap::getType(), and TAstraDynamic.

Here is the call graph for this function:

◆ TEST_F() [20/22]

TEST_F ( Astra1DDynamicTest  ,
ReadFreeCycle   
)

Definition at line 489 of file TestAstra1DDynamic.cpp.

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

Here is the call graph for this function:

◆ TEST_F() [21/22]

TEST_F ( Astra1DDynamicTest  ,
SwapNoCrash   
)

Definition at line 441 of file TestAstra1DDynamic.cpp.

◆ TEST_F() [22/22]

TEST_F ( Astra1DDynamicTest  ,
UniformFieldStrengthOnAxis   
)

Definition at line 204 of file TestAstra1DDynamic.cpp.

References Fieldmap::getFieldstrength().

Here is the call graph for this function: