OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
MeshGenerator.h
Go to the documentation of this file.
1//
2// Mesh Generator
3//
4// Copyright (c) 2008-2020
5// Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved.
7//
8// OPAL is licensed under GNU GPL version 3.
9//
10
11#ifndef MESHGENERATOR_H_
12#define MESHGENERATOR_H_
13
14#include <string>
15#include <utility>
16#include <vector>
17#include "OPALTypes.h"
18
19class ElementBase;
20
21class MeshData {
22public:
23 std::vector<Vector_t<double, 3>> vertices_m;
24 std::vector<Vector_t<unsigned int, 3>> triangles_m;
25 std::vector<std::pair<Vector_t<double, 3>, Vector_t<double, 3>>> decorations_m;
26 int type_m;
27};
28
30public:
32
45 static bool getTransverseSupport(const ElementBase& element, double& minor, double& major);
46
57 void setDriftReference(double minor, double major);
58
59 void add(const ElementBase& element);
60
61 void write(const std::string& fname);
62
63private:
75
76 static MeshData getCylinder(
77 double length, double minor, double major, double formFactor,
78 const unsigned int numSegments = 36);
79
95 static MeshData getTube(
96 double length, double innerMinor, double innerMajor, double outerMinor,
97 double outerMajor, const unsigned int numSegments = 36);
98
112 static MeshData getQuadrupole(double length, double minor, double major, double formFactor);
113
126 static MeshData getSolenoid(double length, double minor, double major);
127
140 static MeshData getRFCavity(double length, double minor, double major);
141
153 static MeshData getTravelingWave(double length, double minor, double major);
154
155 static MeshData getBox(double length, double width, double height, double formFactor);
156
157 std::vector<MeshData> elements_m;
161};
162
163#endif
ippl::Vector< T, Dim > Vector_t
std::vector< Vector_t< double, 3 > > vertices_m
std::vector< std::pair< Vector_t< double, 3 >, Vector_t< double, 3 > > > decorations_m
std::vector< Vector_t< unsigned int, 3 > > triangles_m
static MeshData getSolenoid(double length, double minor, double major)
Build a solenoid body as a hollow tube with short end collars.
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 getTravelingWave(double length, double minor, double major)
Build a traveling-wave structure with repeated shallow corrugations.
static MeshData getRFCavity(double length, double minor, double major)
Build a standing-wave cavity body from a sequence of bulged cells.
void add(const ElementBase &element)
static MeshData getBox(double length, double width, double height, double formFactor)
std::vector< MeshData > elements_m
void setDriftReference(double minor, double major)
Set the drift support radius used when meshing drift spaces.
static MeshData getQuadrupole(double length, double minor, double major, double formFactor)
Build a quadrupole-like body from four longitudinal pole blocks.
void write(const std::string &fname)
static MeshData getCylinder(double length, double minor, double major, double formFactor, const unsigned int numSegments=36)
static bool getTransverseSupport(const ElementBase &element, double &minor, double &major)
Extract a transverse support size suitable for placement/export meshes.