mat_vec_fns_II.h
Go to the documentation of this file.
1 //
2 // This file is part of the FFEA simulation package
3 //
4 // Copyright (c) by the Theory and Development FFEA teams,
5 // as they appear in the README.md file.
6 //
7 // FFEA is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // FFEA is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with FFEA. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // To help us fund FFEA development, we humbly ask that you cite
21 // the research papers on the package.
22 //
23 
24 #ifndef MAT_VEC_FNS_II_H_INCLUDED
25 #define MAT_VEC_FNS_II_H_INCLUDED
26 
27 #include <cmath>
28 #include "mat_vec_types.h"
29 
33 
35 template <class t_scalar> bool sameSign(t_scalar a, t_scalar b);
36 
40 int getMissingNode(int n0, int n1, int n2);
41 void getRestOfNodes(int iN, int &iO0, int &iO1, int &iO2);
42 void getMissingPair(int in0, int in1, int &on0, int &on1);
43 
47 
50 // template <class brr3> void arr3arr3Add(brr3 &vecA, brr3 &vecB, brr3 &res);
51 template <class t_scalar, class brr3> void arr3arr3Add(arr3_view<t_scalar,brr3> vecA, arr3_view<t_scalar,brr3> vecB, arr3_view<t_scalar,brr3> res);
52 
55 // void arr3arr3Substract(arr3 &vecA, arr3 &vecB, arr3 &res);
56 // template <class brr3> void arr3arr3Substract(brr3 &vecA, brr3 &vecB, brr3 &res);
57 template <class t_scalar, class brr3> void arr3arr3Substract(arr3_view<t_scalar,brr3> vecA, arr3_view<t_scalar,brr3> vecB, arr3_view<t_scalar,brr3> res);
58 
61 // void arr3arr3VectorProduct(arr3 (&u), arr3 (&v), arr3 (&w));
62 // template <class brr3> void arr3arr3VectorProduct(brr3 (&u), brr3 (&v), brr3 (&w));
64 
66 // scalar arr3arr3DotProduct(arr3 &vecA, arr3 &vecB);
67 template <class t_scalar, class brr3> t_scalar arr3arr3DotProduct(arr3_view<t_scalar,brr3> vecA, arr3_view<t_scalar,brr3> vecB);
68 
70 template <class t_scalar, class brr3> void arr3Normalise(arr3_view<t_scalar,brr3> e);
71 
73 // void arr3Normalise2(arr3 &e, arr3 &n);
74 template <class t_scalar, class brr3> void arr3Normalise2(arr3_view<t_scalar,brr3> e, arr3_view<t_scalar,brr3> n);
75 
77 template <class t_scalar, class brr3> void arr3Resize(t_scalar f, arr3_view<t_scalar,brr3> u);
78 
80 // void arr3Resize2(scalar f, arr3 &u, arr3 &v);
81 template <class t_scalar, class brr3> void arr3Resize2(t_scalar f, arr3_view<t_scalar,brr3> u, arr3_view<t_scalar,brr3> v);
82 
84 template <class t_scalar, class brr3> void arr3Resize3(t_scalar f, arr3_view<t_scalar,brr3> u, arr3_view<t_scalar,brr3> v);
85 
87 template <class t_scalar, class brr3> void arr3Store(arr3_view<t_scalar,brr3> u, arr3_view<t_scalar,brr3> v);
88 
90 template <class t_scalar, class brr3> t_scalar arr3arr3Distance(arr3_view<t_scalar,brr3> vecA, arr3_view<t_scalar,brr3> vecB);
91 
93 template <class t_scalar, class brr3> t_scalar mag(arr3_view<t_scalar,brr3> v);
94 
96 template <class t_scalar, class brr3> t_scalar mag2(arr3_view<t_scalar,brr3> v);
97 
99 template <class brr3> void arr3Initialise(brr3 &v);
100 
102 template <class t_scalar, class brr3> t_scalar detByRows(arr3_view<t_scalar,brr3> a, arr3_view<t_scalar,brr3> b, arr3_view<t_scalar,brr3> c);
103 
105 template <class t_scalar, class brr3> t_scalar detByCols(arr3_view<t_scalar,brr3> a, arr3_view<t_scalar,brr3> b, arr3_view<t_scalar,brr3> c);
106 
107 
111 
113 // void tangent(arr3 &vecA, arr3 &vecB, arr3 &t);
114 template <class t_scalar, class brr3> void tangent(brr3 &vecA, brr3 &vecB, brr3 &t);
115 
118 // template <class t_scalar, class brr3> void getUnitNormal(brr3 &u, brr3 &v, brr3 &w);
119 // template <class brr3> void getUnitNormal(brr3 &u, brr3 &v, brr3 &w);
120 template <class t_scalar, class brr3> void getUnitNormal(brr3 &u, brr3 &v, brr3 &w);
121 
123 template <class t_scalar, class brr3> void getNormal(brr3 &v1, brr3 &v2, brr3 &v3, brr3 &n);
124 
130 template <class t_scalar, class brr3> void getNormalInwards(brr3 (&tetA)[4], int n0, int n1, int n2, brr3 (&n));
131 template <class t_scalar, class brr3> void getNormalInwards(brr3 &f0, brr3 &f1, brr3 &f2, brr3 &p3, brr3 (&n));
132 
136 // bool sameSidePlane(arr3 &vec, arr3 &test, arr3 &p1, arr3 &p2, arr3 &p3);
137 template <class t_scalar, class brr3> bool sameSidePlane(brr3 &vec, brr3 &test, brr3 &p1, brr3 &p2, brr3 &p3);
138 
144 template <class t_scalar, class brr3> bool sameSideLine(brr3 &e, brr3 &p1, brr3 &p2, brr3 &p3);
145 
150 template <class t_scalar, class brr3> bool nodeInTet(brr3 &vec, brr3 (tet)[4]);
151 template <class t_scalar, class brr3> bool nodeInTet(brr3 &vec, brr3 &tet0, brr3 &tet1, brr3 &tet2, brr3 &tet3);
152 
158 // void linePlaneIntersectionPoint(arr3 &ip, arr3 &e1, arr3 &e2, arr3 &p1, arr3 &p2, arr3 &p3);
159 template <class t_scalar, class brr3> void linePlaneIntersectionPoint(brr3 &ip, brr3 &e1, brr3 &e2, brr3 &p1, brr3 &p2, brr3 &p3);
160 
167 template <class t_scalar, class brr3> bool safeLinePlaneIntersectionPoint(brr3 &ip, brr3 &e1, brr3 &e2, brr3 &p1, brr3 &p2, brr3 &p3);
168 
175 template <class t_scalar,class brr3> bool lineFaceIntersectionPoint(brr3 (&ip), brr3 (&e1), brr3 (&e2), brr3 (&p1), brr3 (&p2), brr3 (&p3));
176 
177 
181 // bool isPointInFace(arr3 &ip, arr3 &p1, arr3 &p2, arr3 &p3);
182 template <class t_scalar, class brr3> bool isPointInFace(brr3 &ip, brr3 &p1, brr3 &p2, brr3 &p3);
183 
191 // bool intersectionPoint(arr3 &(ip), arr3 (&e1), arr3 (&e2), arr3 (&tet)[4], int f1, int f2, int f3);
192 template <class t_scalar, class brr3> bool intersectionPoint(brr3 &(ip), brr3 (&e1), brr3 (&e2), brr3 (&tet)[4], int f1, int f2, int f3);
193 template <class t_scalar, class brr3> bool intersectionPoint(brr3 &ip, brr3 &e1, brr3 &e2, brr3 &f1, brr3 &f2, brr3 &f3);
194 
196 // void faceCentroid(arr3 &p1, arr3 &p2, arr3 &p3, arr3 &c);
197 template <class brr3> void faceCentroid(brr3 &p1, brr3 &p2, brr3 &p3, brr3 &c);
198 
200 template <class t_scalar, class brr3> bool samePlane(brr3 &p1, brr3 &p2, brr3 &p3, brr3 &p4);
201 
207 template <class t_scalar, class brr3> void intersectingPointToLine(vector3 &p0, arr3_view<t_scalar,brr3> p1, arr3_view<t_scalar,brr3> p2p1, arr3_view<t_scalar,brr3> p3);
208 // template <class t_scalar, class brr3> void intersectingPointToLine(brr3 &p0, brr3 &p1, brr3 &p2, brr3 &p3);
209 
212 template <class t_scalar, class brr3> t_scalar distanceFromPointToLine(arr3_view<t_scalar,brr3> p0, arr3_view<t_scalar,brr3> p1, arr3_view<t_scalar,brr3> p2);
213 
215 
217 template <class brr3> void getTetrahedraCM(brr3 &p1, brr3 &p2, brr3 &p3, brr3 &p4, brr3 &c);
218 
219 
221 
225 template <class brr3> void vec3Vec3SubsToArr3(vector3 &u, vector3 &v, brr3 (&w));
226 void vec3Arr3SubsToArr3(vector3 &u, arr3 &v, arr3 &w);
227 void arr3Vec3SubsToArr3(arr3 (&u), vector3 &v, arr3 (&w));
228 
229 
230 void vec3Arr3AddToArr3(vector3 &u, arr3 (&v), arr3 (&w));
231 void vec3Vec3AddToArr3(vector3 &u, vector3 &v, arr3 (&w));
232 
234 void vec3ResizeToArr3(scalar f, vector3 &u, arr3 &v);
235 
237 
238 #endif
scalar vec3Arr3DotProduct(vector3 &u, arr3 &v)
Definition: mat_vec_fns_II.cpp:810
void arr3Normalise(arr3_view< t_scalar, brr3 > e)
Definition: mat_vec_fns_II.cpp:149
t_scalar getTetrahedraVolume(arr3_view< t_scalar, brr3 > p0, arr3_view< t_scalar, brr3 > p1, arr3_view< t_scalar, brr3 > p2, arr3_view< t_scalar, brr3 > p3)
Definition: mat_vec_fns_II.cpp:708
bool sameSidePlane(brr3 &vec, brr3 &test, brr3 &p1, brr3 &p2, brr3 &p3)
Definition: mat_vec_fns_II.cpp:383
void vec3Arr3SubsToArr3(vector3 &u, arr3 &v, arr3 &w)
Definition: mat_vec_fns_II.cpp:778
t_scalar distanceFromPointToLine(arr3_view< t_scalar, brr3 > p0, arr3_view< t_scalar, brr3 > p1, arr3_view< t_scalar, brr3 > p2)
Definition: mat_vec_fns_II.cpp:683
void getRestOfNodes(int iN, int &iO0, int &iO1, int &iO2)
Definition: mat_vec_fns_II.cpp:64
void getMissingPair(int in0, int in1, int &on0, int &on1)
Definition: mat_vec_fns_II.cpp:88
bool sameSign(t_scalar a, t_scalar b)
check whether two scalars have the same sign
Definition: mat_vec_fns_II.cpp:34
void vec3Vec3AddToArr3(vector3 &u, vector3 &v, arr3(&w))
void arr3Store(arr3_view< t_scalar, brr3 > u, arr3_view< t_scalar, brr3 > v)
Definition: mat_vec_fns_II.cpp:208
void arr3Initialise(brr3 &v)
Definition: mat_vec_fns_II.cpp:253
void arr3arr3Substract(arr3_view< t_scalar, brr3 > vecA, arr3_view< t_scalar, brr3 > vecB, arr3_view< t_scalar, brr3 > res)
Definition: mat_vec_fns_II.cpp:117
t_scalar arr3arr3Distance(arr3_view< t_scalar, brr3 > vecA, arr3_view< t_scalar, brr3 > vecB)
Definition: mat_vec_fns_II.cpp:218
t_scalar detByRows(arr3_view< t_scalar, brr3 > a, arr3_view< t_scalar, brr3 > b, arr3_view< t_scalar, brr3 > c)
Definition: mat_vec_fns_II.cpp:261
void arr3Resize(t_scalar f, arr3_view< t_scalar, brr3 > u)
Definition: mat_vec_fns_II.cpp:179
bool isPointInFace(brr3 &ip, brr3 &p1, brr3 &p2, brr3 &p3)
Definition: mat_vec_fns_II.cpp:531
bool sameSideLine(brr3 &e, brr3 &p1, brr3 &p2, brr3 &p3)
Definition: mat_vec_fns_II.cpp:405
void getTetrahedraCM(brr3 &p1, brr3 &p2, brr3 &p3, brr3 &p4, brr3 &c)
Definition: mat_vec_fns_II.cpp:717
bool safeLinePlaneIntersectionPoint(brr3 &ip, brr3 &e1, brr3 &e2, brr3 &p1, brr3 &p2, brr3 &p3)
Definition: mat_vec_fns_II.cpp:480
scalar arr3[3]
Definition: mat_vec_types.h:70
void vec3ResizeToArr3(scalar f, vector3 &u, arr3 &v)
Definition: mat_vec_fns_II.cpp:802
void arr3Resize3(t_scalar f, arr3_view< t_scalar, brr3 > u, arr3_view< t_scalar, brr3 > v)
Definition: mat_vec_fns_II.cpp:198
void arr3Resize2(t_scalar f, arr3_view< t_scalar, brr3 > u, arr3_view< t_scalar, brr3 > v)
Definition: mat_vec_fns_II.cpp:188
void getNormalInwards(brr3(&tetA)[4], int n0, int n1, int n2, brr3(&n))
Definition: mat_vec_fns_II.cpp:338
void vec3Vec3SubsToArr3(vector3 &u, vector3 &v, brr3(&w))
Definition: mat_vec_fns_II.cpp:770
void tangent(brr3 &vecA, brr3 &vecB, brr3 &t)
Definition: mat_vec_fns_II.cpp:295
t_scalar detByCols(arr3_view< t_scalar, brr3 > a, arr3_view< t_scalar, brr3 > b, arr3_view< t_scalar, brr3 > c)
Definition: mat_vec_fns_II.cpp:271
void getNormal(brr3 &v1, brr3 &v2, brr3 &v3, brr3 &n)
Definition: mat_vec_fns_II.cpp:325
void arr3arr3VectorProduct(arr3_view< t_scalar, brr3 > u, arr3_view< t_scalar, brr3 > v, arr3_view< t_scalar, brr3 > w)
Definition: mat_vec_fns_II.cpp:127
void intersectingPointToLine(arr3_view< t_scalar, brr3 > p0, arr3_view< t_scalar, brr3 > p1, arr3_view< t_scalar, brr3 > p2p1, arr3_view< t_scalar, brr3 > p3)
Definition: mat_vec_fns_II.cpp:590
void getUnitNormal(brr3 &u, brr3 &v, brr3 &w)
Definition: mat_vec_fns_II.cpp:311
int getMissingNode(int n0, int n1, int n2)
Definition: mat_vec_fns_II.cpp:43
Definition: mat_vec_types.h:104
void vec3Arr3AddToArr3(vector3 &u, arr3(&v), arr3(&w))
Definition: mat_vec_fns_II.cpp:794
t_scalar mag2(arr3_view< t_scalar, brr3 > v)
Definition: mat_vec_fns_II.cpp:242
bool intersectionPoint(brr3 &(ip), brr3(&e1), brr3(&e2), brr3(&tet)[4], int f1, int f2, int f3)
Definition: mat_vec_fns_II.cpp:549
t_scalar arr3arr3DotProduct(arr3_view< t_scalar, brr3 > vecA, arr3_view< t_scalar, brr3 > vecB)
Definition: mat_vec_fns_II.cpp:138
void faceCentroid(brr3 &p1, brr3 &p2, brr3 &p3, brr3 &c)
void arr3arr3Add(arr3_view< t_scalar, brr3 > vecA, arr3_view< t_scalar, brr3 > vecB, arr3_view< t_scalar, brr3 > res)
Definition: mat_vec_fns_II.cpp:105
void linePlaneIntersectionPoint(brr3 &ip, brr3 &e1, brr3 &e2, brr3 &p1, brr3 &p2, brr3 &p3)
Definition: mat_vec_fns_II.cpp:450
Definition: mat_vec_types.h:90
double scalar
Definition: mat_vec_types.h:36
bool samePlane(brr3 &p1, brr3 &p2, brr3 &p3, brr3 &p4)
bool lineFaceIntersectionPoint(brr3(&ip), brr3(&e1), brr3(&e2), brr3(&p1), brr3(&p2), brr3(&p3))
Definition: mat_vec_fns_II.cpp:515
bool nodeInTet(brr3 &vec, brr3(tet)[4])
Definition: mat_vec_fns_II.cpp:423
t_scalar mag(arr3_view< t_scalar, brr3 > v)
Definition: mat_vec_fns_II.cpp:229
void getLocalCoordinatesForLinTet(arr3_view< t_scalar, brr3 > t0, arr3_view< t_scalar, brr3 > t1, arr3_view< t_scalar, brr3 > t2, arr3_view< t_scalar, brr3 > t3, arr3_view< t_scalar, brr3 > p, brr4 &phi)
Definition: mat_vec_fns_II.cpp:725
void arr3Normalise2(arr3_view< t_scalar, brr3 > e, arr3_view< t_scalar, brr3 > n)
Definition: mat_vec_fns_II.cpp:164
void arr3Vec3SubsToArr3(arr3(&u), vector3 &v, arr3(&w))
Definition: mat_vec_fns_II.cpp:786