| 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 ASLLEVELSET_H |
| 25 |
#define ASLLEVELSET_H |
| 26 |
|
| 27 |
#include "aslNumMethod.h" |
| 28 |
#include "acl/aclMath/aclVectorOfElementsDef.h" |
| 29 |
|
| 30 |
|
| 31 |
namespace acl{ |
| 32 |
class Kernel; |
| 33 |
class VectorOfElementsData; |
| 34 |
} |
| 35 |
|
| 36 |
namespace asl |
| 37 |
{ |
| 38 |
class VectorTemplate; |
| 39 |
class VTObjects; |
| 40 |
template <typename V> class DataWithGhostNodes; |
| 41 |
typedef DataWithGhostNodes<acl::VectorOfElementsData> |
| 42 |
DataWithGhostNodesACLData; |
| 43 |
typedef std::shared_ptr<DataWithGhostNodesACLData> |
| 44 |
SPDataWithGhostNodesACLData; |
| 45 |
typedef DataWithGhostNodes<acl::VectorOfElements> |
| 46 |
DataWithGhostNodesACL; |
| 47 |
typedef std::shared_ptr<DataWithGhostNodesACL> |
| 48 |
SPDataWithGhostNodesACL; |
| 49 |
class TemplateVE; |
| 50 |
|
| 51 |
/// Numerical method which computes evolution of an interface |
| 52 |
/** |
| 53 |
\ingroup InterfaceTracking |
| 54 |
\ingroup NumMethods |
| 55 |
\ingroup LevelSet |
| 56 |
*/ |
| 57 |
class LevelSet: public NumMethod |
| 58 |
{ |
| 59 |
public: |
| 60 |
typedef SPDataWithGhostNodesACLData Data; |
| 61 |
typedef SPDataWithGhostNodesACL DataGen; |
| 62 |
/// generates expression resulting true if there is a boundary within the element |
| 63 |
/** |
| 64 |
\param iEl element number |
| 65 |
*/ |
| 66 |
acl::VectorOfElements isBoundaryEl(unsigned int iEl); |
| 67 |
|
| 68 |
/// generates expression resulting true if there is a boundary in this direction |
| 69 |
/** |
| 70 |
\param iDir direction number |
| 71 |
*/ |
| 72 |
acl::VectorOfElements isBoundaryDir(unsigned int iDir); |
| 73 |
|
| 74 |
/// generates expression resulting the value of the \p field |
| 75 |
/** |
| 76 |
\param field vector contains values in each direction |
| 77 |
\param iDir is the direction |
| 78 |
*/ |
| 79 |
acl::VectorOfElements getValueOnBoundary(acl::VectorOfElements field, |
| 80 |
unsigned int iDir); |
| 81 |
|
| 82 |
/// generates expression for center of a boundary element |
| 83 |
/** |
| 84 |
\param iEl the element number |
| 85 |
computes avarage point of corners of the boundary poligon within the element |
| 86 |
|
| 87 |
*/ |
| 88 |
acl::VectorOfElements getBoundaryCenter(unsigned int iEl); |
| 89 |
|
| 90 |
/// generates expression for area of a boundary element |
| 91 |
/** |
| 92 |
\param iEl the element number |
| 93 |
computes area of the corresponding boundary within cell iEl |
| 94 |
*/ |
| 95 |
vector<acl::Element> gcBoundaryArea(unsigned int iEl, |
| 96 |
acl::VectorOfElements & center, |
| 97 |
acl::VectorOfElements & area); |
| 98 |
|
| 99 |
/// generates expression for area of a boundary element |
| 100 |
/** |
| 101 |
computes area of the corresponding boundary within cell iEl |
| 102 |
*/ |
| 103 |
vector<acl::Element> gcBoundaryArea(acl::VectorOfElements & center, |
| 104 |
acl::VectorOfElements & area); |
| 105 |
/// computes coordinates of the surface point on the \p iDir vector |
| 106 |
/** |
| 107 |
\param iDir the element number |
| 108 |
|
| 109 |
*/ |
| 110 |
acl::VectorOfElements getBoundaryPoint(unsigned int iDir); |
| 111 |
|
| 112 |
protected: |
| 113 |
std::unique_ptr<acl::Kernel> kernel; |
| 114 |
|
| 115 |
Data distanceField; |
| 116 |
Data distanceFieldInternalData; |
| 117 |
|
| 118 |
const VectorTemplate* vectorTemplate; |
| 119 |
const VTObjects* vto; |
| 120 |
|
| 121 |
unique_ptr<TemplateVE> distanceTVE; |
| 122 |
vector<acl::VectorOfElements> lVelocities; |
| 123 |
|
| 124 |
void initKernelPropagation(); |
| 125 |
virtual void initVelocityComputation()=0; |
| 126 |
virtual void initDistancesComputation()=0; |
| 127 |
|
| 128 |
public: |
| 129 |
LevelSet(); |
| 130 |
/** |
| 131 |
\param df is distance field |
| 132 |
*/ |
| 133 |
LevelSet(Data df); |
| 134 |
~LevelSet(); |
| 135 |
|
| 136 |
inline const VectorTemplate* getVectorTemplate() const; |
| 137 |
|
| 138 |
virtual void init(); |
| 139 |
virtual void execute(); |
| 140 |
}; |
| 141 |
|
| 142 |
typedef std::shared_ptr<LevelSet> SPLevelSet; |
| 143 |
|
| 144 |
// --------------------------- Implementation -------------------- |
| 145 |
|
| 146 |
inline const VectorTemplate* LevelSet::getVectorTemplate() const |
| 147 |
{ |
| 148 |
return vectorTemplate; |
| 149 |
} |
| 150 |
|
| 151 |
} //asl |
| 152 |
|
| 153 |
#endif //ASLLEVELSET_H |