aslNumMethod.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ASLNUMMETHOD_H
#define ASLNUMMETHOD_H
#include <acl/aclStdIncludes.h>
#include <memory>
namespace asl
{
class NumMethod
{
public:
virtual void execute() = 0;
virtual void init() = 0;
virtual ~NumMethod();
};
typedef std::shared_ptr<NumMethod> SPNumMethod;
template <class T> inline void initAll(std::vector<T*> &v);
template <class T> inline void initAll(std::vector<std::shared_ptr<T> > & v);
template <class T> inline void executeAll(std::vector<T*> &v);
template <class T> inline void executeAll(std::vector<std::shared_ptr<T> > & v);
//---------------------------- Implementation ---------------------------
template <class T> void executeAll(std::vector<T*> &v)
{
for (unsigned int i(0); i < v.size(); ++i)
v[i]->execute();
}
template <class T> void executeAll(std::vector<std::shared_ptr<T> > &v)
{
for (unsigned int i(0); i < v.size(); ++i)
v[i]->execute();
}
template <class T> void initAll(std::vector<T*> &v)
{
for (unsigned int i(0); i < v.size(); ++i)
v[i]->init();
}
template <class T> void initAll(std::vector<std::shared_ptr<T> > &v)
{
for (unsigned int i(0); i < v.size(); ++i)
v[i]->init();
}
} //asl
#endif //ASLNUMMETHOD_H
asl::NumMethod::init
virtual void init()=0
Builds the necesery internal data and kernels.
asl::NumMethod::execute
virtual void execute()=0
Executes the numerical procedure.
asl::NumMethod::~NumMethod
virtual ~NumMethod()
asl
Advanced Simulation Library.
Definition: aslDataInc.h:31
asl::initAll
void initAll(std::vector< T * > &v)
Definition: aslNumMethod.h:67
asl::SPNumMethod
std::shared_ptr< NumMethod > SPNumMethod
Definition: aslNumMethod.h:44
asl::executeAll
void executeAll(std::vector< T * > &v)
Definition: aslNumMethod.h:55