Class has no member?

Pages: 12
I am having compiling issues and am looking for an explanation as to what is causing the error and how to fix it. The declaration of 'g4vuplInstanceID' seems to be global in scope in my option, however I may be wrong.

Compiler Error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
error: 'class myPhysListGeneral' has no member named 'g4vupInstanceID'




#include "G4VUserPhysicsList.hh"
#include "G4VUPLSplitter.hh"
#include "G4VPhysicsConstructor.hh"
#include "myPhysListGeneral.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4PhysicsListHelper.hh"

#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"

#include "G4Decay.hh"
#include "G4RadioactiveDecay.hh"
#include "G4GenericIon.hh"
#include "globals.hh"
#include "G4RadioactiveDecayPhysics.hh"
#include "G4hIonisation.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleWithCuts.hh"


myPhysListGeneral::myPhysListGeneral(const G4String& name)
   :  G4VPhysicsConstructor(name)
{}


myPhysListGeneral::~myPhysListGeneral()
{}


void myPhysListGeneral::ConstructProcess()
{
  // Add Decay Process

  G4Decay* fDecayProcess = new G4Decay();
  G4RadioactiveDecay*  theRadioactiveDecay = new G4RadioactiveDecay();
  G4GenericIon* ion = G4GenericIon::GenericIon();

//  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); 
  theParticleIterator->reset();
  
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName(); 

    if (particle == ion) {
      pmanager->AddProcess(theRadioactiveDecay, 0, -1, 3);
    } 
    else if (fDecayProcess->IsApplicable(*particle)) { 
      pmanager ->AddProcess(fDecayProcess);
      // set ordering for PostStepDoIt and AtRestDoIt
      pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
      pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
    }

  }
}



The declarations are given in one of the headers as follows:

theParticleIterator:

#define theParticleIterator ((this->subInstanceManager.offset[this->g4vuplInstanceID])._theParticleIterator)

g4vuplInstanceID:

protected:
G4int g4vuplInstanceID;


Any useful help is appreciated!
Last edited on
did you copy and paste that from your class or write it?
This is a copy-paste from the class, however it is shown in its entirety as given.
you have two I's in the declaration. g4vuplInstanceID;
Let me check the code, that is probably just a transcription error on my part, the declarations I hand copied.
Confirmed, just a transcription error on my part, the double I's are not the cause of the error.
did it give a line number?
Yes, the corresponding line numbers here are 48, 50, and 51.
ok, well i can only one think wrong with it. that once again there are two i's in the #define. if this is a transcription error again ill have to see your class.
That is again a transcription error, here is the class source (in the next post, it is large):
wait no dont post it here then! pastebin.com
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
class G4VUserPhysicsList
{
  public: 
    G4VUserPhysicsList();
    virtual ~G4VUserPhysicsList();

  // copy constructor and assignment operator
    G4VUserPhysicsList(const G4VUserPhysicsList&);
    G4VUserPhysicsList & operator=(const G4VUserPhysicsList&);

  public:  
   virtual void ConstructParticle() = 0;

   void Construct();
   virtual void ConstructProcess() = 0;

  protected: 
   void AddTransportation();

   G4bool RegisterProcess(G4VProcess*            process,
			  G4ParticleDefinition*  particle);

  public:
   void UseCoupledTransportation(G4bool vl=true);

  /////////////////////////////////////////////////////////////////
  public:
   virtual void SetCuts(); 

  public:
   void     SetDefaultCutValue(G4double newCutValue);
   G4double GetDefaultCutValue() const;

  /////////////////////////////////////////////////////////////////////  
  public: // with description
    // Invoke BuildPhysicsTable for all processes for all particles
    // In case of "Retrieve" flag is ON, PhysicsTable will be
    // retrieved from files
    void BuildPhysicsTable();    
  
   // do PreparePhysicsTable for specified particle type
    void PreparePhysicsTable(G4ParticleDefinition* );    

   // do BuildPhysicsTable for specified particle type
    void BuildPhysicsTable(G4ParticleDefinition* );    

     // Store PhysicsTable together with both material and cut value 
    // information in files under the specified directory.
    //  (return true if files are sucessfully created)
    G4bool  StorePhysicsTable(const G4String& directory = ".");
 
    // Return true if "Retrieve" flag is ON. 
    // (i.e. PhysicsTable will be retrieved from files)
    G4bool  IsPhysicsTableRetrieved() const;
    G4bool  IsStoredInAscii() const;

    // Get directory path for physics table files.
    const G4String& GetPhysicsTableDirectory() const;

    // Set "Retrieve" flag
    // Directory path can be set together.
    // Null string (default) means directory is not changed 
    // from the current value 
    void    SetPhysicsTableRetrieved(const G4String& directory = "");
    void    SetStoredInAscii();
  
    // Reset "Retrieve" flag
    void    ResetPhysicsTableRetrieved();
    void    ResetStoredInAscii();

 ///////////////////////////////////////////////////////////////////////
  public: // with description
    // Print out the List of registered particles types
    void DumpList() const;

  public: // with description
    // Request to print out information of cut values
    // Printing will be performed when all tables are made
    void DumpCutValuesTable(G4int flag =1);

    // The following method actually trigger the print-out requested
    // by the above method. This method must be invoked by RunManager
    // at the proper moment.
    void DumpCutValuesTableIfRequested();

  public: // with description
    void  SetVerboseLevel(G4int value);
    G4int GetVerboseLevel() const;
    // set/get controle flag for output message
    //  0: Silent
    //  1: Warning message
    //  2: More

  ///////////////////////////////////////////////////////////////////////////
  public: // with description
   //  "SetCutsWithDefault" method invokes default SetCuts method
   //   Note: Cut values will not be overwriten with this method 
   //   Using default SetCuts method is recommended
   //  (i.e You do not need to implement SetCuts method) 
   void SetCutsWithDefault();   

   // Following are utility methods for SetCuts
  
   // SetCutValue sets a cut value for a particle type for the default region
   void SetCutValue(G4double aCut, const G4String& pname); 

   // GetCutValue sets a cut value for a particle type for the default region
   G4double GetCutValue(const G4String& pname) const; 

   // SetCutValue sets a cut value for a particle type for a region
   void SetCutValue(G4double aCut, const G4String& pname, const G4String& rname); 

   // Invoke SetCuts for specified particle for a region
   // If the pointer to the region is NULL, the default region is used
   // In case of "Retrieve" flag is ON, 
   // Cut values will be retrieved from files
   void SetParticleCuts(G4double cut,G4ParticleDefinition* particle,G4Region* region=0);
  void SetParticleCuts( G4double cut, const G4String& particleName, G4Region* region=0);

   // Invoke SetCuts for all particles in a region
   void SetCutsForRegion(G4double aCut, const G4String& rname);

   // Following are utility methods are obsolete
   void ResetCuts();

///////////////////////////////////////////////////////////////////
  public:   
   // Get/SetApplyCuts gets/sets the flag for ApplyCuts
   void SetApplyCuts(G4bool value, const G4String& name); 
   G4bool GetApplyCuts(const G4String& name) const; 

///////////////////////////////////////////////////////////////////////////////
  protected:  
    // do BuildPhysicsTable for make the integral schema
    void BuildIntegralPhysicsTable(G4VProcess* ,G4ParticleDefinition*  );   


  protected: 
    // Retrieve PhysicsTable from files for proccess belongng the particle.
    // Normal BuildPhysics procedure of processes will be invoked, 
    // if it fails (in case of Process's RetrievePhysicsTable returns false)
    virtual void  RetrievePhysicsTable(G4ParticleDefinition* ,	
				       const G4String& directory, 
				       G4bool          ascii = false);

   /////////////////////////////////////////////////////////////////
  protected: 
    // adds new ProcessManager to all particles in the Particle Table
    //   this routine is used in Construct()
    void InitializeProcessManager();

  public: // with description
    // remove and delete ProcessManagers for all particles in tha Particle Table
    //    this routine is invoked from RunManager 
    void RemoveProcessManager();

  public: // with description
    // add process manager for particles created on-the-fly 
    void AddProcessManager(G4ParticleDefinition* newParticle,
			   G4ProcessManager*    newManager = 0 );
 
   /////////////////////////////////////////////////////////////////
  public:
    // check consistencies of list of particles 

    void CheckParticleList();

    void DisableCheckParticleList();
 
  ////////////////////////////////////////////////////////////////////////
  protected:
   // the particle table has the complete List of existing particle types
   G4ParticleTable* theParticleTable;
   //G4ParticleTable::G4PTblDicIterator* theParticleIterator; //AND

  protected: 
   // pointer to G4UserPhysicsListMessenger
   //G4UserPhysicsListMessenger* theMessenger;

  protected:
   G4int verboseLevel;

  protected:
   // this is the default cut value for all particles
   G4double defaultCutValue;
  G4bool   isSetDefaultCutValue;

  protected:
   // pointer to ProductionCutsTable
   G4ProductionCutsTable* fCutsTable;

   // flag to determine physics table will be build from file or not
   G4bool fRetrievePhysicsTable;  
   G4bool fStoredInAscii;
 
   G4bool fIsCheckedForRetrievePhysicsTable;
   G4bool fIsRestoredCutValues;

   // directory name for physics table files 
   G4String directoryPhysicsTable;   

   // flag for displaying the range cuts & energy thresholds
   //G4int fDisplayThreshold;

  // flag for Physics Table has been built 
   //G4bool fIsPhysicsTableBuilt;

  // flag for CheckParticleList 
  G4bool fDisableCheckParticleList; 

  // PhysicsListHelper
  //G4PhysicsListHelper* thePLHelper;

  private:
   enum { FixedStringLengthForStore = 32 }; 

  //Changes for MT
  protected:
    G4int g4vuplInstanceID;
    G4RUN_DLL static G4VUPLManager subInstanceManager;
  public:
    inline G4int GetInstanceID() const;
    static const G4VUPLManager& GetSubInstanceManager();
    //Used by Worker threads on the shared instance of
    // PL to initialize workers
    void InitializeWorker();
};
It fit? I can still put it in pastebin if you prefer, I had to remove comments to make it fit.
The declaration of 'g4vuplInstanceID' is on line 219 of the source I gave.
no its fine here
oh well theres your problem: myPhyicsLIstGeneral is calling it when the variable belongs tog4vuserphysicslist
Do I call it as 'G4VUserPhysicsList::gvuplInstanceID', then?
Thanks for the help so-far by the way.
More appropriately it would have to be called 'G4VUserPhysicsList::theParticleIterator' I think.

########################################################################
Update:
That didn't work, ideas?
Last edited on
yes that works. you can also inherit from the class containing the variable
class myPhysListGeneral : G4VUserPhysicsList
Pages: 12