Skip to content

Commit 456a600

Browse files
authored
Merge pull request #13 from dengwirda/dev
0.9.8 updates: "Off-centre" fix -- dual cell checks
2 parents 9c677b5 + b312e2d commit 456a600

31 files changed

+2373
-1289
lines changed

example.jig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@
4949
MESH_FILE = out/bunny.msh
5050

5151

52+
#
53+
# OPTIONAL fields (INIT):
54+
# ----------------------
55+
#
56+
57+
# ---> INIT_FILE - 'INITNAME.MSH', a string containing the
58+
# name of the initial distribution file (is required
59+
# at input).
60+
#
61+
62+
# INIT_FILE = *.msh
63+
64+
5265
#
5366
# OPTIONAL fields (GEOM):
5467
# ----------------------

inc/lib_jigsaw.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* JIGSAW: Interface to the JIGSAW meshing library.
1515
--------------------------------------------------------
1616
*
17-
* Last updated: 19 January, 2019
17+
* Last updated: 22 January, 2019
1818
*
1919
* Copyright 2013 -- 2019
2020
* Darren Engwirda
@@ -91,8 +91,8 @@
9191
*/
9292
jigsaw_msh_t *_init,
9393

94-
/* HFUN (OPTIONAL): mesh-spacing function H(x).
95-
* => NULL for empty H(x).
94+
/* HFUN (OPTIONAL): mesh-spacing function h(x).
95+
* => NULL for empty h(x).
9696
*/
9797
jigsaw_msh_t *_hfun,
9898

@@ -103,7 +103,7 @@
103103

104104
/*
105105
--------------------------------------------------------
106-
* generate rDEL via JIGSAW.
106+
* compute rDT's via TRIPOD.
107107
--------------------------------------------------------
108108
*/
109109

@@ -126,6 +126,23 @@
126126
*/
127127
jigsaw_msh_t *_mesh
128128
) ;
129+
130+
/*
131+
--------------------------------------------------------
132+
* limit |df/dx| via MARCHE.
133+
--------------------------------------------------------
134+
*/
135+
136+
extern indx_t marche (
137+
138+
/* JCFG (REQUIRED): settings obj. definition.
139+
*/
140+
jigsaw_jig_t *_jcfg,
141+
142+
/* HFUN (REQUIRED): apply limiter to |df/dx|.
143+
*/
144+
jigsaw_msh_t *_ffun
145+
) ;
129146

130147
/*
131148
--------------------------------------------------------

src/jigsaw.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
--------------------------------------------------------
3535
*
3636
* JIGSAW release 0.9.8.x
37-
* Last updated: 19 January, 2019
37+
* Last updated: 22 January, 2019
3838
*
3939
* Copyright 2013 -- 2019
4040
* Darren Engwirda
@@ -148,7 +148,7 @@
148148
* gradient-based optimisation:
149149
*
150150
* L. Chen, J.C. Xu, (2004): "Optimal Delaunay
151-
* triangulations, J. Comp. Math., 22, pp. 299308,
151+
* triangulations, J. Comp. Math., 22, pp. 299-308,
152152
* https://www.jstor.org/stable/43693155
153153
*
154154
* L.A. Freitag, C. Ollivier-Gooch, (1997): "Tetrahedral
@@ -756,7 +756,7 @@
756756
# include "jigsaw.hpp"
757757
# include "tripod.hpp"
758758

759-
// # include "marche.hpp"
759+
# include "marche.hpp"
760760

761761
// # include "stitch.hpp"
762762

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
template <
3+
typename F
4+
>
5+
class hj_mesh_2
6+
{
7+
8+
__static_call
9+
__normal_call void_type limit_edge_2 (
10+
)
11+
{
12+
}
13+
14+
__static_call
15+
__normal_call void_type limit_tria_3 (
16+
)
17+
{
18+
}
19+
20+
__static_call
21+
__normal_call void_type limit_mesh (
22+
ffun_type &_ffun,
23+
real_type _DFDX
24+
)
25+
{
26+
27+
containers::priority_map<> _sort;
28+
29+
// push nodes onto pq
30+
// pop min at each pass
31+
// limit any cell neighbours
32+
// if a cell is limited, update pq of its nodes
33+
34+
// that's it!
35+
36+
}
37+
38+
} ;
39+
40+
41+

src/libcpp/libbasic.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
# pragma warning(disable:4503) // decorated name length
6161
# pragma warning(disable:4458) // shadowing
6262

63-
//!! also the damn MSVC non-standard "extensions" somehow
64-
6563
# elif defined(__LLVM__)
6664

6765
# elif defined(__GNUC__)

src/libcpp/rdel_mesh/rdel_base_2.hpp

Lines changed: 26 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929
* way whatsoever. This code is provided "as-is" to be
3030
* used at your own risk.
3131
*
32+
--------------------------------------------------------
33+
*
34+
* Last updated: 24 January, 2019
35+
*
36+
* Copyright 2013-2019
37+
* Darren Engwirda
38+
39+
* https://github.com/dengwirda/
40+
*
3241
--------------------------------------------------------
3342
*
3443
* This class defines the basic "restricted" delaunay
@@ -44,10 +53,10 @@
4453
* Procedia Engineering, 163, pp. 84-96,
4554
* http://dx.doi.org/10.1016/j.proeng.2016.11.024
4655
*
47-
* D. Engwirda, (2014): "Locally-optimal Delaunay-
48-
* refinement and optimisation-based mesh generation",
49-
* Ph.D. Thesis, School of Mathematics and Statistics,
50-
* Univ. of Sydney.
56+
* D. Engwirda, (2014): "Locally-optimal Delaunay-
57+
* refinement and optimisation-based mesh generation",
58+
* Ph.D. Thesis, School of Mathematics and Statistics,
59+
* Univ. of Sydney.
5160
* http://hdl.handle.net/2123/13148
5261
*
5362
* building on various previous works on rDT methods,
@@ -128,8 +137,7 @@
128137
__normal_call double half_sign (
129138
__const_ptr (double) _pp,
130139
__const_ptr (double) _pa,
131-
__const_ptr (double) _pb,
132-
double _rt
140+
__const_ptr (double) _pb
133141
)
134142
{
135143
/*-------- helper: eval. sign w.r.t. half-plane [a,b] */
@@ -155,34 +163,7 @@
155163
_ab[0] * _mp[0] +
156164
_ab[1] * _mp[1] ;
157165

158-
if (_dp < -2.0 * _rt ||
159-
_dp > +2.0 * _rt )
160166
return ((double) _dp );
161-
162-
/*-------- fall-back to double-double if near to zero */
163-
dd_flt _PM[2];
164-
_PM[0] = _pa[0] * 0.5 ;
165-
_PM[1] = _pa[1] * 0.5 ;
166-
_PM[0]+= _pb[0] * 0.5 ;
167-
_PM[1]+= _pb[1] * 0.5 ;
168-
169-
dd_flt _AB[2];
170-
_AB[0] = _pb[0] ;
171-
_AB[1] = _pb[1] ;
172-
_AB[0]-= _pa[0] ;
173-
_AB[1]-= _pa[1] ;
174-
175-
dd_flt _MP[2];
176-
_MP[0] = _pp[0] ;
177-
_MP[1] = _pp[1] ;
178-
_MP[0]-= _pm[0] ;
179-
_MP[1]-= _pm[1] ;
180-
181-
dd_flt _DP =
182-
_AB[0] * _MP[0] +
183-
_AB[1] * _MP[1] ;
184-
185-
return ((double) _DP );
186167
}
187168

188169
template <
@@ -222,20 +203,19 @@
222203
_BPOS[1] = _mesh.
223204
_tria.node(_bnod)->pval(1) ;
224205

225-
double _sign = +0.0;
206+
double _sign = +0.0 ;
226207
if (_bnod > _anod)
227208
_sign = + half_sign (
228209
(double*) _PPOS,
229210
(double*) _APOS,
230-
(double*) _BPOS,
231-
(double ) _rtol) ;
211+
(double*) _BPOS) ;
232212
else
233213
_sign = - half_sign (
234214
(double*) _PPOS,
235215
(double*) _BPOS,
236-
(double*) _APOS,
237-
(double ) _rtol) ;
216+
(double*) _APOS) ;
238217

218+
/*-------- "fatten" dual cavity to filter imprecision */
239219
if (_sign >= -_rtol &&
240220
_sign <= +_rtol)
241221
_safe = false;
@@ -265,7 +245,7 @@
265245
iptr_type &_part
266246
)
267247
{
268-
real_type const _rEPS =
248+
real_type static const _rEPS =
269249
std::pow(std::numeric_limits
270250
<real_type>::epsilon(),+.67);
271251

@@ -417,17 +397,20 @@
417397
_pred._list.tend() ;
418398
++_iter )
419399
{
420-
if (clip_dual(_mesh, _hset ,
421-
&_iter->pval( 0), _safe,
422-
_RTOL) )
400+
if (clip_dual( _mesh, _hset ,
401+
&_iter->pval( 0),
402+
_safe, _RTOL) )
423403
{
424404
/*--------------------------- dist to face circumball */
425405
real_type _dsqr =
426406
geometry::lensqr_2d(
427407
_ebal ,
428408
&_iter->pval( 0)) ;
429409

430-
if(!_safe && _dsqr > _RTOL)
410+
real_type _dtol =
411+
(real_type) 1./3. * _ebal[2] ;
412+
413+
if(!_safe && _dsqr > _dtol)
431414
/*--------------------------- prune near-degeneracies */
432415
continue ;
433416

0 commit comments

Comments
 (0)