AmpTools
ParameterManagerMPI.h
Go to the documentation of this file.
1 #if !defined(PARAMETERMANAGERMPI)
2 #define PARAMETERMANAGERMPI
3 
4 //******************************************************************************
5 // This file is part of AmpTools, a package for performing Amplitude Analysis
6 //
7 // Copyright Trustees of Indiana University 2010, all rights reserved
8 //
9 // This software written by Matthew Shepherd, Ryan Mitchell, and
10 // Hrayr Matevosyan at Indiana University, Bloomington
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions
14 // are met:
15 // 1. Redistributions of source code must retain the above copyright
16 // notice and author attribution, this list of conditions and the
17 // following disclaimer.
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice and author attribution, this list of conditions and the
20 // following disclaimer in the documentation and/or other materials
21 // provided with the distribution.
22 // 3. Neither the name of the University nor the names of its contributors
23 // may be used to endorse or promote products derived from this software
24 // without specific prior written permission.
25 //
26 // Creation of derivative forms of this software for commercial
27 // utilization may be subject to restriction; written permission may be
28 // obtained from the Trustees of Indiana University.
29 //
30 // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES,
31 // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA
32 // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR
33 // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR
34 // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS,
35 // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be
36 // held liable for any liability with respect to any claim by the user or
37 // any other party arising from use of the program.
38 //******************************************************************************
39 
40 #include <vector>
41 #include <map>
42 #include <complex>
43 
48 
49 using namespace std;
50 
52 {
53 
54 public:
55 
56  enum { kMaxNameLength = 200 };
57 
58  // since there is only one MinuitMinimizationManager we must add
59  // an additional constructor for the worker nodes
60 
61  // this constructor is called on the head node
63  IntensityManager* intenManager );
65  const vector< IntensityManager* >& intenManagers );
66 
67  // this constructor should be called on the worker nodes
68  ParameterManagerMPI( IntensityManager* intenManager );
69  ParameterManagerMPI( const vector< IntensityManager* >& intenManagers );
70 
72 
73  // override these functions to do the appropriate thing depending
74  // on whether this instance is on the head or worker node
75  void addProductionParameter( const string& termName, bool real = false, bool fixed = false );
76  void addAmplitudeParameter( const string& termName, const ParameterInfo* parInfo );
77 
78  // the likelihood calculator will need to call this routine in order
79  // to update the parameters in advance of the likelihood calculation
80  void updateParameters();
81 
82  // the likelihood calculator on the worker nodes will call this routine
83  // in order to update a changed ampitude parameter -- the update routine
84  // on the master (function below) will call this directly with the
85  // parameter name
86  void updateAmpParameter( const string& parName = "" );
87 
88 protected:
89 
90  // this overrides the base class function
91  void update( const string& parName );
92 
93 private:
94 
95  void setupMPI();
96 
97  vector<IntensityManager*> m_intenManagers;
98 
99  int m_rank;
100  int m_numProc;
101  bool m_isMaster;
102 
103  map< string, complex< double >* > m_prodParMap;
104  map< string, double* > m_ampParMap;
105 
106 };
107 
108 #endif