mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Hadrons: module creation fix
This commit is contained in:
		@@ -65,6 +65,11 @@ public:
 | 
			
		||||
    virtual ~Application(void) = default;
 | 
			
		||||
    // access
 | 
			
		||||
    void setPar(const GlobalPar &par);
 | 
			
		||||
    // module creation
 | 
			
		||||
    template <typename M>
 | 
			
		||||
    void createModule(const std::string name);
 | 
			
		||||
    template <typename M>
 | 
			
		||||
    void createModule(const std::string name, const typename M::Par &par);
 | 
			
		||||
    // execute
 | 
			
		||||
    void run(void);
 | 
			
		||||
    // parse parameter file
 | 
			
		||||
@@ -81,6 +86,23 @@ private:
 | 
			
		||||
    std::vector<unsigned int>                       program_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                     Application template implementation                    *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
// module creation /////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename M>
 | 
			
		||||
void Application::createModule(const std::string name)
 | 
			
		||||
{
 | 
			
		||||
    env_.createModule<M>(name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename M>
 | 
			
		||||
void Application::createModule(const std::string name,
 | 
			
		||||
                               const typename M::Par &par)
 | 
			
		||||
{
 | 
			
		||||
    env_.createModule<M>(name, par);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_Application_hpp_
 | 
			
		||||
 
 | 
			
		||||
@@ -251,9 +251,9 @@ template <typename M>
 | 
			
		||||
void Environment::createModule(const std::string name,
 | 
			
		||||
                               const typename M::Par &par)
 | 
			
		||||
{
 | 
			
		||||
    std::unique_ptr<M> pt(new M(name));
 | 
			
		||||
    ModPt pt(new M(name));
 | 
			
		||||
    
 | 
			
		||||
    pt->setPar(par);
 | 
			
		||||
    static_cast<M *>(pt.get())->setPar(par);
 | 
			
		||||
    pushModule(pt);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user