 |
Ice Sheet System Model
4.18
Code documentation
|
Go to the documentation of this file.
7 #include "../shared/shared.h"
20 if (i<0 || j<0 || k<0){
23 if (i>=nbv || j>=nbv || k>=nbv){
24 _error_(
"i>=nbv || j>=nbv || k>=nbv");
77 _printf_(
" vertices pointer towards three vertices\n");
79 _printf_(
" adj pointer towards three adjacent triangles\n");
80 _printf_(
" adj[0] adj[1] adj[2] = " <<
adj[0] <<
" " <<
adj[1] <<
" " <<
adj[2] <<
"\n");
81 _printf_(
" det (integer triangle determinant) = " <<
det <<
"\n");
83 _printf_(
" link (pointer toward duplicate triangle)= " <<
link <<
"\n");
95 _printf_(
" vertex " << i+1 <<
" does not exist\n");
129 while (t->
swap(j,koption)){
130 if (k>=20000)
_error_(
"k>=20000");
150 if (
adj[0] >=tb &&
adj[0] <te)
adj[0] = tb + renu[
adj[0]-tb];
151 if (
adj[1] >=tb &&
adj[1] <te)
adj[1] = tb + renu[
adj[1]-tb];
152 if (
adj[2] >=tb &&
adj[2] <te)
adj[2] = tb + renu[
adj[2]-tb];
229 if(a/4 !=0)
return 0;
233 if(a2/4 !=0)
return 0;
240 long long det1=t1->
det , det2=t2->det ;
241 long long detT = det1+det2;
242 long long detA =
Abs(det1) +
Abs(det2);
243 long long detMin =
Min(det1,det2);
253 else if(( s1 != 0) && (s2 != 0) ) {
256 OnSwap = (
Abs(det1) +
Abs(det2)) < detA;
258 long long detMinNew=
Min(det1,det2);
259 if (! OnSwap &&(detMinNew>0)) {
266 long long xb1 = sb->
i.
x - s1->
i.
x,
267 x21 = s2->
i.
x - s1->
i.
x,
268 yb1 = sb->
i.
y - s1->
i.
y,
269 y21 = s2->
i.
y - s1->
i.
y,
270 xba = sb->
i.
x - sa->
i.
x,
271 x2a = s2->
i.
x - sa->
i.
x,
272 yba = sb->
i.
y - sa->
i.
y,
273 y2a = s2->
i.
y - sa->
i.
y;
275 cosb12 = double(xb1*x21 + yb1*y21),
276 cosba2 = double(xba*x2a + yba*y2a) ,
277 sinb12 = double(det2),
278 sinba2 = double(t2->det);
281 OnSwap = ((double) cosb12 * (
double) sinba2) < ((
double) cosba2 * (double) sinb12);
287 I2 AB=(
I2) *sb - (
I2) *sa;
288 I2 MAB2=((
I2) *sb + (
I2) *sa);
289 R2 MAB(MAB2.
x*0.5,MAB2.
y*0.5);
290 I2 A1=(
I2) *s1 - (
I2) *sa;
291 I2 D = (
I2) * s1 - (
I2) * sb ;
300 double dd =
Abs(ABo.
x*A1o.
y)+
Abs(ABo.
y*A1o.
x);
301 double d = (ABo.
x*A1o.
y - ABo.
y*A1o.
x)*2;
302 if (
Abs(d) > dd*1.e-3) {
303 R2 C(MAB+ABo*((D.
x*A1o.
y - D.
y*A1o.
x)/d));
315 double dd =
Abs(ABo.
x*A1o.
y)+
Abs(ABo.
y*A1o.
x);
316 double d = (ABo.
x*A1o.
y - ABo.
y*A1o.
x)*2;
317 if(
Abs(d) > dd*1.e-3) {
318 R2 C(MAB+ABo*((D.
x*A1o.
y - D.
y*A1o.
x)/d));
long GetId(const Triangle &t) const
void SetSingleVertexToTriangleConnectivity()
static const short PreviousEdge[3]
long Optim(short a, int=0)
#define _printf_(StreamArgs)
void SetUnMarkUnSwap(int a)
R2 Orthogonal(const R2 x)
static const short OppositeEdge[3]
AdjacentTriangle Adj(int i) const
int swap(short a1, int=0)
short NuEdgeTriangleAdj(int i) const
long long det(const I2 &a, const I2 &b, const I2 &c)
RR Norme2(const P2< R, RR > x)
friend class AdjacentTriangle
double Length(double Ax, double Ay) const
#define _error_(StreamArgs)
static const short VerticesOfTriangularEdge[3][2]
void SetMarkUnSwap(int a)
Triangle * TriangleAdj(int i) const
void swap(Triangle *t1, short a1, Triangle *t2, short a2, BamgVertex *s1, BamgVertex *s2, long long det1, long long det2)
void Set(const Triangle &, const Mesh &, Mesh &)
void Renumbering(Triangle *tb, Triangle *te, long *renu)
IssmDouble max(IssmDouble a, IssmDouble b)
T Min(const T &a, const T &b)
static const short OppositeVertex[3]
void SetAdj2(short a, Triangle *t, short aat)
static const short NextEdge[3]