| 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 ASLTEMPLATESEXTRAS_H |
| 25 |
#define ASLTEMPLATESEXTRAS_H |
| 26 |
|
| 27 |
#include "aslTemplates.h" |
| 28 |
#include "aslMatrices.h" |
| 29 |
|
| 30 |
namespace acl { |
| 31 |
class VectorOfElements; |
| 32 |
} |
| 33 |
|
| 34 |
namespace asl { |
| 35 |
|
| 36 |
|
| 37 |
/// Defines andditionl features related to a VectorTemplate |
| 38 |
/** |
| 39 |
\ingroup Templates |
| 40 |
contains list of edges for a template. this can be used in level |
| 41 |
set and iso-surface extraction algorithms |
| 42 |
*/ |
| 43 |
class VTObjects |
| 44 |
{ |
| 45 |
private: |
| 46 |
void initCellMatrices(); |
| 47 |
public: |
| 48 |
const VectorTemplate * vt; |
| 49 |
std::vector<unsigned int> edgePoint1; |
| 50 |
std::vector<unsigned int> edgePoint2; |
| 51 |
std::vector<AVec<int>> elementaryCells; |
| 52 |
std::vector<AMatr<>> cellMatrices; |
| 53 |
|
| 54 |
VTObjects(const VectorTemplate * vt, |
| 55 |
const std::vector<unsigned int> & ep1, |
| 56 |
const std::vector<unsigned int> & ep2, |
| 57 |
const std::vector<AVec<int>> & elCells); |
| 58 |
|
| 59 |
/// computes gradient within the elementary cell \p ic and values in the corners \p val |
| 60 |
acl::VectorOfElements cellGradient(const acl::VectorOfElements & val, |
| 61 |
unsigned int ic) const; |
| 62 |
/// fill \p points by corner coordinates of the cell \p ic |
| 63 |
void getCellPoints(unsigned int ic, std::vector<AVec<>> & points) const; |
| 64 |
}; |
| 65 |
|
| 66 |
inline unsigned int nD(const VTObjects vto); |
| 67 |
|
| 68 |
/// Returns vtObjecs corresponding to the given VectorTemplate \ingroup Templates |
| 69 |
const VTObjects* vtObject(const VectorTemplate *); |
| 70 |
|
| 71 |
/// returns coefficient of the laplace operator corresponding to the direction of a cell edge |
| 72 |
/** |
| 73 |
\related VTObjects |
| 74 |
*/ |
| 75 |
double edgeWeight(const VTObjects & vto, unsigned int iEl, unsigned int i, unsigned int j); |
| 76 |
|
| 77 |
|
| 78 |
///Vector template |
| 79 |
/** |
| 80 |
\ingroup TemplatesNN |
| 81 |
|
| 82 |
\image html t5.png |
| 83 |
*/ |
| 84 |
const VTObjects & d2q5Objs(); |
| 85 |
|
| 86 |
///Vector template |
| 87 |
/** |
| 88 |
\ingroup TemplatesNN |
| 89 |
|
| 90 |
\image html t7.png |
| 91 |
*/ |
| 92 |
const VTObjects & d3q7Objs(); |
| 93 |
|
| 94 |
///Vector template |
| 95 |
/** |
| 96 |
\ingroup TemplatesNN |
| 97 |
|
| 98 |
\image html t9.png |
| 99 |
*/ |
| 100 |
const VTObjects & d2q9Objs(); |
| 101 |
|
| 102 |
///Vector template |
| 103 |
/** |
| 104 |
\ingroup TemplatesNN |
| 105 |
|
| 106 |
\image html t15.png |
| 107 |
*/ |
| 108 |
const VTObjects & d3q15Objs(); |
| 109 |
|
| 110 |
///Vector template |
| 111 |
/** |
| 112 |
\ingroup TemplatesNN |
| 113 |
|
| 114 |
\image html t19.png |
| 115 |
*/ |
| 116 |
const VTObjects & d3q19Objs(); |
| 117 |
|
| 118 |
// ----------------------------- Implementation ------------------------- |
| 119 |
|
| 120 |
inline unsigned int nD(const VTObjects & vto) |
| 121 |
{ |
| 122 |
return nD(*vto.vt); |
| 123 |
} |
| 124 |
|
| 125 |
}// asl |
| 126 |
|
| 127 |
#endif // ASLTEMPLATESEXTRAS_H |