CMS 3D CMS Logo

MFGridFactory.cc
Go to the documentation of this file.
2 #include "binary_ifstream.h"
4 
11 
12 #include <iostream>
13 
14 using namespace std;
15 
16 MFGrid* MFGridFactory::build(const string& name, const GloballyPositioned<float>& vol) {
17  binary_ifstream inFile(name);
18  int gridType;
19  inFile >> gridType;
20 
21  MFGrid* result;
22  switch (gridType) {
23  case 1:
24  result = new RectangularCartesianMFGrid(inFile, vol);
25  break;
26  case 2:
27  result = new TrapezoidalCartesianMFGrid(inFile, vol);
28  break;
29  case 3:
30  result = new RectangularCylindricalMFGrid(inFile, vol);
31  break;
32  case 4:
33  result = new TrapezoidalCylindricalMFGrid(inFile, vol);
34  break;
35  case 5:
36  result = new SpecialCylindricalMFGrid(inFile, vol, gridType);
37  break;
38  case 6:
39  result = new SpecialCylindricalMFGrid(inFile, vol, gridType);
40  break;
41  default:
42  cout << "ERROR Grid type unknown: " << gridType << endl;
43  // result = new GlobalGridWrapper(vol, name);
44  result = nullptr;
45  break;
46  }
47  inFile.close();
48  return result;
49 }
50 
51 MFGrid* MFGridFactory::build(const string& name, const GloballyPositioned<float>& vol, double phiMin, double phiMax) {
52  MFGrid* sectorGrid = build(name, vol);
53  return new CylinderFromSectorMFGrid(vol, phiMin, phiMax, sectorGrid);
54 }
static MFGrid * build(const std::string &name, const GloballyPositioned< float > &vol)
Build interpolator for a binary grid file.
Definition: MFGrid.h:27