| 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 |
#ifndef TEMPLATEVE_H_INCLUDED |
| 25 |
#define TEMPLATEVE_H_INCLUDED |
| 26 |
|
| 27 |
#include <acl/aclMath/aclVectorOfElements.h> |
| 28 |
#include "data/aslDataWithGhostNodes.h" |
| 29 |
#include "aslTemplatesExtras.h" |
| 30 |
#include "aslDistanceFunction.h" |
| 31 |
|
| 32 |
/** |
| 33 |
\defgroup DifferentialOpperators Differential Operrators |
| 34 |
*/ |
| 35 |
|
| 36 |
|
| 37 |
namespace asl |
| 38 |
{ |
| 39 |
/// This class contains VectorOfElements which corresponds to values of a field in littice nodes |
| 40 |
/** |
| 41 |
This class contains VectorOfElements (VE) with PrivateVariables. |
| 42 |
This list should be added to the kernel before use as follows: |
| 43 |
|
| 44 |
\code |
| 45 |
Kernel kernel; |
| 46 |
TemplateVE a; |
| 47 |
|
| 48 |
kernel<<a.initValues; |
| 49 |
\endcode |
| 50 |
*/ |
| 51 |
class TemplateVE |
| 52 |
{ |
| 53 |
public: |
| 54 |
const VectorTemplate* vectorTemplate; |
| 55 |
const VTObjects* vto; |
| 56 |
acl::VectorOfElements values; |
| 57 |
acl::VectorOfElements initValues; |
| 58 |
/** |
| 59 |
\param data is a data field |
| 60 |
\param vectorT is a tempate vector |
| 61 |
\param i is the number of component (for a case with multicomponent data) |
| 62 |
\param bIni incase of true it generates private variable for storage otherwise it uses direct acces |
| 63 |
*/ |
| 64 |
TemplateVE(AbstractDataWithGhostNodes & data, |
| 65 |
const VectorTemplate & vectorT, |
| 66 |
unsigned int i=0, |
| 67 |
bool bIni=true); |
| 68 |
/** |
| 69 |
\param data is a data field |
| 70 |
\param position contains current position (not index) |
| 71 |
\param vectorT is a tempate vector |
| 72 |
\param i is the number of component (for a case with multicomponent data) |
| 73 |
*/ |
| 74 |
TemplateVE(DistanceFunction & data, |
| 75 |
acl::VectorOfElements & position, |
| 76 |
const VectorTemplate & vectorT, |
| 77 |
unsigned int i=0); |
| 78 |
///this is used for matematical operations with TemplateVE |
| 79 |
TemplateVE(const acl::VectorOfElements & val, |
| 80 |
const VectorTemplate & vectorT); |
| 81 |
|
| 82 |
TemplateVE(); |
| 83 |
acl::VectorOfElements getValue(unsigned int i); |
| 84 |
/** |
| 85 |
Note: the init function does not make initialization of values in case |
| 86 |
whete its length remains the same. this is usefull for reuse of private variables |
| 87 |
|
| 88 |
\param data is a data field |
| 89 |
\param vectorT is a tempate vector |
| 90 |
\param i is the number of component (for a case with multicomponent data) |
| 91 |
\param bIni incase of true it generates private variable for storage otherwise it uses direct acces |
| 92 |
*/ |
| 93 |
void init(AbstractDataWithGhostNodes & data, |
| 94 |
const VectorTemplate & vectorT, |
| 95 |
unsigned int i=0, |
| 96 |
bool bIni=true); |
| 97 |
|
| 98 |
/** |
| 99 |
Note: the init function does not make initialization of values in case |
| 100 |
whete its length remains the same. this is usefull for reuse of private variables |
| 101 |
\todo Fnish!!! not distance functino but Position function |
| 102 |
*/ |
| 103 |
void init(DistanceFunction & data, |
| 104 |
acl::VectorOfElements & position, |
| 105 |
const VectorTemplate & vectorT, |
| 106 |
unsigned int i=0); |
| 107 |
}; // class TemplateVE |
| 108 |
|
| 109 |
TemplateVE operator+ (const TemplateVE &a, const TemplateVE &b); |
| 110 |
TemplateVE operator- (const TemplateVE &a, const TemplateVE &b); |
| 111 |
TemplateVE operator* (const TemplateVE &a, const TemplateVE &b); |
| 112 |
TemplateVE operator/ (const TemplateVE &a, const TemplateVE &b); |
| 113 |
|
| 114 |
/// differential operator \f$ \Delta a \f$ \ingroup DifferentialOpperators |
| 115 |
acl::VectorOfElements laplas(const TemplateVE & a); |
| 116 |
|
| 117 |
/// differential operator \f$ \vec\nabla a \f$ \ingroup DifferentialOpperators |
| 118 |
acl::VectorOfElements gradient(const TemplateVE & a); |
| 119 |
/// differential operator \f$ \partial_x a \f$ \ingroup DifferentialOpperators |
| 120 |
acl::VectorOfElements dx(const TemplateVE & a); |
| 121 |
/// differential operator \f$ \partial_y a \f$ \ingroup DifferentialOpperators |
| 122 |
acl::VectorOfElements dy(const TemplateVE & a); |
| 123 |
/// differential operator \f$ \partial_z a \f$ \ingroup DifferentialOpperators |
| 124 |
acl::VectorOfElements dz(const TemplateVE & a); |
| 125 |
/// differential operator \f$ \partial_{i} a \f$ \ingroup DifferentialOpperators |
| 126 |
acl::VectorOfElements dxi(const TemplateVE & a, unsigned int i); |
| 127 |
|
| 128 |
/// differential operator \f$ \nabla(a \nabla b) \f$ \ingroup DifferentialOpperators |
| 129 |
acl::VectorOfElements divAgradB(const TemplateVE & a, const TemplateVE & b); |
| 130 |
|
| 131 |
/// differential operator \f$ \nabla \cdot \vec a \f$ \ingroup DifferentialOpperators |
| 132 |
acl::VectorOfElements div(const vector<TemplateVE> & a); |
| 133 |
/// differential operator \f$ \nabla \cdot (\vec a c) \f$ \ingroup DifferentialOpperators |
| 134 |
/** |
| 135 |
This is a discret approximation discribef by the following expression: |
| 136 |
\f[ \nabla_\alpha (v_\alpha c) = \frac{1}{2}\sum_i w_i a_{i\alpha} (v_{0\alpha}+v_{i\alpha})(c_0+c_i) ) \f] |
| 137 |
where \f$ w_i \f$ are coefficients corresponding to a gradient ones |
| 138 |
*/ |
| 139 |
acl::VectorOfElements divProduct(const vector<TemplateVE> & a, const TemplateVE & c); |
| 140 |
/// differential operator \f$ \nabla \cdot \vec a \f$ \ingroup DifferentialOpperators |
| 141 |
acl::VectorOfElements div(const TemplateVE & ax, const TemplateVE & ay); |
| 142 |
/// differential operator \f$ \nabla \cdot \vec a \f$ \ingroup DifferentialOpperators |
| 143 |
acl::VectorOfElements div(const TemplateVE & ax, const TemplateVE & ay, const TemplateVE & az); |
| 144 |
|
| 145 |
|
| 146 |
/// differential operator \f$ \nabla_i \nabla_j a \f$ \ingroup DifferentialOpperators |
| 147 |
acl::VectorOfElements dIdJ(unsigned int i, unsigned int j, const TemplateVE & a); |
| 148 |
|
| 149 |
/// generates expresion for bilinear interpolation the template should be an elementary cell |
| 150 |
acl::VectorOfElements interpolate(const TemplateVE & a, acl::VectorOfElements e); |
| 151 |
|
| 152 |
|
| 153 |
}// asl |
| 154 |
|
| 155 |
#endif // TEMPLATEVE_H_INCLUDED |