Tomato
OxFactoryOfSignCalculators.hxx
Go to the documentation of this file.
1 
7 #ifndef Tomato_OXFACTORYOFSignCalculators_HXX
8 #define Tomato_OXFACTORYOFSignCalculators_HXX
9 
10 #include "CmakeConfigForTomato.h"
11 #include "OxSignCalculatorNoSign.h"
14 
15 namespace Ox {
16  template < typename TYPE >
17  SignCalculator<TYPE>*
18  FactoryOfSignCalculators<TYPE>
19  ::newByFactory(TomatoOptions<TYPE> *opts){
20  switch (opts->sign_calc_method){
21  case NoSign: {
22  return new SignCalculatorNoSign<TYPE>();
23  }
24  case RealImag: {
25  return new SignCalculatorRealImag<TYPE>();
26  }
27  case MagPhase: {
28  return new SignCalculatorShmolli<TYPE>();
29  }
30  case None: {
31  return 0;
32  }
33  default:
34  throw std::runtime_error("sign_calc_method not available");
35  }
36  }
37 
38  template < typename TYPE >
39  void
40  FactoryOfSignCalculators<TYPE>
41  ::disp(int sign_calc_method){
42 
43  if (sign_calc_method >= 0) {
44  printf("%-28s%-22s", " sign_calc_method: ", signCalculatorsTypeNames[sign_calc_method]);
45  }
46 
47  printf("options: [ ");
48 
49  for (int i = 0; i < lastSignCalculatorType+1; i++){
50 
51  if(signCalculatorsAvailability[i]){
52  printf("%s ", signCalculatorsTypeNames[i]);
53  }
54  }
55 
56  printf("] \n");
57  }
58 
59 } // namespace Ox
60 
61 #endif //Tomato_OXFACTORYOFSignCalculators_HXX
Definition: OxCalculator.h:19