OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
MeshGenerator Class Reference

#include <MeshGenerator.h>

Collaboration diagram for MeshGenerator:
Collaboration graph

Public Member Functions

 MeshGenerator ()
 
void setDriftReference (double minor, double major)
 Set the drift support radius used when meshing drift spaces.
 
void add (const ElementBase &element)
 
void write (const std::string &fname)
 

Static Public Member Functions

static bool getTransverseSupport (const ElementBase &element, double &minor, double &major)
 Extract a transverse support size suitable for placement/export meshes.
 

Private Types

enum  MeshType {
  OTHER = 0 , DIPOLE , QUADRUPOLE , SEXTUPOLE ,
  OCTUPOLE , SOLENOID , RFCAVITY , TRAVELINGWAVE ,
  DRIFT
}
 

Static Private Member Functions

static MeshData getCylinder (double length, double minor, double major, double formFactor, const unsigned int numSegments=36)
 
static MeshData getTube (double length, double innerMinor, double innerMajor, double outerMinor, double outerMajor, const unsigned int numSegments=36)
 Build a hollow tube aligned with the local z-axis.
 
static MeshData getQuadrupole (double length, double minor, double major, double formFactor)
 Build a quadrupole-like body from four longitudinal pole blocks.
 
static MeshData getSolenoid (double length, double minor, double major)
 Build a solenoid body as a hollow tube with short end collars.
 
static MeshData getRFCavity (double length, double minor, double major)
 Build a standing-wave cavity body from a sequence of bulged cells.
 
static MeshData getTravelingWave (double length, double minor, double major)
 Build a traveling-wave structure with repeated shallow corrugations.
 
static MeshData getBox (double length, double width, double height, double formFactor)
 

Private Attributes

std::vector< MeshDataelements_m
 
bool hasDriftReference_m
 
double driftMinor_m
 
double driftMajor_m
 

Detailed Description

Definition at line 29 of file MeshGenerator.h.

Member Enumeration Documentation

◆ MeshType

Enumerator
OTHER 
DIPOLE 
QUADRUPOLE 
SEXTUPOLE 
OCTUPOLE 
SOLENOID 
RFCAVITY 
TRAVELINGWAVE 
DRIFT 

Definition at line 64 of file MeshGenerator.h.

Constructor & Destructor Documentation

◆ MeshGenerator()

MeshGenerator::MeshGenerator ( )

Definition at line 42 of file MeshGenerator.cpp.

Member Function Documentation

◆ add()

◆ getBox()

MeshData MeshGenerator::getBox ( double  length,
double  width,
double  height,
double  formFactor 
)
staticprivate

Definition at line 1357 of file MeshGenerator.cpp.

References MeshData::decorations_m, MeshData::triangles_m, and MeshData::vertices_m.

Referenced by add(), and getQuadrupole().

◆ getCylinder()

MeshData MeshGenerator::getCylinder ( double  length,
double  minor,
double  major,
double  formFactor,
const unsigned int  numSegments = 36 
)
staticprivate

Definition at line 1160 of file MeshGenerator.cpp.

References MeshData::decorations_m, MeshData::triangles_m, Physics::two_pi, and MeshData::vertices_m.

Referenced by add().

◆ getQuadrupole()

MeshData MeshGenerator::getQuadrupole ( double  length,
double  minor,
double  major,
double  formFactor 
)
staticprivate

Build a quadrupole-like body from four longitudinal pole blocks.

The pole blocks are scaled from the element aperture and extruded along the full element length so that the resulting shape remains meaningful when the quadrupole length changes.

Parameters
lengthBody length along the local z-axis.
minorAperture semi-axis in the local y-direction.
majorAperture semi-axis in the local x-direction.
formFactorExit scaling factor used for conic apertures.
Returns
Triangulated quadrupole body mesh.

Definition at line 1251 of file MeshGenerator.cpp.

References getBox().

Referenced by add().

Here is the call graph for this function:

◆ getRFCavity()

MeshData MeshGenerator::getRFCavity ( double  length,
double  minor,
double  major 
)
staticprivate

Build a standing-wave cavity body from a sequence of bulged cells.

The body is assembled from hollow tube segments with alternating neck and cell radii. This produces a programmer-facing standing-wave cavity shape while remaining purely geometric and length-scaled.

Parameters
lengthBody length along the local z-axis.
minorOuter semi-axis in the local y-direction.
majorOuter semi-axis in the local x-direction.
Returns
Triangulated standing-wave cavity mesh.

Definition at line 1307 of file MeshGenerator.cpp.

References getTube().

Referenced by add().

Here is the call graph for this function:

◆ getSolenoid()

MeshData MeshGenerator::getSolenoid ( double  length,
double  minor,
double  major 
)
staticprivate

Build a solenoid body as a hollow tube with short end collars.

The body is scaled from the transverse support envelope and extruded over the full element length. Short end collars make the solenoid visually distinct from both drifts and plain cylindrical supports.

Parameters
lengthBody length along the local z-axis.
minorOuter semi-axis in the local y-direction.
majorOuter semi-axis in the local x-direction.
Returns
Triangulated solenoid body mesh.

Definition at line 1281 of file MeshGenerator.cpp.

References getTube().

Referenced by add().

Here is the call graph for this function:

◆ getTransverseSupport()

bool MeshGenerator::getTransverseSupport ( const ElementBase element,
double &  minor,
double &  major 
)
static

Extract a transverse support size suitable for placement/export meshes.

The returned radii are in the element-local transverse frame. This is used both for direct meshing and for deriving a representative drift radius from the first non-drift element in the lattice.

Parameters
elementBeamline element to inspect.
minorOutput minor transverse radius.
majorOutput major transverse radius.
Returns
true if a finite support size is available, false otherwise.

Definition at line 45 of file MeshGenerator.cpp.

References CONIC_ELLIPTICAL, CONIC_RECTANGULAR, DRIFT, ELLIPTICAL, ElementBase::getAperture(), ElementBase::getType(), RECTANGULAR, and SOLENOID.

Referenced by add(), and OpalBeamline::save3DLattice().

Here is the call graph for this function:

◆ getTravelingWave()

MeshData MeshGenerator::getTravelingWave ( double  length,
double  minor,
double  major 
)
staticprivate

Build a traveling-wave structure with repeated shallow corrugations.

Compared to the standing-wave cavity, the modulation is more uniform and elongated to suggest a periodic accelerating structure.

Parameters
lengthBody length along the local z-axis.
minorOuter semi-axis in the local y-direction.
majorOuter semi-axis in the local x-direction.
Returns
Triangulated traveling-wave cavity mesh.

Definition at line 1332 of file MeshGenerator.cpp.

References getTube().

Referenced by add().

Here is the call graph for this function:

◆ getTube()

MeshData MeshGenerator::getTube ( double  length,
double  innerMinor,
double  innerMajor,
double  outerMinor,
double  outerMajor,
const unsigned int  numSegments = 36 
)
staticprivate

Build a hollow tube aligned with the local z-axis.

The tube is represented by triangulated inner and outer walls without end caps. This is used for drift sections to visualise the beam pipe rather than a solid support body.

Parameters
lengthTube length along the local z-axis.
innerMinorInner semi-axis in the local y-direction.
innerMajorInner semi-axis in the local x-direction.
outerMinorOuter semi-axis in the local y-direction.
outerMajorOuter semi-axis in the local x-direction.
numSegmentsNumber of azimuthal segments.
Returns
Hollow triangulated tube mesh.

Definition at line 1202 of file MeshGenerator.cpp.

References MeshData::triangles_m, Physics::two_pi, and MeshData::vertices_m.

Referenced by add(), getRFCavity(), getSolenoid(), and getTravelingWave().

◆ setDriftReference()

void MeshGenerator::setDriftReference ( double  minor,
double  major 
)

Set the drift support radius used when meshing drift spaces.

Drifts do not carry their own physical support envelope. For visualisation we derive a representative cylindrical radius from the first non-drift element in the beamline and reuse it for all drifts.

Parameters
minorMinor transverse radius.
majorMajor transverse radius.

Definition at line 81 of file MeshGenerator.cpp.

References driftMajor_m, driftMinor_m, and hasDriftReference_m.

Referenced by OpalBeamline::save3DLattice().

◆ write()

void MeshGenerator::write ( const std::string &  fname)

Definition at line 205 of file MeshGenerator.cpp.

References Util::base64_encode(), Util::combineFilePath(), elements_m, OpalData::getAuxiliaryOutputDirectory(), and OpalData::getInstance().

Referenced by OpalBeamline::save3DLattice(), TEST_F(), and TEST_F().

Here is the call graph for this function:

Member Data Documentation

◆ driftMajor_m

double MeshGenerator::driftMajor_m
private

Definition at line 160 of file MeshGenerator.h.

Referenced by add(), and setDriftReference().

◆ driftMinor_m

double MeshGenerator::driftMinor_m
private

Definition at line 159 of file MeshGenerator.h.

Referenced by add(), and setDriftReference().

◆ elements_m

std::vector<MeshData> MeshGenerator::elements_m
private

Definition at line 157 of file MeshGenerator.h.

Referenced by add(), and write().

◆ hasDriftReference_m

bool MeshGenerator::hasDriftReference_m
private

Definition at line 158 of file MeshGenerator.h.

Referenced by add(), and setDriftReference().


The documentation for this class was generated from the following files: