| 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 "aslSingleKernelNM.h" |
| 25 |
#include <data/aslDataWithGhostNodes.h> |
| 26 |
#include <acl/aclMath/aclVectorOfElements.h> |
| 27 |
#include <acl/Kernels/aclKernel.h> |
| 28 |
#include <acl/acl.h> |
| 29 |
|
| 30 |
|
| 31 |
namespace asl |
| 32 |
{ |
| 33 |
SingleKernelNM::SingleKernelNM(const acl::KernelConfiguration & kernelConfig): |
| 34 |
kernel(new acl::Kernel(kernelConfig)) |
| 35 |
{ |
| 36 |
} |
| 37 |
|
| 38 |
SingleKernelNM::~SingleKernelNM() |
| 39 |
{ |
| 40 |
} |
| 41 |
|
| 42 |
void SingleKernelNM::init() |
| 43 |
{ |
| 44 |
init0(); |
| 45 |
kernel->setup(); |
| 46 |
} |
| 47 |
|
| 48 |
void SingleKernelNM::execute() |
| 49 |
{ |
| 50 |
preProcessing(); |
| 51 |
kernel->compute(); |
| 52 |
postProcessing(); |
| 53 |
} |
| 54 |
|
| 55 |
void SingleKernelNM::preProcessing() |
| 56 |
{ |
| 57 |
} |
| 58 |
|
| 59 |
void SingleKernelNM::postProcessing() |
| 60 |
{ |
| 61 |
} |
| 62 |
|
| 63 |
SingleKernelMapNM::SingleKernelMapNM(const acl::KernelConfiguration & kernelCongig): |
| 64 |
SingleKernelNM(kernelCongig) |
| 65 |
{ |
| 66 |
} |
| 67 |
|
| 68 |
SingleKernelMapNM::SingleKernelMapNM(Field map, const acl::KernelConfiguration & kernelCongig): |
| 69 |
SingleKernelNM(kernelCongig), |
| 70 |
map(map) |
| 71 |
{ |
| 72 |
} |
| 73 |
|
| 74 |
void SingleKernelMapNM::setMap(Field m) |
| 75 |
{ |
| 76 |
map=m; |
| 77 |
} |
| 78 |
|
| 79 |
void SingleKernelMapNM::initMapInfrastructure(acl::ExpressionContainer & k) |
| 80 |
{ |
| 81 |
if (map.get()!=0) |
| 82 |
{ |
| 83 |
k.addExpression(acl::elementOperators:: |
| 84 |
ifElse(acl::elementOperators::any((map->getEContainer() <= 0.)[0]), |
| 85 |
{acl::elementOperators::returnStatement()}, |
| 86 |
{} )); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
SingleKernelMapNM::~SingleKernelMapNM() |
| 91 |
{ |
| 92 |
} |
| 93 |
|
| 94 |
} // asl |
| 95 |
|