Debian Codegraph @

src/num/aslNumMethodsMerger.cxx

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #include "aslNumMethodsMerger.h"
25 #include "aslSingleKernelNM.h"
26 #include <acl/Kernels/aclKernelMerger.h>
27
28 using namespace std;
29
30 namespace asl
31 {
32
33 NumMethodsMerger::NumMethodsMerger():
34 km(new acl::KernelMerger)
35 {
36 }
37
38 void NumMethodsMerger::init(bool buildKernels)
39 {
40 for(unsigned int i(0); i<nmList.size();++i){
41 if(buildKernels)
42 nmList[i]->init0();
43 km->addKernel(nmList[i]->kernel);
44 }
45 km->setup();
46 }
47
48 void NumMethodsMerger::execute()
49 {
50 km->compute();
51 for(unsigned int i(0); i<nmList.size();++i){
52 nmList[i]->postProcessing();
53 }
54 }
55
56 void NumMethodsMerger::addNM(const vector<SPSingleKernelNM> &nm)
57 {
58 unsigned int s(nmList.size());
59 nmList.resize(s+nm.size());
60 for(unsigned int i(0);i<nm.size();++i)
61 nmList[i+s]=nm[i];
62 }
63
64
65 } // asl
66