From 9e20ae53e716e7ea801b82dfab7cb328a8d85b95 Mon Sep 17 00:00:00 2001
From: dengwirda
Date: Wed, 10 Apr 2019 21:05:55 -0400
Subject: [PATCH 01/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
example.jig | 10 +
inc/jigsaw_jig_t.h | 17 +-
src/ini_load.hpp | 49 +-
src/jig_load.hpp | 35 +-
src/jig_read.hpp | 11 +-
src/jigsaw.cpp | 6 +-
src/libcpp/allocators/alloc_wrap.hpp | 10 +-
src/libcpp/containers/array.hpp | 18 +-
src/libcpp/containers/fixed_array.hpp | 12 +-
.../{geom_pred_k.hpp => predicate_k.hpp} | 0
src/libcpp/geometry.hpp | 2 +-
src/libcpp/iter_mesh/iter_mesh_2.hpp | 68 +-
.../iter_mesh/iter_mesh_euclidean_2.hpp | 5 +-
.../iter_mesh/iter_mesh_euclidean_3.hpp | 13 +-
src/libcpp/rdel_mesh/rdel_create_init_2.inc | 490 +++++++++++++
src/libcpp/rdel_mesh/rdel_create_init_3.inc | 692 ++++++++++++++++++
src/libcpp/rdel_mesh/rdel_make_2.hpp | 45 +-
src/libcpp/rdel_mesh/rdel_make_3.hpp | 52 +-
src/libcpp/rdel_mesh/rdel_mesh_2.hpp | 289 ++------
src/libcpp/rdel_mesh/rdel_mesh_3.hpp | 330 +++------
src/libcpp/rdel_mesh/rdel_params.hpp | 80 +-
src/libcpp/rdel_mesh/rdel_sink_delfront_2.inc | 96 +--
src/libcpp/rdel_mesh/rdel_sink_delfront_3.inc | 222 +++---
src/libcpp/rdel_mesh/rdel_test_bounds_2.inc | 41 +-
src/libcpp/rdel_mesh/rdel_test_bounds_3.inc | 97 ++-
src/libcpp/rdel_mesh/rvor_mesh_2.hpp | 44 +-
src/libcpp/rdel_mesh/rvor_mesh_3.hpp | 14 +-
src/libcpp/tessellate/delaunay_tri_k.hpp | 34 +-
src/liblib/init_jig_t.hpp | 9 +-
src/liblib/load_jig_t.hpp | 13 +-
src/liblib/save_jig_t.hpp | 7 +-
uni/test_1.c | 15 +-
uni/test_2.c | 15 +-
uni/test_3.c | 15 +-
uni/test_4.c | 15 +-
uni/test_5.c | 20 +-
uni/test_6.c | 161 ++++
version.txt | 39 +-
38 files changed, 2151 insertions(+), 940 deletions(-)
rename src/libcpp/geom_base/{geom_pred_k.hpp => predicate_k.hpp} (100%)
create mode 100644 src/libcpp/rdel_mesh/rdel_create_init_2.inc
create mode 100644 src/libcpp/rdel_mesh/rdel_create_init_3.inc
create mode 100644 uni/test_6.c
diff --git a/example.jig b/example.jig
index 6614696..1cca1e6 100644
--- a/example.jig
+++ b/example.jig
@@ -61,6 +61,16 @@
# INIT_FILE = *.msh
+# ---> INIT_NEAR - {default = 1.E-8} relative "zip" tol.
+# applied when processing initial conditions. In cases
+# where "sharp-feature" detection is active, nodes in
+# the initial set are zipped to their nearest feature
+# node if the separation length is less than NEAR*SCAL
+# where SCAL is the max. bounding-box dimension.
+#
+
+# INIT_NEAR = 1.E-6
+
#
# OPTIONAL fields (GEOM):
diff --git a/inc/jigsaw_jig_t.h b/inc/jigsaw_jig_t.h
index 7062c3a..c2ebb73 100644
--- a/inc/jigsaw_jig_t.h
+++ b/inc/jigsaw_jig_t.h
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 31 July, 2018
+ * Last updated: 10 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -107,6 +107,19 @@
real_t _geom_eta2 ;
+ /*
+ --------------------------------------------------------
+ * INIT_NEAR - {default = 1.E-8} relative "zip" tol.
+ * applied when processing initial conditions. In cases
+ * where "sharp-feature" detection is active, nodes in
+ * the initial set are zipped to their nearest feature
+ * node if the separation length is less than NEAR*SCAL
+ * where SCAL is the max. bounding-box dimension.
+ --------------------------------------------------------
+ */
+
+ real_t _init_near ;
+
/*
--------------------------------------------------------
* HFUN_SCAL - {default = 'relative'} scaling type for
diff --git a/src/ini_load.hpp b/src/ini_load.hpp
index 2a45494..110d3bf 100644
--- a/src/ini_load.hpp
+++ b/src/ini_load.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 02 February, 2019
+ * Last updated: 09 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -115,11 +115,12 @@
::node_type _ndat ;
_ndat.pval(0) = _pval[0];
_ndat.pval(1) = _pval[1];
+ _ndat.itag () = _itag ;
_ndat.pval(2) =
(real_type) +0. ;
- _ndat.fdim () = +0 ;
+ _ndat.fdim () = +0 ;
if (_itag < +0)
_ndat.feat () =
@@ -143,11 +144,12 @@
_ndat.pval(0) = _pval[0];
_ndat.pval(1) = _pval[1];
_ndat.pval(2) = _pval[2];
+ _ndat.itag () = _itag ;
_ndat.pval(3) =
(real_type) +0. ;
- _ndat.fdim () = +0 ;
+ _ndat.fdim () = +0 ;
if (_itag < +0)
_ndat.feat () =
@@ -180,6 +182,7 @@
::edge_type _edat ;
_edat.node(0) = _node[0];
_edat.node(1) = _node[1];
+ _edat.itag () = _itag ;
this->_init->
_euclidean_mesh_2d.
@@ -195,7 +198,8 @@
::edge_type _edat ;
_edat.node(0) = _node[0];
_edat.node(1) = _node[1];
-
+ _edat.itag () = _itag ;
+
this->_init->
_euclidean_mesh_3d.
_mesh.push_edge(_edat, false) ;
@@ -221,6 +225,7 @@
_tdat.node(0) = _node[0];
_tdat.node(1) = _node[1];
_tdat.node(2) = _node[2];
+ _tdat.itag () = _itag ;
this->_init->
_euclidean_mesh_2d.
@@ -237,7 +242,8 @@
_tdat.node(0) = _node[0];
_tdat.node(1) = _node[1];
_tdat.node(2) = _node[2];
-
+ _tdat.itag () = _itag ;
+
this->_init->
_euclidean_mesh_3d.
_mesh.push_tri3(_tdat, false) ;
@@ -271,6 +277,7 @@
_tdat.node(1) = _node[1];
_tdat.node(2) = _node[2];
_tdat.node(3) = _node[3];
+ _tdat.itag () = _itag ;
this->_init->
_euclidean_mesh_3d.
@@ -363,14 +370,15 @@
_vert2._data[_ipos]._ppos[0];
_ndat.pval(1) = _imsh.
_vert2._data[_ipos]._ppos[1];
+ _ndat.itag () = _imsh.
+ _vert2._data[_ipos]._itag ;
_ndat.pval(2) =
(real_type) +0. ;
- _ndat.fdim () = +0;
+ _ndat.fdim () = +0 ;
- if (_imsh._vert2.
- _data[_ipos]._itag < +0)
+ if (_ndat.itag () < +0)
_ndat.feat () =
mesh::user_feat ;
else
@@ -392,6 +400,8 @@
_edge2._data[_ipos]._node[0];
_edat.node(1) = _imsh.
_edge2._data[_ipos]._node[1];
+ _edat.itag () = _imsh.
+ _edge2._data[_ipos]._itag ;
_init._euclidean_mesh_2d.
_mesh.push_edge(_edat,false);
@@ -410,6 +420,8 @@
_tria3._data[_ipos]._node[1];
_tdat.node(2) = _imsh.
_tria3._data[_ipos]._node[2];
+ _tdat.itag () = _imsh.
+ _tria3._data[_ipos]._itag ;
_init._euclidean_mesh_2d.
_mesh.push_tri3(_tdat,false);
@@ -437,14 +449,15 @@
_vert3._data[_ipos]._ppos[1];
_ndat.pval(2) = _imsh.
_vert3._data[_ipos]._ppos[2];
+ _ndat.itag () = _imsh.
+ _vert3._data[_ipos]._itag ;
_ndat.pval(3) =
(real_type) +0. ;
- _ndat.fdim () = +0;
+ _ndat.fdim () = +0 ;
- if (_imsh._vert3.
- _data[_ipos]._itag < +0)
+ if (_ndat.itag () < +0)
_ndat.feat () =
mesh::user_feat ;
else
@@ -466,6 +479,8 @@
_edge2._data[_ipos]._node[0];
_edat.node(1) = _imsh.
_edge2._data[_ipos]._node[1];
+ _edat.itag () = _imsh.
+ _edge2._data[_ipos]._itag ;
_init._euclidean_mesh_3d.
_mesh.push_edge(_edat,false);
@@ -479,11 +494,13 @@
mesh_data::euclidean_mesh_3d
::face_type _tdat ;
_tdat.node(0) = _imsh.
- _tria4._data[_ipos]._node[0];
+ _tria3._data[_ipos]._node[0];
_tdat.node(1) = _imsh.
- _tria4._data[_ipos]._node[1];
+ _tria3._data[_ipos]._node[1];
_tdat.node(2) = _imsh.
- _tria4._data[_ipos]._node[2];
+ _tria3._data[_ipos]._node[2];
+ _tdat.itag () = _imsh.
+ _tria3._data[_ipos]._itag ;
_init._euclidean_mesh_3d.
_mesh.push_tri3(_tdat,false);
@@ -504,7 +521,9 @@
_tria4._data[_ipos]._node[2];
_tdat.node(3) = _imsh.
_tria4._data[_ipos]._node[3];
-
+ _tdat.itag () = _imsh.
+ _tria4._data[_ipos]._itag ;
+
_init._euclidean_mesh_3d.
_mesh.push_tri4(_tdat,false);
}
diff --git a/src/jig_load.hpp b/src/jig_load.hpp
index 2321f5f..4a6f2a5 100644
--- a/src/jig_load.hpp
+++ b/src/jig_load.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 20 February, 2019
+ * Last updated: 10 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -136,7 +136,16 @@
this->_jjig->
_rdel_opts.eta2() = _eta2;
}
-
+
+ /*------------------------------------- INIT keywords */
+ __normal_call void_type push_init_near (
+ double _near
+ )
+ {
+ this->_jjig->
+ _rdel_opts.near() = _near;
+ }
+
/*------------------------------------- HFUN keywords */
__normal_call void_type push_hfun_file (
std::string _file
@@ -478,6 +487,10 @@
eta1() = _jjig._geom_eta1 ;
_jcfg._rdel_opts.
eta2() = _jjig._geom_eta2 ;
+
+ /*------------------------------------- INIT keywords */
+ _jcfg._rdel_opts.
+ near() = _jjig._init_near ;
/*------------------------------------- HFUN keywords */
if (_jjig._hfun_scal ==
@@ -589,7 +602,7 @@
_sstr.str(""); \
_sstr.clear(); \
_sstr << \
- " **input error: " __tag "=" \
+ "**input error: " __tag " = " \
<< std::setw(+9) \
<< std::setfill(' ') \
<< __var << "\n"; \
@@ -605,7 +618,7 @@
_sstr.str(""); \
_sstr.clear(); \
_sstr << \
- " **input error: " __tag "=" \
+ "**input error: " __tag " = " \
<< std::scientific \
<< std::setprecision(2) \
<< __var << "\n"; \
@@ -620,7 +633,7 @@
_sstr.str(""); \
_sstr.clear(); \
_sstr << \
- " **input warning: " __tag "=" \
+ "**input warning: " __tag " = " \
<< std::scientific \
<< std::setprecision(2) \
<< __var << "\n"; \
@@ -654,6 +667,12 @@
(real_type) 0.,
(real_type)180.)
+ /*---------------------------- test INIT keywords */
+ __testREAL("INIT-NEAR",
+ _jcfg._rdel_opts.near(),
+ (real_type) 0.,
+ (real_type) 1.)
+
/*---------------------------- test HFUN keywords */
__testREAL("HFUN-HMAX",
_jcfg ._hfun_hmax ,
@@ -863,6 +882,12 @@
_jlog.push("\n") ;
+ /*---------------------------- push INIT keywords */
+ __dumpREAL("INIT-NEAR",
+ _jcfg._rdel_opts.near())
+
+ _jlog.push("\n") ;
+
/*---------------------------- push HFUN keywords */
if(_jcfg._hfun_scal ==
jcfg_data::hfun_scal::absolute)
diff --git a/src/jig_read.hpp b/src/jig_read.hpp
index 69b81b6..d147ab8 100644
--- a/src/jig_read.hpp
+++ b/src/jig_read.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 20 February, 2019
+ * Last updated: 10 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -91,6 +91,10 @@
__normal_call void_type push_geom_eta2 (
double /*_eta2*/
) { }
+
+ __normal_call void_type push_init_near (
+ double /*_near*/
+ ) { }
__normal_call void_type push_hfun_scal (
std::int32_t /*_scal*/
@@ -410,6 +414,11 @@
__putFILE(push_init_file, _stok) ;
}
else
+ if (_stok[0] == "INIT-NEAR")
+ {
+ __putREAL(push_init_near, _stok) ;
+ }
+ else
/*---------------------------- read HFUN keywords */
if (_stok[0] == "HFUN_FILE")
{
diff --git a/src/jigsaw.cpp b/src/jigsaw.cpp
index dd59eef..91ecc60 100644
--- a/src/jigsaw.cpp
+++ b/src/jigsaw.cpp
@@ -33,8 +33,8 @@
* JIGSAW: an unstructured mesh generation library.
--------------------------------------------------------
*
- * JIGSAW release 0.9.9.x
- * Last updated: 20 February, 2019
+ * JIGSAW release 0.9.10.x
+ * Last updated: 10 April, 2019
*
* Copyright 2013 -- 2019
* Darren Engwirda
@@ -200,7 +200,7 @@
# endif
-# define __JGSWVSTR "JIGSAW VERSION 0.9.9"
+# define __JGSWVSTR "JIGSAW VERSION 0.9.10"
/*---------------------------------- for i/o on files */
diff --git a/src/libcpp/allocators/alloc_wrap.hpp b/src/libcpp/allocators/alloc_wrap.hpp
index fa45038..3c35c90 100644
--- a/src/libcpp/allocators/alloc_wrap.hpp
+++ b/src/libcpp/allocators/alloc_wrap.hpp
@@ -64,14 +64,14 @@
{
/*-------- pointer to base allocator: stateful allocators */
public :
- typedef A allocator ;
-
- typedef _wrap_alloc self_type ;
+ typedef A allocator ;
+
+ typedef _wrap_alloc self_type ;
typedef typename
- allocator::size_type size_type ;
+ allocator::size_type size_type ;
typedef typename
- allocator::diff_type diff_type ;
+ allocator::diff_type diff_type ;
private :
diff --git a/src/libcpp/containers/array.hpp b/src/libcpp/containers/array.hpp
index 21513cb..6ad11c7 100644
--- a/src/libcpp/containers/array.hpp
+++ b/src/libcpp/containers/array.hpp
@@ -73,33 +73,33 @@
/*------ a dynamically allocated, contiguous array object */
public :
- typedef D data_type ;
- typedef A allocator ;
+ typedef D data_type ;
+ typedef A allocator ;
typedef typename
- allocator::size_type size_type ;
+ allocator::size_type size_type ;
typedef typename
- allocator::diff_type diff_type ;
+ allocator::diff_type diff_type ;
typedef __cont::array <
data_type,
- allocator > self_type ;
+ allocator > self_type ;
typedef __cont::write_array_iterator <
- self_type > _write_it ;
+ self_type > _write_it ;
typedef __cont::const_array_iterator <
- self_type > _const_it ;
+ self_type > _const_it ;
typedef allocators::_item_alloc <
data_type,
- allocator > obj_alloc ;
+ allocator > obj_alloc ;
private :
enum {_hptr, _tptr, _lptr} ;
containers::
- fixed_array<__write_ptr(data_type),+3> _ptrs ;
+ fixed_array<__write_ptr(data_type),+3> _ptrs ;
private :
diff --git a/src/libcpp/containers/fixed_array.hpp b/src/libcpp/containers/fixed_array.hpp
index 0f96e4d..27b9fe5 100644
--- a/src/libcpp/containers/fixed_array.hpp
+++ b/src/libcpp/containers/fixed_array.hpp
@@ -66,21 +66,21 @@
{
/*------------ simple wrapper for "c-style" static arrays */
public :
- typedef D data_type ;
+ typedef D data_type ;
- typedef std:: size_t size_type ;
- typedef std::ptrdiff_t diff_type ;
+ typedef std:: size_t size_type ;
+ typedef std::ptrdiff_t diff_type ;
size_type static const _size = L > +0 ?
L : +1 ;
typedef __cont::fixed_array <
- data_type, L > self_type ;
+ data_type, L > self_type ;
typedef __cont::const_array_iterator <
- self_type > _const_it ;
+ self_type > _const_it ;
typedef __cont::write_array_iterator <
- self_type > _write_it ;
+ self_type > _write_it ;
private :
diff --git a/src/libcpp/geom_base/geom_pred_k.hpp b/src/libcpp/geom_base/predicate_k.hpp
similarity index 100%
rename from src/libcpp/geom_base/geom_pred_k.hpp
rename to src/libcpp/geom_base/predicate_k.hpp
diff --git a/src/libcpp/geometry.hpp b/src/libcpp/geometry.hpp
index cb987fe..7e0c000 100644
--- a/src/libcpp/geometry.hpp
+++ b/src/libcpp/geometry.hpp
@@ -53,7 +53,7 @@
# include "geom_base/vect_base_k.hpp"
-# include "geom_base/geom_pred_k.hpp"
+# include "geom_base/predicate_k.hpp"
# include "geom_base/intersect_k.hpp"
diff --git a/src/libcpp/iter_mesh/iter_mesh_2.hpp b/src/libcpp/iter_mesh/iter_mesh_2.hpp
index f8604c1..3da76d4 100644
--- a/src/libcpp/iter_mesh/iter_mesh_2.hpp
+++ b/src/libcpp/iter_mesh/iter_mesh_2.hpp
@@ -518,40 +518,40 @@
real_type _proj [_dims] = {
(real_type) +0.0 } ;
- real_type _ladj = (real_type) + 0.0 ;
-
- /*---------------- calc. line search direction vector */
- if (_kind == _odt_kind)
- {
- _odt_move_2 (
- _mesh, _hfun, _pred,
- _hval, _tset, _node,
- _line, _ladj) ;
- }
- else
- if (_kind == _sdQ_kind)
- {
- if (_TMIN<=_TLIM)
- {
- grad_move_2 (
- _mesh, _hfun, _pred,
- _tset, _node, _told,
- _line, _ladj) ;
- }
- else { return ; }
- }
-
- /*---------------- scale line search direction vector */
- real_type _llen = std::
- sqrt(_pred.length_sq(_line)) ;
-
- real_type _xtol =
- (real_type)+.1 * _opts.qtol() ;
-
- if (_llen<=
- _ladj * _xtol) return;
-
- real_type _scal = // overrelaxation
+ real_type _ladj = (real_type) + 0.0 ;
+
+ /*---------------- calc. line search direction vector */
+ if (_kind == _odt_kind)
+ {
+ _odt_move_2 (
+ _mesh, _hfun, _pred,
+ _hval, _tset, _node,
+ _line, _ladj) ;
+ }
+ else
+ if (_kind == _sdQ_kind)
+ {
+ if (_TMIN<=_TLIM)
+ {
+ grad_move_2 (
+ _mesh, _hfun, _pred,
+ _tset, _node, _told,
+ _line, _ladj) ;
+ }
+ else { return ; }
+ }
+
+ /*---------------- scale line search direction vector */
+ real_type _llen = std::
+ sqrt(_pred.length_sq(_line)) ;
+
+ real_type _xtol =
+ (real_type)+.1 * _opts.qtol() ;
+
+ if (_llen<=
+ _ladj * _xtol) return;
+
+ real_type _scal = // overrelaxation
_llen * (real_type)5./3. ;
/*---------------- do backtracking line search iter's */
diff --git a/src/libcpp/iter_mesh/iter_mesh_euclidean_2.hpp b/src/libcpp/iter_mesh/iter_mesh_euclidean_2.hpp
index 607a247..5c372ec 100644
--- a/src/libcpp/iter_mesh/iter_mesh_euclidean_2.hpp
+++ b/src/libcpp/iter_mesh/iter_mesh_euclidean_2.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 10 September, 2018
+ * Last updated: 09 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -77,6 +77,7 @@
public :
iptr_type _hidx ;
+ iptr_type _itag ;
char_type _fdim ;
char_type _feat ;
diff --git a/src/libcpp/iter_mesh/iter_mesh_euclidean_3.hpp b/src/libcpp/iter_mesh/iter_mesh_euclidean_3.hpp
index 0a70b3f..4426200 100644
--- a/src/libcpp/iter_mesh/iter_mesh_euclidean_3.hpp
+++ b/src/libcpp/iter_mesh/iter_mesh_euclidean_3.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 10 September, 2018
+ * Last updated: 09 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -80,6 +80,7 @@ template <
public :
iptr_type _hidx ;
+ iptr_type _itag ;
char_type _fdim ;
char_type _feat ;
@@ -94,6 +95,14 @@ template <
) const
{ return this->_hidx ;
}
+ __inline_call iptr_type & itag (
+ )
+ { return this->_itag ;
+ }
+ __inline_call iptr_type const& itag (
+ ) const
+ { return this->_itag ;
+ }
__inline_call char_type & fdim (
)
{ return this->_fdim ;
diff --git a/src/libcpp/rdel_mesh/rdel_create_init_2.inc b/src/libcpp/rdel_mesh/rdel_create_init_2.inc
new file mode 100644
index 0000000..1e5f470
--- /dev/null
+++ b/src/libcpp/rdel_mesh/rdel_create_init_2.inc
@@ -0,0 +1,490 @@
+
+ /*
+ --------------------------------------------------------
+ * RDEL-INITIAL-MESH-2: set initial conditions in R^2.
+ --------------------------------------------------------
+ *
+ * This program may be freely redistributed under the
+ * condition that the copyright notices (including this
+ * entire header) are not removed, and no compensation
+ * is received through use of the software. Private,
+ * research, and institutional use is free. You may
+ * distribute modified versions of this code UNDER THE
+ * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE
+ * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE
+ * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE
+ * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR
+ * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution
+ * of this code as part of a commercial system is
+ * permissible ONLY BY DIRECT ARRANGEMENT WITH THE
+ * AUTHOR. (If you are not directly supplying this
+ * code to a customer, and you are instead telling them
+ * how they can obtain it for free, then you are not
+ * required to make any arrangement with me.)
+ *
+ * Disclaimer: Neither I nor: Columbia University, The
+ * Massachusetts Institute of Technology, The
+ * University of Sydney, nor The National Aeronautics
+ * and Space Administration warrant this code in any
+ * way whatsoever. This code is provided "as-is" to be
+ * used at your own risk.
+ *
+ --------------------------------------------------------
+ *
+ * Last updated: 08 April, 2019
+ *
+ * Copyright 2013-2018
+ * Darren Engwirda
+ * de2363@columbia.edu
+ * https://github.com/dengwirda/
+ *
+ --------------------------------------------------------
+ */
+
+ // from rdel_mesh_2.hpp
+
+
+ /*
+ --------------------------------------------------------
+ * INIT-SORT: create an insertion order.
+ --------------------------------------------------------
+ */
+
+ template <
+ typename init_type
+ >
+ __static_call
+ __normal_call void_type init_sort (
+ init_type &_init,
+ iptr_list &_iset
+ )
+ {
+ typedef geom_tree::aabb_node_base_k
+ tree_node ;
+
+ typedef geom_tree::
+ aabb_item_node_k <
+ real_type,
+ iptr_type, 2> tree_item ;
+
+ typedef geom_tree::aabb_tree <
+ tree_item, 2,
+ tree_node,
+ allocator > tree_type ;
+
+ containers::array _bbox;
+
+ /*------------------------------ initialise aabb-tree */
+ iptr_type _npos = 0 ;
+ tree_type _tree ;
+ for (auto _node =
+ _init._mesh._set1.head() ;
+ _node !=
+ _init._mesh._set1.tend() ;
+ ++_node, ++_npos)
+ {
+ if (_node->mark() >= +0)
+ {
+
+ _bbox.push_tail() ;
+ _bbox.tail()->
+ pval(0) = _node->pval(0) ;
+ _bbox.tail()->
+ pval(1) = _node->pval(1) ;
+
+ _bbox.tail()->
+ ipos () = _npos ;
+
+ }
+ }
+
+ iptr_type _NBOX =
+ (iptr_type) std::pow (8, 2) ; // 8^ndim
+
+ _tree.load(_bbox.head(),
+ _bbox.tend(), _NBOX) ;
+
+ /*------------------------------ randomised tree sort */
+ _tree.brio(_iset) ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * HAVE-EDGE: TRUE if exists in DT.
+ --------------------------------------------------------
+ */
+
+ __static_call
+ __normal_call bool_type have_edge (
+ mesh_type &_mesh,
+ iptr_list &_imap,
+ iptr_type &_eadj,
+ iptr_type &_tadj,
+ iptr_type *_enod
+ )
+ {
+ class node_pred
+ {
+ /*--------------------- find adj. set of tria-to-node */
+ public :
+
+ typedef typename
+ mesh_type::tria_type tria_type ;
+
+ public :
+ iptr_type _npos;
+
+ public :
+ __inline_call node_pred (
+ iptr_type _nsrc
+ ) : _npos(_nsrc) {}
+ /*--------------------- find adj. set of tria-to-node */
+ __inline_call bool_type operator() (
+ tria_type&_tria,
+ iptr_type _tpos,
+ iptr_type _fpos
+ )
+ {
+ iptr_type _tnod[3] = {
+ _tria.tria(_tpos)->node(0) ,
+ _tria.tria(_tpos)->node(1) ,
+ _tria.tria(_tpos)->node(2)
+ } ;
+
+ __unreferenced(_fpos) ;
+
+ if (_tnod[0] == this->_npos)
+ return true ;
+ if (_tnod[1] == this->_npos)
+ return true ;
+ if (_tnod[2] == this->_npos)
+ return true ;
+
+ return false ;
+ }
+ } ;
+
+ if (_imap[_enod[0]] != -1 &&
+ _imap[_enod[1]] != -1 )
+ {
+ /*--------------------- TRUE if we find edge in DTRI. */
+ iptr_type _emap[2];
+ _emap[0] = _imap[_enod[ 0]] ;
+ _emap[1] = _imap[_enod[ 1]] ;
+
+ /*--------------------- find all tria's about ENOD[0] */
+ iptr_list _tset;
+ iptr_type _epos;
+ _tset.set_alloc( +32) ;
+
+ _mesh._tria.walk_node (
+ _emap[0],
+ node_pred(_emap[0]), _tset);
+
+ /*--------------------- can find exact match to edge? */
+ for (auto _tpos = _tset.head();
+ _tpos != _tset.tend();
+ ++_tpos )
+ {
+ for (_epos = 3; _epos-- != 0; )
+ {
+ iptr_type _ENOD [ +3];
+ mesh_type::tria_type::
+ tria_type::face_node(
+ _ENOD, _epos, +2, +1 );
+
+ _ENOD[0] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_ENOD[0]);
+ _ENOD[1] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_ENOD[1]);
+
+ iptr_type _same = +0 ;
+ if (_emap[0] == _ENOD[0] ||
+ _emap[0] == _ENOD[1] )
+ _same += +1 ;
+ if (_emap[1] == _ENOD[0] ||
+ _emap[1] == _ENOD[1] )
+ _same += +1 ;
+
+ if (_same == +2 )
+ {
+ /*--------------------- return TRUE for edge in DTRI. */
+ _eadj = _epos ;
+
+ _tadj =*_tpos ;
+
+ return true ;
+ }
+ }
+ }
+
+ }
+
+ return false ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * INIT-INIT: push IC nodes + faces.
+ --------------------------------------------------------
+ */
+
+ template <
+ typename init_type
+ >
+ __static_call
+ __normal_call void_type init_init (
+ init_type &_init,
+ mesh_type &_mesh,
+ typename
+ mesh_type::edge_list & _epro,
+ typename
+ mesh_type::edge_list & _ebad,
+ real_type _NEAR
+ )
+ {
+ /*------------------------------ form insertion order */
+ iptr_type _hint = -1 ;
+ iptr_type _null = -1 ;
+ iptr_list _iset, _imap ;
+ init_sort(_init, _iset) ;
+
+ /*------------------------------ find "central" point */
+ iptr_type _imid = -1 ;
+ real_type _dmin =
+ std::numeric_limits
+ ::infinity();
+
+ _imap.set_count (
+ _iset.count(),
+ containers::tight_alloc, _null);
+
+ real_type _pmid[2] ;
+ _pmid[0] = (real_type) +0. ;
+ _pmid[1] = (real_type) +0. ;
+
+ for (auto _iter = _iset.head();
+ _iter != _iset.tend();
+ ++_iter )
+ {
+ auto _node =
+ &_init._mesh._set1 [*_iter] ;
+
+ _pmid[0] +=
+ _node->pval(0);
+ _pmid[1] +=
+ _node->pval(1);
+ }
+
+ _pmid[0] /= _iset.count () ;
+ _pmid[1] /= _iset.count () ;
+
+ for (auto _iter = _iset.head();
+ _iter != _iset.tend();
+ ++_iter )
+ {
+ auto _node =
+ &_init._mesh._set1 [*_iter] ;
+
+ real_type _dsqr =
+ geometry::lensqr_2d(
+ &_node->pval(0), _pmid) ;
+
+ if (_dsqr < _dmin)
+ {
+ _dmin = _dsqr ;
+
+ _imid =*_iter ;
+ }
+ }
+
+ /*------------------------------ seed node from init. */
+ if (_imid > -1)
+ {
+ auto _node =
+ &_init._mesh._set1 [ _imid] ;
+
+ iptr_type _npos = -1 ;
+ iptr_type _near = -1 ;
+
+ if (_mesh._tria.find_node(
+ &_node->pval(0) ,
+ _near, _hint ) )
+ {
+ /*------------------------------ find len. to nearest */
+ auto _nptr =
+ _mesh._tria. node ( _near) ;
+
+ _hint = _mesh._tria.
+ node(_near)->next() ;
+
+ real_type _dsqr =
+ geometry::lensqr_2d (
+ &_node->pval(0) ,
+ &_nptr->pval(0) ) ;
+
+ if (_dsqr >= _NEAR )
+ {
+ if (_mesh._tria.push_node(
+ &_node->pval(0) ,
+ _npos, _hint ) )
+ {
+ /*------------------------------ is "new" if distinct */
+ _imap[_imid] = _npos ;
+
+ _mesh._tria.node
+ (_npos)->fdim()
+ = _node->fdim() ;
+
+ _mesh._tria.node
+ (_npos)->feat()
+ = _node->feat() ;
+
+ _mesh._tria.node
+ (_npos)->topo() = 2 ;
+
+ _hint = _npos ;
+
+ }
+ }
+ else
+ {
+ /*------------------------------ else move to nearest */
+ _imap[_imid] = _near ;
+
+ _hint = _near ;
+
+ }
+
+ }
+ }
+
+ /*------------------------------ seed node from init. */
+ for (auto _iter = _iset.head();
+ _iter != _iset.tend();
+ ++_iter )
+ {
+ if (*_iter == _imid)
+ continue ;
+
+ auto _inum =*_iter;
+ auto _node =
+ &_init._mesh ._set1[*_iter] ;
+
+ iptr_type _near = -1 ;
+ iptr_type _npos = -1 ;
+
+ if (_mesh._tria.find_node(
+ &_node->pval(0) ,
+ _near, _hint ) )
+ {
+ /*------------------------------ find len. to nearest */
+ auto _nptr =
+ _mesh._tria. node ( _near) ;
+
+ _hint = _mesh._tria.
+ node(_near)->next() ;
+
+ real_type _dsqr =
+ geometry::lensqr_2d (
+ &_node->pval(0) ,
+ &_nptr->pval(0) ) ;
+
+ if (_dsqr >= _NEAR )
+ {
+ if (_mesh._tria.push_node(
+ &_node->pval(0) ,
+ _npos, _hint ) )
+ {
+ /*------------------------------ is "new" if distinct */
+ _imap[_inum] = _npos ;
+
+ _mesh._tria.node
+ (_npos)->fdim()
+ = _node->fdim() ;
+
+ _mesh._tria.node
+ (_npos)->feat()
+ = _node->feat() ;
+
+ _mesh._tria.node
+ (_npos)->topo() = 2 ;
+
+ _hint = _npos ;
+
+ }
+ }
+ else
+ {
+ /*------------------------------ else move to nearest */
+ _imap[_inum] = _near ;
+
+ _hint = _near ;
+
+ }
+
+ }
+ }
+
+ /*------------------------------ seed edge from init. */
+ for (auto _iter =
+ _init._mesh._set2.head();
+ _iter !=
+ _init._mesh._set2.tend();
+ ++_iter )
+ {
+ if (_iter->mark() >= +0)
+ if (_iter->itag() <= -1)
+ {
+ /*------------------------------ find edge "in" DTRI. */
+ iptr_type _eadj, _tadj ;
+ if (have_edge( _mesh,
+ _imap,_eadj,_tadj,
+ &_iter->node( +0 )) )
+ {
+ /*------------------------------ mark as un-refinable */
+ edge_data _edat;
+ _edat._node[0] =
+ _imap[_iter->node( 0 )] ;
+ _edat._node[1] =
+ _imap[_iter->node( 1 )] ;
+
+ _edat._part =
+ _iter->itag() ;
+
+ _edat._eadj = _eadj ;
+ _edat._tadj = _tadj ;
+
+ algorithms::isort (
+ &_edat._node[0],
+ &_edat._node[2],
+ std::less()) ;
+
+ _epro.push(_edat) ;
+
+ }
+ else
+ {
+ /*------------------------------ edge is non-Delaunay */
+ edge_data _edat;
+ _edat._node[0] =
+ _iter->node( 0) ;
+ _edat._node[1] =
+ _iter->node( 1) ;
+
+ _edat._part =
+ _iter->itag() ;
+
+ _ebad.push(_edat) ;
+
+ }
+
+ }
+ }
+
+ }
+
+
+
diff --git a/src/libcpp/rdel_mesh/rdel_create_init_3.inc b/src/libcpp/rdel_mesh/rdel_create_init_3.inc
new file mode 100644
index 0000000..3e44904
--- /dev/null
+++ b/src/libcpp/rdel_mesh/rdel_create_init_3.inc
@@ -0,0 +1,692 @@
+
+ /*
+ --------------------------------------------------------
+ * RDEL-INITIAL-MESH-3: set initial conditions in R^3.
+ --------------------------------------------------------
+ *
+ * This program may be freely redistributed under the
+ * condition that the copyright notices (including this
+ * entire header) are not removed, and no compensation
+ * is received through use of the software. Private,
+ * research, and institutional use is free. You may
+ * distribute modified versions of this code UNDER THE
+ * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE
+ * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE
+ * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE
+ * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR
+ * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution
+ * of this code as part of a commercial system is
+ * permissible ONLY BY DIRECT ARRANGEMENT WITH THE
+ * AUTHOR. (If you are not directly supplying this
+ * code to a customer, and you are instead telling them
+ * how they can obtain it for free, then you are not
+ * required to make any arrangement with me.)
+ *
+ * Disclaimer: Neither I nor: Columbia University, The
+ * Massachusetts Institute of Technology, The
+ * University of Sydney, nor The National Aeronautics
+ * and Space Administration warrant this code in any
+ * way whatsoever. This code is provided "as-is" to be
+ * used at your own risk.
+ *
+ --------------------------------------------------------
+ *
+ * Last updated: 08 April, 2019
+ *
+ * Copyright 2013-2018
+ * Darren Engwirda
+ * de2363@columbia.edu
+ * https://github.com/dengwirda/
+ *
+ --------------------------------------------------------
+ */
+
+ // from rdel_mesh_3.hpp
+
+
+ /*
+ --------------------------------------------------------
+ * INIT-SORT: create an insertion order.
+ --------------------------------------------------------
+ */
+
+ template <
+ typename init_type
+ >
+ __static_call
+ __normal_call void_type init_sort (
+ init_type &_init,
+ iptr_list &_iset
+ )
+ {
+ typedef geom_tree::aabb_node_base_k
+ tree_node ;
+
+ typedef geom_tree::
+ aabb_item_node_k <
+ real_type,
+ iptr_type, 3> tree_item ;
+
+ typedef geom_tree::aabb_tree <
+ tree_item, 3,
+ tree_node,
+ allocator > tree_type ;
+
+ containers::array _bbox;
+
+ /*------------------------------ initialise aabb-tree */
+ iptr_type _npos = 0 ;
+ tree_type _tree ;
+ for (auto _node =
+ _init._mesh._set1.head() ;
+ _node !=
+ _init._mesh._set1.tend() ;
+ ++_node, ++_npos)
+ {
+ if (_node->mark() >= +0)
+ {
+
+ _bbox.push_tail() ;
+ _bbox.tail()->
+ pval(0) = _node->pval(0) ;
+ _bbox.tail()->
+ pval(1) = _node->pval(1) ;
+ _bbox.tail()->
+ pval(2) = _node->pval(2) ;
+
+ _bbox.tail()->
+ ipos () = _npos ;
+
+ }
+ }
+
+ iptr_type _NBOX =
+ (iptr_type) std::pow (8, 3) ; // 8^ndim
+
+ _tree.load(_bbox.head(),
+ _bbox.tend(), _NBOX) ;
+
+ /*------------------------------ randomised tree sort */
+ _tree.brio(_iset) ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * HAVE-EDGE: TRUE if exists in DT.
+ --------------------------------------------------------
+ */
+
+ __static_call
+ __normal_call bool_type have_edge (
+ mesh_type &_mesh,
+ iptr_list &_imap,
+ iptr_type &_eadj,
+ iptr_type &_tadj,
+ iptr_type *_enod
+ )
+ {
+ class node_pred
+ {
+ /*--------------------- find adj. set of tria-to-node */
+ public :
+
+ typedef typename
+ mesh_type::tria_type tria_type ;
+
+ public :
+ iptr_type _npos;
+
+ public :
+ __inline_call node_pred (
+ iptr_type _nsrc
+ ) : _npos(_nsrc) {}
+ /*--------------------- find adj. set of tria-to-node */
+ __inline_call bool_type operator() (
+ tria_type&_tria,
+ iptr_type _tpos,
+ iptr_type _fpos
+ )
+ {
+ iptr_type _tnod[4] = {
+ _tria.tria(_tpos)->node(0) ,
+ _tria.tria(_tpos)->node(1) ,
+ _tria.tria(_tpos)->node(2) ,
+ _tria.tria(_tpos)->node(3)
+ } ;
+
+ __unreferenced(_fpos) ;
+
+ if (_tnod[0] == this->_npos)
+ return true ;
+ if (_tnod[1] == this->_npos)
+ return true ;
+ if (_tnod[2] == this->_npos)
+ return true ;
+ if (_tnod[3] == this->_npos)
+ return true ;
+
+ return false ;
+ }
+ } ;
+
+ if (_imap[_enod[0]] != -1 &&
+ _imap[_enod[1]] != -1 )
+ {
+ /*--------------------- TRUE if we find edge in DTRI. */
+ iptr_type _emap[2];
+ _emap[0] = _imap[_enod[ 0]] ;
+ _emap[1] = _imap[_enod[ 1]] ;
+
+ /*--------------------- find all tria's about ENOD[0] */
+ iptr_list _tset;
+ iptr_type _epos;
+ _tset.set_alloc( +32) ;
+
+ _mesh._tria.walk_node (
+ _emap[0],
+ node_pred(_emap[0]), _tset);
+
+ /*--------------------- can find exact match to edge? */
+ for (auto _tpos = _tset.head();
+ _tpos != _tset.tend();
+ ++_tpos )
+ {
+ for (_epos = 6; _epos-- != 0; )
+ {
+ iptr_type _ENOD [ +4];
+ mesh_type::tria_type::
+ tria_type::face_node(
+ _ENOD, _epos, +3, +1 );
+
+ _ENOD[0] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_ENOD[0]);
+ _ENOD[1] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_ENOD[1]);
+
+ iptr_type _same = +0 ;
+ if (_emap[0] == _ENOD[0] ||
+ _emap[0] == _ENOD[1] )
+ _same += +1 ;
+ if (_emap[1] == _ENOD[0] ||
+ _emap[1] == _ENOD[1] )
+ _same += +1 ;
+
+ if (_same == +2 )
+ {
+ /*--------------------- return TRUE for edge in DTRI. */
+ _eadj = _epos ;
+ _tadj =*_tpos ;
+
+ return true ;
+ }
+ }
+ }
+
+ }
+
+ return false ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * HAVE-FACE: TRUE if exists in DT.
+ --------------------------------------------------------
+ */
+
+ __static_call
+ __normal_call bool_type have_face (
+ mesh_type &_mesh,
+ iptr_list &_imap,
+ iptr_type &_fadj,
+ iptr_type &_tadj,
+ iptr_type *_fnod
+ )
+ {
+ class node_pred
+ {
+ /*--------------------- find adj. set of tria-to-node */
+ public :
+
+ typedef typename
+ mesh_type::tria_type tria_type ;
+
+ public :
+ iptr_type _npos;
+
+ public :
+ __inline_call node_pred (
+ iptr_type _nsrc
+ ) : _npos(_nsrc) {}
+ /*--------------------- find adj. set of tria-to-node */
+ __inline_call bool_type operator() (
+ tria_type&_tria,
+ iptr_type _tpos,
+ iptr_type _fpos
+ )
+ {
+ iptr_type _tnod[4] = {
+ _tria.tria(_tpos)->node(0) ,
+ _tria.tria(_tpos)->node(1) ,
+ _tria.tria(_tpos)->node(2) ,
+ _tria.tria(_tpos)->node(3)
+ } ;
+
+ __unreferenced(_fpos) ;
+
+ if (_tnod[0] == this->_npos)
+ return true ;
+ if (_tnod[1] == this->_npos)
+ return true ;
+ if (_tnod[2] == this->_npos)
+ return true ;
+ if (_tnod[3] == this->_npos)
+ return true ;
+
+ return false ;
+ }
+ } ;
+
+ if (_imap[_fnod[0]] != -1 &&
+ _imap[_fnod[1]] != -1 &&
+ _imap[_fnod[2]] != -1 )
+ {
+ /*--------------------- TRUE if we find edge in DTRI. */
+ iptr_type _fmap[3];
+ _fmap[0] = _imap[_fnod[ 0]] ;
+ _fmap[1] = _imap[_fnod[ 1]] ;
+ _fmap[2] = _imap[_fnod[ 2]] ;
+
+ /*--------------------- find all tria's about ENOD[0] */
+ iptr_list _tset;
+ iptr_type _fpos;
+ _tset.set_alloc( +32) ;
+
+ _mesh._tria.walk_node (
+ _fmap[0],
+ node_pred(_fmap[0]), _tset);
+
+ /*--------------------- can find exact match to edge? */
+ for (auto _tpos = _tset.head();
+ _tpos != _tset.tend();
+ ++_tpos )
+ {
+ for (_fpos = 4; _fpos-- != 0; )
+ {
+ iptr_type _FNOD [ +4];
+ mesh_type::tria_type::
+ tria_type::face_node(
+ _FNOD, _fpos, +3, +2 );
+
+ _FNOD[0] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_FNOD[0]);
+ _FNOD[1] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_FNOD[1]);
+ _FNOD[2] = _mesh.
+ _tria .tria(
+ *_tpos)->node(_FNOD[2]);
+
+ iptr_type _same = +0 ;
+ if (_fmap[0] == _FNOD[0] ||
+ _fmap[0] == _FNOD[1] ||
+ _fmap[0] == _FNOD[2] )
+ _same += +1 ;
+ if (_fmap[1] == _FNOD[0] ||
+ _fmap[1] == _FNOD[1] ||
+ _fmap[1] == _FNOD[2] )
+ _same += +1 ;
+ if (_fmap[2] == _FNOD[0] ||
+ _fmap[2] == _FNOD[1] ||
+ _fmap[2] == _FNOD[2] )
+ _same += +1 ;
+
+ if (_same == +3 )
+ {
+ /*--------------------- return TRUE for edge in DTRI. */
+ _fadj = _fpos ;
+ _tadj =*_tpos ;
+
+ return true ;
+ }
+ }
+ }
+
+ }
+
+ return false ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * INIT-INIT: push IC nodes + faces.
+ --------------------------------------------------------
+ */
+
+ template <
+ typename init_type
+ >
+ __static_call
+ __normal_call void_type init_init (
+ init_type &_init,
+ mesh_type &_mesh,
+ typename
+ mesh_type::edge_list & _epro,
+ typename
+ mesh_type::edge_list & _ebad,
+ typename
+ mesh_type::face_list & _fpro,
+ typename
+ mesh_type::face_list & _fbad,
+ real_type _NEAR
+ )
+ {
+ /*------------------------------ form insertion order */
+ iptr_type _hint = -1 ;
+ iptr_type _null = -1 ;
+ iptr_list _iset, _imap ;
+ init_sort(_init, _iset) ;
+
+ /*------------------------------ find "central" point */
+ iptr_type _imid = -1 ;
+ real_type _dmin =
+ std::numeric_limits
+ ::infinity();
+
+ _imap.set_count (
+ _iset.count(),
+ containers::tight_alloc, _null);
+
+ real_type _pmid[3] ;
+ _pmid[0] = (real_type) +0. ;
+ _pmid[1] = (real_type) +0. ;
+ _pmid[2] = (real_type) +0. ;
+
+ for (auto _iter = _iset.head();
+ _iter != _iset.tend();
+ ++_iter )
+ {
+ auto _node =
+ &_init._mesh._set1 [*_iter] ;
+
+ _pmid[0] +=
+ _node->pval(0);
+ _pmid[1] +=
+ _node->pval(1);
+ _pmid[2] +=
+ _node->pval(2);
+ }
+
+ _pmid[0] /= _iset.count () ;
+ _pmid[1] /= _iset.count () ;
+ _pmid[2] /= _iset.count () ;
+
+ for (auto _iter = _iset.head();
+ _iter != _iset.tend();
+ ++_iter )
+ {
+ auto _node =
+ &_init._mesh._set1 [*_iter] ;
+
+ real_type _dsqr =
+ geometry::lensqr_3d(
+ &_node->pval(0), _pmid) ;
+
+ if (_dsqr < _dmin)
+ {
+ _dmin = _dsqr ;
+
+ _imid =*_iter ;
+ }
+ }
+
+ /*------------------------------ seed node from init. */
+ if (_imid > -1)
+ {
+ auto _node =
+ &_init._mesh._set1 [ _imid] ;
+
+ iptr_type _npos = -1 ;
+ iptr_type _near = -1 ;
+
+ if (_mesh._tria.find_node(
+ &_node->pval(0) ,
+ _near, _hint ) )
+ {
+ /*------------------------------ find len. to nearest */
+ auto _nptr =
+ _mesh._tria. node ( _near) ;
+
+ _hint = _mesh._tria.
+ node(_near)->next() ;
+
+ real_type _dsqr =
+ geometry::lensqr_3d (
+ &_node->pval(0) ,
+ &_nptr->pval(0) ) ;
+
+ if (_dsqr >= _NEAR )
+ {
+ if (_mesh._tria.push_node(
+ &_node->pval(0) ,
+ _npos, _hint ) )
+ {
+ /*------------------------------ is "new" if distinct */
+ _imap[_imid] = _npos ;
+
+ _mesh._tria.node
+ (_npos)->fdim()
+ = _node->fdim() ;
+
+ _mesh._tria.node
+ (_npos)->feat()
+ = _node->feat() ;
+
+ _mesh._tria.node
+ (_npos)->topo() = 2 ;
+
+ _hint = _npos ;
+
+ }
+ }
+ else
+ {
+ /*------------------------------ else move to nearest */
+ _imap[_imid] = _near ;
+
+ _hint = _near ;
+
+ }
+
+ }
+ }
+
+ /*------------------------------ seed node from init. */
+ for (auto _iter = _iset.head();
+ _iter != _iset.tend();
+ ++_iter )
+ {
+ if (*_iter == _imid)
+ continue ;
+
+ auto _inum =*_iter;
+ auto _node =
+ &_init._mesh ._set1[*_iter] ;
+
+ iptr_type _near = -1 ;
+ iptr_type _npos = -1 ;
+
+ if (_mesh._tria.find_node(
+ &_node->pval(0) ,
+ _near, _hint ) )
+ {
+ /*------------------------------ find len. to nearest */
+ auto _nptr =
+ _mesh._tria. node ( _near) ;
+
+ _hint = _mesh._tria.
+ node(_near)->next() ;
+
+ real_type _dsqr =
+ geometry::lensqr_3d (
+ &_node->pval(0) ,
+ &_nptr->pval(0) ) ;
+
+ if (_dsqr >= _NEAR )
+ {
+ if (_mesh._tria.push_node(
+ &_node->pval(0) ,
+ _npos, _hint ) )
+ {
+ /*------------------------------ is "new" if distinct */
+ _imap[_inum] = _npos ;
+
+ _mesh._tria.node
+ (_npos)->fdim()
+ = _node->fdim() ;
+
+ _mesh._tria.node
+ (_npos)->feat()
+ = _node->feat() ;
+
+ _mesh._tria.node
+ (_npos)->topo() = 2 ;
+
+ _hint = _npos ;
+
+ }
+ }
+ else
+ {
+ /*------------------------------ else move to nearest */
+ _imap[_inum] = _near ;
+
+ _hint = _near ;
+
+ }
+
+ }
+ }
+
+ /*------------------------------ seed edge from init. */
+ for (auto _iter =
+ _init._mesh._set2.head();
+ _iter !=
+ _init._mesh._set2.tend();
+ ++_iter )
+ {
+ if (_iter->mark() >= +0)
+ if (_iter->itag() <= -1)
+ {
+ /*------------------------------ find edge "in" DTRI. */
+ iptr_type _eadj, _tadj ;
+ if (have_edge( _mesh,
+ _imap,_eadj,_tadj,
+ &_iter->node( +0 )) )
+ {
+ /*------------------------------ mark as un-refinable */
+ edge_data _edat;
+ _edat._node[0] =
+ _imap[_iter->node( 0 )] ;
+ _edat._node[1] =
+ _imap[_iter->node( 1 )] ;
+
+ _edat._part =
+ _iter->itag() ;
+
+ _edat._eadj = _eadj ;
+ _edat._tadj = _tadj ;
+
+ algorithms::isort (
+ &_edat._node[0],
+ &_edat._node[2],
+ std::less()) ;
+
+ _epro.push(_edat) ;
+
+ }
+ else
+ {
+ /*------------------------------ edge is non-Delaunay */
+ edge_data _edat;
+ _edat._node[0] =
+ _iter->node( 0) ;
+ _edat._node[1] =
+ _iter->node( 1) ;
+
+ _edat._part =
+ _iter->itag() ;
+
+ _ebad.push(_edat) ;
+
+ }
+
+ }
+ }
+
+ /*------------------------------ seed face from init. */
+ for (auto _iter =
+ _init._mesh._set3.head();
+ _iter !=
+ _init._mesh._set3.tend();
+ ++_iter )
+ {
+ if (_iter->mark() >= +0)
+ if (_iter->itag() <= -1)
+ {
+ /*------------------------------ find face "in" DTRI. */
+ iptr_type _fadj, _tadj ;
+ if (have_face( _mesh,
+ _imap,_fadj,_tadj,
+ &_iter->node( +0 )) )
+ {
+ /*------------------------------ mark as un-refinable */
+ face_data _fdat;
+ _fdat._node[0] =
+ _imap[_iter->node( 0 )] ;
+ _fdat._node[1] =
+ _imap[_iter->node( 1 )] ;
+ _fdat._node[2] =
+ _imap[_iter->node( 2 )] ;
+
+ _fdat._part =
+ _iter->itag() ;
+
+ _fdat._fadj = _fadj ;
+ _fdat._tadj = _tadj ;
+
+ algorithms::isort (
+ &_fdat._node[0],
+ &_fdat._node[3],
+ std::less()) ;
+
+ _fpro.push(_fdat) ;
+
+ }
+ else
+ {
+ /*------------------------------ face is non-Delaunay */
+ face_data _fdat;
+ _fdat._node[0] =
+ _iter->node( 0) ;
+ _fdat._node[1] =
+ _iter->node( 1) ;
+ _fdat._node[2] =
+ _iter->node( 2) ;
+
+ _fdat._part =
+ _iter->itag() ;
+
+ _fbad.push(_fdat) ;
+
+ }
+
+ }
+ }
+
+ }
+
+
+
diff --git a/src/libcpp/rdel_mesh/rdel_make_2.hpp b/src/libcpp/rdel_mesh/rdel_make_2.hpp
index 9dc356c..339a25f 100644
--- a/src/libcpp/rdel_mesh/rdel_make_2.hpp
+++ b/src/libcpp/rdel_mesh/rdel_make_2.hpp
@@ -94,39 +94,39 @@
/*----------- restricted delaunay tessellation in R^2 */
- typedef M mesh_type ;
- typedef G geom_type ;
- typedef A allocator ;
+ typedef M mesh_type ;
+ typedef G geom_type ;
+ typedef A allocator ;
typedef typename
- mesh_type::real_type real_type ;
+ mesh_type::real_type real_type ;
typedef typename
- mesh_type::iptr_type iptr_type ;
+ mesh_type::iptr_type iptr_type ;
typedef typename
- allocator::size_type uint_type ;
+ allocator::size_type uint_type ;
typedef typename
- mesh_type::node_data node_data ;
+ mesh_type::node_data node_data ;
typedef typename
- mesh_type::edge_data edge_data ;
+ mesh_type::edge_data edge_data ;
typedef typename
- mesh_type::tria_data tria_data ;
+ mesh_type::tria_data tria_data ;
typedef containers::array <
- iptr_type > iptr_list ;
+ iptr_type > iptr_list ;
typedef mesh::rdel_pred_base_2 <
geom_type,
- mesh_type > rdel_pred ;
+ mesh_type > rdel_pred ;
typedef mesh::rdel_params <
real_type,
- iptr_type > rdel_opts ;
+ iptr_type > rdel_opts ;
typedef mesh::rdel_timers <
real_type ,
- iptr_type > rdel_stat ;
+ iptr_type > rdel_stat ;
/*
--------------------------------------------------------
@@ -371,7 +371,8 @@
typedef geom_tree::aabb_node_base_k
tree_node ;
- typedef geom_tree::aabb_item_node_k <
+ typedef geom_tree::
+ aabb_item_node_k <
real_type,
iptr_type, 2> tree_item ;
@@ -396,12 +397,12 @@
_bbox.push_tail() ;
_bbox.tail()->
- pval(0) = _node->pval( 0) ;
+ pval(0) = _node->pval(0) ;
_bbox.tail()->
- pval(1) = _node->pval( 1) ;
+ pval(1) = _node->pval(1) ;
_bbox.tail()->
- ipos () = _npos ;
+ ipos () = _npos ;
}
}
@@ -447,8 +448,10 @@
auto _node =
&_init._mesh._set1 [*_iter] ;
- _pmid[0] += _node->pval(0) ;
- _pmid[1] += _node->pval(1) ;
+ _pmid[0] +=
+ _node->pval(0);
+ _pmid[1] +=
+ _node->pval(1);
}
_pmid[0] /= _iset.count () ;
@@ -467,8 +470,8 @@
if (_dsqr < _dmin)
{
- _dmin = _dsqr;
- _imid =*_iter;
+ _dmin = _dsqr ;
+ _imid =*_iter ;
}
}
diff --git a/src/libcpp/rdel_mesh/rdel_make_3.hpp b/src/libcpp/rdel_mesh/rdel_make_3.hpp
index d1329ec..174ef3f 100644
--- a/src/libcpp/rdel_mesh/rdel_make_3.hpp
+++ b/src/libcpp/rdel_mesh/rdel_make_3.hpp
@@ -94,41 +94,41 @@
/*----------- restricted delaunay tessellation in R^3 */
- typedef M mesh_type ;
- typedef G geom_type ;
- typedef A allocator ;
+ typedef M mesh_type ;
+ typedef G geom_type ;
+ typedef A allocator ;
typedef typename
- mesh_type::real_type real_type ;
+ mesh_type::real_type real_type ;
typedef typename
- mesh_type::iptr_type iptr_type ;
+ mesh_type::iptr_type iptr_type ;
typedef typename
- allocator::size_type uint_type ;
+ allocator::size_type uint_type ;
typedef typename
- mesh_type::node_data node_data ;
+ mesh_type::node_data node_data ;
typedef typename
- mesh_type::edge_data edge_data ;
+ mesh_type::edge_data edge_data ;
typedef typename
- mesh_type::face_data face_data ;
+ mesh_type::face_data face_data ;
typedef typename
- mesh_type::tria_data tria_data ;
+ mesh_type::tria_data tria_data ;
typedef containers::array <
- iptr_type > iptr_list ;
+ iptr_type > iptr_list ;
typedef mesh::rdel_pred_base_3 <
geom_type,
- mesh_type > rdel_pred ;
+ mesh_type > rdel_pred ;
typedef mesh::rdel_params <
real_type,
- iptr_type > rdel_opts ;
+ iptr_type > rdel_opts ;
typedef mesh::rdel_timers <
real_type ,
- iptr_type > rdel_stat ;
+ iptr_type > rdel_stat ;
/*
--------------------------------------------------------
@@ -478,7 +478,8 @@
typedef geom_tree::aabb_node_base_k
tree_node ;
- typedef geom_tree::aabb_item_node_k <
+ typedef geom_tree::
+ aabb_item_node_k <
real_type,
iptr_type, 3> tree_item ;
@@ -503,14 +504,14 @@
_bbox.push_tail() ;
_bbox.tail()->
- pval(0) = _node->pval( 0) ;
+ pval(0) = _node->pval(0) ;
_bbox.tail()->
- pval(1) = _node->pval( 1) ;
+ pval(1) = _node->pval(1) ;
_bbox.tail()->
- pval(2) = _node->pval( 2) ;
+ pval(2) = _node->pval(2) ;
_bbox.tail()->
- ipos () = _npos ;
+ ipos () = _npos ;
}
}
@@ -557,9 +558,12 @@
auto _node =
&_init._mesh._set1 [*_iter] ;
- _pmid[0] += _node->pval(0) ;
- _pmid[1] += _node->pval(1) ;
- _pmid[2] += _node->pval(2) ;
+ _pmid[0] +=
+ _node->pval(0);
+ _pmid[1] +=
+ _node->pval(1);
+ _pmid[2] +=
+ _node->pval(2);
}
_pmid[0] /= _iset.count () ;
@@ -579,8 +583,8 @@
if (_dsqr < _dmin)
{
- _dmin = _dsqr;
- _imid =*_iter;
+ _dmin = _dsqr ;
+ _imid =*_iter ;
}
}
diff --git a/src/libcpp/rdel_mesh/rdel_mesh_2.hpp b/src/libcpp/rdel_mesh/rdel_mesh_2.hpp
index 22d6d9f..53ad07d 100644
--- a/src/libcpp/rdel_mesh/rdel_mesh_2.hpp
+++ b/src/libcpp/rdel_mesh/rdel_mesh_2.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 15 February, 2019
+ * Last updated: 08 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -122,19 +122,19 @@
/*-------- restricted delaunay mesh-generation in R^2 */
- typedef M mesh_type ;
- typedef P mesh_pred ;
- typedef G geom_type ;
- typedef H hfun_type ;
- typedef A allocator ;
+ typedef M mesh_type ;
+ typedef P mesh_pred ;
+ typedef G geom_type ;
+ typedef H hfun_type ;
+ typedef A allocator ;
typedef typename
- mesh_type::real_type real_type ;
+ mesh_type::real_type real_type ;
typedef typename
- mesh_type::iptr_type iptr_type ;
+ mesh_type::iptr_type iptr_type ;
typedef typename
- allocator::size_type uint_type ;
+ allocator::size_type uint_type ;
typedef char_type mode_type ;
@@ -161,58 +161,63 @@
} ;
typedef typename
- mesh_type::node_data node_data ;
+ mesh_type::node_data node_data ;
typedef typename
- mesh_type::ball_data ball_data ;
+ mesh_type::ball_data ball_data ;
typedef typename
- mesh_type::edge_data edge_data ;
+ mesh_type::edge_data edge_data ;
typedef typename
- mesh_type::tria_data tria_data ;
+ mesh_type::tria_data tria_data ;
+
+ typedef typename
+ mesh_type::edge_list edge_hash ;
+ typedef typename
+ mesh_type::tria_list tria_hash ;
typedef mesh::rdel_params <
real_type,
- iptr_type > rdel_opts ;
+ iptr_type > rdel_opts ;
typedef mesh::rdel_timers <
real_type ,
- iptr_type > rdel_stat ;
+ iptr_type > rdel_stat ;
typedef containers::array <
- iptr_type > iptr_list ;
+ iptr_type > iptr_list ;
/*------------------------------------------ cavity lists */
typedef containers::array <
- edge_data > edat_list ;
+ edge_data > edat_list ;
typedef containers::array <
- edge_cost > escr_list ;
+ edge_cost > escr_list ;
typedef containers::array <
- tria_data > tdat_list ;
+ tria_data > tdat_list ;
typedef containers::array <
- tria_cost > tscr_list ;
+ tria_cost > tscr_list ;
/*------------------------------------------ refine lists */
typedef containers::priorityset <
node_data,
- node_pred > node_heap ;
+ node_pred > node_heap ;
typedef containers::priorityset <
edge_cost,
- edge_pred > edge_heap ;
+ edge_pred > edge_heap ;
typedef containers::priorityset <
tria_cost,
- tria_pred > tria_heap ;
-
+ tria_pred > tria_heap ;
+
/*------------------------------------------ collar lists */
typedef containers::array <
- ball_data > ball_list ;
+ ball_data > ball_list ;
typedef containers::priorityset <
ball_data,
- ball_pred > ball_heap ;
+ ball_pred > ball_heap ;
class node_pred
{
@@ -264,6 +269,15 @@
} ;
+ /*
+ --------------------------------------------------------
+ * RDEL-CREATE: set-up initial nodes/faces.
+ --------------------------------------------------------
+ */
+
+ #include "rdel_create_init_2.inc"
+
+
/*
--------------------------------------------------------
* RDEL-UPDATE: update the restricted-tria.
@@ -518,182 +532,6 @@
--------------------------------------------------------
*/
- template <
- typename init_type
- >
- __static_call
- __normal_call void_type init_sort (
- init_type &_init,
- iptr_list &_iset
- )
- {
- typedef geom_tree::aabb_node_base_k
- tree_node ;
-
- typedef geom_tree::aabb_item_node_k <
- real_type,
- iptr_type, 2> tree_item ;
-
- typedef geom_tree::aabb_tree <
- tree_item, 2,
- tree_node,
- allocator > tree_type ;
-
- containers::array _bbox;
-
- /*------------------------------ initialise aabb-tree */
- iptr_type _npos = 0 ;
- tree_type _tree ;
- for (auto _node =
- _init._mesh._set1.head() ;
- _node !=
- _init._mesh._set1.tend() ;
- ++_node, ++_npos)
- {
- if (_node->mark() >= +0)
- {
-
- _bbox.push_tail() ;
- _bbox.tail()->
- pval(0) = _node->pval( 0) ;
- _bbox.tail()->
- pval(1) = _node->pval( 1) ;
-
- _bbox.tail()->
- ipos () = _npos ;
-
- }
- }
-
- iptr_type _NBOX =
- (iptr_type) std::pow (8, 2) ; // 8^ndim
-
- _tree.load(_bbox.head(),
- _bbox.tend(), _NBOX) ;
-
- /*------------------------------ randomised tree sort */
- _tree.brio(_iset) ;
- }
-
- template <
- typename init_type
- >
- __static_call
- __normal_call void_type init_init (
- init_type &_init,
- mesh_type &_mesh
- )
- {
- /*------------------------------ form insertion order */
- iptr_type _hint = -1 ;
- iptr_list _iset ;
- init_sort(_init, _iset) ;
-
- /*------------------------------ find "central" point */
- iptr_type _imid = -1 ;
- real_type _dmin =
- +std::numeric_limits
- ::infinity();
-
- real_type _pmid[2] ;
- _pmid[0] = (real_type) +0. ;
- _pmid[1] = (real_type) +0. ;
-
- for (auto _iter = _iset.head();
- _iter != _iset.tend();
- ++_iter )
- {
- auto _node =
- &_init._mesh._set1 [*_iter] ;
-
- _pmid[0] += _node->pval(0) ;
- _pmid[1] += _node->pval(1) ;
- }
-
- _pmid[0] /= _iset.count () ;
- _pmid[1] /= _iset.count () ;
-
- for (auto _iter = _iset.head();
- _iter != _iset.tend();
- ++_iter )
- {
- auto _node =
- &_init._mesh._set1 [*_iter] ;
-
- real_type _dsqr =
- geometry::lensqr_2d(
- &_node->pval(0), _pmid) ;
-
- if (_dsqr < _dmin)
- {
- _dmin = _dsqr;
- _imid =*_iter;
- }
- }
-
- /*------------------------------ seed mesh from init. */
- if (_imid > -1)
- {
- auto _node =
- &_init._mesh._set1 [ _imid] ;
-
- iptr_type _npos = -1 ;
- if (_mesh._tria.push_node(
- &_node->pval(0) ,
- _npos, _hint ) )
- {
-
- _mesh._tria.node
- (_npos)->fdim()
- = _node->fdim() ;
-
- _mesh._tria.node
- (_npos)->feat()
- = _node->feat() ;
-
- _mesh._tria.node
- (_npos)->topo() = 2 ;
-
- _hint = _mesh._tria.
- node(_npos)->next() ;
-
- }
- }
-
- /*------------------------------ seed mesh from init. */
- for (auto _iter = _iset.head();
- _iter != _iset.tend();
- ++_iter )
- {
- if (*_iter == _imid) continue;
-
- auto _node =
- &_init._mesh._set1 [*_iter] ;
-
- iptr_type _npos = -1 ;
- if (_mesh._tria.push_node(
- &_node->pval(0) ,
- _npos, _hint ) )
- {
-
- _mesh._tria.node
- (_npos)->fdim()
- = _node->fdim() ;
-
- _mesh._tria.node
- (_npos)->feat()
- = _node->feat() ;
-
- _mesh._tria.node
- (_npos)->topo() = 2 ;
-
- _hint = _mesh._tria.
- node(_npos)->next() ;
-
- }
- }
- }
-
template <
typename init_type
>
@@ -703,6 +541,10 @@
init_type &_init,
hfun_type &_hfun,
mesh_type &_mesh,
+ typename
+ mesh_type::edge_list & _epro,
+ typename
+ mesh_type::edge_list & _ebad,
rdel_opts &_opts
)
{
@@ -738,8 +580,15 @@
real_type _plen[ 2] = {
_pmax[ 0] - _pmin[ 0] ,
- _pmax[ 1] - _pmin[ 1] ,
- } ;
+ _pmax[ 1] - _pmin[ 1] } ;
+
+ real_type _scal =
+ (real_type)+0.0 ;
+ _scal = std::max(
+ _scal , _plen[ 0]);
+ _scal = std::max(
+ _scal , _plen[ 1]);
+
_plen[ 0]*= (real_type)+2.0 ;
_plen[ 1]*= (real_type)+2.0 ;
@@ -778,8 +627,13 @@
seed_feat(_mesh, _opts) ;
/*------------------------------ seed mesh from init. */
-
- init_init(_init, _mesh) ;
+ real_type _NEAR =
+ _scal *_opts.near() *
+ _scal *_opts.near() ;
+
+ init_init(_init, _mesh ,
+ _epro, _ebad ,
+ _NEAR) ;
/*------------------------------ seed mesh from geom. */
_geom.
@@ -868,16 +722,22 @@
typename mesh_type::edge_hash(),
typename mesh_type::edge_pred(),
+.8,_mesh._eset.get_alloc()) ;
+
+ typename
+ mesh_type::edge_list _ebad (
+ typename mesh_type::edge_hash(),
+ typename mesh_type::edge_pred(),
+ +.8,_mesh._eset.get_alloc()) ;
/*------------------------------ init. point counters */
containers:: fixed_array<
iptr_type ,
- rdel_opts::last_kind> _enod;
+ rdel_opts::last_kind> _enod;
+ _enod.fill( +0 ) ;
+
containers:: fixed_array<
iptr_type ,
rdel_opts::last_kind> _tnod;
-
- _enod.fill( +0 ) ;
_tnod.fill( +0 ) ;
/*------------------------------ initialise mesh obj. */
@@ -886,7 +746,16 @@
# endif//__use_timers
init_mesh( _geom , _init, _hfun,
- _mesh, _args );
+ _mesh, _epro ,
+ _ebad, _args ) ;
+
+ if (_ebad.count() > +0)
+ {
+ _dump.push("\n");
+ _dump.push(
+ "**input warning: initial edge(s) not recovered! \n") ;
+ _dump.push("\n");
+ }
# ifdef __use_timers
_ttoc = _time.now() ;
diff --git a/src/libcpp/rdel_mesh/rdel_mesh_3.hpp b/src/libcpp/rdel_mesh/rdel_mesh_3.hpp
index dca4ceb..c422786 100644
--- a/src/libcpp/rdel_mesh/rdel_mesh_3.hpp
+++ b/src/libcpp/rdel_mesh/rdel_mesh_3.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 15 February, 2019
+ * Last updated: 08 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -122,19 +122,19 @@
/*-------- restricted delaunay mesh-generation in R^3 */
- typedef M mesh_type ;
- typedef P mesh_pred ;
- typedef G geom_type ;
- typedef H hfun_type ;
- typedef A allocator ;
+ typedef M mesh_type ;
+ typedef P mesh_pred ;
+ typedef G geom_type ;
+ typedef H hfun_type ;
+ typedef A allocator ;
typedef typename
- mesh_type::real_type real_type ;
+ mesh_type::real_type real_type ;
typedef typename
- mesh_type::iptr_type iptr_type ;
+ mesh_type::iptr_type iptr_type ;
typedef typename
- allocator::size_type uint_type ;
+ allocator::size_type uint_type ;
typedef char_type mode_type ;
@@ -170,70 +170,70 @@
} ;
typedef typename
- mesh_type::node_data node_data ;
+ mesh_type::node_data node_data ;
typedef typename
- mesh_type::ball_data ball_data ;
+ mesh_type::ball_data ball_data ;
typedef typename
- mesh_type::edge_data edge_data ;
+ mesh_type::edge_data edge_data ;
typedef typename
- mesh_type::face_data face_data ;
+ mesh_type::face_data face_data ;
typedef typename
- mesh_type::tria_data tria_data ;
+ mesh_type::tria_data tria_data ;
typedef mesh::rdel_params <
real_type,
- iptr_type > rdel_opts ;
+ iptr_type > rdel_opts ;
typedef mesh::rdel_timers <
real_type ,
- iptr_type > rdel_stat ;
+ iptr_type > rdel_stat ;
typedef containers::array <
- iptr_type > iptr_list ;
+ iptr_type > iptr_list ;
/*------------------------------------------ cavity lists */
typedef containers::array <
- edge_data > edat_list ;
+ edge_data > edat_list ;
typedef containers::array <
- edge_cost > escr_list ;
+ edge_cost > escr_list ;
typedef containers::array <
- face_data > fdat_list ;
+ face_data > fdat_list ;
typedef containers::array <
- face_cost > fscr_list ;
+ face_cost > fscr_list ;
typedef containers::array <
- tria_data > tdat_list ;
+ tria_data > tdat_list ;
typedef containers::array <
- tria_cost > tscr_list ;
+ tria_cost > tscr_list ;
/*------------------------------------------ refine lists */
typedef containers::priorityset <
node_data,
- node_pred > node_heap ;
+ node_pred > node_heap ;
typedef containers::priorityset <
edge_cost,
- edge_pred > edge_heap ;
+ edge_pred > edge_heap ;
typedef containers::priorityset <
face_cost,
- face_pred > face_heap ;
+ face_pred > face_heap ;
typedef containers::priorityset <
tria_cost,
- tria_pred > tria_heap ;
+ tria_pred > tria_heap ;
/*------------------------------------------ collar lists */
typedef containers::array <
- ball_data > ball_list ;
+ ball_data > ball_list ;
typedef containers::priorityset <
ball_data,
- ball_pred > ball_heap ;
+ ball_pred > ball_heap ;
class node_pred
{
@@ -295,7 +295,16 @@
::tria_pred(_idat, _jdat) ;
}
} ;
-
+
+
+ /*
+ --------------------------------------------------------
+ * RDEL-CREATE: set-up initial nodes/faces.
+ --------------------------------------------------------
+ */
+
+ #include "rdel_create_init_3.inc"
+
/*
--------------------------------------------------------
@@ -327,6 +336,7 @@
#include "rdel_refine_face_3.inc"
#include "rdel_refine_topo_3.inc"
+
/*
--------------------------------------------------------
@@ -619,187 +629,6 @@
--------------------------------------------------------
*/
- template <
- typename init_type
- >
- __static_call
- __normal_call void_type init_sort (
- init_type &_init,
- iptr_list &_iset
- )
- {
- typedef geom_tree::aabb_node_base_k
- tree_node ;
-
- typedef geom_tree::aabb_item_node_k <
- real_type,
- iptr_type, 3> tree_item ;
-
- typedef geom_tree::aabb_tree <
- tree_item, 3,
- tree_node,
- allocator > tree_type ;
-
- containers::array _bbox;
-
- /*------------------------------ initialise aabb-tree */
- iptr_type _npos = 0 ;
- tree_type _tree ;
- for (auto _node =
- _init._mesh._set1.head() ;
- _node !=
- _init._mesh._set1.tend() ;
- ++_node, ++_npos)
- {
- if (_node->mark() >= +0)
- {
-
- _bbox.push_tail() ;
- _bbox.tail()->
- pval(0) = _node->pval( 0) ;
- _bbox.tail()->
- pval(1) = _node->pval( 1) ;
- _bbox.tail()->
- pval(2) = _node->pval( 2) ;
-
- _bbox.tail()->
- ipos () = _npos ;
-
- }
- }
-
- iptr_type _NBOX =
- (iptr_type) std::pow (8, 3) ; // 8^ndim
-
- _tree.load(_bbox.head(),
- _bbox.tend(), _NBOX) ;
-
- /*------------------------------ randomised tree sort */
- _tree.brio(_iset) ;
- }
-
- template <
- typename init_type
- >
- __static_call
- __normal_call void_type init_init (
- init_type &_init,
- mesh_type &_mesh
- )
- {
- /*------------------------------ form insertion order */
- iptr_type _hint = -1 ;
- iptr_list _iset ;
- init_sort(_init, _iset) ;
-
- /*------------------------------ find "central" point */
- iptr_type _imid = -1 ;
- real_type _dmin =
- std::numeric_limits
- ::infinity();
-
- real_type _pmid[3] ;
- _pmid[0] = (real_type) +0. ;
- _pmid[1] = (real_type) +0. ;
- _pmid[2] = (real_type) +0. ;
-
- for (auto _iter = _iset.head();
- _iter != _iset.tend();
- ++_iter )
- {
- auto _node =
- &_init._mesh._set1 [*_iter] ;
-
- _pmid[0] += _node->pval(0) ;
- _pmid[1] += _node->pval(1) ;
- _pmid[2] += _node->pval(2) ;
- }
-
- _pmid[0] /= _iset.count () ;
- _pmid[1] /= _iset.count () ;
- _pmid[2] /= _iset.count () ;
-
- for (auto _iter = _iset.head();
- _iter != _iset.tend();
- ++_iter )
- {
- auto _node =
- &_init._mesh._set1 [*_iter] ;
-
- real_type _dsqr =
- geometry::lensqr_3d(
- &_node->pval(0), _pmid) ;
-
- if (_dsqr < _dmin)
- {
- _dmin = _dsqr;
- _imid =*_iter;
- }
- }
-
- /*------------------------------ seed mesh from init. */
- if (_imid > -1)
- {
- auto _node =
- &_init._mesh._set1 [ _imid] ;
-
- iptr_type _npos = -1 ;
- if (_mesh._tria.push_node(
- &_node->pval(0) ,
- _npos, _hint ) )
- {
-
- _mesh._tria.node
- (_npos)->fdim()
- = _node->fdim() ;
-
- _mesh._tria.node
- (_npos)->feat()
- = _node->feat() ;
-
- _mesh._tria.node
- (_npos)->topo() = 2 ;
-
- _hint = _mesh._tria.
- node(_npos)->next() ;
-
- }
- }
-
- /*------------------------------ seed mesh from init. */
- for (auto _iter = _iset.head();
- _iter != _iset.tend();
- ++_iter )
- {
- if (*_iter == _imid) continue;
-
- auto _node =
- &_init._mesh._set1 [*_iter] ;
-
- iptr_type _npos = -1 ;
- if (_mesh._tria.push_node(
- &_node->pval(0) ,
- _npos, _hint ) )
- {
-
- _mesh._tria.node
- (_npos)->fdim()
- = _node->fdim() ;
-
- _mesh._tria.node
- (_npos)->feat()
- = _node->feat() ;
-
- _mesh._tria.node
- (_npos)->topo() = 2 ;
-
- _hint = _mesh._tria.
- node(_npos)->next() ;
-
- }
- }
- }
-
template <
typename init_type
>
@@ -809,6 +638,14 @@
init_type &_init,
hfun_type &_hfun,
mesh_type &_mesh,
+ typename
+ mesh_type::edge_list & _epro,
+ typename
+ mesh_type::edge_list & _ebad,
+ typename
+ mesh_type::face_list & _fpro,
+ typename
+ mesh_type::face_list & _fbad,
rdel_opts &_opts
)
{
@@ -852,8 +689,17 @@
real_type _plen[ 3] = {
_pmax[ 0] - _pmin[ 0] ,
_pmax[ 1] - _pmin[ 1] ,
- _pmax[ 2] - _pmin[ 2] ,
- } ;
+ _pmax[ 2] - _pmin[ 2] } ;
+
+ real_type _scal =
+ (real_type)+0.0 ;
+ _scal = std::max(
+ _scal , _plen[ 0]);
+ _scal = std::max(
+ _scal , _plen[ 1]);
+ _scal = std::max(
+ _scal , _plen[ 2]);
+
_plen[ 0]*= (real_type)+2.0 ;
_plen[ 1]*= (real_type)+2.0 ;
_plen[ 2]*= (real_type)+2.0 ;
@@ -900,10 +746,16 @@
_geom.
seed_feat(_mesh, _opts) ;
- /*------------------------------ seed mesh from init. */
-
- init_init(_init, _mesh) ;
-
+ /*------------------------------ seed node from init. */
+ real_type _NEAR =
+ _scal *_opts.near() *
+ _scal *_opts.near() ;
+
+ init_init(_init, _mesh ,
+ _epro, _ebad ,
+ _fpro, _fbad ,
+ _NEAR) ;
+
/*------------------------------ seed mesh from geom. */
_geom.
seed_mesh(_mesh, _opts) ;
@@ -983,15 +835,15 @@
/*------------------------------ alloc. for hash obj. */
_mesh._eset._lptr. set_count (
_mesh._tria._tset.count()*+6 ,
- containers::loose_alloc, nullptr) ;
+ containers::loose_alloc, nullptr);
_mesh._fset._lptr. set_count (
_mesh._tria._tset.count()*+4 ,
- containers::loose_alloc, nullptr) ;
+ containers::loose_alloc, nullptr);
_mesh._tset._lptr. set_count (
_mesh._tria._tset.count()*+1 ,
- containers::loose_alloc, nullptr) ;
+ containers::loose_alloc, nullptr);
/*------------------------------ init. topo hash obj. */
typename
@@ -999,6 +851,12 @@
typename mesh_type::edge_hash(),
typename mesh_type::edge_pred(),
+.8,_mesh._eset.get_alloc()) ;
+
+ typename
+ mesh_type::edge_list _ebad (
+ typename mesh_type::edge_hash(),
+ typename mesh_type::edge_pred(),
+ +.8,_mesh._eset.get_alloc()) ;
typename
mesh_type::face_list _fpro (
@@ -1006,19 +864,26 @@
typename mesh_type::face_pred(),
+.8,_mesh._fset.get_alloc()) ;
+ typename
+ mesh_type::face_list _fbad (
+ typename mesh_type::face_hash(),
+ typename mesh_type::face_pred(),
+ +.8,_mesh._fset.get_alloc()) ;
+
/*------------------------------ init. point counters */
containers:: fixed_array<
iptr_type,
rdel_opts::last_kind> _enod;
+ _enod.fill( +0 ) ;
+
containers:: fixed_array<
iptr_type,
rdel_opts::last_kind> _fnod;
+ _fnod.fill( +0 ) ;
+
containers:: fixed_array<
iptr_type,
rdel_opts::last_kind> _tnod;
-
- _enod.fill( +0 ) ;
- _fnod.fill( +0 ) ;
_tnod.fill( +0 ) ;
/*------------------------------ initialise mesh obj. */
@@ -1027,7 +892,24 @@
# endif//__use_timers
init_mesh( _geom , _init, _hfun,
- _mesh, _args ) ;
+ _mesh, _epro ,
+ _ebad, _fpro ,
+ _fbad, _args ) ;
+
+ if (_ebad.count() > +0)
+ {
+ _dump.push("\n");
+ _dump.push(
+ "**input warning: initial edge(s) not recovered! \n") ;
+ _dump.push("\n");
+ }
+ if (_fbad.count() > +0)
+ {
+ _dump.push("\n");
+ _dump.push(
+ "**input warning: initial face(s) not recovered! \n") ;
+ _dump.push("\n");
+ }
# ifdef __use_timers
_ttoc = _time.now() ;
diff --git a/src/libcpp/rdel_mesh/rdel_params.hpp b/src/libcpp/rdel_mesh/rdel_params.hpp
index faf08ab..1818450 100644
--- a/src/libcpp/rdel_mesh/rdel_params.hpp
+++ b/src/libcpp/rdel_mesh/rdel_params.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 20 February, 2019
+ * Last updated: 10 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -70,52 +70,54 @@
enum node_kind {
null_kind = +0 ,
fail_kind ,
- circ_kind , // "circ"-type refinement
- sink_kind , // "sink"-type off-centre
- offH_kind , // "size"-type off-centre
- offC_kind , // "circ"-type off-centre
- offE_kind , // "err."-type off-centre
- offT_kind , // "topo"-type off-centre
- last_kind } ;
+ circ_kind , // "circ"-type refinement
+ sink_kind , // "sink"-type off-centre
+ offH_kind , // "size"-type off-centre
+ offC_kind , // "circ"-type off-centre
+ offE_kind , // "err."-type off-centre
+ offT_kind , // "topo"-type off-centre
+ last_kind } ;
- iptr_type _verb ; // logfile output verbosity
+ iptr_type _verb ; // logfile output verbosity
- iptr_type _seed ; // no. init. "seed" nodes
+ iptr_type _seed ; // no. init. "seed" nodes
- real_type _phi1 ; // 1-"hard" angle tolerance
- real_type _phi2 ; // 2-"hard" angle tolerance
+ real_type _phi1 ; // 1-"hard" angle tolerance
+ real_type _phi2 ; // 2-"hard" angle tolerance
- real_type _eta1 ; // 1-"soft" angle tolerance
- real_type _eta2 ; // 2-"soft" angle tolerance
+ real_type _eta1 ; // 1-"soft" angle tolerance
+ real_type _eta2 ; // 2-"soft" angle tolerance
- bool_type _feat ; // true for feature calc.
+ bool_type _feat ; // true for feature calc.
- iptr_type _dims ; // topo. dimensions to mesh
+ real_type _near ; // "zip" tolerance for IC's
+
+ iptr_type _dims ; // topo. dimensions to mesh
- iptr_type _iter ; // max. num. refine iter.
+ iptr_type _iter ; // max. num. refine iter.
- iptr_type _rule ; // rule for cell refinement
+ iptr_type _rule ; // rule for cell refinement
- real_type _siz1 ; // 1-dim. element size mul.
- real_type _siz2 ; // 2-dim. element size mul.
- real_type _siz3 ; // 3-dim. element size mul.
+ real_type _siz1 ; // 1-dim. element size mul.
+ real_type _siz2 ; // 2-dim. element size mul.
+ real_type _siz3 ; // 3-dim. element size mul.
- real_type _eps1 ; // 1-dim. 1-hausdorff error
- real_type _eps2 ; // 2-dim. 2-hausdorff error
+ real_type _eps1 ; // 1-dim. 1-hausdorff error
+ real_type _eps2 ; // 2-dim. 2-hausdorff error
- real_type _rad2 ; // 2-dim. radius-edge ratio
- real_type _rad3 ; // 3-dim. radius-edge ratio
+ real_type _rad2 ; // 2-dim. radius-edge ratio
+ real_type _rad3 ; // 3-dim. radius-edge ratio
- real_type _off2 ; // 2-off. radius-edge ratio
- real_type _off3 ; // 3-off. radius-edge ratio
+ real_type _off2 ; // 2-off. radius-edge ratio
+ real_type _off3 ; // 3-off. radius-edge ratio
- real_type _snk2 ; // 2-dim. sink "safe" ratio
- real_type _snk3 ; // 3-dim. sink "safe" ratio
+ real_type _snk2 ; // 2-dim. sink "safe" ratio
+ real_type _snk3 ; // 3-dim. sink "safe" ratio
- real_type _vol3 ; // volume-length ratio
+ real_type _vol3 ; // volume-length ratio
- bool_type _top1 ; // impose 1-"manifold-ness"
- bool_type _top2 ; // impose 2-"manifold-ness"
+ bool_type _top1 ; // impose 1-"manifold-ness"
+ bool_type _top2 ; // impose 2-"manifold-ness"
public :
@@ -174,6 +176,8 @@
_eta2(real_type(+ 45.)) ,
_feat(bool_type(false)) ,
+
+ _near(real_type(1.E-8)) ,
_dims(iptr_type(+ 3)) ,
@@ -248,6 +252,11 @@
{ return this->_feat ;
}
+ __inline_call real_type & near (
+ )
+ { return this->_near ;
+ }
+
__inline_call iptr_type & dims (
)
{ return this->_dims ;
@@ -359,6 +368,11 @@
) const
{ return this->_feat ;
}
+
+ __inline_call real_type const& near (
+ ) const
+ { return this->_near ;
+ }
__inline_call iptr_type const& dims (
) const
@@ -432,7 +446,7 @@
}
-# endif // __RDEL_PARAMS__
+# endif // __RDEL_PARAMS__
diff --git a/src/libcpp/rdel_mesh/rdel_sink_delfront_2.inc b/src/libcpp/rdel_mesh/rdel_sink_delfront_2.inc
index b300c3a..e7fd4ac 100644
--- a/src/libcpp/rdel_mesh/rdel_sink_delfront_2.inc
+++ b/src/libcpp/rdel_mesh/rdel_sink_delfront_2.inc
@@ -64,57 +64,57 @@
)
{
class sink_pred
- {
+ {
/*-------------------- helper: find "sink" candidates */
- public :
-
- typedef typename
- mesh_type::tria_type tria_type ;
-
- public :
- iptr_type _tnod[ 3] ;
+ public :
+
+ typedef typename
+ mesh_type::tria_type tria_type ;
+
+ public :
+ iptr_type _tnod[ 3] ;
- public :
- __inline_call sink_pred (
- iptr_type*_tsrc
- )
- {
- this->_tnod[0] = _tsrc[ 0];
- this->_tnod[1] = _tsrc[ 1];
- this->_tnod[2] = _tsrc[ 2];
- }
+ public :
+ __inline_call sink_pred (
+ iptr_type*_tsrc
+ )
+ {
+ this->_tnod[0] = _tsrc[ 0];
+ this->_tnod[1] = _tsrc[ 1];
+ this->_tnod[2] = _tsrc[ 2];
+ }
- __inline_call bool_type operator() (
- tria_type&_tria,
- iptr_type _tpos,
- iptr_type _epos
- )
- {
- iptr_type _nadj[3] = {
- _tria.tria(_tpos)->node(0),
- _tria.tria(_tpos)->node(1),
- _tria.tria(_tpos)->node(2)
- } ;
-
- __unreferenced(_epos) ;
-
- iptr_type _same = +0;
- if (_nadj[0] == _tnod[0] ||
- _nadj[0] == _tnod[1] ||
- _nadj[0] == _tnod[2] )
- _same += +1 ;
- if (_nadj[1] == _tnod[0] ||
- _nadj[1] == _tnod[1] ||
- _nadj[1] == _tnod[2] )
- _same += +1 ;
- if (_nadj[2] == _tnod[0] ||
- _nadj[2] == _tnod[1] ||
- _nadj[2] == _tnod[2] )
- _same += +1 ;
-
- return _same >= +1 ;
- }
- } ;
+ __inline_call bool_type operator() (
+ tria_type&_tria,
+ iptr_type _tpos,
+ iptr_type _epos
+ )
+ {
+ iptr_type _nadj[3] = {
+ _tria.tria(_tpos)->node(0),
+ _tria.tria(_tpos)->node(1),
+ _tria.tria(_tpos)->node(2)
+ } ;
+
+ __unreferenced(_epos) ;
+
+ iptr_type _same = +0;
+ if (_nadj[0] == _tnod[0] ||
+ _nadj[0] == _tnod[1] ||
+ _nadj[0] == _tnod[2] )
+ _same += +1 ;
+ if (_nadj[1] == _tnod[0] ||
+ _nadj[1] == _tnod[1] ||
+ _nadj[1] == _tnod[2] )
+ _same += +1 ;
+ if (_nadj[2] == _tnod[0] ||
+ _nadj[2] == _tnod[1] ||
+ _nadj[2] == _tnod[2] )
+ _same += +1 ;
+
+ return _same >= +1 ;
+ }
+ } ;
typename rdel_opts::node_kind
_kind = rdel_opts::null_kind ;
diff --git a/src/libcpp/rdel_mesh/rdel_sink_delfront_3.inc b/src/libcpp/rdel_mesh/rdel_sink_delfront_3.inc
index dae2023..1eee356 100644
--- a/src/libcpp/rdel_mesh/rdel_sink_delfront_3.inc
+++ b/src/libcpp/rdel_mesh/rdel_sink_delfront_3.inc
@@ -64,62 +64,62 @@
)
{
class sink_pred
- {
+ {
/*-------------------- helper: find "sink" candidates */
- public :
-
- typedef typename
- mesh_type::tria_type tria_type ;
-
- public :
- iptr_type _fnod[ 3] ;
+ public :
+
+ typedef typename
+ mesh_type::tria_type tria_type ;
+
+ public :
+ iptr_type _fnod[ 3] ;
- public :
- __inline_call sink_pred (
- iptr_type*_fsrc
- )
- {
- this->_fnod[0] = _fsrc[ 0];
- this->_fnod[1] = _fsrc[ 1];
- this->_fnod[2] = _fsrc[ 2];
- }
+ public :
+ __inline_call sink_pred (
+ iptr_type*_fsrc
+ )
+ {
+ this->_fnod[0] = _fsrc[ 0];
+ this->_fnod[1] = _fsrc[ 1];
+ this->_fnod[2] = _fsrc[ 2];
+ }
- __inline_call bool_type operator() (
- tria_type&_tria,
- iptr_type _tpos,
- iptr_type _fpos
- )
- {
- iptr_type _tnod[4] = {
- _tria.tria(_tpos)->node(0),
- _tria.tria(_tpos)->node(1),
- _tria.tria(_tpos)->node(2),
- _tria.tria(_tpos)->node(3)
- } ;
-
- __unreferenced(_fpos) ;
-
- iptr_type _same = +0;
- if (_tnod[0] == _fnod[0] ||
- _tnod[0] == _fnod[1] ||
- _tnod[0] == _fnod[2] )
- _same += +1 ;
- if (_tnod[1] == _fnod[0] ||
- _tnod[1] == _fnod[1] ||
- _tnod[1] == _fnod[2] )
- _same += +1 ;
- if (_tnod[2] == _fnod[0] ||
- _tnod[2] == _fnod[1] ||
- _tnod[2] == _fnod[2] )
- _same += +1 ;
- if (_tnod[3] == _fnod[0] ||
- _tnod[3] == _fnod[1] ||
- _tnod[3] == _fnod[2] )
- _same += +1 ;
-
- return ( _same >= +1 ) ;
- }
- } ;
+ __inline_call bool_type operator() (
+ tria_type&_tria,
+ iptr_type _tpos,
+ iptr_type _fpos
+ )
+ {
+ iptr_type _tnod[4] = {
+ _tria.tria(_tpos)->node(0),
+ _tria.tria(_tpos)->node(1),
+ _tria.tria(_tpos)->node(2),
+ _tria.tria(_tpos)->node(3)
+ } ;
+
+ __unreferenced(_fpos) ;
+
+ iptr_type _same = +0;
+ if (_tnod[0] == _fnod[0] ||
+ _tnod[0] == _fnod[1] ||
+ _tnod[0] == _fnod[2] )
+ _same += +1 ;
+ if (_tnod[1] == _fnod[0] ||
+ _tnod[1] == _fnod[1] ||
+ _tnod[1] == _fnod[2] )
+ _same += +1 ;
+ if (_tnod[2] == _fnod[0] ||
+ _tnod[2] == _fnod[1] ||
+ _tnod[2] == _fnod[2] )
+ _same += +1 ;
+ if (_tnod[3] == _fnod[0] ||
+ _tnod[3] == _fnod[1] ||
+ _tnod[3] == _fnod[2] )
+ _same += +1 ;
+
+ return ( _same >= +1 ) ;
+ }
+ } ;
typename rdel_opts::node_kind
_kind = rdel_opts::null_kind ;
@@ -263,67 +263,67 @@
)
{
class sink_pred
- {
+ {
/*-------------------- helper: find "sink" candidates */
- public :
-
- typedef typename
- mesh_type::tria_type tria_type ;
-
- public :
- iptr_type _tnod[ 4] ;
+ public :
+
+ typedef typename
+ mesh_type::tria_type tria_type ;
+
+ public :
+ iptr_type _tnod[ 4] ;
- public :
- __inline_call sink_pred (
- iptr_type*_tsrc
- )
- {
- this->_tnod[0] = _tsrc[ 0];
- this->_tnod[1] = _tsrc[ 1];
- this->_tnod[2] = _tsrc[ 2];
- this->_tnod[3] = _tsrc[ 3];
- }
+ public :
+ __inline_call sink_pred (
+ iptr_type*_tsrc
+ )
+ {
+ this->_tnod[0] = _tsrc[ 0];
+ this->_tnod[1] = _tsrc[ 1];
+ this->_tnod[2] = _tsrc[ 2];
+ this->_tnod[3] = _tsrc[ 3];
+ }
- __inline_call bool_type operator() (
- tria_type&_tria,
- iptr_type _tpos,
- iptr_type _fpos
- )
- {
- iptr_type _nadj[4] = {
- _tria.tria(_tpos)->node(0),
- _tria.tria(_tpos)->node(1),
- _tria.tria(_tpos)->node(2),
- _tria.tria(_tpos)->node(3)
- } ;
-
- __unreferenced(_fpos) ;
-
- iptr_type _same = +0;
- if (_nadj[0] == _tnod[0] ||
- _nadj[0] == _tnod[1] ||
- _nadj[0] == _tnod[2] ||
- _nadj[0] == _tnod[3] )
- _same += +1 ;
- if (_nadj[1] == _tnod[0] ||
- _nadj[1] == _tnod[1] ||
- _nadj[1] == _tnod[2] ||
- _nadj[1] == _tnod[3] )
- _same += +1 ;
- if (_nadj[2] == _tnod[0] ||
- _nadj[2] == _tnod[1] ||
- _nadj[2] == _tnod[2] ||
- _nadj[2] == _tnod[3] )
- _same += +1 ;
- if (_nadj[3] == _tnod[0] ||
- _nadj[3] == _tnod[1] ||
- _nadj[3] == _tnod[2] ||
- _nadj[3] == _tnod[3] )
- _same += +1 ;
-
- return _same >= +1 ;
- }
- } ;
+ __inline_call bool_type operator() (
+ tria_type&_tria,
+ iptr_type _tpos,
+ iptr_type _fpos
+ )
+ {
+ iptr_type _nadj[4] = {
+ _tria.tria(_tpos)->node(0),
+ _tria.tria(_tpos)->node(1),
+ _tria.tria(_tpos)->node(2),
+ _tria.tria(_tpos)->node(3)
+ } ;
+
+ __unreferenced(_fpos) ;
+
+ iptr_type _same = +0;
+ if (_nadj[0] == _tnod[0] ||
+ _nadj[0] == _tnod[1] ||
+ _nadj[0] == _tnod[2] ||
+ _nadj[0] == _tnod[3] )
+ _same += +1 ;
+ if (_nadj[1] == _tnod[0] ||
+ _nadj[1] == _tnod[1] ||
+ _nadj[1] == _tnod[2] ||
+ _nadj[1] == _tnod[3] )
+ _same += +1 ;
+ if (_nadj[2] == _tnod[0] ||
+ _nadj[2] == _tnod[1] ||
+ _nadj[2] == _tnod[2] ||
+ _nadj[2] == _tnod[3] )
+ _same += +1 ;
+ if (_nadj[3] == _tnod[0] ||
+ _nadj[3] == _tnod[1] ||
+ _nadj[3] == _tnod[2] ||
+ _nadj[3] == _tnod[3] )
+ _same += +1 ;
+
+ return _same >= +1 ;
+ }
+ } ;
typename rdel_opts::node_kind
_kind = rdel_opts::null_kind ;
diff --git a/src/libcpp/rdel_mesh/rdel_test_bounds_2.inc b/src/libcpp/rdel_mesh/rdel_test_bounds_2.inc
index 3d7fd6c..7d83f48 100644
--- a/src/libcpp/rdel_mesh/rdel_test_bounds_2.inc
+++ b/src/libcpp/rdel_mesh/rdel_test_bounds_2.inc
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 24 January, 2019
+ * Last updated: 09 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -60,20 +60,9 @@
edat_list &_ecav
)
{
- /*------------------------- init. for local hash obj. */
- typename
- mesh_type::edge_list _eset (
- typename mesh_type::edge_hash(),
- typename mesh_type::edge_pred(),
- +.8, _mesh._eset.get_alloc()) ;
-
+ /*------------------------- extract restricted k-face */
__unreferenced(_geom) ;
- /*------------------------- push alloc. for hash obj. */
- _eset._lptr.set_count (
- _tset.count() * +3 ,
- containers::loose_alloc, nullptr);
-
for ( auto _tpos = _tset.head();
_tpos != _tset.tend();
++_tpos )
@@ -105,14 +94,11 @@
typename mesh_type::
edge_list::
- item_type *_mptr=nullptr;
- if (_eset.find(_fdat,_mptr))
- continue ;
+ item_type *_mptr=nullptr ;
if (_mesh.
- find_edge(_fdat,_mptr))
- _ecav.push_tail(_mptr->_data);
-
- _eset.push( _fdat) ;
+ find_edge(_fdat, _mptr))
+ _ecav.
+ push_tail(_mptr->_data);
}
}
}
@@ -344,6 +330,11 @@
edat_list &_eold
)
{
+ __unreferenced( _geom ) ;
+ __unreferenced( _told ) ;
+
+ if (_epro.count() > +0)
+ {
/*------------------------- init. for local hash obj. */
typename
mesh_type::edge_list _eset (
@@ -354,11 +345,8 @@
/*------------------------- push alloc. for hash obj. */
_eset._lptr.set_count (
_enew.count() * +2 ,
- containers::loose_alloc, nullptr);
-
- __unreferenced( _geom );
- __unreferenced( _told );
-
+ containers::loose_alloc,nullptr) ;
+
for ( auto _epos = _enew.head();
_epos != _enew.tend();
++_epos )
@@ -382,7 +370,8 @@
}
}
}
-
+ }
+
return false ;
}
diff --git a/src/libcpp/rdel_mesh/rdel_test_bounds_3.inc b/src/libcpp/rdel_mesh/rdel_test_bounds_3.inc
index 1d166b0..bfc779b 100644
--- a/src/libcpp/rdel_mesh/rdel_test_bounds_3.inc
+++ b/src/libcpp/rdel_mesh/rdel_test_bounds_3.inc
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 24 January, 2019
+ * Last updated: 09 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -61,28 +61,9 @@
fdat_list &_fcav
)
{
- /*------------------------- init. for local hash obj. */
- typename
- mesh_type::edge_list _eset (
- typename mesh_type::edge_hash(),
- typename mesh_type::edge_pred(),
- +.8, _mesh._eset.get_alloc()) ;
- typename
- mesh_type::face_list _fset (
- typename mesh_type::face_hash(),
- typename mesh_type::face_pred(),
- +.8, _mesh._fset.get_alloc()) ;
-
+ /*------------------------- extract restricted k-face */
__unreferenced(_geom) ;
- /*------------------------- push alloc. for hash obj. */
- _eset._lptr.set_count (
- _tset.count() * +6 ,
- containers::loose_alloc, nullptr);
- _fset._lptr.set_count (
- _tset.count() * +4 ,
- containers::loose_alloc, nullptr);
-
for ( auto _tpos = _tset.head();
_tpos != _tset.tend();
++_tpos )
@@ -114,14 +95,11 @@
typename mesh_type::
edge_list::
- item_type *_mptr=nullptr;
- if (_eset.find(_fdat,_mptr))
- continue ;
+ item_type *_mptr=nullptr ;
if (_mesh.
- find_edge(_fdat,_mptr))
- _ecav.push_tail(_mptr->_data);
-
- _eset.push( _fdat) ;
+ find_edge(_fdat, _mptr))
+ _ecav.
+ push_tail(_mptr->_data);
}
/*------------------------- extract restricted 2-face */
for ( auto _fpos = 4; _fpos-- != 0; )
@@ -155,19 +133,15 @@
typename mesh_type::
face_list::
- item_type *_mptr=nullptr;
- if (_fset.find(_fdat,_mptr))
- continue ;
+ item_type *_mptr=nullptr ;
if (_mesh.
- find_face(_fdat,_mptr))
- _fcav.push_tail(_mptr->_data);
-
- _fset.push( _fdat) ;
+ find_face(_fdat, _mptr))
+ _fcav.
+ push_tail(_mptr->_data);
}
}
}
-
/*
--------------------------------------------------------
* _CAV-BNDS: return TRUE if encroachment found.
@@ -563,41 +537,29 @@
fdat_list &_fold
)
{
+ __unreferenced( _geom ) ;
+ __unreferenced( _told ) ;
+
+ if (_epro.count() > +0)
+ {
/*------------------------- init. for local hash obj. */
typename
mesh_type::edge_list _eset (
typename mesh_type::edge_hash(),
typename mesh_type::edge_pred(),
+.8, _mesh._eset.get_alloc()) ;
- typename
- mesh_type::face_list _fset (
- typename mesh_type::face_hash(),
- typename mesh_type::face_pred(),
- +.8, _mesh._fset.get_alloc()) ;
-
+
/*------------------------- push alloc. for hash obj. */
_eset._lptr.set_count (
_enew.count() * +2 ,
- containers::loose_alloc, nullptr);
- _fset._lptr.set_count (
- _fnew.count() * +2 ,
- containers::loose_alloc, nullptr);
-
- __unreferenced( _geom );
- __unreferenced( _told );
-
+ containers::loose_alloc,nullptr) ;
+
for ( auto _epos = _enew.head();
_epos != _enew.tend();
++_epos )
{
_eset.push(*_epos) ;
}
- for ( auto _fpos = _fnew.head();
- _fpos != _fnew.tend();
- ++_fpos )
- {
- _fset.push(*_fpos) ;
- }
for ( auto _epos = _eold.head();
_epos != _eold.tend();
@@ -615,6 +577,28 @@
}
}
}
+ }
+
+ if (_fpro.count() > +0)
+ {
+ /*------------------------- init. for local hash obj. */
+ typename
+ mesh_type::face_list _fset (
+ typename mesh_type::face_hash(),
+ typename mesh_type::face_pred(),
+ +.8, _mesh._fset.get_alloc()) ;
+
+ /*------------------------- push alloc. for hash obj. */
+ _fset._lptr.set_count (
+ _fnew.count() * +2 ,
+ containers::loose_alloc,nullptr) ;
+
+ for ( auto _fpos = _fnew.head();
+ _fpos != _fnew.tend();
+ ++_fpos )
+ {
+ _fset.push(*_fpos) ;
+ }
for ( auto _fpos = _fold.head();
_fpos != _fold.tend();
@@ -632,6 +616,7 @@
}
}
}
+ }
return false ;
}
diff --git a/src/libcpp/rdel_mesh/rvor_mesh_2.hpp b/src/libcpp/rdel_mesh/rvor_mesh_2.hpp
index c6ac21f..08bbc30 100644
--- a/src/libcpp/rdel_mesh/rvor_mesh_2.hpp
+++ b/src/libcpp/rdel_mesh/rvor_mesh_2.hpp
@@ -61,16 +61,16 @@
/*--------- restricted voronoi mesh-generation in R^2 */
- typedef M mesh_type ;
- typedef P mesh_pred ;
- typedef G geom_type ;
- typedef H hfun_type ;
- typedef A allocator ;
+ typedef M mesh_type ;
+ typedef P mesh_pred ;
+ typedef G geom_type ;
+ typedef H hfun_type ;
+ typedef A allocator ;
typedef typename
- mesh_type::real_type real_type ;
+ mesh_type::real_type real_type ;
typedef typename
- mesh_type::iptr_type iptr_type ;
+ mesh_type::iptr_type iptr_type ;
char_type static constexpr null_ball = +0 ;
char_type static constexpr feat_ball = +1 ;
@@ -102,54 +102,54 @@
} ;
typedef typename
- mesh_type::node_data node_data ;
+ mesh_type::node_data node_data ;
typedef typename
- mesh_type::ball_data ball_data ;
+ mesh_type::ball_data ball_data ;
typedef typename
- mesh_type::edge_data edge_data ;
+ mesh_type::edge_data edge_data ;
typedef typename
- mesh_type::tria_data tria_data ;
+ mesh_type::tria_data tria_data ;
typedef mesh::rdel_params <
real_type,
- iptr_type > rdel_opts ;
+ iptr_type > rdel_opts ;
typedef containers::array <
- iptr_type > iptr_list ;
+ iptr_type > iptr_list ;
/*------------------------------------------ cavity lists */
typedef containers::array <
- edge_data > edat_list ;
+ edge_data > edat_list ;
typedef containers::array <
- edge_cost > escr_list ;
+ edge_cost > escr_list ;
typedef containers::array <
- tria_data > tdat_list ;
+ tria_data > tdat_list ;
typedef containers::array <
- tria_cost > tscr_list ;
+ tria_cost > tscr_list ;
/*------------------------------------------ refine lists */
typedef containers::priorityset <
node_data,
- node_pred > node_heap ;
+ node_pred > node_heap ;
typedef containers::priorityset <
edge_cost,
- edge_pred > edge_heap ;
+ edge_pred > edge_heap ;
typedef containers::priorityset <
tria_cost,
- tria_pred > tria_heap ;
+ tria_pred > tria_heap ;
/*------------------------------------------ collar lists */
typedef containers::array <
- ball_data > ball_list ;
+ ball_data > ball_list ;
typedef containers::priorityset <
ball_data,
- ball_pred > ball_heap ;
+ ball_pred > ball_heap ;
class node_pred
{
diff --git a/src/libcpp/rdel_mesh/rvor_mesh_3.hpp b/src/libcpp/rdel_mesh/rvor_mesh_3.hpp
index 2d31749..dec71bf 100644
--- a/src/libcpp/rdel_mesh/rvor_mesh_3.hpp
+++ b/src/libcpp/rdel_mesh/rvor_mesh_3.hpp
@@ -61,16 +61,16 @@
/*--------- restricted voronoi mesh-generation in R^3 */
- typedef M mesh_type ;
- typedef P mesh_pred ;
- typedef G geom_type ;
- typedef H hfun_type ;
- typedef A allocator ;
+ typedef M mesh_type ;
+ typedef P mesh_pred ;
+ typedef G geom_type ;
+ typedef H hfun_type ;
+ typedef A allocator ;
typedef typename
- mesh_type::real_type real_type ;
+ mesh_type::real_type real_type ;
typedef typename
- mesh_type::iptr_type iptr_type ;
+ mesh_type::iptr_type iptr_type ;
} ;
diff --git a/src/libcpp/tessellate/delaunay_tri_k.hpp b/src/libcpp/tessellate/delaunay_tri_k.hpp
index fb86c72..0ef6511 100644
--- a/src/libcpp/tessellate/delaunay_tri_k.hpp
+++ b/src/libcpp/tessellate/delaunay_tri_k.hpp
@@ -98,17 +98,17 @@
/*------------------------- delaunay triangulation in R^k */
public :
- typedef N node_type ;
- typedef T tria_type ;
- typedef A allocator ;
- typedef P tria_pred ;
+ typedef N node_type ;
+ typedef T tria_type ;
+ typedef A allocator ;
+ typedef P tria_pred ;
typedef typename
- node_type::real_type real_type ;
+ node_type::real_type real_type ;
typedef typename
- tria_type::iptr_type iptr_type ;
+ tria_type::iptr_type iptr_type ;
- typedef char_type fptr_type ;
+ typedef char_type fptr_type ;
/*------------------------- alternative to "static const" */
@@ -126,41 +126,41 @@
node_type,
tria_type,
tria_pred,
- allocator > self_type ;
+ allocator > self_type ;
typedef typename
- tria_pred::face_ptrs face_ptrs ;
+ tria_pred::face_ptrs face_ptrs ;
typedef typename
- tria_pred::face_hash face_hash ;
+ tria_pred::face_hash face_hash ;
typedef typename
- tria_pred::face_same face_same ;
+ tria_pred::face_same face_same ;
iptr_type static constexpr pool_byte_size = 96*1024 ;
typedef allocators::_pool_alloc <
allocators::basic_alloc ,
- pool_byte_size > pool_base ;
+ pool_byte_size > pool_base ;
typedef allocators::_wrap_alloc <
- pool_base > pool_wrap ;
+ pool_base > pool_wrap ;
typedef containers::hash_table <
face_ptrs ,
face_hash ,
face_same ,
- pool_wrap > hash_list ;
+ pool_wrap > hash_list ;
typedef containers::block_array <
node_type ,
- allocator > node_list ;
+ allocator > node_list ;
typedef containers::block_array <
tria_type ,
- allocator > tria_list ;
+ allocator > tria_list ;
typedef containers::array <
iptr_type ,
- allocator > iptr_list ;
+ allocator > iptr_list ;
public :
diff --git a/src/liblib/init_jig_t.hpp b/src/liblib/init_jig_t.hpp
index 68e5cc0..142d609 100644
--- a/src/liblib/init_jig_t.hpp
+++ b/src/liblib/init_jig_t.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 31 July, 2018
+ * Last updated: 10 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -72,7 +72,10 @@
_jcfg->_geom_feat = (indx_t) +0 ;
_jcfg->_geom_eta1 = (real_t) +45.0 ;
_jcfg->_geom_eta2 = (real_t) +45.0 ;
-
+
+ /*------------------------------------- INIT keywords */
+ _jcfg->_init_near = (real_t) +1.E-8;
+
/*------------------------------------- HFUN keywords */
_jcfg->_hfun_scal = JIGSAW_HFUN_RELATIVE ;
_jcfg->_hfun_hmax = (real_t) +0.02 ;
diff --git a/src/liblib/load_jig_t.hpp b/src/liblib/load_jig_t.hpp
index 9b0e675..07731f5 100644
--- a/src/liblib/load_jig_t.hpp
+++ b/src/liblib/load_jig_t.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 31 July, 2018
+ * Last updated: 10 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -111,6 +111,15 @@
this->
_jjig->_geom_eta2 = _eta2;
}
+
+ /*------------------------------------- INIT keywords */
+ __normal_call void_type push_init_near (
+ double _near
+ )
+ {
+ this->
+ _jjig->_init_near = _near;
+ }
/*------------------------------------- HFUN keywords */
__normal_call void_type push_hfun_scal (
diff --git a/src/liblib/save_jig_t.hpp b/src/liblib/save_jig_t.hpp
index 1949a58..e09fa94 100644
--- a/src/liblib/save_jig_t.hpp
+++ b/src/liblib/save_jig_t.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 30 July, 2018
+ * Last updated: 10 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -96,6 +96,9 @@
_jcfg->_geom_eta1 << "\n" ;
_file << "GEOM_ETA2 = " <<
_jcfg->_geom_eta2 << "\n" ;
+
+ _file << "INIT_NEAR = " <<
+ _jcfg->_init_near << "\n" ;
/*--------------------------------- HFUN keywords */
if (_jcfg->_hfun_scal ==
diff --git a/uni/test_1.c b/uni/test_1.c
index 12bc8cd..f138497 100644
--- a/uni/test_1.c
+++ b/uni/test_1.c
@@ -3,6 +3,9 @@
// -Xlinker -rpath=../lib/LNX-64
// -L ../lib/LNX-64 -ljigsaw64r -o test_1
+// A simple example to start: use JIGSAW to mesh a square
+// domain.
+
# include "../inc/lib_jigsaw.h"
# include "stdio.h"
@@ -77,11 +80,11 @@
_jjig._mesh_dims = +2 ;
_retv = jigsaw (
- &_jjig, // the config. opts
- &_geom, // geom. data
- NULL, // empty init. data
- NULL, // empty hfun. data
- &_mesh) ;
+ &_jjig , // the config. opts
+ &_geom , // geom. data
+ NULL , // empty init. data
+ NULL , // empty hfun. data
+ &_mesh ) ;
/*-------------------------------- print JIGSAW tria. */
@@ -118,7 +121,7 @@
jigsaw_free_msh_t(&_mesh);
printf (
- "JIGSAW returned code: %d \n", _retv) ;
+ "JIGSAW returned code : %d \n",_retv);
return _retv ;
diff --git a/uni/test_2.c b/uni/test_2.c
index cddd32e..7479405 100644
--- a/uni/test_2.c
+++ b/uni/test_2.c
@@ -3,6 +3,9 @@
// -Xlinker -rpath=../lib/LNX-64
// -L ../lib/LNX-64 -ljigsaw64r -o test_2
+// Use JIGSAW to mesh a simple geometry with user-defined
+// mesh-spacing data defined on a "mesh".
+
# include "../inc/lib_jigsaw.h"
# include "stdio.h"
@@ -130,11 +133,11 @@
_jjig._mesh_dims = +2 ;
_retv = jigsaw (
- &_jjig, // the config. opts
- &_geom, // geom. data
- NULL, // empty init. data
- &_hfun, // hfun. data
- &_mesh) ;
+ &_jjig , // the config. opts
+ &_geom , // geom. data
+ NULL , // empty init. data
+ &_hfun , // hfun. data
+ &_mesh ) ;
/*-------------------------------- print JIGSAW tria. */
@@ -171,7 +174,7 @@
jigsaw_free_msh_t(&_mesh);
printf (
- "JIGSAW returned code: %i \n", _retv) ;
+ "JIGSAW returned code : %d \n",_retv);
return _retv ;
diff --git a/uni/test_3.c b/uni/test_3.c
index aff4f04..0be31f4 100644
--- a/uni/test_3.c
+++ b/uni/test_3.c
@@ -3,6 +3,9 @@
// -Xlinker -rpath=../lib/LNX-64
// -L ../lib/LNX-64 -ljigsaw64r -o test_3
+// Use JIGSAW to mesh a simple geometry with user-defined
+// mesh-spacing data defined on a "grid".
+
# include "../inc/lib_jigsaw.h"
# include "stdio.h"
@@ -126,11 +129,11 @@
_jjig._mesh_dims = +2 ;
_retv = jigsaw (
- &_jjig, // the config. opts
- &_geom, // geom. data
- NULL, // empty init. data
- &_hfun, // hfun. data
- &_mesh) ;
+ &_jjig , // the config. opts
+ &_geom , // geom. data
+ NULL , // empty init. data
+ &_hfun , // hfun. data
+ &_mesh ) ;
/*-------------------------------- print JIGSAW tria. */
@@ -167,7 +170,7 @@
jigsaw_free_msh_t(&_mesh);
printf (
- "JIGSAW returned code: %i \n", _retv) ;
+ "JIGSAW returned code : %d \n",_retv);
return _retv ;
diff --git a/uni/test_4.c b/uni/test_4.c
index cc88132..8dcf13b 100644
--- a/uni/test_4.c
+++ b/uni/test_4.c
@@ -3,6 +3,9 @@
// -Xlinker -rpath=../lib/LNX-64
// -L ../lib/LNX-64 -ljigsaw64r -o test_4
+// An example that uses JIGSAW to mesh "multiply-connected"
+// geometry.
+
# include "../inc/lib_jigsaw.h"
# include "stdio.h"
@@ -98,11 +101,11 @@
_jjig._mesh_dims = +2 ;
_retv = jigsaw (
- &_jjig, // the config. opts
- &_geom, // geom. data
- NULL, // empty init. data
- NULL, // empty hfun. data
- &_mesh) ;
+ &_jjig , // the config. opts
+ &_geom , // geom. data
+ NULL , // empty init. data
+ NULL , // empty hfun. data
+ &_mesh ) ;
/*-------------------------------- print JIGSAW tria. */
@@ -139,7 +142,7 @@
jigsaw_free_msh_t(&_mesh);
printf (
- "JIGSAW returned code: %d \n", _retv) ;
+ "JIGSAW returned code : %d \n",_retv);
return _retv ;
diff --git a/uni/test_5.c b/uni/test_5.c
index 119b88b..f14b475 100644
--- a/uni/test_5.c
+++ b/uni/test_5.c
@@ -3,6 +3,8 @@
// -Xlinker -rpath=../lib/LNX-64
// -L ../lib/LNX-64 -ljigsaw64r -o test_5
+// An example that uses TRIPOD to build a "restricted" DT.
+
# include "../inc/lib_jigsaw.h"
# include "stdio.h"
@@ -68,7 +70,7 @@
_geom._edge2._data = &_edge2[0] ;
_geom._edge2._size = +4 ;
- /*-------------------------------- points for r-tria. */
+ /*-------------------------------- pts to triangulate */
jigsaw_VERT2_t _point[9] = {
{ {0., 0.}, +0 } ,
@@ -88,19 +90,19 @@
_init._vert2._data = &_point[0] ;
_init._vert2._size = +9 ;
- /*-------------------------------- build JIGSAW tria. */
+ /*-------------------------------- build TRIPOD r-DT. */
_jjig._verbosity = +1 ;
_jjig._mesh_dims = +2 ;
_retv = tripod (
- &_jjig, // the config. opts
- &_init, // init. data
- &_geom, // geom. data
- &_tria) ;
-
- /*-------------------------------- print JIGSAW tria. */
+ &_jjig , // the config. opts
+ &_init , // init. data
+ &_geom , // geom. data
+ &_tria ) ;
+
+ /*-------------------------------- print TRIPOD r-DT. */
printf("\n VERT2: \n\n") ;
@@ -135,7 +137,7 @@
jigsaw_free_msh_t(&_tria);
printf (
- "TRIPOD returned code: %d \n", _retv) ;
+ "TRIPOD returned code : %d \n",_retv);
return _retv ;
diff --git a/uni/test_6.c b/uni/test_6.c
new file mode 100644
index 0000000..2d5de46
--- /dev/null
+++ b/uni/test_6.c
@@ -0,0 +1,161 @@
+
+// gcc -Wall test_6.c
+// -Xlinker -rpath=../lib/LNX-64
+// -L ../lib/LNX-64 -ljigsaw64r -o test_6
+
+// Use JIGSAW to mesh a simple domain, but starting from
+// user-defined initial-conditions.
+
+# include "../inc/lib_jigsaw.h"
+
+# include "stdio.h"
+
+ int main (
+ int _argc ,
+ char **_argv
+ )
+ {
+ int _retv = 0;
+
+ /*-------------------------------- setup JIGSAW types */
+ jigsaw_jig_t _jjig ;
+ jigsaw_msh_t _geom ;
+ jigsaw_msh_t _init ;
+ jigsaw_msh_t _mesh ;
+
+ jigsaw_init_jig_t(&_jjig) ;
+ jigsaw_init_msh_t(&_geom) ;
+ jigsaw_init_msh_t(&_init) ;
+ jigsaw_init_msh_t(&_mesh) ;
+
+ /*
+ --------------------------------------------------------
+ * A simple square domain
+ --------------------------------------------------------
+ *
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | |
+ * | |
+ * e:3 | | e:1
+ * | |
+ * | |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
+ *
+ --------------------------------------------------------
+ */
+
+ jigsaw_VERT2_t _vert2[4] = { // setup geom.
+ { {0., 0.}, +0 } ,
+ { {1., 0.}, +0 } ,
+ { {1., 1.}, +0 } ,
+ { {0., 1.}, +0 }
+ } ;
+
+ jigsaw_EDGE2_t _edge2[4] = {
+ { {+0, +1}, +0 } ,
+ { {+1, +2}, +0 } ,
+ { {+2, +3}, +0 } ,
+ { {+3, +0}, +0 }
+ } ;
+
+ _geom._flags
+ = JIGSAW_EUCLIDEAN_MESH;
+
+ _geom._vert2._data = &_vert2[0] ;
+ _geom._vert2._size = +4 ;
+
+ _geom._edge2._data = &_edge2[0] ;
+ _geom._edge2._size = +4 ;
+
+ /*-------------------------------- form init. config. */
+
+ jigsaw_VERT2_t _point[4] = {
+ { {0., 0.}, +0 } ,
+ { {0., .5}, +0 } ,
+ { {0., 1.}, +0 } ,
+ { {.5, .5}, +0 }
+ } ;
+
+ jigsaw_EDGE2_t _edges[3] = {
+ { {+0, +1}, -1 } , // -1 => "un-refinable"
+ { {+1, +2}, -1 } ,
+ { {+2, +3}, -1 }
+ } ;
+
+ _init._flags
+ = JIGSAW_EUCLIDEAN_MESH;
+
+ _init._vert2._data = &_point[0] ;
+ _init._vert2._size = +4 ;
+
+ _init._edge2._data = &_edges[0] ;
+ _init._edge2._size = +3 ;
+
+ /*-------------------------------- build JIGSAW tria. */
+
+ _jjig._verbosity = +1 ;
+
+ _jjig._hfun_hmax = 0.33 ;
+ _jjig._hfun_scal =
+ JIGSAW_HFUN_RELATIVE;
+
+ _jjig._mesh_dims = +2 ;
+ _jjig._geom_feat = +1 ;
+ _jjig._mesh_top1 = +1 ;
+
+ _jjig._optm_iter = +0 ;
+
+ _retv = jigsaw (
+ &_jjig , // the config. opts
+ &_geom , // geom. data
+ &_init , // init. data
+ NULL , // empty hfun. data
+ &_mesh ) ;
+
+ /*-------------------------------- print JIGSAW tria. */
+
+ printf("\n VERT2: \n\n") ;
+
+ for (indx_t _ipos = +0;
+ _ipos != _mesh._vert2._size ;
+ ++_ipos )
+ {
+ printf("%1.4f, %1.4f\n",
+ _mesh._vert2.
+ _data[_ipos]._ppos[0],
+ _mesh._vert2.
+ _data[_ipos]._ppos[1]
+ ) ;
+ }
+
+ printf("\n TRIA3: \n\n") ;
+
+ for (indx_t _ipos = +0;
+ _ipos != _mesh._tria3._size ;
+ ++_ipos )
+ {
+ printf("%d, %d, %d\n",
+ _mesh._tria3.
+ _data[_ipos]._node[0],
+ _mesh._tria3.
+ _data[_ipos]._node[1],
+ _mesh._tria3.
+ _data[_ipos]._node[2]
+ ) ;
+ }
+
+ jigsaw_free_msh_t(&_mesh);
+
+ printf (
+ "JIGSAW returned code : %d \n",_retv);
+
+
+ return _retv ;
+ }
+
+
+
diff --git a/version.txt b/version.txt
index 75f9a61..1241657 100644
--- a/version.txt
+++ b/version.txt
@@ -13,8 +13,15 @@
# JIGSAW: an unstructured mesh generation library
#------------------------------------------------------------
- * Version 0.9.8:
- -------------
+ * Version 0.9.10:
+ --------------
+
+ - Improved support for initial conditions, allow-
+ ing "un-refinable" edges/faces to be specified.
+
+
+ * Version 0.9.8 :
+ --------------
- Support for "multi-part" domains and "internal"
constraints. An additional geometry index BOUND
@@ -44,15 +51,15 @@
"sharp-features" in R^3.
- * Version 0.9.6:
- -------------
+ * Version 0.9.6 :
+ --------------
- Support for definition of initial distributions
via INIT_FILE.
- * Version 0.9.5:
- -------------
+ * Version 0.9.5 :
+ --------------
- Support for generalised 'regular-power' grids -
a 'weighted' variant of the 'standard' Voronoi-
@@ -65,8 +72,8 @@
OPTM_DUAL=TRUE.
- * Version 0.9.4:
- -------------
+ * Version 0.9.4 :
+ --------------
- Support for a new iterative mesh-optimisation
algorithm. Improvements to mesh-quality metrics
@@ -76,8 +83,8 @@
'merge' and 'split' predicates.
- * Version 0.9.3:
- -------------
+ * Version 0.9.3 :
+ --------------
- Support for user-defined mesh-spacing functions
via HFUN_FILE, allowing general mesh-size info-
@@ -85,8 +92,8 @@
uctured background grids.
- * Version 0.9.2:
- -------------
+ * Version 0.9.2 :
+ --------------
- Improvements to the 2-dimensional mesh generat-
or, including full detection and protection of
@@ -94,8 +101,8 @@
ometry.
- * Version 0.9.1:
- -------------
+ * Version 0.9.1 :
+ --------------
- Support for topological constraints: 1-dim fea-
tures can be forced to be 'locally 1-manifold',
@@ -135,8 +142,8 @@
be compromised otherwise.
- * Version 0.9.0:
- -------------
+ * Version 0.9.0 :
+ --------------
- Initial BETA release.
From abc3a22718754744c83b1cdffa82724caca6ad1b Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Mon, 15 Apr 2019 09:41:59 -0400
Subject: [PATCH 02/13] Add `conda` build information
---
README.md | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index a7f4b40..564e3a5 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
-`JIGSAW` is a computational library for unstructured mesh generation and tessellation; designed to generate high-quality triangulations and polyhedral decompositions of general planar, surface and volumetric domains. `JIGSAW` includes `refinement`-based algorithms for the construction of new meshes, `optimisation`-driven techniques for the improvement of existing grids, as well as routines to assemble (restricted) Delaunay tessellations and Voronoi complexes.
+`JIGSAW` is a computational library for unstructured mesh generation and tessellation; designed to generate high-quality triangulations and polyhedral decompositions of general planar, surface and volumetric domains. `JIGSAW` includes refinement-based algorithms for the construction of new meshes, optimisation-driven techniques for the improvement of existing grids, as well as routines to assemble (restricted) Delaunay tessellations, Voronoi complexes and Power diagrams.
This package provides the underlying `C++` source for `JIGSAW`; defining a basic command-line interface and a `C`-format `API`. A `MATLAB` / `OCTAVE` based scripting interface, including a range of additional facilities for file I/O, mesh visualisation and post-processing operations can be found here.
@@ -28,29 +28,44 @@ This package provides the underlying `C++` source for `JIGSAW`; defining a basic
## `Getting Started`
-The first step is to compile the code! The `JIGSAW` src can be found in `../jigsaw/src/`.
+The first step is to compile and configure the code! `JIGSAW` can either be built directly from src, or installed using the `conda` package manager.
-`JIGSAW` is a `header-only` package - there is only the single main `jigsaw.cpp` file that simply `#include`'s the rest of the library as headers. The resulting build process should be fairly straight-forward as a result. `JIGSAW` does not currently dependent on any external packages or libraries.
+### `Install JIGSAW via conda`
+
+`JIGSAW` is available as a `conda` environment. To install and use, follow the steps below:
+
+ * Ensure you have the conda package manager installed. If not, Miniconda is a lightweight option.
+ * Add conda-forge as a channel: `conda config --add channels conda-forge`
+ * Create a jigsaw environment: `conda create -n jigsaw jigsaw`
+
+Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`
+
+Once activated, the various `JIGSAW` command-line utilities will be available in your run path, `JIGSAW`'s shared library (`libjigsaw`) will be available in your library path and its include files in your include path.
+
+### `Building JIGSAW from src`
+
+The full `JIGSAW` src can be found in `../jigsaw/src/`.
+
+`JIGSAW` is a `header-only` package - the single main `jigsaw.cpp` file simply `#include`'s the rest of the library as headers. The resulting build process should be fairly straightforward as a result. `JIGSAW` does not currently dependent on any external packages or libraries.
+
+`JIGSAW` can be built in several different ways: `(a)` as a set of command-line utilities that read and write mesh data to file, or `(b)` as a shared library accessible via a `C`-style `API`.
#### `On Linux/Mac`
`JIGSAW` has been successfully built using various versions of the `g++` and `llvm` compilers. Since the build process is a simple one-liner, there's no `make` script - instead:
- g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
- -D __cmd_jigsaw -static-libstdc++ jigsaw.cpp
- -o jigsaw64r
+ g++ -std=c++11 -pedantic -Wall -O3 -flto -D NDEBUG
+ -D __cmd_jigsaw jigsaw.cpp -o jigsaw64r
will build the main `JIGSAW` cmd-line executable,
- g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
- -D __cmd_tripod -static-libstdc++ jigsaw.cpp
- -o tripod64r
+ g++ -std=c++11 -pedantic -Wall -O3 -flto -D NDEBUG
+ -D __cmd_tripod jigsaw.cpp -o tripod64r
will build the `TRIPOD` cmd-line utility (`JIGSAW`'s tessellation infrastructure) and,
g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC -D NDEBUG
- -D __lib_jigsaw -static-libstdc++ jigsaw.cpp
- -shared -o libjigsaw64r.so
+ -D __lib_jigsaw jigsaw.cpp -shared -o libjigsaw64r.so
will build `JIGSAW` as shared library. See the headers in `../jigsaw/inc/` for details on the `API`.
From 5d8829d15070b2025a03805750c9140d31934965 Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Mon, 15 Apr 2019 09:46:46 -0400
Subject: [PATCH 03/13] Add `conda` build information
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 564e3a5..4c81b1f 100644
--- a/README.md
+++ b/README.md
@@ -34,9 +34,9 @@ The first step is to compile and configure the code! `JIGSAW` can either be buil
`JIGSAW` is available as a `conda` environment. To install and use, follow the steps below:
- * Ensure you have the conda package manager installed. If not, Miniconda is a lightweight option.
- * Add conda-forge as a channel: `conda config --add channels conda-forge`
- * Create a jigsaw environment: `conda create -n jigsaw jigsaw`
+ * Ensure you have conda installed. If not, Miniconda is a lightweight option.
+ * Add `conda-forge` as a channel: `conda config --add channels conda-forge`
+ * Create a `jigsaw` environment: `conda create -n jigsaw jigsaw`
Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`
From dccb5f8ac88949c73a6b15098d77583aa598f5d0 Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Mon, 15 Apr 2019 09:49:06 -0400
Subject: [PATCH 04/13] Add `conda` build information
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 4c81b1f..eb0aa53 100644
--- a/README.md
+++ b/README.md
@@ -35,8 +35,8 @@ The first step is to compile and configure the code! `JIGSAW` can either be buil
`JIGSAW` is available as a `conda` environment. To install and use, follow the steps below:
* Ensure you have conda installed. If not, Miniconda is a lightweight option.
- * Add `conda-forge` as a channel: `conda config --add channels conda-forge`
- * Create a `jigsaw` environment: `conda create -n jigsaw jigsaw`
+ * Add conda-forge as a channel: conda config --add channels conda-forge
+ * Create a jigsaw environment: conda create -n jigsaw jigsaw
Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`
@@ -46,7 +46,7 @@ Once activated, the various `JIGSAW` command-line utilities will be available in
The full `JIGSAW` src can be found in `../jigsaw/src/`.
-`JIGSAW` is a `header-only` package - the single main `jigsaw.cpp` file simply `#include`'s the rest of the library as headers. The resulting build process should be fairly straightforward as a result. `JIGSAW` does not currently dependent on any external packages or libraries.
+`JIGSAW` is a `header-only` package - the single main `jigsaw.cpp` file simply `#include`'s the rest of the library directly. The resulting build process should be fairly straightforward as a result. `JIGSAW` does not currently dependent on any external packages or libraries.
`JIGSAW` can be built in several different ways: `(a)` as a set of command-line utilities that read and write mesh data to file, or `(b)` as a shared library accessible via a `C`-style `API`.
From ba2537efec96ed94f408803e80a69afb8d4822fe Mon Sep 17 00:00:00 2001
From: dengwirda
Date: Tue, 16 Apr 2019 04:16:54 -0400
Subject: [PATCH 05/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
CMakeLists.txt | 4 +
README.md | 106 +-
bin/.keep | 0
bin/LNX-64/temp.txt | 3 -
bin/MAC-64/temp.txt | 3 -
bin/WIN-64/temp.txt | 3 -
example.jig | 12 +-
lib/.keep | 0
lib/LNX-64/temp.txt | 3 -
lib/MAC-64/temp.txt | 3 -
lib/WIN-64/temp.txt | 3 -
out/.keep | 0
out/temp.txt | 3 -
src/CMakeLists.txt | 17 +
src/jigsaw.cpp | 9 +-
src/libcpp/geom_base/intersect_k.hpp | 424 +++---
src/libcpp/geom_base/predicate_k.hpp | 1921 ++++++++++++--------------
src/libcpp/geom_base/tria_ball_k.hpp | 2 +-
uni/CMakeLists.txt | 36 +
uni/test_1.c | 4 +-
uni/test_2.c | 4 +-
uni/test_3.c | 4 +-
uni/test_4.c | 4 +-
uni/test_5.c | 4 +-
uni/test_6.c | 4 +-
25 files changed, 1224 insertions(+), 1352 deletions(-)
create mode 100644 CMakeLists.txt
create mode 100644 bin/.keep
delete mode 100644 bin/LNX-64/temp.txt
delete mode 100644 bin/MAC-64/temp.txt
delete mode 100644 bin/WIN-64/temp.txt
create mode 100644 lib/.keep
delete mode 100644 lib/LNX-64/temp.txt
delete mode 100644 lib/MAC-64/temp.txt
delete mode 100644 lib/WIN-64/temp.txt
create mode 100644 out/.keep
delete mode 100644 out/temp.txt
create mode 100644 src/CMakeLists.txt
create mode 100644 uni/CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..63ebd7b
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required (VERSION 3.9.4)
+project (JIGSAW)
+
+add_subdirectory ("${PROJECT_SOURCE_DIR}/src")
diff --git a/README.md b/README.md
index eb0aa53..3dddca2 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
This package provides the underlying `C++` source for `JIGSAW`; defining a basic command-line interface and a `C`-format `API`. A `MATLAB` / `OCTAVE` based scripting interface, including a range of additional facilities for file I/O, mesh visualisation and post-processing operations can be found here.
-`JIGSAW` has been compiled and tested on various `64-bit` `Linux` , `Windows` and `Mac` based platforms.
+`JIGSAW` has been compiled and tested on various `64-bit` `Linux`, `Windows` and `MacOS` based platforms.
## `Code Structure`
@@ -30,71 +30,94 @@ This package provides the underlying `C++` source for `JIGSAW`; defining a basic
The first step is to compile and configure the code! `JIGSAW` can either be built directly from src, or installed using the `conda` package manager.
-### `Install JIGSAW via conda`
-
-`JIGSAW` is available as a `conda` environment. To install and use, follow the steps below:
-
- * Ensure you have conda installed. If not, Miniconda is a lightweight option.
- * Add conda-forge as a channel: conda config --add channels conda-forge
- * Create a jigsaw environment: conda create -n jigsaw jigsaw
-
-Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`
-
-Once activated, the various `JIGSAW` command-line utilities will be available in your run path, `JIGSAW`'s shared library (`libjigsaw`) will be available in your library path and its include files in your include path.
-
### `Building JIGSAW from src`
The full `JIGSAW` src can be found in `../jigsaw/src/`.
-`JIGSAW` is a `header-only` package - the single main `jigsaw.cpp` file simply `#include`'s the rest of the library directly. The resulting build process should be fairly straightforward as a result. `JIGSAW` does not currently dependent on any external packages or libraries.
+`JIGSAW` is a `header-only` package - the single main `jigsaw.cpp` file simply `#include`'s the rest of the library directly. `JIGSAW` does not currently dependent on any external packages or libraries.
+
+`JIGSAW` consists of several pieces: `(a)` a set of command-line utilities that read and write mesh data from/to file, and `(b)` a shared library, accessible via a `C`-format `API`.
-`JIGSAW` can be built in several different ways: `(a)` as a set of command-line utilities that read and write mesh data to file, or `(b)` as a shared library accessible via a `C`-style `API`.
+#### `Using cmake`
-#### `On Linux/Mac`
+`JIGSAW` can be built using the `cmake` utility. To build, follow the steps below:
-`JIGSAW` has been successfully built using various versions of the `g++` and `llvm` compilers. Since the build process is a simple one-liner, there's no `make` script - instead:
+ * Ensure you have the cmake utility installed.
+ * Clone or download this repository.
+ * Navigate to the root `../jigsaw/` directory.
+ * Create a new temporary directory BUILD (to store the cmake build files).
+ * Navigate into the temporary directory.
+ * Execute: cmake -D CMAKE_BUILD_TYPE=BUILD_MODE ..
+ * Execute: make
+ * Execute: make install
+ * Delete the temporary directory.
- g++ -std=c++11 -pedantic -Wall -O3 -flto -D NDEBUG
- -D __cmd_jigsaw jigsaw.cpp -o jigsaw64r
-
-will build the main `JIGSAW` cmd-line executable,
+This process will build a series of executables and the shared library: `jigsaw` itself - the main command-line meshing utility, `tripod` - `JIGSAW`'s tessellation infrastructure, as well as `libjigsaw` - `JIGSAW`'s shared `API`. `BUILD_MODE` can be used to select different compiler configurations and should be either `RELEASE` or `DEBUG`.
- g++ -std=c++11 -pedantic -Wall -O3 -flto -D NDEBUG
- -D __cmd_tripod jigsaw.cpp -o tripod64r
-
-will build the `TRIPOD` cmd-line utility (`JIGSAW`'s tessellation infrastructure) and,
+See `example.jig` for documentation on calling the command-line executables, and the headers in `../jigsaw/inc/` for details on the `API`.
- g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC -D NDEBUG
- -D __lib_jigsaw jigsaw.cpp -shared -o libjigsaw64r.so
+#### `Via g++/llvm`
-will build `JIGSAW` as shared library. See the headers in `../jigsaw/inc/` for details on the `API`.
+`JIGSAW` has been successfully built using various versions of the `g++` and `llvm` compilers. The build process is a simple one-liner (from `../jigsaw/src/`):
+````
+g++ -std=c++11 -pedantic -Wall -O3 -flto -D NDEBUG
+-D __cmd_jigsaw jigsaw.cpp -o ../bin/jigsaw
+````
+will build the main `jigsaw` command-line executable,
+````
+g++ -std=c++11 -pedantic -Wall -O3 -flto -D NDEBUG
+-D __cmd_tripod jigsaw.cpp -o ../bin/tripod
+````
+will build the `tripod` command-line utility (`JIGSAW`'s tessellation infrastructure) and,
+````
+g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC -D NDEBUG
+-D __lib_jigsaw jigsaw.cpp -shared -o ../lib/libjigsaw.so
+````
+will build `JIGSAW` as a shared library (`libjigsaw`).
-#### `On Windows`
+### `Install JIGSAW via conda`
-`JIGSAW` has been successfully built using various versions of the `msvc` compiler. I do not provide a sample `msvc` project, but the following steps can be used to create one:
+`JIGSAW` is also available as a `conda` environment. To install and use, follow the steps below:
- * Create a new, empty MSVC project.
- * Import the jigsaw.cpp file, this contains the main() entry-point.
+ * Ensure you have conda installed. If not, consider miniconda as a lightweight option.
+ * Add conda-forge as a channel: conda config --add channels conda-forge
+ * Create a jigsaw environment: conda create -n jigsaw jigsaw
-#### `Folder Structure`
+Each time you want to use `JIGSAW` simply activate the environment using: `conda activate jigsaw`
-Once you have built the `JIGSAW` binaries, place them in the appropriate sub-folders in`../jigsaw/bin/` and/or `../jigsaw/lib/` directories, so that they can be found by the unit tests in `../jigsaw/uni/`.
+Once activated, the various `JIGSAW` command-line utilities will be available in your run path, `JIGSAW`'s shared library (`libjigsaw`) will be available in your library path and its include files in your include path.
## `A Simple Example`
-After compiling the code, run the following command-line example to get started:
+After compiling the code, try running the following command-line example to get started:
````
-On WIN-64 platforms:
+On WIN platforms:
-\bin\WIN-64\jigsaw64r.exe example.jig
+\bin\jigsaw.exe example.jig
-On LNX-64 platforms:
+On LNX platforms:
-/bin/LNX-64/jigsaw64r example.jig
+/bin/jigsaw example.jig
````
-In this example, a high-quality tetrahedral mesh is generated for the 'stanford-bunny' geometry and the result is written to file. The input geometry is specified as a triangulated surface, and is read from `../jigsaw/geo/bunny.msh`. The volume and surface mesh outputs are written to `../jigsaw/out/bunny.msh`. Edit `example.jig` for a description of `JIGSAW`'s configuration options.
+In this example, a high-quality tetrahedral mesh is generated for the 'stanford-bunny' geometry and the result written to file. The input geometry is specified as a triangulated surface, and is read from `../jigsaw/geo/bunny.msh`. The volume and surface mesh outputs are written to `../jigsaw/out/bunny.msh`. See the `example.jig` text-file for a description of `JIGSAW`'s configuration options.
+
+A repository of additional surface models generated using `JIGSAW` can be found here.
+
+## `API Example Code`
+
+A set of unit-tests and `libjigsaw` example programs are contained in `../jigsaw/uni/`. The `JIGSAW-API` is documented via the header files in `../jigsaw/inc/`.
-A set of unit-tests and `libjigsaw` example programs are contained in `../uni/`. The `JIGSAW-API` is documented via the header files in `../inc/`. A repository of 3D surface models generated using `JIGSAW` can be found here.
+The unit-tests can be built using the `cmake` utility. To build, follow the steps below:
+
+ * Navigate to the `../jigsaw/uni/` directory.
+ * Create a new temporary directory BUILD (to store the cmake build files).
+ * Navigate into the temporary directory.
+ * Execute: cmake -D CMAKE_BUILD_TYPE=BUILD_MODE ..
+ * Execute: make
+ * Execute: make install
+ * Delete the temporary directory.
+
+This process will build the unit-tests as a series of executables in `../jigsaw/uni/`. `BUILD_MODE` is a compiler configuration flag: either `RELEASE` or `DEBUG`.
## `License`
@@ -116,3 +139,4 @@ There are a number of publications that describe the algorithms used in `JIGSAW`
`[5]` - Darren Engwirda, Locally-optimal Delaunay-refinement and optimisation-based mesh generation, Ph.D. Thesis, School of Mathematics and Statistics, The University of Sydney, http://hdl.handle.net/2123/13148, 2014.
+
diff --git a/bin/.keep b/bin/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/bin/LNX-64/temp.txt b/bin/LNX-64/temp.txt
deleted file mode 100644
index ddc78ea..0000000
--- a/bin/LNX-64/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# to-do: place LNX binaries here and delete me!
-#
diff --git a/bin/MAC-64/temp.txt b/bin/MAC-64/temp.txt
deleted file mode 100644
index e875568..0000000
--- a/bin/MAC-64/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# to-do: place MAC binaries here and delete me!
-#
diff --git a/bin/WIN-64/temp.txt b/bin/WIN-64/temp.txt
deleted file mode 100644
index f7bcb6e..0000000
--- a/bin/WIN-64/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# to-do: place WIN binaries here and delete me!
-#
diff --git a/example.jig b/example.jig
index 1cca1e6..80506a1 100644
--- a/example.jig
+++ b/example.jig
@@ -6,17 +6,13 @@
# To run this example navigate to the directory containing
# this file and run the following from the cmd line:
#
-# On WIN-64 platforms:
+# On WIN platforms:
#
-# bin\WIN-64\jigsaw64r.exe example.jig
+# bin\jigsaw.exe example.jig
#
-# On LNX-64 platforms:
+# On LNX platforms:
#
-# bin/LNX-64/jigsaw64r example.jig
-#
-# On MAC-64 platforms:
-#
-# bin/MAC-64/jigsaw64r example.jig
+# bin/jigsaw example.jig
#
# This command calls JIGSAW using the config. data contai-
# ned in "example.jig", which, in unmodified form, creates
diff --git a/lib/.keep b/lib/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/lib/LNX-64/temp.txt b/lib/LNX-64/temp.txt
deleted file mode 100644
index ddc78ea..0000000
--- a/lib/LNX-64/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# to-do: place LNX binaries here and delete me!
-#
diff --git a/lib/MAC-64/temp.txt b/lib/MAC-64/temp.txt
deleted file mode 100644
index e875568..0000000
--- a/lib/MAC-64/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# to-do: place MAC binaries here and delete me!
-#
diff --git a/lib/WIN-64/temp.txt b/lib/WIN-64/temp.txt
deleted file mode 100644
index f7bcb6e..0000000
--- a/lib/WIN-64/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# to-do: place WIN binaries here and delete me!
-#
diff --git a/out/.keep b/out/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/out/temp.txt b/out/temp.txt
deleted file mode 100644
index 8ab8c81..0000000
--- a/out/temp.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# don't delete me! I'm here so this directory doesn't look empty...
-#
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..c804318
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,17 @@
+set (CMAKE_CXX_STANDARD 11)
+set (CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+
+add_executable (jigsaw-cmd jigsaw.cpp)
+target_compile_definitions (jigsaw-cmd PRIVATE __cmd_jigsaw)
+set_target_properties (jigsaw-cmd PROPERTIES OUTPUT_NAME jigsaw)
+install (TARGETS jigsaw-cmd DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+
+add_executable (tripod-cmd jigsaw.cpp)
+target_compile_definitions (tripod-cmd PRIVATE __cmd_tripod)
+set_target_properties (tripod-cmd PROPERTIES OUTPUT_NAME tripod)
+install (TARGETS tripod-cmd DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+
+add_library (jigsaw-lib SHARED jigsaw.cpp)
+target_compile_definitions (jigsaw-lib PRIVATE __lib_jigsaw)
+set_target_properties (jigsaw-lib PROPERTIES OUTPUT_NAME jigsaw)
+install (TARGETS jigsaw-lib DESTINATION "${PROJECT_SOURCE_DIR}/lib")
diff --git a/src/jigsaw.cpp b/src/jigsaw.cpp
index 91ecc60..3bc7c43 100644
--- a/src/jigsaw.cpp
+++ b/src/jigsaw.cpp
@@ -3,19 +3,16 @@
// for cmd-jigsaw:
//
// g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
- // -D __cmd_jigsaw -static-libstdc++ jigsaw.cpp
- // -o jigsaw64r
+ // -D __cmd_jigsaw jigsaw.cpp -o jigsaw
//
// g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
- // -D __cmd_tripod -static-libstdc++ jigsaw.cpp
- // -o tripod64r
+ // -D __cmd_tripod jigsaw.cpp -o tripod
//
//
// for lib-jigsaw:
//
// g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC
- // -D NDEBUG -D __lib_jigsaw -static-libstdc++ jigsaw.cpp
- // -shared -o libjigsaw64r.so
+ // -D NDEBUG -D __lib_jigsaw jigsaw.cpp -shared -o libjigsaw.so
//
/*
diff --git a/src/libcpp/geom_base/intersect_k.hpp b/src/libcpp/geom_base/intersect_k.hpp
index 21f4fa3..df53305 100644
--- a/src/libcpp/geom_base/intersect_k.hpp
+++ b/src/libcpp/geom_base/intersect_k.hpp
@@ -1,17 +1,4 @@
-
-
- //!! TODO:
- //!! should use dd_flt wherever an intersection
- //!! is interpolated from existing points
- //!!
- //!! should apply a careful interpolation calc.
- //!! a'la line_tria -- any existing routines
- //!! that compute a "midpoint" need updating
- //!!
-
-
-
/*
--------------------------------------------------------
* INTERSECT-K: various (robust) intersection tests.
@@ -44,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 02 March, 2019
+ * Last updated: 13 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -134,45 +121,39 @@
__write_ptr (data_type) _qb
)
{
- size_t _nn = +0;
-
- data_type _pm[2] = {
- (data_type)+.5 * (_pa[0]+_pb[0]),
- (data_type)+.5 * (_pa[1]+_pb[1])
- } ;
- data_type _pd[2] = {
- (data_type)+.5 * (_pb[0]-_pa[0]),
- (data_type)+.5 * (_pb[1]-_pa[1])
- } ;
- data_type _mc[2] = {
- (data_type)+1. * (_pm[0]-_pc[0]),
- (data_type)+1. * (_pm[1]-_pc[1])
- } ;
-
- data_type _aa = dot_2d(_pd, _pd) ;
- data_type _bb = dot_2d(_pd, _mc) *
+ data_type _vv[2] ;
+ _vv[0] = _pb[0] -_pa[0] ;
+ _vv[1] = _pb[1] -_pa[1] ;
+
+ data_type _ca[2] ;
+ _ca[0] = _pa[0] -_pc[0] ;
+ _ca[1] = _pa[1] -_pc[1] ;
+
+ data_type _aa =
+ geometry::dot_2d(_vv, _vv) ;
+ data_type _bb =
+ geometry::dot_2d(_vv, _ca) *
(data_type) +2. ;
- data_type _cc = dot_2d(_mc, _mc) ;
+ data_type _cc =
+ geometry::dot_2d(_ca, _ca) ;
_cc -= _rc * _rc ;
-
+
+ size_t _nn = +0 ;
data_type _tt[2] ;
if (polyroots(_aa, _bb, _cc, _tt))
{
- if (_tt[0] >= (data_type)-1. &&
+ if (_tt[0] >= (data_type)+0. &&
_tt[0] <= (data_type)+1. )
{
- data_type *_qq = _nn++ == +0
- ? _qa
- : _qb ;
-
- dd_flt _WB = _tt[0] ;
- _WB = (dd_flt)+1. + _WB;
- _WB = (dd_flt)+.5 * _WB;
-
- dd_flt _WA = _tt[0] ;
- _WA = (dd_flt)+1. - _WA;
- _WA = (dd_flt)+.5 * _WA;
+ /*----------------------- compute 1st-root intersect. */
+ data_type _WB =
+ (data_type)+0.+_tt[0] ;
+ data_type _WA =
+ (data_type)+1.-_tt[0] ;
+
+ _nn += +1 ;
+
dd_flt _PA[2] ;
_PA[0]=_pa[0] ;
_PA[1]=_pa[1] ;
@@ -182,30 +163,34 @@
_PB[1]=_pb[1] ;
dd_flt _QQ[2] ;
- _QQ[0]=_PA[0] * _WA +
- _PB[0] * _WB ;
- _QQ[1]=_PA[1] * _WA +
- _PB[1] * _WB ;
-
- _qq[0]=_QQ[0] ;
- _qq[1]=_QQ[1] ;
+ _QQ[0]=_PA[0] * _WA +
+ _PB[0] * _WB ;
+ _QQ[1]=_PA[1] * _WA +
+ _PB[1] * _WB ;
+
+ if (_nn == 1)
+ {
+ _qa[0]=_QQ[0] ;
+ _qa[1]=_QQ[1] ;
+ }
+ else
+ {
+ _qb[0]=_QQ[0] ;
+ _qb[1]=_QQ[1] ;
+ }
}
-
- if (_tt[1] >= (data_type)-1. &&
+ if (_tt[1] >= (data_type)+0. &&
_tt[1] <= (data_type)+1. )
- {
- data_type *_qq = _nn++ == +0
- ? _qa
- : _qb ;
-
- dd_flt _WB = _tt[1] ;
- _WB = (dd_flt)+1. + _WB;
- _WB = (dd_flt)+.5 * _WB;
+ {
+ /*----------------------- compute 2nd-root intersect. */
+ data_type _WB =
+ (data_type)+0.+_tt[1] ;
- dd_flt _WA = _tt[1] ;
- _WA = (dd_flt)+1. - _WA;
- _WA = (dd_flt)+.5 * _WA;
+ data_type _WA =
+ (data_type)+1.-_tt[1] ;
+ _nn += +1 ;
+
dd_flt _PA[2] ;
_PA[0]=_pa[0] ;
_PA[1]=_pa[1] ;
@@ -215,13 +200,21 @@
_PB[1]=_pb[1] ;
dd_flt _QQ[2] ;
- _QQ[0]=_PA[0] * _WA +
- _PB[0] * _WB ;
- _QQ[1]=_PA[1] * _WA +
- _PB[1] * _WB ;
+ _QQ[0]=_PA[0] * _WA +
+ _PB[0] * _WB ;
+ _QQ[1]=_PA[1] * _WA +
+ _PB[1] * _WB ;
- _qq[0]=_QQ[0] ;
- _qq[1]=_QQ[1] ;
+ if (_nn == 1)
+ {
+ _qa[0]=_QQ[0] ;
+ _qa[1]=_QQ[1] ;
+ }
+ else
+ {
+ _qb[0]=_QQ[0] ;
+ _qb[1]=_QQ[1] ;
+ }
}
}
@@ -240,48 +233,41 @@
__write_ptr (data_type) _qb
)
{
- size_t _nn = +0;
-
- data_type _pm[3] = {
- (data_type)+.5 * (_pa[0]+_pb[0]),
- (data_type)+.5 * (_pa[1]+_pb[1]),
- (data_type)+.5 * (_pa[2]+_pb[2])
- } ;
- data_type _pd[3] = {
- (data_type)+.5 * (_pb[0]-_pa[0]),
- (data_type)+.5 * (_pb[1]-_pa[1]),
- (data_type)+.5 * (_pb[2]-_pa[2])
- } ;
- data_type _mc[3] = {
- (data_type)+1. * (_pm[0]-_pc[0]),
- (data_type)+1. * (_pm[1]-_pc[1]),
- (data_type)+1. * (_pm[2]-_pc[2])
- } ;
-
- data_type _aa = dot_3d(_pd, _pd) ;
- data_type _bb = dot_3d(_pd, _mc) *
+ data_type _vv[3] ;
+ _vv[0] = _pb[0] -_pa[0] ;
+ _vv[1] = _pb[1] -_pa[1] ;
+ _vv[2] = _pb[2] -_pa[2] ;
+
+ data_type _ca[3] ;
+ _ca[0] = _pa[0] -_pc[0] ;
+ _ca[1] = _pa[1] -_pc[1] ;
+ _ca[2] = _pa[2] -_pc[2] ;
+
+ data_type _aa =
+ geometry::dot_3d(_vv, _vv) ;
+ data_type _bb =
+ geometry::dot_3d(_vv, _ca) *
(data_type) +2. ;
- data_type _cc = dot_3d(_mc, _mc) ;
+ data_type _cc =
+ geometry::dot_3d(_ca, _ca) ;
_cc -= _rc * _rc ;
-
+
+ size_t _nn = +0 ;
data_type _tt[2] ;
if (polyroots(_aa, _bb, _cc, _tt))
{
- if (_tt[0] >= (data_type)-1. &&
+ if (_tt[0] >= (data_type)+0. &&
_tt[0] <= (data_type)+1. )
{
- data_type *_qq = _nn++ == +0
- ? _qa
- : _qb ;
-
- dd_flt _WB = _tt[0] ;
- _WB = (dd_flt)+1. + _WB;
- _WB = (dd_flt)+.5 * _WB;
-
- dd_flt _WA = _tt[0] ;
- _WA = (dd_flt)+1. - _WA;
- _WA = (dd_flt)+.5 * _WA;
+ /*----------------------- compute 1st-root intersect. */
+ data_type _WB =
+ (data_type)+0.+_tt[0] ;
+ data_type _WA =
+ (data_type)+1.-_tt[0] ;
+
+ _nn += +1 ;
+
dd_flt _PA[3] ;
_PA[0]=_pa[0] ;
_PA[1]=_pa[1] ;
@@ -293,33 +279,38 @@
_PB[2]=_pb[2] ;
dd_flt _QQ[3] ;
- _QQ[0]=_PA[0] * _WA +
- _PB[0] * _WB ;
- _QQ[1]=_PA[1] * _WA +
- _PB[1] * _WB ;
- _QQ[2]=_PA[2] * _WA +
- _PB[2] * _WB ;
-
- _qq[0]=_QQ[0] ;
- _qq[1]=_QQ[1] ;
- _qq[2]=_QQ[2] ;
+ _QQ[0]=_PA[0] * _WA +
+ _PB[0] * _WB ;
+ _QQ[1]=_PA[1] * _WA +
+ _PB[1] * _WB ;
+ _QQ[2]=_PA[2] * _WA +
+ _PB[2] * _WB ;
+
+ if (_nn == 1)
+ {
+ _qa[0]=_QQ[0] ;
+ _qa[1]=_QQ[1] ;
+ _qa[2]=_QQ[2] ;
+ }
+ else
+ {
+ _qb[0]=_QQ[0] ;
+ _qb[1]=_QQ[1] ;
+ _qb[2]=_QQ[2] ;
+ }
}
-
- if (_tt[1] >= (data_type)-1. &&
+ if (_tt[1] >= (data_type)+0. &&
_tt[1] <= (data_type)+1. )
- {
- data_type *_qq = _nn++ == +0
- ? _qa
- : _qb ;
-
- dd_flt _WB = _tt[1] ;
- _WB = (dd_flt)+1. + _WB;
- _WB = (dd_flt)+.5 * _WB;
+ {
+ /*----------------------- compute 2nd-root intersect. */
+ data_type _WB =
+ (data_type)+0.+_tt[1] ;
- dd_flt _WA = _tt[1] ;
- _WA = (dd_flt)+1. - _WA;
- _WA = (dd_flt)+.5 * _WA;
+ data_type _WA =
+ (data_type)+1.-_tt[1] ;
+ _nn += +1 ;
+
dd_flt _PA[3] ;
_PA[0]=_pa[0] ;
_PA[1]=_pa[1] ;
@@ -331,16 +322,25 @@
_PB[2]=_pb[2] ;
dd_flt _QQ[3] ;
- _QQ[0]=_PA[0] * _WA +
- _PB[0] * _WB ;
- _QQ[1]=_PA[1] * _WA +
- _PB[1] * _WB ;
- _QQ[2]=_PA[2] * _WA +
- _PB[2] * _WB ;
+ _QQ[0]=_PA[0] * _WA +
+ _PB[0] * _WB ;
+ _QQ[1]=_PA[1] * _WA +
+ _PB[1] * _WB ;
+ _QQ[2]=_PA[2] * _WA +
+ _PB[2] * _WB ;
- _qq[0]=_QQ[0] ;
- _qq[1]=_QQ[1] ;
- _qq[2]=_QQ[2] ;
+ if (_nn == 1)
+ {
+ _qa[0]=_QQ[0] ;
+ _qa[1]=_QQ[1] ;
+ _qa[2]=_QQ[2] ;
+ }
+ else
+ {
+ _qb[0]=_QQ[0] ;
+ _qb[1]=_QQ[1] ;
+ _qb[2]=_QQ[2] ;
+ }
}
}
@@ -357,62 +357,94 @@
typename data_type
>
__inline_call bool node_rect_2d (
- __const_ptr (data_type) _pp,
- __const_ptr (data_type) _b0,
- __const_ptr (data_type) _b1
+ __const_ptr (data_type) _pp, // node
+ __const_ptr (data_type) _b0, // min. rect. B
+ __const_ptr (data_type) _b1 // max. rect. B
)
- { return _pp[0] >= _b0[0] &&
- _pp[0] <= _b1[0] &&
- _pp[1] >= _b0[1] &&
- _pp[1] <= _b1[1] ;
+ {
+ if (_pp[0] >= _b0[0] &&
+ _pp[0] <= _b1[0] &&
+ _pp[1] >= _b0[1] &&
+ _pp[1] <= _b1[1] )
+ {
+ return ( true ) ;
+ }
+ else
+ {
+ return ( false ) ;
+ }
}
template <
typename data_type
>
__inline_call bool node_rect_3d (
- __const_ptr (data_type) _pp,
- __const_ptr (data_type) _b0,
- __const_ptr (data_type) _b1
+ __const_ptr (data_type) _pp, // node
+ __const_ptr (data_type) _b0, // min. rect. B
+ __const_ptr (data_type) _b1 // max. rect. B
)
- { return _pp[0] >= _b0[0] &&
- _pp[0] <= _b1[0] &&
- _pp[1] >= _b0[1] &&
- _pp[1] <= _b1[1] &&
- _pp[2] >= _b0[2] &&
- _pp[2] <= _b1[2] ;
+ {
+ if (_pp[0] >= _b0[0] &&
+ _pp[0] <= _b1[0] &&
+ _pp[1] >= _b0[1] &&
+ _pp[1] <= _b1[1] &&
+ _pp[2] >= _b0[2] &&
+ _pp[2] <= _b1[2] )
+ {
+ return ( true ) ;
+ }
+ else
+ {
+ return ( false ) ;
+ }
}
template <
typename data_type
>
__inline_call bool rect_rect_2d (
- __const_ptr (data_type) _a0,
- __const_ptr (data_type) _a1,
- __const_ptr (data_type) _b0,
- __const_ptr (data_type) _b1
+ __const_ptr (data_type) _a0, // min. rect. A
+ __const_ptr (data_type) _a1, // max. rect. A
+ __const_ptr (data_type) _b0, // min. rect. B
+ __const_ptr (data_type) _b1 // max. rect. B
)
- { return _a0[0] <= _b1[0] &&
- _b0[0] <= _a1[0] &&
- _a0[1] <= _b1[1] &&
- _b0[1] <= _a1[1] ;
+ {
+ if (_a0[0] <= _b1[0] &&
+ _b0[0] <= _a1[0] &&
+ _a0[1] <= _b1[1] &&
+ _b0[1] <= _a1[1] )
+ {
+ return ( true ) ;
+ }
+ else
+ {
+ return ( false ) ;
+ }
}
template <
typename data_type
>
__inline_call bool rect_rect_3d (
- __const_ptr (data_type) _a0,
- __const_ptr (data_type) _a1,
- __const_ptr (data_type) _b0,
- __const_ptr (data_type) _b1
+ __const_ptr (data_type) _a0, // min. rect. A
+ __const_ptr (data_type) _a1, // max. rect. A
+ __const_ptr (data_type) _b0, // min. rect. B
+ __const_ptr (data_type) _b1 // max. rect. B
)
- { return _a0[0] <= _b1[0] &&
- _b0[0] <= _a1[0] &&
- _a0[1] <= _b1[1] &&
- _b0[1] <= _a1[1] &&
- _a0[2] <= _b1[2] &&
- _b0[2] <= _a1[2] ;
+ {
+ if (_a0[0] <= _b1[0] &&
+ _b0[0] <= _a1[0] &&
+ _a0[1] <= _b1[1] &&
+ _b0[1] <= _a1[1] &&
+ _a0[2] <= _b1[2] &&
+ _b0[2] <= _a1[2] )
+ {
+ return ( true ) ;
+ }
+ else
+ {
+ return ( false ) ;
+ }
}
/*
@@ -501,38 +533,38 @@
if (_tt == (data_type)+0.)
{
- _qq[0] = _pa[0] ;
- _qq[1] = _pa[1] ;
- _qq[2] = _pa[2] ;
+ _qq[0] = _pa[0] ;
+ _qq[1] = _pa[1] ;
+ _qq[2] = _pa[2] ;
}
else
if (_tt == (data_type)+1.)
{
- _qq[0] = _pb[0] ;
- _qq[1] = _pb[1] ;
- _qq[2] = _pb[2] ;
+ _qq[0] = _pb[0] ;
+ _qq[1] = _pb[1] ;
+ _qq[2] = _pb[2] ;
}
else
{
- dd_flt _AB[3];
- _AB[0] = _pb[0] ;
- _AB[1] = _pb[1] ;
- _AB[2] = _pb[2] ;
- _AB[0]-= _pa[0] ;
- _AB[1]-= _pa[1] ;
- _AB[2]-= _pa[2] ;
-
- dd_flt _QQ[3];
- _QQ[0] = _pa[0] ;
- _QQ[1] = _pa[1] ;
- _QQ[2] = _pa[2] ;
- _QQ[0]+= _AB[0] * _tt ;
- _QQ[1]+= _AB[1] * _tt ;
- _QQ[2]+= _AB[2] * _tt ;
-
- _qq[0] = _QQ[0] ;
- _qq[1] = _QQ[1] ;
- _qq[2] = _QQ[2] ;
+ dd_flt _AB[3] ;
+ _AB[0] = _pb[0] ;
+ _AB[1] = _pb[1] ;
+ _AB[2] = _pb[2] ;
+ _AB[0]-= _pa[0] ;
+ _AB[1]-= _pa[1] ;
+ _AB[2]-= _pa[2] ;
+
+ dd_flt _QQ[3] ;
+ _QQ[0] = _pa[0] ;
+ _QQ[1] = _pa[1] ;
+ _QQ[2] = _pa[2] ;
+ _QQ[0]+= _AB[0] * _tt ;
+ _QQ[1]+= _AB[1] * _tt ;
+ _QQ[2]+= _AB[2] * _tt ;
+
+ _qq[0] = _QQ[0] ;
+ _qq[1] = _QQ[1] ;
+ _qq[2] = _QQ[2] ;
}
return ( true ) ;
diff --git a/src/libcpp/geom_base/predicate_k.hpp b/src/libcpp/geom_base/predicate_k.hpp
index 5d46bfd..d7f9a18 100644
--- a/src/libcpp/geom_base/predicate_k.hpp
+++ b/src/libcpp/geom_base/predicate_k.hpp
@@ -42,23 +42,16 @@
/* */
/* */
/* Several geometric predicates are defined. Their parameters are all */
-/* points. Each point is an array of two or three floating-point */
+/* points. Each point is an array of two, three or four floating-point */
/* numbers. The geometric predicates, described in the papers, are */
/* */
/* orient2d(pa, pb, pc) */
-/* orient2dfast(pa, pb, pc) */
/* orient3d(pa, pb, pc, pd) */
-/* orient3dfast(pa, pb, pc, pd) */
+/* orient4d(pa, pb, pc, pd, pe) */
/* incircle(pa, pb, pc, pd) */
-/* incirclefast(pa, pb, pc, pd) */
/* insphere(pa, pb, pc, pd, pe) */
-/* inspherefast(pa, pb, pc, pd, pe) */
-/* */
-/* Those with suffix "fast" are approximate, non-robust versions. Those */
-/* without the suffix are adaptive precision, robust versions. There */
-/* are also versions with the suffices "exact" and "slow", which are */
-/* non-adaptive, exact arithmetic versions, which I use only for timings */
-/* in my arithmetic papers. */
+/* regular2(pa, pb, pc, pd) */
+/* regular3(pa, pb, pc, pd, pe) */
/* */
/* */
/* An expansion is represented by an array of floating-point numbers, */
@@ -125,25 +118,7 @@
namespace geompred
{
-/* On some machines, the exact arithmetic routines might be defeated by the */
-/* use of internal extended precision floating-point registers. Sometimes */
-/* this problem can be fixed by defining certain values to be volatile, */
-/* thus forcing them to be stored to memory and rounded off. This isn't */
-/* a great solution, though, as it slows the arithmetic down. */
-/* */
-/* To try this out, write "#define INEXACT volatile" below. Normally, */
-/* however, INEXACT should be defined to be nothing. ("#define INEXACT".) */
-
-#define INEXACT /* nothing */
-/*
-#define INEXACT volatile
- */
-
#define REAL double /* float or double */
-#define REALPRINT doubleprint
-#define REALRAND doublerand
-#define NARROWRAND narrowdoublerand
-#define UNIFORMRAND uniformdoublerand
/* Which of the following two methods of finding the absolute values is */
/* fastest is compiler-dependent. A few compilers can inline and optimize */
@@ -152,7 +127,6 @@ namespace geompred
/* mask the appropriate bit, but that's difficult to do in C. */
#define Absolute(a) ((a) >= 0.0 ? (a) : -(a))
-/* #define Absolute(a) fabs(a) */
/* Many of the operations are broken up into two pieces, a main part that */
/* performs an approximate operation, and a "tail" that computes the */
@@ -371,7 +345,7 @@ REAL splitter; /* = 2^ceiling(p / 2) + 1. Used to split floats in half. */
REAL epsilon; /* = 2^(-p). Used to estimate roundoff errors. */
/* A set of coefficients used to calculate maximum roundoff errors. */
REAL resulterrbound;
-REAL ccwerrboundA, ccwerrboundB, ccwerrboundC;
+REAL o2derrboundA, o2derrboundB, o2derrboundC;
REAL o3derrboundA, o3derrboundB, o3derrboundC;
REAL iccerrboundA, iccerrboundB, iccerrboundC;
REAL isperrboundA, isperrboundB, isperrboundC;
@@ -400,16 +374,38 @@ void exactinit()
REAL half;
REAL check, lastcheck;
int every_other;
+#ifdef LINUX
+ int cword;
+#endif /* LINUX */
+
+#ifdef CPU86
+#ifdef SINGLE
+ _control87(_PC_24, _MCW_PC); /* Set FPU control word for single precision. */
+#else /* not SINGLE */
+ _control87(_PC_53, _MCW_PC); /* Set FPU control word for double precision. */
+#endif /* not SINGLE */
+#endif /* CPU86 */
+#ifdef LINUX
+#ifdef SINGLE
+ /* cword = 4223; */
+ cword = 4210; /* set FPU control word for single precision */
+#else /* not SINGLE */
+ /* cword = 4735; */
+ cword = 4722; /* set FPU control word for double precision */
+#endif /* not SINGLE */
+ _FPU_SETCW(cword);
+#endif /* LINUX */
every_other = 1;
half = 0.5;
epsilon = 1.0;
splitter = 1.0;
check = 1.0;
- /* Repeatedly divide `epsilon' by two until it is too small to add to */
- /* one without causing roundoff. (Also check if the sum is equal to */
- /* the previous sum, for machines that round up instead of using exact */
- /* rounding. Not that this library will work on such machines anyway. */
+
+ /* Repeatedly divide `epsilon' by two until it is too small to add to */
+ /* one without causing roundoff. (Also check if the sum is equal to */
+ /* the previous sum, for machines that round up instead of using exact */
+ /* rounding. Not that these routines will work on such machines.) */
do {
lastcheck = check;
epsilon *= half;
@@ -421,19 +417,16 @@ void exactinit()
} while ((check != 1.0) && (check != lastcheck));
splitter += 1.0;
- /* Error bounds for orientation and incircle tests. */
- resulterrbound = (3.0 + 8.0 * epsilon) * epsilon;
- ccwerrboundA = (3.0 + 16.0 * epsilon) * epsilon;
- ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon;
- ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon;
- o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon;
- o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon;
- o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon;
- iccerrboundA = (10.0 + 96.0 * epsilon) * epsilon;
- iccerrboundB = (4.0 + 48.0 * epsilon) * epsilon;
- iccerrboundC = (44.0 + 576.0 * epsilon) * epsilon * epsilon;
- isperrboundA = (16.0 + 224.0 * epsilon) * epsilon;
- isperrboundB = (5.0 + 72.0 * epsilon) * epsilon;
+ /* Error bounds for orientation and insphere tests. */
+ resulterrbound = (3.0 + 8.0 * epsilon) * epsilon;
+ o2derrboundA = (3.0 + 16.0 * epsilon) * epsilon;
+ o2derrboundB = (2.0 + 12.0 * epsilon) * epsilon;
+ o2derrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon;
+ o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon;
+ o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon;
+ o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon;
+ isperrboundA = (16.0 + 224.0 * epsilon) * epsilon;
+ isperrboundB = (5.0 + 72.0 * epsilon) * epsilon;
isperrboundC = (71.0 + 1408.0 * epsilon) * epsilon * epsilon;
}
@@ -452,16 +445,14 @@ void exactinit()
int grow_expansion (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
REAL b ,
- REAL *h ) /* e and h can be the same. */
+ __write_ptr(REAL) h ) /* e and h can be the same. */
{
- REAL Q;
- INEXACT REAL Qnew;
+ REAL Q, Qnew;
int eindex;
REAL enow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL bvirt, avirt, bround, around;
Q = b;
for (eindex = 0; eindex < elen; eindex++) {
@@ -489,16 +480,14 @@ int grow_expansion (
int grow_expansion_zeroelim (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
REAL b ,
- REAL *h ) /* e and h can be the same. */
+ __write_ptr(REAL) h ) /* e and h can be the same. */
{
- REAL Q, hh;
- INEXACT REAL Qnew;
+ REAL Q, hh, Qnew;
int eindex, hindex;
REAL enow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL bvirt, avirt, bround, around;
hindex = 0;
Q = b;
@@ -531,18 +520,16 @@ int grow_expansion_zeroelim (
int expansion_sum (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h )
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h )
/* e and h can be the same, but f and h cannot. */
{
- REAL Q;
- INEXACT REAL Qnew;
+ REAL Q, Qnew;
int findex, hindex, hlast;
REAL hnow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL bvirt, avirt, bround, around;
Q = f[0];
for (hindex = 0; hindex < elen; hindex++) {
@@ -580,18 +567,16 @@ int expansion_sum (
int expansion_sum_zeroelim1 (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h )
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h )
/* e and h can be the same, but f and h cannot. */
{
- REAL Q;
- INEXACT REAL Qnew;
+ REAL Q, Qnew;
int index, findex, hindex, hlast;
REAL hnow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL bvirt, avirt, bround, around;
Q = f[0];
for (hindex = 0; hindex < elen; hindex++) {
@@ -640,18 +625,16 @@ int expansion_sum_zeroelim1 (
int expansion_sum_zeroelim2 (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h )
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h )
/* e and h can be the same, but f and h cannot. */
{
- REAL Q, hh;
- INEXACT REAL Qnew;
+ REAL Q, hh, Qnew;
int eindex, findex, hindex, hlast;
REAL enow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL bvirt, avirt, bround, around;
hindex = 0;
Q = f[0];
@@ -697,15 +680,13 @@ int expansion_sum_zeroelim2 (
int fast_expansion_sum (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h ) /* h cannot be e or f. */
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h ) /* h cannot be e or f. */
{
- REAL Q;
- INEXACT REAL Qnew;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL Q, Qnew;
+ REAL bvirt, avirt, bround, around;
int eindex, findex, hindex;
REAL enow, fnow;
@@ -774,16 +755,13 @@ int fast_expansion_sum (
int fast_expansion_sum_zeroelim (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h ) /* h cannot be e or f. */
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h ) /* h cannot be e or f. */
{
- REAL Q;
- INEXACT REAL Qnew;
- INEXACT REAL hh;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL Q, Qnew, hh;
+ REAL bvirt, avirt, bround, around;
int eindex, findex, hindex;
REAL enow, fnow;
@@ -859,19 +837,15 @@ int fast_expansion_sum_zeroelim (
int linear_expansion_sum (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h ) /* h cannot be e or f. */
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h ) /* h cannot be e or f. */
{
- REAL Q, q;
- INEXACT REAL Qnew;
- INEXACT REAL R;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL Q, q, Qnew, R;
+ REAL bvirt, avirt, bround, around;
int eindex, findex, hindex;
- REAL enow, fnow;
- REAL g0;
+ REAL enow, fnow, g0;
enow = e[0];
fnow = f[0];
@@ -923,20 +897,16 @@ int linear_expansion_sum (
int linear_expansion_sum_zeroelim (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
int flen,
- REAL *f ,
- REAL *h )/* h cannot be e or f. */
+ __const_ptr(REAL) f ,
+ __write_ptr(REAL) h ) /* h cannot be e or f. */
{
- REAL Q, q, hh;
- INEXACT REAL Qnew;
- INEXACT REAL R;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
+ REAL Q, q, hh, Qnew, R;
+ REAL bvirt, avirt, bround, around;
int eindex, findex, hindex;
int count;
- REAL enow, fnow;
- REAL g0;
+ REAL enow, fnow, g0;
enow = e[0];
fnow = f[0];
@@ -997,21 +967,15 @@ int linear_expansion_sum_zeroelim (
int scale_expansion (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
REAL b ,
- REAL *h ) /* e and h cannot be the same. */
+ __write_ptr(REAL) h ) /* e and h cannot be the same. */
{
- INEXACT REAL Q;
- INEXACT REAL sum;
- INEXACT REAL product1;
- REAL product0;
+ REAL Q, sum, product1, product0;
int eindex, hindex;
REAL enow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
Split(b, bhi, blo);
@@ -1046,21 +1010,16 @@ int scale_expansion (
int scale_expansion_zeroelim (
int elen,
- REAL *e ,
+ __const_ptr(REAL) e ,
REAL b ,
- REAL *h ) /* e and h cannot be the same. */
+ __write_ptr(REAL) h ) /* e and h cannot be the same. */
{
- INEXACT REAL Q, sum;
- REAL hh;
- INEXACT REAL product1;
- REAL product0;
+ REAL Q, sum, hh;
+ REAL product1, product0;
int eindex, hindex;
REAL enow;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
Split(b, bhi, blo);
@@ -1101,13 +1060,12 @@ int scale_expansion_zeroelim (
int compress (
int elen,
- REAL *e ,
- REAL *h ) /* e and h may be the same. */
+ __const_ptr(REAL) e ,
+ __write_ptr(REAL) h ) /* e and h may be the same. */
{
- REAL Q, q;
- INEXACT REAL Qnew;
+ REAL Q, q, Qnew;
int eindex, hindex;
- INEXACT REAL bvirt;
+ REAL bvirt;
REAL enow, hnow;
int top, bottom;
@@ -1146,7 +1104,7 @@ int compress (
REAL estimate (
int elen,
- REAL *e )
+ __const_ptr(REAL) e )
{
REAL Q;
int eindex;
@@ -1160,9 +1118,6 @@ REAL estimate (
/*****************************************************************************/
/* */
-/* orient2dfast() Approximate 2D orientation test. Nonrobust. */
-/* orient2dexact() Exact 2D orientation test. Robust. */
-/* orient2dslow() Another exact 2D orientation test. Robust. */
/* orient2d() Adaptive exact 2D orientation test. Robust. */
/* */
/* Return a positive value if the points pa, pb, and pc occur */
@@ -1171,9 +1126,6 @@ REAL estimate (
/* result is also a rough approximation of twice the signed */
/* area of the triangle defined by the three points. */
/* */
-/* Only the first and last routine should be used; the middle two are for */
-/* timings. */
-/* */
/* The last three use exact arithmetic to ensure a correct answer. The */
/* result returned is the determinant of a matrix. In orient2d() only, */
/* this determinant is computed adaptively, in the sense that exact */
@@ -1184,40 +1136,22 @@ REAL estimate (
/* */
/*****************************************************************************/
-REAL orient2dfast (
- REAL *pa,
- REAL *pb,
- REAL *pc)
-{
- REAL acx, bcx, acy, bcy;
-
- acx = pa[0] - pc[0];
- bcx = pb[0] - pc[0];
- acy = pa[1] - pc[1];
- bcy = pb[1] - pc[1];
- return acx * bcy - acy * bcx;
-}
-
REAL orient2dexact (
- REAL *pa,
- REAL *pb,
- REAL *pc)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc)
{
- INEXACT REAL axby1, axcy1, bxcy1, bxay1, cxay1, cxby1;
+ REAL axby1, axcy1, bxcy1, bxay1, cxay1, cxby1;
REAL axby0, axcy0, bxcy0, bxay0, cxay0, cxby0;
REAL aterms[4], bterms[4], cterms[4];
- INEXACT REAL aterms3, bterms3, cterms3;
+ REAL aterms3, bterms3, cterms3;
REAL v[8], w[12];
int vlength, wlength;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
Two_Product(pa[0], pb[1], axby1, axby0);
Two_Product(pa[0], pc[1], axcy1, axcy0);
@@ -1243,77 +1177,27 @@ REAL orient2dexact (
return w[wlength - 1];
}
-REAL orient2dslow (
- REAL *pa,
- REAL *pb,
- REAL *pc)
-{
- INEXACT REAL acx, acy, bcx, bcy;
- REAL acxtail, acytail;
- REAL bcxtail, bcytail;
- REAL negate, negatetail;
- REAL axby[8], bxay[8];
- INEXACT REAL axby7, bxay7;
- REAL deter[16];
- int deterlen;
-
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL a0hi, a0lo, a1hi, a1lo, bhi, blo;
- REAL err1, err2, err3;
- INEXACT REAL _i, _j, _k, _l, _m, _n;
- REAL _0, _1, _2;
-
- Two_Diff(pa[0], pc[0], acx, acxtail);
- Two_Diff(pa[1], pc[1], acy, acytail);
- Two_Diff(pb[0], pc[0], bcx, bcxtail);
- Two_Diff(pb[1], pc[1], bcy, bcytail);
-
- Two_Two_Product(acx, acxtail, bcy, bcytail,
- axby7, axby[6], axby[5], axby[4],
- axby[3], axby[2], axby[1], axby[0]);
- axby[7] = axby7;
- negate = -acy;
- negatetail = -acytail;
- Two_Two_Product(bcx, bcxtail, negate, negatetail,
- bxay7, bxay[6], bxay[5], bxay[4],
- bxay[3], bxay[2], bxay[1], bxay[0]);
- bxay[7] = bxay7;
-
- deterlen = fast_expansion_sum_zeroelim(8, axby, 8, bxay, deter);
-
- return deter[deterlen - 1];
-}
-
REAL orient2dadapt (
- REAL *pa,
- REAL *pb,
- REAL *pc,
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
REAL detsum)
{
- INEXACT REAL acx, acy, bcx, bcy;
+ REAL acx, acy, bcx, bcy;
REAL acxtail, acytail, bcxtail, bcytail;
- INEXACT REAL detleft, detright;
+ REAL detleft, detright;
REAL detlefttail, detrighttail;
REAL det, errbound;
REAL B[4], C1[8], C2[12], D[16];
- INEXACT REAL B3;
+ REAL B3;
int C1length, C2length, Dlength;
REAL u[4];
- INEXACT REAL u3;
- INEXACT REAL s1, t1;
- REAL s0, t0;
-
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL u3, s1, t1, s0, t0;
+
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
acx = (REAL) (pa[0] - pc[0]);
bcx = (REAL) (pb[0] - pc[0]);
@@ -1328,7 +1212,7 @@ REAL orient2dadapt (
B[3] = B3;
det = estimate(4, B);
- errbound = ccwerrboundB * detsum;
+ errbound = o2derrboundB * detsum;
if ((det >= errbound) || (-det >= errbound)) {
return det;
}
@@ -1343,7 +1227,7 @@ REAL orient2dadapt (
return det;
}
- errbound = ccwerrboundC * detsum + resulterrbound * Absolute(det);
+ errbound = o2derrboundC * detsum + resulterrbound * Absolute(det);
det += (acx * bcytail + bcy * acxtail)
- (acy * bcxtail + bcx * acytail);
if ((det >= errbound) || (-det >= errbound)) {
@@ -1372,9 +1256,9 @@ REAL orient2dadapt (
}
REAL orient2d (
- REAL *pa,
- REAL *pb,
- REAL *pc)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc)
{
REAL detleft, detright, det;
REAL detsum, errbound;
@@ -1399,7 +1283,7 @@ REAL orient2d (
return det;
}
- errbound = ccwerrboundA * detsum;
+ errbound = o2derrboundA * detsum;
if ((det >= errbound) || (-det >= errbound)) {
return det;
}
@@ -1409,9 +1293,6 @@ REAL orient2d (
/*****************************************************************************/
/* */
-/* orient3dfast() Approximate 3D orientation test. Nonrobust. */
-/* orient3dexact() Exact 3D orientation test. Robust. */
-/* orient3dslow() Another exact 3D orientation test. Robust. */
/* orient3d() Adaptive exact 3D orientation test. Robust. */
/* */
/* Return a positive value if the point pd lies below the */
@@ -1423,9 +1304,6 @@ REAL orient2d (
/* times the signed volume of the tetrahedron defined by the */
/* four points. */
/* */
-/* Only the first and last routine should be used; the middle two are for */
-/* timings. */
-/* */
/* The last three use exact arithmetic to ensure a correct answer. The */
/* result returned is the determinant of a matrix. In orient3d() only, */
/* this determinant is computed adaptively, in the sense that exact */
@@ -1436,39 +1314,14 @@ REAL orient2d (
/* */
/*****************************************************************************/
-REAL orient3dfast (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
-{
- REAL adx, bdx, cdx;
- REAL ady, bdy, cdy;
- REAL adz, bdz, cdz;
-
- adx = pa[0] - pd[0];
- bdx = pb[0] - pd[0];
- cdx = pc[0] - pd[0];
- ady = pa[1] - pd[1];
- bdy = pb[1] - pd[1];
- cdy = pc[1] - pd[1];
- adz = pa[2] - pd[2];
- bdz = pb[2] - pd[2];
- cdz = pc[2] - pd[2];
-
- return adx * (bdy * cdz - bdz * cdy)
- + bdx * (cdy * adz - cdz * ady)
- + cdx * (ady * bdz - adz * bdy);
-}
-
REAL orient3dexact (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd)
{
- INEXACT REAL axby1, bxcy1, cxdy1, dxay1, axcy1, bxdy1;
- INEXACT REAL bxay1, cxby1, dxcy1, axdy1, cxay1, dxby1;
+ REAL axby1, bxcy1, cxdy1, dxay1, axcy1, bxdy1;
+ REAL bxay1, cxby1, dxcy1, axdy1, cxay1, dxby1;
REAL axby0, bxcy0, cxdy0, dxay0, axcy0, bxdy0;
REAL bxay0, cxby0, dxcy0, axdy0, cxay0, dxby0;
REAL ab[4], bc[4], cd[4], da[4], ac[4], bd[4];
@@ -1484,14 +1337,10 @@ REAL orient3dexact (
int deterlen;
int i;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
Two_Product(pa[0], pb[1], axby1, axby0);
Two_Product(pb[0], pa[1], bxay1, bxay0);
@@ -1542,116 +1391,20 @@ REAL orient3dexact (
return deter[deterlen - 1];
}
-REAL orient3dslow (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
-{
- INEXACT REAL adx, ady, adz, bdx, bdy, bdz, cdx, cdy, cdz;
- REAL adxtail, adytail, adztail;
- REAL bdxtail, bdytail, bdztail;
- REAL cdxtail, cdytail, cdztail;
- REAL negate, negatetail;
- INEXACT REAL axby7, bxcy7, axcy7, bxay7, cxby7, cxay7;
- REAL axby[8], bxcy[8], axcy[8], bxay[8], cxby[8], cxay[8];
- REAL temp16[16], temp32[32], temp32t[32];
- int temp16len, temp32len, temp32tlen;
- REAL adet[64], bdet[64], cdet[64];
- int alen, blen, clen;
- REAL abdet[128];
- int ablen;
- REAL deter[192];
- int deterlen;
-
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL a0hi, a0lo, a1hi, a1lo, bhi, blo;
- REAL err1, err2, err3;
- INEXACT REAL _i, _j, _k, _l, _m, _n;
- REAL _0, _1, _2;
-
- Two_Diff(pa[0], pd[0], adx, adxtail);
- Two_Diff(pa[1], pd[1], ady, adytail);
- Two_Diff(pa[2], pd[2], adz, adztail);
- Two_Diff(pb[0], pd[0], bdx, bdxtail);
- Two_Diff(pb[1], pd[1], bdy, bdytail);
- Two_Diff(pb[2], pd[2], bdz, bdztail);
- Two_Diff(pc[0], pd[0], cdx, cdxtail);
- Two_Diff(pc[1], pd[1], cdy, cdytail);
- Two_Diff(pc[2], pd[2], cdz, cdztail);
-
- Two_Two_Product(adx, adxtail, bdy, bdytail,
- axby7, axby[6], axby[5], axby[4],
- axby[3], axby[2], axby[1], axby[0]);
- axby[7] = axby7;
- negate = -ady;
- negatetail = -adytail;
- Two_Two_Product(bdx, bdxtail, negate, negatetail,
- bxay7, bxay[6], bxay[5], bxay[4],
- bxay[3], bxay[2], bxay[1], bxay[0]);
- bxay[7] = bxay7;
- Two_Two_Product(bdx, bdxtail, cdy, cdytail,
- bxcy7, bxcy[6], bxcy[5], bxcy[4],
- bxcy[3], bxcy[2], bxcy[1], bxcy[0]);
- bxcy[7] = bxcy7;
- negate = -bdy;
- negatetail = -bdytail;
- Two_Two_Product(cdx, cdxtail, negate, negatetail,
- cxby7, cxby[6], cxby[5], cxby[4],
- cxby[3], cxby[2], cxby[1], cxby[0]);
- cxby[7] = cxby7;
- Two_Two_Product(cdx, cdxtail, ady, adytail,
- cxay7, cxay[6], cxay[5], cxay[4],
- cxay[3], cxay[2], cxay[1], cxay[0]);
- cxay[7] = cxay7;
- negate = -cdy;
- negatetail = -cdytail;
- Two_Two_Product(adx, adxtail, negate, negatetail,
- axcy7, axcy[6], axcy[5], axcy[4],
- axcy[3], axcy[2], axcy[1], axcy[0]);
- axcy[7] = axcy7;
-
- temp16len = fast_expansion_sum_zeroelim(8, bxcy, 8, cxby, temp16);
- temp32len = scale_expansion_zeroelim(temp16len, temp16, adz, temp32);
- temp32tlen = scale_expansion_zeroelim(temp16len, temp16, adztail, temp32t);
- alen = fast_expansion_sum_zeroelim(temp32len, temp32, temp32tlen, temp32t,
- adet);
-
- temp16len = fast_expansion_sum_zeroelim(8, cxay, 8, axcy, temp16);
- temp32len = scale_expansion_zeroelim(temp16len, temp16, bdz, temp32);
- temp32tlen = scale_expansion_zeroelim(temp16len, temp16, bdztail, temp32t);
- blen = fast_expansion_sum_zeroelim(temp32len, temp32, temp32tlen, temp32t,
- bdet);
-
- temp16len = fast_expansion_sum_zeroelim(8, axby, 8, bxay, temp16);
- temp32len = scale_expansion_zeroelim(temp16len, temp16, cdz, temp32);
- temp32tlen = scale_expansion_zeroelim(temp16len, temp16, cdztail, temp32t);
- clen = fast_expansion_sum_zeroelim(temp32len, temp32, temp32tlen, temp32t,
- cdet);
-
- ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet);
- deterlen = fast_expansion_sum_zeroelim(ablen, abdet, clen, cdet, deter);
-
- return deter[deterlen - 1];
-}
-
REAL orient3dadapt (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
REAL permanent)
{
- INEXACT REAL adx, bdx, cdx, ady, bdy, cdy, adz, bdz, cdz;
+ REAL adx, bdx, cdx, ady, bdy, cdy, adz, bdz, cdz;
REAL det, errbound;
- INEXACT REAL bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1;
+ REAL bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1;
REAL bdxcdy0, cdxbdy0, cdxady0, adxcdy0, adxbdy0, bdxady0;
REAL bc[4], ca[4], ab[4];
- INEXACT REAL bc3, ca3, ab3;
+ REAL bc3, ca3, ab3;
REAL adet[8], bdet[8], cdet[8];
int alen, blen, clen;
REAL abdet[16];
@@ -1663,38 +1416,34 @@ REAL orient3dadapt (
REAL adxtail, bdxtail, cdxtail;
REAL adytail, bdytail, cdytail;
REAL adztail, bdztail, cdztail;
- INEXACT REAL at_blarge, at_clarge;
- INEXACT REAL bt_clarge, bt_alarge;
- INEXACT REAL ct_alarge, ct_blarge;
+ REAL at_blarge, at_clarge;
+ REAL bt_clarge, bt_alarge;
+ REAL ct_alarge, ct_blarge;
REAL at_b[4], at_c[4], bt_c[4], bt_a[4], ct_a[4], ct_b[4];
int at_blen, at_clen, bt_clen, bt_alen, ct_alen, ct_blen;
- INEXACT REAL bdxt_cdy1, cdxt_bdy1, cdxt_ady1;
- INEXACT REAL adxt_cdy1, adxt_bdy1, bdxt_ady1;
+ REAL bdxt_cdy1, cdxt_bdy1, cdxt_ady1;
+ REAL adxt_cdy1, adxt_bdy1, bdxt_ady1;
REAL bdxt_cdy0, cdxt_bdy0, cdxt_ady0;
REAL adxt_cdy0, adxt_bdy0, bdxt_ady0;
- INEXACT REAL bdyt_cdx1, cdyt_bdx1, cdyt_adx1;
- INEXACT REAL adyt_cdx1, adyt_bdx1, bdyt_adx1;
+ REAL bdyt_cdx1, cdyt_bdx1, cdyt_adx1;
+ REAL adyt_cdx1, adyt_bdx1, bdyt_adx1;
REAL bdyt_cdx0, cdyt_bdx0, cdyt_adx0;
REAL adyt_cdx0, adyt_bdx0, bdyt_adx0;
REAL bct[8], cat[8], abt[8];
int bctlen, catlen, abtlen;
- INEXACT REAL bdxt_cdyt1, cdxt_bdyt1, cdxt_adyt1;
- INEXACT REAL adxt_cdyt1, adxt_bdyt1, bdxt_adyt1;
+ REAL bdxt_cdyt1, cdxt_bdyt1, cdxt_adyt1;
+ REAL adxt_cdyt1, adxt_bdyt1, bdxt_adyt1;
REAL bdxt_cdyt0, cdxt_bdyt0, cdxt_adyt0;
REAL adxt_cdyt0, adxt_bdyt0, bdxt_adyt0;
REAL u[4], v[12], w[16];
- INEXACT REAL u3;
+ REAL u3;
int vlength, wlength;
REAL negate;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j, _k;
- REAL _0;
+ REAL _i, _j, _k, _0;
adx = (REAL) (pa[0] - pd[0]);
bdx = (REAL) (pb[0] - pd[0]);
@@ -2044,10 +1793,10 @@ REAL orient3dadapt (
}
REAL orient3d (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd)
{
REAL adx, bdx, cdx, ady, bdy, cdy, adz, bdz, cdz;
REAL bdxcdy, cdxbdy, cdxady, adxcdy, adxbdy, bdxady;
@@ -2090,9 +1839,6 @@ REAL orient3d (
/*****************************************************************************/
/* */
-/* incirclefast() Approximate 2D incircle test. Nonrobust. */
-/* incircleexact() Exact 2D incircle test. Robust. */
-/* incircleslow() Another exact 2D incircle test. Robust. */
/* incircle() Adaptive exact 2D incircle test. Robust. */
/* */
/* Return a positive value if the point pd lies inside the */
@@ -2101,9 +1847,6 @@ REAL orient3d (
/* The points pa, pb, and pc must be in counterclockwise */
/* order, or the sign of the result will be reversed. */
/* */
-/* Only the first and last routine should be used; the middle two are for */
-/* timings. */
-/* */
/* The last three use exact arithmetic to ensure a correct answer. The */
/* result returned is the determinant of a matrix. In incircle() only, */
/* this determinant is computed adaptively, in the sense that exact */
@@ -2114,41 +1857,14 @@ REAL orient3d (
/* */
/*****************************************************************************/
-REAL incirclefast (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
-{
- REAL adx, ady, bdx, bdy, cdx, cdy;
- REAL abdet, bcdet, cadet;
- REAL alift, blift, clift;
-
- adx = pa[0] - pd[0];
- ady = pa[1] - pd[1];
- bdx = pb[0] - pd[0];
- bdy = pb[1] - pd[1];
- cdx = pc[0] - pd[0];
- cdy = pc[1] - pd[1];
-
- abdet = adx * bdy - bdx * ady;
- bcdet = bdx * cdy - cdx * bdy;
- cadet = cdx * ady - adx * cdy;
- alift = adx * adx + ady * ady;
- blift = bdx * bdx + bdy * bdy;
- clift = cdx * cdx + cdy * cdy;
-
- return alift * bcdet + blift * cadet + clift * abdet;
-}
-
REAL incircleexact (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd)
{
- INEXACT REAL axby1, bxcy1, cxdy1, dxay1, axcy1, bxdy1;
- INEXACT REAL bxay1, cxby1, dxcy1, axdy1, cxay1, dxby1;
+ REAL axby1, bxcy1, cxdy1, dxay1, axcy1, bxdy1;
+ REAL bxay1, cxby1, dxcy1, axdy1, cxay1, dxby1;
REAL axby0, bxcy0, cxdy0, dxay0, axcy0, bxdy0;
REAL bxay0, cxby0, dxcy0, axdy0, cxay0, dxby0;
REAL ab[4], bc[4], cd[4], da[4], ac[4], bd[4];
@@ -2166,14 +1882,10 @@ REAL incircleexact (
int deterlen;
int i;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
Two_Product(pa[0], pb[1], axby1, axby0);
Two_Product(pb[0], pa[1], bxay1, bxay0);
@@ -2243,180 +1955,20 @@ REAL incircleexact (
return deter[deterlen - 1];
}
-REAL incircleslow (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
-{
- INEXACT REAL adx, bdx, cdx, ady, bdy, cdy;
- REAL adxtail, bdxtail, cdxtail;
- REAL adytail, bdytail, cdytail;
- REAL negate, negatetail;
- INEXACT REAL axby7, bxcy7, axcy7, bxay7, cxby7, cxay7;
- REAL axby[8], bxcy[8], axcy[8], bxay[8], cxby[8], cxay[8];
- REAL temp16[16];
- int temp16len;
- REAL detx[32], detxx[64], detxt[32], detxxt[64], detxtxt[64];
- int xlen, xxlen, xtlen, xxtlen, xtxtlen;
- REAL x1[128], x2[192];
- int x1len, x2len;
- REAL dety[32], detyy[64], detyt[32], detyyt[64], detytyt[64];
- int ylen, yylen, ytlen, yytlen, ytytlen;
- REAL y1[128], y2[192];
- int y1len, y2len;
- REAL adet[384], bdet[384], cdet[384], abdet[768], deter[1152];
- int alen, blen, clen, ablen, deterlen;
- int i;
-
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL a0hi, a0lo, a1hi, a1lo, bhi, blo;
- REAL err1, err2, err3;
- INEXACT REAL _i, _j, _k, _l, _m, _n;
- REAL _0, _1, _2;
-
- Two_Diff(pa[0], pd[0], adx, adxtail);
- Two_Diff(pa[1], pd[1], ady, adytail);
- Two_Diff(pb[0], pd[0], bdx, bdxtail);
- Two_Diff(pb[1], pd[1], bdy, bdytail);
- Two_Diff(pc[0], pd[0], cdx, cdxtail);
- Two_Diff(pc[1], pd[1], cdy, cdytail);
-
- Two_Two_Product(adx, adxtail, bdy, bdytail,
- axby7, axby[6], axby[5], axby[4],
- axby[3], axby[2], axby[1], axby[0]);
- axby[7] = axby7;
- negate = -ady;
- negatetail = -adytail;
- Two_Two_Product(bdx, bdxtail, negate, negatetail,
- bxay7, bxay[6], bxay[5], bxay[4],
- bxay[3], bxay[2], bxay[1], bxay[0]);
- bxay[7] = bxay7;
- Two_Two_Product(bdx, bdxtail, cdy, cdytail,
- bxcy7, bxcy[6], bxcy[5], bxcy[4],
- bxcy[3], bxcy[2], bxcy[1], bxcy[0]);
- bxcy[7] = bxcy7;
- negate = -bdy;
- negatetail = -bdytail;
- Two_Two_Product(cdx, cdxtail, negate, negatetail,
- cxby7, cxby[6], cxby[5], cxby[4],
- cxby[3], cxby[2], cxby[1], cxby[0]);
- cxby[7] = cxby7;
- Two_Two_Product(cdx, cdxtail, ady, adytail,
- cxay7, cxay[6], cxay[5], cxay[4],
- cxay[3], cxay[2], cxay[1], cxay[0]);
- cxay[7] = cxay7;
- negate = -cdy;
- negatetail = -cdytail;
- Two_Two_Product(adx, adxtail, negate, negatetail,
- axcy7, axcy[6], axcy[5], axcy[4],
- axcy[3], axcy[2], axcy[1], axcy[0]);
- axcy[7] = axcy7;
-
-
- temp16len = fast_expansion_sum_zeroelim(8, bxcy, 8, cxby, temp16);
-
- xlen = scale_expansion_zeroelim(temp16len, temp16, adx, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, adx, detxx);
- xtlen = scale_expansion_zeroelim(temp16len, temp16, adxtail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, adx, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, adxtail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
-
- ylen = scale_expansion_zeroelim(temp16len, temp16, ady, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, ady, detyy);
- ytlen = scale_expansion_zeroelim(temp16len, temp16, adytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, ady, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, adytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
-
- alen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, adet);
-
-
- temp16len = fast_expansion_sum_zeroelim(8, cxay, 8, axcy, temp16);
-
- xlen = scale_expansion_zeroelim(temp16len, temp16, bdx, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, bdx, detxx);
- xtlen = scale_expansion_zeroelim(temp16len, temp16, bdxtail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, bdx, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, bdxtail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
-
- ylen = scale_expansion_zeroelim(temp16len, temp16, bdy, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, bdy, detyy);
- ytlen = scale_expansion_zeroelim(temp16len, temp16, bdytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, bdy, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, bdytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
-
- blen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, bdet);
-
-
- temp16len = fast_expansion_sum_zeroelim(8, axby, 8, bxay, temp16);
-
- xlen = scale_expansion_zeroelim(temp16len, temp16, cdx, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, cdx, detxx);
- xtlen = scale_expansion_zeroelim(temp16len, temp16, cdxtail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, cdx, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, cdxtail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
-
- ylen = scale_expansion_zeroelim(temp16len, temp16, cdy, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, cdy, detyy);
- ytlen = scale_expansion_zeroelim(temp16len, temp16, cdytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, cdy, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, cdytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
-
- clen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, cdet);
-
- ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet);
- deterlen = fast_expansion_sum_zeroelim(ablen, abdet, clen, cdet, deter);
-
- return deter[deterlen - 1];
-}
-
REAL incircleadapt (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
REAL permanent)
{
- INEXACT REAL adx, bdx, cdx, ady, bdy, cdy;
+ REAL adx, bdx, cdx, ady, bdy, cdy;
REAL det, errbound;
- INEXACT REAL bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1;
+ REAL bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1;
REAL bdxcdy0, cdxbdy0, cdxady0, adxcdy0, adxbdy0, bdxady0;
REAL bc[4], ca[4], ab[4];
- INEXACT REAL bc3, ca3, ab3;
+ REAL bc3, ca3, ab3;
REAL axbc[8], axxbc[16], aybc[8], ayybc[16], adet[32];
int axbclen, axxbclen, aybclen, ayybclen, alen;
REAL bxca[8], bxxca[16], byca[8], byyca[16], bdet[32];
@@ -2430,14 +1982,14 @@ REAL incircleadapt (
int finlength;
REAL adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail;
- INEXACT REAL adxadx1, adyady1, bdxbdx1, bdybdy1, cdxcdx1, cdycdy1;
+ REAL adxadx1, adyady1, bdxbdx1, bdybdy1, cdxcdx1, cdycdy1;
REAL adxadx0, adyady0, bdxbdx0, bdybdy0, cdxcdx0, cdycdy0;
REAL aa[4], bb[4], cc[4];
- INEXACT REAL aa3, bb3, cc3;
- INEXACT REAL ti1, tj1;
+ REAL aa3, bb3, cc3;
+ REAL ti1, tj1;
REAL ti0, tj0;
REAL u[4], v[4];
- INEXACT REAL u3, v3;
+ REAL u3, v3;
REAL temp8[8], temp16a[16], temp16b[16], temp16c[16];
REAL temp32a[32], temp32b[32], temp48[48], temp64[64];
int temp8len, temp16alen, temp16blen, temp16clen;
@@ -2459,17 +2011,13 @@ REAL incircleadapt (
int abtlen, bctlen, catlen;
REAL abtt[4], bctt[4], catt[4];
int abttlen, bcttlen, cattlen;
- INEXACT REAL abtt3, bctt3, catt3;
+ REAL abtt3, bctt3, catt3;
REAL negate;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
adx = (REAL) (pa[0] - pd[0]);
bdx = (REAL) (pb[0] - pd[0]);
@@ -2978,10 +2526,10 @@ REAL incircleadapt (
}
REAL incircle (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd)
{
REAL adx, bdx, cdx, ady, bdy, cdy;
REAL bdxcdy, cdxbdy, cdxady, adxcdy, adxbdy, bdxady;
@@ -3025,9 +2573,6 @@ REAL incircle (
/*****************************************************************************/
/* */
-/* inspherefast() Approximate 3D insphere test. Nonrobust. */
-/* insphereexact() Exact 3D insphere test. Robust. */
-/* insphereslow() Another exact 3D insphere test. Robust. */
/* insphere() Adaptive exact 3D insphere test. Robust. */
/* */
/* Return a positive value if the point pe lies inside the */
@@ -3037,9 +2582,6 @@ REAL incircle (
/* so that they have a positive orientation (as defined by */
/* orient3d()), or the sign of the result will be reversed. */
/* */
-/* Only the first and last routine should be used; the middle two are for */
-/* timings. */
-/* */
/* The last three use exact arithmetic to ensure a correct answer. The */
/* result returned is the determinant of a matrix. In insphere() only, */
/* this determinant is computed adaptively, in the sense that exact */
@@ -3050,65 +2592,17 @@ REAL incircle (
/* */
/*****************************************************************************/
-REAL inspherefast (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
- REAL *pe)
-{
- REAL aex, bex, cex, dex;
- REAL aey, bey, cey, dey;
- REAL aez, bez, cez, dez;
- REAL alift, blift, clift, dlift;
- REAL ab, bc, cd, da, ac, bd;
- REAL abc, bcd, cda, dab;
-
- aex = pa[0] - pe[0];
- bex = pb[0] - pe[0];
- cex = pc[0] - pe[0];
- dex = pd[0] - pe[0];
- aey = pa[1] - pe[1];
- bey = pb[1] - pe[1];
- cey = pc[1] - pe[1];
- dey = pd[1] - pe[1];
- aez = pa[2] - pe[2];
- bez = pb[2] - pe[2];
- cez = pc[2] - pe[2];
- dez = pd[2] - pe[2];
-
- ab = aex * bey - bex * aey;
- bc = bex * cey - cex * bey;
- cd = cex * dey - dex * cey;
- da = dex * aey - aex * dey;
-
- ac = aex * cey - cex * aey;
- bd = bex * dey - dex * bey;
-
- abc = aez * bc - bez * ac + cez * ab;
- bcd = bez * cd - cez * bd + dez * bc;
- cda = cez * da + dez * ac + aez * cd;
- dab = dez * ab + aez * bd + bez * da;
-
- alift = aex * aex + aey * aey + aez * aez;
- blift = bex * bex + bey * bey + bez * bez;
- clift = cex * cex + cey * cey + cez * cez;
- dlift = dex * dex + dey * dey + dez * dez;
-
- return (dlift * abc - clift * dab) + (blift * cda - alift * bcd);
-}
-
REAL insphereexact (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
- REAL *pe)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe)
{
- INEXACT REAL axby1, bxcy1, cxdy1, dxey1, exay1;
- INEXACT REAL bxay1, cxby1, dxcy1, exdy1, axey1;
- INEXACT REAL axcy1, bxdy1, cxey1, dxay1, exby1;
- INEXACT REAL cxay1, dxby1, excy1, axdy1, bxey1;
+ REAL axby1, bxcy1, cxdy1, dxey1, exay1;
+ REAL bxay1, cxby1, dxcy1, exdy1, axey1;
+ REAL axcy1, bxdy1, cxey1, dxay1, exby1;
+ REAL cxay1, dxby1, excy1, axdy1, bxey1;
REAL axby0, bxcy0, cxdy0, dxey0, exay0;
REAL bxay0, cxby0, dxcy0, exdy0, axey0;
REAL axcy0, bxdy0, cxey0, dxay0, exby0;
@@ -3138,14 +2632,10 @@ REAL insphereexact (
int deterlen;
int i;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
Two_Product(pa[0], pb[1], axby1, axby0);
Two_Product(pb[0], pa[1], bxay1, bxay0);
@@ -3355,359 +2845,25 @@ REAL insphereexact (
return deter[deterlen - 1];
}
-REAL insphereslow (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
- REAL *pe)
-{
- INEXACT REAL aex, bex, cex, dex, aey, bey, cey, dey, aez, bez, cez, dez;
- REAL aextail, bextail, cextail, dextail;
- REAL aeytail, beytail, ceytail, deytail;
- REAL aeztail, beztail, ceztail, deztail;
- REAL negate, negatetail;
- INEXACT REAL axby7, bxcy7, cxdy7, dxay7, axcy7, bxdy7;
- INEXACT REAL bxay7, cxby7, dxcy7, axdy7, cxay7, dxby7;
- REAL axby[8], bxcy[8], cxdy[8], dxay[8], axcy[8], bxdy[8];
- REAL bxay[8], cxby[8], dxcy[8], axdy[8], cxay[8], dxby[8];
- REAL ab[16], bc[16], cd[16], da[16], ac[16], bd[16];
- int ablen, bclen, cdlen, dalen, aclen, bdlen;
- REAL temp32a[32], temp32b[32], temp64a[64], temp64b[64], temp64c[64];
- int temp32alen, temp32blen, temp64alen, temp64blen, temp64clen;
- REAL temp128[128], temp192[192];
- int temp128len, temp192len;
- REAL detx[384], detxx[768], detxt[384], detxxt[768], detxtxt[768];
- int xlen, xxlen, xtlen, xxtlen, xtxtlen;
- REAL x1[1536], x2[2304];
- int x1len, x2len;
- REAL dety[384], detyy[768], detyt[384], detyyt[768], detytyt[768];
- int ylen, yylen, ytlen, yytlen, ytytlen;
- REAL y1[1536], y2[2304];
- int y1len, y2len;
- REAL detz[384], detzz[768], detzt[384], detzzt[768], detztzt[768];
- int zlen, zzlen, ztlen, zztlen, ztztlen;
- REAL z1[1536], z2[2304];
- int z1len, z2len;
- REAL detxy[4608];
- int xylen;
- REAL adet[6912], bdet[6912], cdet[6912], ddet[6912];
- int alen, blen, clen, dlen;
- REAL abdet[13824], cddet[13824], deter[27648];
- int deterlen;
- int i;
-
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL a0hi, a0lo, a1hi, a1lo, bhi, blo;
- REAL err1, err2, err3;
- INEXACT REAL _i, _j, _k, _l, _m, _n;
- REAL _0, _1, _2;
-
- Two_Diff(pa[0], pe[0], aex, aextail);
- Two_Diff(pa[1], pe[1], aey, aeytail);
- Two_Diff(pa[2], pe[2], aez, aeztail);
- Two_Diff(pb[0], pe[0], bex, bextail);
- Two_Diff(pb[1], pe[1], bey, beytail);
- Two_Diff(pb[2], pe[2], bez, beztail);
- Two_Diff(pc[0], pe[0], cex, cextail);
- Two_Diff(pc[1], pe[1], cey, ceytail);
- Two_Diff(pc[2], pe[2], cez, ceztail);
- Two_Diff(pd[0], pe[0], dex, dextail);
- Two_Diff(pd[1], pe[1], dey, deytail);
- Two_Diff(pd[2], pe[2], dez, deztail);
-
- Two_Two_Product(aex, aextail, bey, beytail,
- axby7, axby[6], axby[5], axby[4],
- axby[3], axby[2], axby[1], axby[0]);
- axby[7] = axby7;
- negate = -aey;
- negatetail = -aeytail;
- Two_Two_Product(bex, bextail, negate, negatetail,
- bxay7, bxay[6], bxay[5], bxay[4],
- bxay[3], bxay[2], bxay[1], bxay[0]);
- bxay[7] = bxay7;
- ablen = fast_expansion_sum_zeroelim(8, axby, 8, bxay, ab);
- Two_Two_Product(bex, bextail, cey, ceytail,
- bxcy7, bxcy[6], bxcy[5], bxcy[4],
- bxcy[3], bxcy[2], bxcy[1], bxcy[0]);
- bxcy[7] = bxcy7;
- negate = -bey;
- negatetail = -beytail;
- Two_Two_Product(cex, cextail, negate, negatetail,
- cxby7, cxby[6], cxby[5], cxby[4],
- cxby[3], cxby[2], cxby[1], cxby[0]);
- cxby[7] = cxby7;
- bclen = fast_expansion_sum_zeroelim(8, bxcy, 8, cxby, bc);
- Two_Two_Product(cex, cextail, dey, deytail,
- cxdy7, cxdy[6], cxdy[5], cxdy[4],
- cxdy[3], cxdy[2], cxdy[1], cxdy[0]);
- cxdy[7] = cxdy7;
- negate = -cey;
- negatetail = -ceytail;
- Two_Two_Product(dex, dextail, negate, negatetail,
- dxcy7, dxcy[6], dxcy[5], dxcy[4],
- dxcy[3], dxcy[2], dxcy[1], dxcy[0]);
- dxcy[7] = dxcy7;
- cdlen = fast_expansion_sum_zeroelim(8, cxdy, 8, dxcy, cd);
- Two_Two_Product(dex, dextail, aey, aeytail,
- dxay7, dxay[6], dxay[5], dxay[4],
- dxay[3], dxay[2], dxay[1], dxay[0]);
- dxay[7] = dxay7;
- negate = -dey;
- negatetail = -deytail;
- Two_Two_Product(aex, aextail, negate, negatetail,
- axdy7, axdy[6], axdy[5], axdy[4],
- axdy[3], axdy[2], axdy[1], axdy[0]);
- axdy[7] = axdy7;
- dalen = fast_expansion_sum_zeroelim(8, dxay, 8, axdy, da);
- Two_Two_Product(aex, aextail, cey, ceytail,
- axcy7, axcy[6], axcy[5], axcy[4],
- axcy[3], axcy[2], axcy[1], axcy[0]);
- axcy[7] = axcy7;
- negate = -aey;
- negatetail = -aeytail;
- Two_Two_Product(cex, cextail, negate, negatetail,
- cxay7, cxay[6], cxay[5], cxay[4],
- cxay[3], cxay[2], cxay[1], cxay[0]);
- cxay[7] = cxay7;
- aclen = fast_expansion_sum_zeroelim(8, axcy, 8, cxay, ac);
- Two_Two_Product(bex, bextail, dey, deytail,
- bxdy7, bxdy[6], bxdy[5], bxdy[4],
- bxdy[3], bxdy[2], bxdy[1], bxdy[0]);
- bxdy[7] = bxdy7;
- negate = -bey;
- negatetail = -beytail;
- Two_Two_Product(dex, dextail, negate, negatetail,
- dxby7, dxby[6], dxby[5], dxby[4],
- dxby[3], dxby[2], dxby[1], dxby[0]);
- dxby[7] = dxby7;
- bdlen = fast_expansion_sum_zeroelim(8, bxdy, 8, dxby, bd);
-
- temp32alen = scale_expansion_zeroelim(cdlen, cd, -bez, temp32a);
- temp32blen = scale_expansion_zeroelim(cdlen, cd, -beztail, temp32b);
- temp64alen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64a);
- temp32alen = scale_expansion_zeroelim(bdlen, bd, cez, temp32a);
- temp32blen = scale_expansion_zeroelim(bdlen, bd, ceztail, temp32b);
- temp64blen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64b);
- temp32alen = scale_expansion_zeroelim(bclen, bc, -dez, temp32a);
- temp32blen = scale_expansion_zeroelim(bclen, bc, -deztail, temp32b);
- temp64clen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64c);
- temp128len = fast_expansion_sum_zeroelim(temp64alen, temp64a,
- temp64blen, temp64b, temp128);
- temp192len = fast_expansion_sum_zeroelim(temp64clen, temp64c,
- temp128len, temp128, temp192);
- xlen = scale_expansion_zeroelim(temp192len, temp192, aex, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, aex, detxx);
- xtlen = scale_expansion_zeroelim(temp192len, temp192, aextail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, aex, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, aextail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
- ylen = scale_expansion_zeroelim(temp192len, temp192, aey, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, aey, detyy);
- ytlen = scale_expansion_zeroelim(temp192len, temp192, aeytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, aey, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, aeytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
- zlen = scale_expansion_zeroelim(temp192len, temp192, aez, detz);
- zzlen = scale_expansion_zeroelim(zlen, detz, aez, detzz);
- ztlen = scale_expansion_zeroelim(temp192len, temp192, aeztail, detzt);
- zztlen = scale_expansion_zeroelim(ztlen, detzt, aez, detzzt);
- for (i = 0; i < zztlen; i++) {
- detzzt[i] *= 2.0;
- }
- ztztlen = scale_expansion_zeroelim(ztlen, detzt, aeztail, detztzt);
- z1len = fast_expansion_sum_zeroelim(zzlen, detzz, zztlen, detzzt, z1);
- z2len = fast_expansion_sum_zeroelim(z1len, z1, ztztlen, detztzt, z2);
- xylen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, detxy);
- alen = fast_expansion_sum_zeroelim(z2len, z2, xylen, detxy, adet);
-
- temp32alen = scale_expansion_zeroelim(dalen, da, cez, temp32a);
- temp32blen = scale_expansion_zeroelim(dalen, da, ceztail, temp32b);
- temp64alen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64a);
- temp32alen = scale_expansion_zeroelim(aclen, ac, dez, temp32a);
- temp32blen = scale_expansion_zeroelim(aclen, ac, deztail, temp32b);
- temp64blen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64b);
- temp32alen = scale_expansion_zeroelim(cdlen, cd, aez, temp32a);
- temp32blen = scale_expansion_zeroelim(cdlen, cd, aeztail, temp32b);
- temp64clen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64c);
- temp128len = fast_expansion_sum_zeroelim(temp64alen, temp64a,
- temp64blen, temp64b, temp128);
- temp192len = fast_expansion_sum_zeroelim(temp64clen, temp64c,
- temp128len, temp128, temp192);
- xlen = scale_expansion_zeroelim(temp192len, temp192, bex, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, bex, detxx);
- xtlen = scale_expansion_zeroelim(temp192len, temp192, bextail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, bex, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, bextail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
- ylen = scale_expansion_zeroelim(temp192len, temp192, bey, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, bey, detyy);
- ytlen = scale_expansion_zeroelim(temp192len, temp192, beytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, bey, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, beytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
- zlen = scale_expansion_zeroelim(temp192len, temp192, bez, detz);
- zzlen = scale_expansion_zeroelim(zlen, detz, bez, detzz);
- ztlen = scale_expansion_zeroelim(temp192len, temp192, beztail, detzt);
- zztlen = scale_expansion_zeroelim(ztlen, detzt, bez, detzzt);
- for (i = 0; i < zztlen; i++) {
- detzzt[i] *= 2.0;
- }
- ztztlen = scale_expansion_zeroelim(ztlen, detzt, beztail, detztzt);
- z1len = fast_expansion_sum_zeroelim(zzlen, detzz, zztlen, detzzt, z1);
- z2len = fast_expansion_sum_zeroelim(z1len, z1, ztztlen, detztzt, z2);
- xylen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, detxy);
- blen = fast_expansion_sum_zeroelim(z2len, z2, xylen, detxy, bdet);
-
- temp32alen = scale_expansion_zeroelim(ablen, ab, -dez, temp32a);
- temp32blen = scale_expansion_zeroelim(ablen, ab, -deztail, temp32b);
- temp64alen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64a);
- temp32alen = scale_expansion_zeroelim(bdlen, bd, -aez, temp32a);
- temp32blen = scale_expansion_zeroelim(bdlen, bd, -aeztail, temp32b);
- temp64blen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64b);
- temp32alen = scale_expansion_zeroelim(dalen, da, -bez, temp32a);
- temp32blen = scale_expansion_zeroelim(dalen, da, -beztail, temp32b);
- temp64clen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64c);
- temp128len = fast_expansion_sum_zeroelim(temp64alen, temp64a,
- temp64blen, temp64b, temp128);
- temp192len = fast_expansion_sum_zeroelim(temp64clen, temp64c,
- temp128len, temp128, temp192);
- xlen = scale_expansion_zeroelim(temp192len, temp192, cex, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, cex, detxx);
- xtlen = scale_expansion_zeroelim(temp192len, temp192, cextail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, cex, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, cextail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
- ylen = scale_expansion_zeroelim(temp192len, temp192, cey, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, cey, detyy);
- ytlen = scale_expansion_zeroelim(temp192len, temp192, ceytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, cey, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, ceytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
- zlen = scale_expansion_zeroelim(temp192len, temp192, cez, detz);
- zzlen = scale_expansion_zeroelim(zlen, detz, cez, detzz);
- ztlen = scale_expansion_zeroelim(temp192len, temp192, ceztail, detzt);
- zztlen = scale_expansion_zeroelim(ztlen, detzt, cez, detzzt);
- for (i = 0; i < zztlen; i++) {
- detzzt[i] *= 2.0;
- }
- ztztlen = scale_expansion_zeroelim(ztlen, detzt, ceztail, detztzt);
- z1len = fast_expansion_sum_zeroelim(zzlen, detzz, zztlen, detzzt, z1);
- z2len = fast_expansion_sum_zeroelim(z1len, z1, ztztlen, detztzt, z2);
- xylen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, detxy);
- clen = fast_expansion_sum_zeroelim(z2len, z2, xylen, detxy, cdet);
-
- temp32alen = scale_expansion_zeroelim(bclen, bc, aez, temp32a);
- temp32blen = scale_expansion_zeroelim(bclen, bc, aeztail, temp32b);
- temp64alen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64a);
- temp32alen = scale_expansion_zeroelim(aclen, ac, -bez, temp32a);
- temp32blen = scale_expansion_zeroelim(aclen, ac, -beztail, temp32b);
- temp64blen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64b);
- temp32alen = scale_expansion_zeroelim(ablen, ab, cez, temp32a);
- temp32blen = scale_expansion_zeroelim(ablen, ab, ceztail, temp32b);
- temp64clen = fast_expansion_sum_zeroelim(temp32alen, temp32a,
- temp32blen, temp32b, temp64c);
- temp128len = fast_expansion_sum_zeroelim(temp64alen, temp64a,
- temp64blen, temp64b, temp128);
- temp192len = fast_expansion_sum_zeroelim(temp64clen, temp64c,
- temp128len, temp128, temp192);
- xlen = scale_expansion_zeroelim(temp192len, temp192, dex, detx);
- xxlen = scale_expansion_zeroelim(xlen, detx, dex, detxx);
- xtlen = scale_expansion_zeroelim(temp192len, temp192, dextail, detxt);
- xxtlen = scale_expansion_zeroelim(xtlen, detxt, dex, detxxt);
- for (i = 0; i < xxtlen; i++) {
- detxxt[i] *= 2.0;
- }
- xtxtlen = scale_expansion_zeroelim(xtlen, detxt, dextail, detxtxt);
- x1len = fast_expansion_sum_zeroelim(xxlen, detxx, xxtlen, detxxt, x1);
- x2len = fast_expansion_sum_zeroelim(x1len, x1, xtxtlen, detxtxt, x2);
- ylen = scale_expansion_zeroelim(temp192len, temp192, dey, dety);
- yylen = scale_expansion_zeroelim(ylen, dety, dey, detyy);
- ytlen = scale_expansion_zeroelim(temp192len, temp192, deytail, detyt);
- yytlen = scale_expansion_zeroelim(ytlen, detyt, dey, detyyt);
- for (i = 0; i < yytlen; i++) {
- detyyt[i] *= 2.0;
- }
- ytytlen = scale_expansion_zeroelim(ytlen, detyt, deytail, detytyt);
- y1len = fast_expansion_sum_zeroelim(yylen, detyy, yytlen, detyyt, y1);
- y2len = fast_expansion_sum_zeroelim(y1len, y1, ytytlen, detytyt, y2);
- zlen = scale_expansion_zeroelim(temp192len, temp192, dez, detz);
- zzlen = scale_expansion_zeroelim(zlen, detz, dez, detzz);
- ztlen = scale_expansion_zeroelim(temp192len, temp192, deztail, detzt);
- zztlen = scale_expansion_zeroelim(ztlen, detzt, dez, detzzt);
- for (i = 0; i < zztlen; i++) {
- detzzt[i] *= 2.0;
- }
- ztztlen = scale_expansion_zeroelim(ztlen, detzt, deztail, detztzt);
- z1len = fast_expansion_sum_zeroelim(zzlen, detzz, zztlen, detzzt, z1);
- z2len = fast_expansion_sum_zeroelim(z1len, z1, ztztlen, detztzt, z2);
- xylen = fast_expansion_sum_zeroelim(x2len, x2, y2len, y2, detxy);
- dlen = fast_expansion_sum_zeroelim(z2len, z2, xylen, detxy, ddet);
-
- ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet);
- cdlen = fast_expansion_sum_zeroelim(clen, cdet, dlen, ddet, cddet);
- deterlen = fast_expansion_sum_zeroelim(ablen, abdet, cdlen, cddet, deter);
-
- return deter[deterlen - 1];
-}
-
REAL insphereadapt (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
- REAL *pe,
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe,
REAL permanent)
{
- INEXACT REAL aex, bex, cex, dex, aey, bey, cey, dey, aez, bez, cez, dez;
+ REAL aex, bex, cex, dex, aey, bey, cey, dey, aez, bez, cez, dez;
REAL det, errbound;
- INEXACT REAL aexbey1, bexaey1, bexcey1, cexbey1;
- INEXACT REAL cexdey1, dexcey1, dexaey1, aexdey1;
- INEXACT REAL aexcey1, cexaey1, bexdey1, dexbey1;
+ REAL aexbey1, bexaey1, bexcey1, cexbey1;
+ REAL cexdey1, dexcey1, dexaey1, aexdey1;
+ REAL aexcey1, cexaey1, bexdey1, dexbey1;
REAL aexbey0, bexaey0, bexcey0, cexbey0;
REAL cexdey0, dexcey0, dexaey0, aexdey0;
REAL aexcey0, cexaey0, bexdey0, dexbey0;
REAL ab[4], bc[4], cd[4], da[4], ac[4], bd[4];
- INEXACT REAL ab3, bc3, cd3, da3, ac3, bd3;
+ REAL ab3, bc3, cd3, da3, ac3, bd3;
REAL abeps, bceps, cdeps, daeps, aceps, bdeps;
REAL temp8a[8], temp8b[8], temp8c[8], temp16[16], temp24[24], temp48[48];
int temp8alen, temp8blen, temp8clen, temp16len, temp24len, temp48len;
@@ -3724,14 +2880,10 @@ REAL insphereadapt (
REAL aeytail, beytail, ceytail, deytail;
REAL aeztail, beztail, ceztail, deztail;
- INEXACT REAL bvirt;
- REAL avirt, bround, around;
- INEXACT REAL c;
- INEXACT REAL abig;
- REAL ahi, alo, bhi, blo;
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
REAL err1, err2, err3;
- INEXACT REAL _i, _j;
- REAL _0;
+ REAL _i, _j, _0;
aex = (REAL) (pa[0] - pe[0]);
bex = (REAL) (pb[0] - pe[0]);
@@ -3910,11 +3062,11 @@ REAL insphereadapt (
}
REAL insphere (
- REAL *pa,
- REAL *pb,
- REAL *pc,
- REAL *pd,
- REAL *pe)
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe)
{
REAL aex, bex, cex, dex;
REAL aey, bey, cey, dey;
@@ -4016,9 +3168,644 @@ REAL insphere (
return insphereadapt(pa, pb, pc, pd, pe, permanent);
}
+/*****************************************************************************/
+/* */
+/* orient4d() Return a positive value if the point pe lies above the */
+/* hyperplane passing through pa, pb, pc, and pd; "above" is */
+/* defined in a manner best found by trial-and-error. Returns */
+/* a negative value if pe lies below the hyperplane. Returns */
+/* zero if the points are co-hyperplanar (not affinely */
+/* independent). The result is also a rough approximation of */
+/* 24 times the signed volume of the 4-simplex defined by the */
+/* five points. */
+/* */
+/* Uses exact arithmetic if necessary to ensure a correct answer. The */
+/* result returned is the determinant of a matrix. This determinant is */
+/* computed adaptively, in the sense that exact arithmetic is used only to */
+/* the degree it is needed to ensure that the returned value has the */
+/* correct sign. Hence, orient4d() is usually quite fast, but will run */
+/* more slowly when the input points are hyper-coplanar or nearly so. */
+/* */
+/* See my Robust Predicates paper for details. */
+/* */
+/*****************************************************************************/
+
+REAL orient4dexact (
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe,
+ REAL aheight,
+ REAL bheight,
+ REAL cheight,
+ REAL dheight,
+ REAL eheight)
+{
+ REAL axby1, bxcy1, cxdy1, dxey1, exay1;
+ REAL bxay1, cxby1, dxcy1, exdy1, axey1;
+ REAL axcy1, bxdy1, cxey1, dxay1, exby1;
+ REAL cxay1, dxby1, excy1, axdy1, bxey1;
+ REAL axby0, bxcy0, cxdy0, dxey0, exay0;
+ REAL bxay0, cxby0, dxcy0, exdy0, axey0;
+ REAL axcy0, bxdy0, cxey0, dxay0, exby0;
+ REAL cxay0, dxby0, excy0, axdy0, bxey0;
+ REAL ab[4], bc[4], cd[4], de[4], ea[4];
+ REAL ac[4], bd[4], ce[4], da[4], eb[4];
+ REAL temp8a[8], temp8b[8], temp16[16];
+ int temp8alen, temp8blen, temp16len;
+ REAL abc[24], bcd[24], cde[24], dea[24], eab[24];
+ REAL abd[24], bce[24], cda[24], deb[24], eac[24];
+ int abclen, bcdlen, cdelen, dealen, eablen;
+ int abdlen, bcelen, cdalen, deblen, eaclen;
+ REAL temp48a[48], temp48b[48];
+ int temp48alen, temp48blen;
+ REAL abcd[96], bcde[96], cdea[96], deab[96], eabc[96];
+ int abcdlen, bcdelen, cdealen, deablen, eabclen;
+ REAL adet[192], bdet[192], cdet[192], ddet[192], edet[192];
+ int alen, blen, clen, dlen, elen;
+ REAL abdet[384], cddet[384], cdedet[576];
+ int ablen, cdlen;
+ REAL deter[960];
+ int deterlen;
+ int i;
+
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
+ REAL err1, err2, err3;
+ REAL _i, _j, _0;
+
+ Two_Product(pa[0], pb[1], axby1, axby0);
+ Two_Product(pb[0], pa[1], bxay1, bxay0);
+ Two_Two_Diff(axby1, axby0, bxay1, bxay0, ab[3], ab[2], ab[1], ab[0]);
+
+ Two_Product(pb[0], pc[1], bxcy1, bxcy0);
+ Two_Product(pc[0], pb[1], cxby1, cxby0);
+ Two_Two_Diff(bxcy1, bxcy0, cxby1, cxby0, bc[3], bc[2], bc[1], bc[0]);
+
+ Two_Product(pc[0], pd[1], cxdy1, cxdy0);
+ Two_Product(pd[0], pc[1], dxcy1, dxcy0);
+ Two_Two_Diff(cxdy1, cxdy0, dxcy1, dxcy0, cd[3], cd[2], cd[1], cd[0]);
+
+ Two_Product(pd[0], pe[1], dxey1, dxey0);
+ Two_Product(pe[0], pd[1], exdy1, exdy0);
+ Two_Two_Diff(dxey1, dxey0, exdy1, exdy0, de[3], de[2], de[1], de[0]);
+
+ Two_Product(pe[0], pa[1], exay1, exay0);
+ Two_Product(pa[0], pe[1], axey1, axey0);
+ Two_Two_Diff(exay1, exay0, axey1, axey0, ea[3], ea[2], ea[1], ea[0]);
+
+ Two_Product(pa[0], pc[1], axcy1, axcy0);
+ Two_Product(pc[0], pa[1], cxay1, cxay0);
+ Two_Two_Diff(axcy1, axcy0, cxay1, cxay0, ac[3], ac[2], ac[1], ac[0]);
+
+ Two_Product(pb[0], pd[1], bxdy1, bxdy0);
+ Two_Product(pd[0], pb[1], dxby1, dxby0);
+ Two_Two_Diff(bxdy1, bxdy0, dxby1, dxby0, bd[3], bd[2], bd[1], bd[0]);
+
+ Two_Product(pc[0], pe[1], cxey1, cxey0);
+ Two_Product(pe[0], pc[1], excy1, excy0);
+ Two_Two_Diff(cxey1, cxey0, excy1, excy0, ce[3], ce[2], ce[1], ce[0]);
+
+ Two_Product(pd[0], pa[1], dxay1, dxay0);
+ Two_Product(pa[0], pd[1], axdy1, axdy0);
+ Two_Two_Diff(dxay1, dxay0, axdy1, axdy0, da[3], da[2], da[1], da[0]);
+
+ Two_Product(pe[0], pb[1], exby1, exby0);
+ Two_Product(pb[0], pe[1], bxey1, bxey0);
+ Two_Two_Diff(exby1, exby0, bxey1, bxey0, eb[3], eb[2], eb[1], eb[0]);
+
+ temp8alen = scale_expansion_zeroelim(4, bc, pa[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, ac, -pb[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, ab, pc[2], temp8a);
+ abclen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ abc);
+
+ temp8alen = scale_expansion_zeroelim(4, cd, pb[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, bd, -pc[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, bc, pd[2], temp8a);
+ bcdlen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ bcd);
+
+ temp8alen = scale_expansion_zeroelim(4, de, pc[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, ce, -pd[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, cd, pe[2], temp8a);
+ cdelen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ cde);
+
+ temp8alen = scale_expansion_zeroelim(4, ea, pd[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, da, -pe[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, de, pa[2], temp8a);
+ dealen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ dea);
+
+ temp8alen = scale_expansion_zeroelim(4, ab, pe[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, eb, -pa[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, ea, pb[2], temp8a);
+ eablen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ eab);
+
+ temp8alen = scale_expansion_zeroelim(4, bd, pa[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, da, pb[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, ab, pd[2], temp8a);
+ abdlen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ abd);
+
+ temp8alen = scale_expansion_zeroelim(4, ce, pb[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, eb, pc[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, bc, pe[2], temp8a);
+ bcelen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ bce);
+
+ temp8alen = scale_expansion_zeroelim(4, da, pc[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, ac, pd[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, cd, pa[2], temp8a);
+ cdalen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ cda);
+
+ temp8alen = scale_expansion_zeroelim(4, eb, pd[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, bd, pe[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, de, pb[2], temp8a);
+ deblen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ deb);
+
+ temp8alen = scale_expansion_zeroelim(4, ac, pe[2], temp8a);
+ temp8blen = scale_expansion_zeroelim(4, ce, pa[2], temp8b);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp8blen, temp8b,
+ temp16);
+ temp8alen = scale_expansion_zeroelim(4, ea, pc[2], temp8a);
+ eaclen = fast_expansion_sum_zeroelim(temp8alen, temp8a, temp16len, temp16,
+ eac);
+
+ temp48alen = fast_expansion_sum_zeroelim(cdelen, cde, bcelen, bce, temp48a);
+ temp48blen = fast_expansion_sum_zeroelim(deblen, deb, bcdlen, bcd, temp48b);
+ for (i = 0; i < temp48blen; i++) {
+ temp48b[i] = -temp48b[i];
+ }
+ bcdelen = fast_expansion_sum_zeroelim(temp48alen, temp48a,
+ temp48blen, temp48b, bcde);
+ alen = scale_expansion_zeroelim(bcdelen, bcde, aheight, adet);
+
+ temp48alen = fast_expansion_sum_zeroelim(dealen, dea, cdalen, cda, temp48a);
+ temp48blen = fast_expansion_sum_zeroelim(eaclen, eac, cdelen, cde, temp48b);
+ for (i = 0; i < temp48blen; i++) {
+ temp48b[i] = -temp48b[i];
+ }
+ cdealen = fast_expansion_sum_zeroelim(temp48alen, temp48a,
+ temp48blen, temp48b, cdea);
+ blen = scale_expansion_zeroelim(cdealen, cdea, bheight, bdet);
+
+ temp48alen = fast_expansion_sum_zeroelim(eablen, eab, deblen, deb, temp48a);
+ temp48blen = fast_expansion_sum_zeroelim(abdlen, abd, dealen, dea, temp48b);
+ for (i = 0; i < temp48blen; i++) {
+ temp48b[i] = -temp48b[i];
+ }
+ deablen = fast_expansion_sum_zeroelim(temp48alen, temp48a,
+ temp48blen, temp48b, deab);
+ clen = scale_expansion_zeroelim(deablen, deab, cheight, cdet);
+
+ temp48alen = fast_expansion_sum_zeroelim(abclen, abc, eaclen, eac, temp48a);
+ temp48blen = fast_expansion_sum_zeroelim(bcelen, bce, eablen, eab, temp48b);
+ for (i = 0; i < temp48blen; i++) {
+ temp48b[i] = -temp48b[i];
+ }
+ eabclen = fast_expansion_sum_zeroelim(temp48alen, temp48a,
+ temp48blen, temp48b, eabc);
+ dlen = scale_expansion_zeroelim(eabclen, eabc, dheight, ddet);
+
+ temp48alen = fast_expansion_sum_zeroelim(bcdlen, bcd, abdlen, abd, temp48a);
+ temp48blen = fast_expansion_sum_zeroelim(cdalen, cda, abclen, abc, temp48b);
+ for (i = 0; i < temp48blen; i++) {
+ temp48b[i] = -temp48b[i];
+ }
+ abcdlen = fast_expansion_sum_zeroelim(temp48alen, temp48a,
+ temp48blen, temp48b, abcd);
+ elen = scale_expansion_zeroelim(abcdlen, abcd, eheight, edet);
+
+ ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet);
+ cdlen = fast_expansion_sum_zeroelim(clen, cdet, dlen, ddet, cddet);
+ cdelen = fast_expansion_sum_zeroelim(cdlen, cddet, elen, edet, cdedet);
+ deterlen = fast_expansion_sum_zeroelim(ablen, abdet, cdelen, cdedet, deter);
+
+ return deter[deterlen - 1];
+}
+
+REAL orient4dadapt (
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe,
+ REAL aheight,
+ REAL bheight,
+ REAL cheight,
+ REAL dheight,
+ REAL eheight,
+ REAL permanent)
+{
+ REAL aex, bex, cex, dex, aey, bey, cey, dey, aez, bez, cez, dez;
+ REAL aeheight, beheight, ceheight, deheight;
+ REAL det, errbound;
+
+ REAL aexbey1, bexaey1, bexcey1, cexbey1;
+ REAL cexdey1, dexcey1, dexaey1, aexdey1;
+ REAL aexcey1, cexaey1, bexdey1, dexbey1;
+ REAL aexbey0, bexaey0, bexcey0, cexbey0;
+ REAL cexdey0, dexcey0, dexaey0, aexdey0;
+ REAL aexcey0, cexaey0, bexdey0, dexbey0;
+ REAL ab[4], bc[4], cd[4], da[4], ac[4], bd[4];
+ REAL ab3, bc3, cd3, da3, ac3, bd3;
+ REAL abeps, bceps, cdeps, daeps, aceps, bdeps;
+ REAL temp8a[8], temp8b[8], temp8c[8], temp16[16], temp24[24];
+ int temp8alen, temp8blen, temp8clen, temp16len, temp24len;
+ REAL adet[48], bdet[48], cdet[48], ddet[48];
+ int alen, blen, clen, dlen;
+ REAL abdet[96], cddet[96];
+ int ablen, cdlen;
+ REAL fin1[192];
+ int finlength;
+
+ REAL aextail, bextail, cextail, dextail;
+ REAL aeytail, beytail, ceytail, deytail;
+ REAL aeztail, beztail, ceztail, deztail;
+ REAL aeheighttail, beheighttail, ceheighttail, deheighttail;
+
+ REAL bvirt, avirt, bround, around;
+ REAL c, abig, ahi, alo, bhi, blo;
+ REAL err1, err2, err3;
+ REAL _i, _j, _0;
+
+ aex = (REAL) (pa[0] - pe[0]);
+ bex = (REAL) (pb[0] - pe[0]);
+ cex = (REAL) (pc[0] - pe[0]);
+ dex = (REAL) (pd[0] - pe[0]);
+ aey = (REAL) (pa[1] - pe[1]);
+ bey = (REAL) (pb[1] - pe[1]);
+ cey = (REAL) (pc[1] - pe[1]);
+ dey = (REAL) (pd[1] - pe[1]);
+ aez = (REAL) (pa[2] - pe[2]);
+ bez = (REAL) (pb[2] - pe[2]);
+ cez = (REAL) (pc[2] - pe[2]);
+ dez = (REAL) (pd[2] - pe[2]);
+ aeheight = (REAL) (aheight - eheight);
+ beheight = (REAL) (bheight - eheight);
+ ceheight = (REAL) (cheight - eheight);
+ deheight = (REAL) (dheight - eheight);
+
+ Two_Product(aex, bey, aexbey1, aexbey0);
+ Two_Product(bex, aey, bexaey1, bexaey0);
+ Two_Two_Diff(aexbey1, aexbey0, bexaey1, bexaey0, ab3, ab[2], ab[1], ab[0]);
+ ab[3] = ab3;
+
+ Two_Product(bex, cey, bexcey1, bexcey0);
+ Two_Product(cex, bey, cexbey1, cexbey0);
+ Two_Two_Diff(bexcey1, bexcey0, cexbey1, cexbey0, bc3, bc[2], bc[1], bc[0]);
+ bc[3] = bc3;
+
+ Two_Product(cex, dey, cexdey1, cexdey0);
+ Two_Product(dex, cey, dexcey1, dexcey0);
+ Two_Two_Diff(cexdey1, cexdey0, dexcey1, dexcey0, cd3, cd[2], cd[1], cd[0]);
+ cd[3] = cd3;
+
+ Two_Product(dex, aey, dexaey1, dexaey0);
+ Two_Product(aex, dey, aexdey1, aexdey0);
+ Two_Two_Diff(dexaey1, dexaey0, aexdey1, aexdey0, da3, da[2], da[1], da[0]);
+ da[3] = da3;
+
+ Two_Product(aex, cey, aexcey1, aexcey0);
+ Two_Product(cex, aey, cexaey1, cexaey0);
+ Two_Two_Diff(aexcey1, aexcey0, cexaey1, cexaey0, ac3, ac[2], ac[1], ac[0]);
+ ac[3] = ac3;
+
+ Two_Product(bex, dey, bexdey1, bexdey0);
+ Two_Product(dex, bey, dexbey1, dexbey0);
+ Two_Two_Diff(bexdey1, bexdey0, dexbey1, dexbey0, bd3, bd[2], bd[1], bd[0]);
+ bd[3] = bd3;
+
+ temp8alen = scale_expansion_zeroelim(4, cd, bez, temp8a);
+ temp8blen = scale_expansion_zeroelim(4, bd, -cez, temp8b);
+ temp8clen = scale_expansion_zeroelim(4, bc, dez, temp8c);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a,
+ temp8blen, temp8b, temp16);
+ temp24len = fast_expansion_sum_zeroelim(temp8clen, temp8c,
+ temp16len, temp16, temp24);
+ alen = scale_expansion_zeroelim(temp24len, temp24, -aeheight, adet);
+
+ temp8alen = scale_expansion_zeroelim(4, da, cez, temp8a);
+ temp8blen = scale_expansion_zeroelim(4, ac, dez, temp8b);
+ temp8clen = scale_expansion_zeroelim(4, cd, aez, temp8c);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a,
+ temp8blen, temp8b, temp16);
+ temp24len = fast_expansion_sum_zeroelim(temp8clen, temp8c,
+ temp16len, temp16, temp24);
+ blen = scale_expansion_zeroelim(temp24len, temp24, beheight, bdet);
+
+ temp8alen = scale_expansion_zeroelim(4, ab, dez, temp8a);
+ temp8blen = scale_expansion_zeroelim(4, bd, aez, temp8b);
+ temp8clen = scale_expansion_zeroelim(4, da, bez, temp8c);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a,
+ temp8blen, temp8b, temp16);
+ temp24len = fast_expansion_sum_zeroelim(temp8clen, temp8c,
+ temp16len, temp16, temp24);
+ clen = scale_expansion_zeroelim(temp24len, temp24, -ceheight, cdet);
+
+ temp8alen = scale_expansion_zeroelim(4, bc, aez, temp8a);
+ temp8blen = scale_expansion_zeroelim(4, ac, -bez, temp8b);
+ temp8clen = scale_expansion_zeroelim(4, ab, cez, temp8c);
+ temp16len = fast_expansion_sum_zeroelim(temp8alen, temp8a,
+ temp8blen, temp8b, temp16);
+ temp24len = fast_expansion_sum_zeroelim(temp8clen, temp8c,
+ temp16len, temp16, temp24);
+ dlen = scale_expansion_zeroelim(temp24len, temp24, deheight, ddet);
+
+ ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet);
+ cdlen = fast_expansion_sum_zeroelim(clen, cdet, dlen, ddet, cddet);
+ finlength = fast_expansion_sum_zeroelim(ablen, abdet, cdlen, cddet, fin1);
+
+ det = estimate(finlength, fin1);
+ errbound = isperrboundB * permanent;
+ if ((det >= errbound) || (-det >= errbound)) {
+ return det;
+ }
+
+ Two_Diff_Tail(pa[0], pe[0], aex, aextail);
+ Two_Diff_Tail(pa[1], pe[1], aey, aeytail);
+ Two_Diff_Tail(pa[2], pe[2], aez, aeztail);
+ Two_Diff_Tail(aheight, eheight, aeheight, aeheighttail);
+ Two_Diff_Tail(pb[0], pe[0], bex, bextail);
+ Two_Diff_Tail(pb[1], pe[1], bey, beytail);
+ Two_Diff_Tail(pb[2], pe[2], bez, beztail);
+ Two_Diff_Tail(bheight, eheight, beheight, beheighttail);
+ Two_Diff_Tail(pc[0], pe[0], cex, cextail);
+ Two_Diff_Tail(pc[1], pe[1], cey, ceytail);
+ Two_Diff_Tail(pc[2], pe[2], cez, ceztail);
+ Two_Diff_Tail(cheight, eheight, ceheight, ceheighttail);
+ Two_Diff_Tail(pd[0], pe[0], dex, dextail);
+ Two_Diff_Tail(pd[1], pe[1], dey, deytail);
+ Two_Diff_Tail(pd[2], pe[2], dez, deztail);
+ Two_Diff_Tail(dheight, eheight, deheight, deheighttail);
+ if ((aextail == 0.0) && (aeytail == 0.0) && (aeztail == 0.0)
+ && (bextail == 0.0) && (beytail == 0.0) && (beztail == 0.0)
+ && (cextail == 0.0) && (ceytail == 0.0) && (ceztail == 0.0)
+ && (dextail == 0.0) && (deytail == 0.0) && (deztail == 0.0)
+ && (aeheighttail == 0.0) && (beheighttail == 0.0)
+ && (ceheighttail == 0.0) && (deheighttail == 0.0)) {
+ return det;
+ }
+
+ errbound = isperrboundC * permanent + resulterrbound * Absolute(det);
+ abeps = (aex * beytail + bey * aextail)
+ - (aey * bextail + bex * aeytail);
+ bceps = (bex * ceytail + cey * bextail)
+ - (bey * cextail + cex * beytail);
+ cdeps = (cex * deytail + dey * cextail)
+ - (cey * dextail + dex * ceytail);
+ daeps = (dex * aeytail + aey * dextail)
+ - (dey * aextail + aex * deytail);
+ aceps = (aex * ceytail + cey * aextail)
+ - (aey * cextail + cex * aeytail);
+ bdeps = (bex * deytail + dey * bextail)
+ - (bey * dextail + dex * beytail);
+ det += ((beheight
+ * ((cez * daeps + dez * aceps + aez * cdeps)
+ + (ceztail * da3 + deztail * ac3 + aeztail * cd3))
+ + deheight
+ * ((aez * bceps - bez * aceps + cez * abeps)
+ + (aeztail * bc3 - beztail * ac3 + ceztail * ab3)))
+ - (aeheight
+ * ((bez * cdeps - cez * bdeps + dez * bceps)
+ + (beztail * cd3 - ceztail * bd3 + deztail * bc3))
+ + ceheight
+ * ((dez * abeps + aez * bdeps + bez * daeps)
+ + (deztail * ab3 + aeztail * bd3 + beztail * da3))))
+ + ((beheighttail * (cez * da3 + dez * ac3 + aez * cd3)
+ + deheighttail * (aez * bc3 - bez * ac3 + cez * ab3))
+ - (aeheighttail * (bez * cd3 - cez * bd3 + dez * bc3)
+ + ceheighttail * (dez * ab3 + aez * bd3 + bez * da3)));
+ if ((det >= errbound) || (-det >= errbound)) {
+ return det;
+ }
+
+ return orient4dexact(pa, pb, pc, pd, pe,
+ aheight, bheight, cheight, dheight, eheight);
+}
+
+REAL orient4d (
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe )
+{
+ REAL aheight, bheight, cheight, dheight, eheight;
+ REAL aex, bex, cex, dex;
+ REAL aey, bey, cey, dey;
+ REAL aez, bez, cez, dez;
+ REAL aexbey, bexaey, bexcey, cexbey, cexdey, dexcey, dexaey, aexdey;
+ REAL aexcey, cexaey, bexdey, dexbey;
+ REAL aeheight, beheight, ceheight, deheight;
+ REAL ab, bc, cd, da, ac, bd;
+ REAL abc, bcd, cda, dab;
+ REAL aezplus, bezplus, cezplus, dezplus;
+ REAL aexbeyplus, bexaeyplus, bexceyplus, cexbeyplus;
+ REAL cexdeyplus, dexceyplus, dexaeyplus, aexdeyplus;
+ REAL aexceyplus, cexaeyplus, bexdeyplus, dexbeyplus;
+ REAL det;
+ REAL permanent, errbound;
+
+ aheight = pa[3];
+ bheight = pb[3];
+ cheight = pc[3];
+ dheight = pd[3];
+ eheight = pe[3];
+
+ aex = pa[0] - pe[0];
+ bex = pb[0] - pe[0];
+ cex = pc[0] - pe[0];
+ dex = pd[0] - pe[0];
+ aey = pa[1] - pe[1];
+ bey = pb[1] - pe[1];
+ cey = pc[1] - pe[1];
+ dey = pd[1] - pe[1];
+ aez = pa[2] - pe[2];
+ bez = pb[2] - pe[2];
+ cez = pc[2] - pe[2];
+ dez = pd[2] - pe[2];
+ aeheight = aheight - eheight;
+ beheight = bheight - eheight;
+ ceheight = cheight - eheight;
+ deheight = dheight - eheight;
+
+ aexbey = aex * bey;
+ bexaey = bex * aey;
+ ab = aexbey - bexaey;
+ bexcey = bex * cey;
+ cexbey = cex * bey;
+ bc = bexcey - cexbey;
+ cexdey = cex * dey;
+ dexcey = dex * cey;
+ cd = cexdey - dexcey;
+ dexaey = dex * aey;
+ aexdey = aex * dey;
+ da = dexaey - aexdey;
+
+ aexcey = aex * cey;
+ cexaey = cex * aey;
+ ac = aexcey - cexaey;
+ bexdey = bex * dey;
+ dexbey = dex * bey;
+ bd = bexdey - dexbey;
+
+ abc = aez * bc - bez * ac + cez * ab;
+ bcd = bez * cd - cez * bd + dez * bc;
+ cda = cez * da + dez * ac + aez * cd;
+ dab = dez * ab + aez * bd + bez * da;
+
+ det = (deheight * abc - ceheight * dab) + (beheight * cda - aeheight * bcd);
+
+ aezplus = Absolute(aez);
+ bezplus = Absolute(bez);
+ cezplus = Absolute(cez);
+ dezplus = Absolute(dez);
+ aexbeyplus = Absolute(aexbey);
+ bexaeyplus = Absolute(bexaey);
+ bexceyplus = Absolute(bexcey);
+ cexbeyplus = Absolute(cexbey);
+ cexdeyplus = Absolute(cexdey);
+ dexceyplus = Absolute(dexcey);
+ dexaeyplus = Absolute(dexaey);
+ aexdeyplus = Absolute(aexdey);
+ aexceyplus = Absolute(aexcey);
+ cexaeyplus = Absolute(cexaey);
+ bexdeyplus = Absolute(bexdey);
+ dexbeyplus = Absolute(dexbey);
+ permanent = ((cexdeyplus + dexceyplus) * bezplus
+ + (dexbeyplus + bexdeyplus) * cezplus
+ + (bexceyplus + cexbeyplus) * dezplus)
+ * aeheight
+ + ((dexaeyplus + aexdeyplus) * cezplus
+ + (aexceyplus + cexaeyplus) * dezplus
+ + (cexdeyplus + dexceyplus) * aezplus)
+ * beheight
+ + ((aexbeyplus + bexaeyplus) * dezplus
+ + (bexdeyplus + dexbeyplus) * aezplus
+ + (dexaeyplus + aexdeyplus) * bezplus)
+ * ceheight
+ + ((bexceyplus + cexbeyplus) * aezplus
+ + (cexaeyplus + aexceyplus) * bezplus
+ + (aexbeyplus + bexaeyplus) * cezplus)
+ * deheight;
+ errbound = isperrboundA * permanent;
+ if ((det > errbound) || (-det > errbound)) {
+ return det;
+ }
+
+ return orient4dadapt(pa, pb, pc, pd, pe,
+ aheight, bheight, cheight, dheight, eheight, permanent);
+}
+
+/*****************************************************************************/
+/* */
+/* regular_k() Return a positive value if the point pe is incompatible */
+/* with the sphere or hyperplane passing through pa, pb, pc, */
+/* and pd (meaning that pe is inside the sphere or below the */
+/* hyperplane); a negative value if it is compatible; and */
+/* zero if the five points are cospherical/cohyperplanar. */
+/* The points pa, pb, pc, and pd must be ordered so that */
+/* they have a positive orientation (as defined by */
+/* orient3d()), or the sign of the result will be reversed. */
+/* */
+/* Uses exact arithmetic if necessary to ensure a correct answer. The */
+/* result returned is the determinant of a matrix. This determinant is */
+/* computed adaptively, in the sense that exact arithmetic is used only to */
+/* the degree it is needed to ensure that the returned value has the */
+/* correct sign. Hence, orient4d() is usually quite fast, but will run */
+/* more slowly when the input points are hyper-coplanar or nearly so. */
+/* */
+/* See my Robust Predicates paper for details. */
+/* */
+/*****************************************************************************/
+
+REAL regular2 (
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd )
+{
+ REAL PA[3], PB[3], PC[3], PD[3] ;
+
+ PA[0] = pa[0] ; PA[1] = pa[1] ;
+ PB[0] = pb[0] ; PB[1] = pb[1] ;
+ PC[0] = pc[0] ; PC[1] = pc[1] ;
+ PD[0] = pd[0] ; PD[1] = pd[1] ;
+
+ PA[2] = pa[0] * pa[0]
+ + pa[1] * pa[1] - pa[2] ;
+ PB[2] = pb[0] * pb[0]
+ + pb[1] * pb[1] - pb[2] ;
+ PC[2] = pc[0] * pc[0]
+ + pc[1] * pc[1] - pc[2] ;
+ PD[2] = pd[0] * pd[0]
+ + pd[1] * pd[1] - pd[2] ;
+
+ return orient3d(PA, PB, PC, PD) ;
+}
+
+REAL regular3 (
+ __const_ptr(REAL) pa,
+ __const_ptr(REAL) pb,
+ __const_ptr(REAL) pc,
+ __const_ptr(REAL) pd,
+ __const_ptr(REAL) pe )
+{
+ REAL PA[4], PB[4], PC[4], PD[4], PE[4] ;
+
+ PA[0] = pa[0] ; PA[1] = pa[1] ; PA[2] = pa[2] ;
+ PB[0] = pb[0] ; PB[1] = pb[1] ; PB[2] = pb[2] ;
+ PC[0] = pc[0] ; PC[1] = pc[1] ; PC[2] = pc[2] ;
+ PD[0] = pd[0] ; PD[1] = pd[1] ; PD[2] = pd[2] ;
+ PE[0] = pe[0] ; PE[1] = pe[1] ; PE[2] = pe[2] ;
+
+ PA[3] = pa[0] * pa[0]
+ + pa[1] * pa[1]
+ + pa[2] * pa[2] - pa[3] ;
+ PB[3] = pb[0] * pb[0]
+ + pb[1] * pb[1]
+ + pb[2] * pb[2] - pb[3] ;
+ PC[3] = pc[0] * pc[0]
+ + pc[1] * pc[1]
+ + pc[2] * pc[2] - pc[3] ;
+ PD[3] = pd[0] * pd[0]
+ + pd[1] * pd[1]
+ + pd[2] * pd[2] - pd[3] ;
+ PE[3] = pe[0] * pe[0]
+ + pe[1] * pe[1]
+ + pe[2] * pe[2] - pe[3] ;
+
+ return orient4d(PA, PB, PC, PD, PE) ;
+}
+
}
-#endif//__GEOMPRED__
+#endif // __GEOMPRED__
diff --git a/src/libcpp/geom_base/tria_ball_k.hpp b/src/libcpp/geom_base/tria_ball_k.hpp
index 6968d0c..e93b4e9 100644
--- a/src/libcpp/geom_base/tria_ball_k.hpp
+++ b/src/libcpp/geom_base/tria_ball_k.hpp
@@ -1333,7 +1333,7 @@
_bb[3] = std::max ( _r4,
std::max ( _r3,
std::max ( _r1, _r2)
- )) ;
+ ) ) ;
}
}
diff --git a/uni/CMakeLists.txt b/uni/CMakeLists.txt
new file mode 100644
index 0000000..32898a8
--- /dev/null
+++ b/uni/CMakeLists.txt
@@ -0,0 +1,36 @@
+cmake_minimum_required (VERSION 3.9.4)
+project (JIGSAW_UNIT_TEST)
+
+find_library (LIBJIGSAW jigsaw HINTS "${PROJECT_SOURCE_DIR}/../lib")
+
+message ("libjigsaw location: ${LIBJIGSAW}")
+
+add_executable (test_1 test_1.c)
+target_link_libraries (test_1 ${LIBJIGSAW})
+set_target_properties(test_1 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install (TARGETS test_1 DESTINATION "${PROJECT_SOURCE_DIR}")
+
+add_executable (test_2 test_2.c)
+target_link_libraries (test_2 ${LIBJIGSAW})
+set_target_properties(test_2 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install (TARGETS test_2 DESTINATION "${PROJECT_SOURCE_DIR}")
+
+add_executable (test_3 test_3.c)
+target_link_libraries (test_3 ${LIBJIGSAW})
+set_target_properties(test_3 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install (TARGETS test_3 DESTINATION "${PROJECT_SOURCE_DIR}")
+
+add_executable (test_4 test_4.c)
+target_link_libraries (test_4 ${LIBJIGSAW})
+set_target_properties(test_4 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install (TARGETS test_4 DESTINATION "${PROJECT_SOURCE_DIR}")
+
+add_executable (test_5 test_5.c)
+target_link_libraries (test_5 ${LIBJIGSAW})
+set_target_properties(test_5 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install (TARGETS test_5 DESTINATION "${PROJECT_SOURCE_DIR}")
+
+add_executable (test_6 test_6.c)
+target_link_libraries (test_6 ${LIBJIGSAW})
+set_target_properties(test_6 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+install (TARGETS test_6 DESTINATION "${PROJECT_SOURCE_DIR}")
diff --git a/uni/test_1.c b/uni/test_1.c
index f138497..906731e 100644
--- a/uni/test_1.c
+++ b/uni/test_1.c
@@ -1,7 +1,7 @@
// gcc -Wall test_1.c
-// -Xlinker -rpath=../lib/LNX-64
-// -L ../lib/LNX-64 -ljigsaw64r -o test_1
+// -Xlinker -rpath=../lib
+// -L ../lib -ljigsaw -o test_1
// A simple example to start: use JIGSAW to mesh a square
// domain.
diff --git a/uni/test_2.c b/uni/test_2.c
index 7479405..55a0e82 100644
--- a/uni/test_2.c
+++ b/uni/test_2.c
@@ -1,7 +1,7 @@
// gcc -Wall test_2.c
-// -Xlinker -rpath=../lib/LNX-64
-// -L ../lib/LNX-64 -ljigsaw64r -o test_2
+// -Xlinker -rpath=../lib
+// -L ../lib -ljigsaw -o test_2
// Use JIGSAW to mesh a simple geometry with user-defined
// mesh-spacing data defined on a "mesh".
diff --git a/uni/test_3.c b/uni/test_3.c
index 0be31f4..af66002 100644
--- a/uni/test_3.c
+++ b/uni/test_3.c
@@ -1,7 +1,7 @@
// gcc -Wall test_3.c
-// -Xlinker -rpath=../lib/LNX-64
-// -L ../lib/LNX-64 -ljigsaw64r -o test_3
+// -Xlinker -rpath=../lib
+// -L ../lib -ljigsaw -o test_3
// Use JIGSAW to mesh a simple geometry with user-defined
// mesh-spacing data defined on a "grid".
diff --git a/uni/test_4.c b/uni/test_4.c
index 8dcf13b..0278cba 100644
--- a/uni/test_4.c
+++ b/uni/test_4.c
@@ -1,7 +1,7 @@
// gcc -Wall test_4.c
-// -Xlinker -rpath=../lib/LNX-64
-// -L ../lib/LNX-64 -ljigsaw64r -o test_4
+// -Xlinker -rpath=../lib
+// -L ../lib -ljigsaw -o test_4
// An example that uses JIGSAW to mesh "multiply-connected"
// geometry.
diff --git a/uni/test_5.c b/uni/test_5.c
index f14b475..de96ae5 100644
--- a/uni/test_5.c
+++ b/uni/test_5.c
@@ -1,7 +1,7 @@
// gcc -Wall test_5.c
-// -Xlinker -rpath=../lib/LNX-64
-// -L ../lib/LNX-64 -ljigsaw64r -o test_5
+// -Xlinker -rpath=../lib
+// -L ../lib -ljigsaw -o test_5
// An example that uses TRIPOD to build a "restricted" DT.
diff --git a/uni/test_6.c b/uni/test_6.c
index 2d5de46..bb672a2 100644
--- a/uni/test_6.c
+++ b/uni/test_6.c
@@ -1,7 +1,7 @@
// gcc -Wall test_6.c
-// -Xlinker -rpath=../lib/LNX-64
-// -L ../lib/LNX-64 -ljigsaw64r -o test_6
+// -Xlinker -rpath=../lib
+// -L ../lib -ljigsaw -o test_6
// Use JIGSAW to mesh a simple domain, but starting from
// user-defined initial-conditions.
From 344368657dd9970158698c1d70f990cbdbc043da Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Tue, 16 Apr 2019 04:23:30 -0400
Subject: [PATCH 06/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3dddca2..d04f530 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ This process will build a series of executables and the shared library: `jigsaw`
See `example.jig` for documentation on calling the command-line executables, and the headers in `../jigsaw/inc/` for details on the `API`.
-#### `Via g++/llvm`
+#### `Using g++/llvm`
`JIGSAW` has been successfully built using various versions of the `g++` and `llvm` compilers. The build process is a simple one-liner (from `../jigsaw/src/`):
````
From 86adbc44b8367bd0561f025a44b60d0d7bb6113c Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Tue, 16 Apr 2019 04:27:43 -0400
Subject: [PATCH 07/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
README.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index d04f530..37a968e 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ This package provides the underlying `C++` source for `JIGSAW`; defining a basic
`JIGSAW` has been compiled and tested on various `64-bit` `Linux`, `Windows` and `MacOS` based platforms.
-## `Code Structure`
+### `Code Structure`
`JIGSAW` is written as a `header-only` library in `C++`. Both a basic command-line interface and a `C`-format `API` are defined:
@@ -26,7 +26,7 @@ This package provides the underlying `C++` source for `JIGSAW`; defining a basic
├── out -- default folder for JIGSAW output
└── uni -- unit tests and libjigsaw example programs
-## `Getting Started`
+### `Getting Started`
The first step is to compile and configure the code! `JIGSAW` can either be built directly from src, or installed using the `conda` package manager.
@@ -87,7 +87,7 @@ Each time you want to use `JIGSAW` simply activate the environment using: `conda
Once activated, the various `JIGSAW` command-line utilities will be available in your run path, `JIGSAW`'s shared library (`libjigsaw`) will be available in your library path and its include files in your include path.
-## `A Simple Example`
+### `A Simple Example`
After compiling the code, try running the following command-line example to get started:
````
@@ -103,7 +103,7 @@ In this example, a high-quality tetrahedral mesh is generated for the 'stanford-
A repository of additional surface models generated using `JIGSAW` can be found here.
-## `API Example Code`
+### `API Example Code`
A set of unit-tests and `libjigsaw` example programs are contained in `../jigsaw/uni/`. The `JIGSAW-API` is documented via the header files in `../jigsaw/inc/`.
@@ -119,13 +119,13 @@ The unit-tests can be built using the `cmake` u
This process will build the unit-tests as a series of executables in `../jigsaw/uni/`. `BUILD_MODE` is a compiler configuration flag: either `RELEASE` or `DEBUG`.
-## `License`
+### `License`
This program may be freely redistributed under the condition that the copyright notices (including this entire header) are not removed, and no compensation is received through use of the software. Private, research, and institutional use is free. You may distribute modified versions of this code `UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS`. Distribution of this code as part of a commercial system is permissible `ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR`. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)
`DISCLAIMER`: Neither I nor: Columbia University, the Massachusetts Institute of Technology, the University of Sydney, nor the National Aeronautics and Space Administration warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk.
-## `References`
+### `References`
There are a number of publications that describe the algorithms used in `JIGSAW` in detail. If you make use of `JIGSAW` in your work, please consider including a reference to the following:
From bc3be3f09c84eeca89759dc968e03018055f8c9e Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Tue, 16 Apr 2019 04:37:47 -0400
Subject: [PATCH 08/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 37a968e..91dc683 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ This package provides the underlying `C++` source for `JIGSAW`; defining a basic
The first step is to compile and configure the code! `JIGSAW` can either be built directly from src, or installed using the `conda` package manager.
-### `Building JIGSAW from src`
+### `Building from src`
The full `JIGSAW` src can be found in `../jigsaw/src/`.
@@ -75,7 +75,7 @@ g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC -D NDEBUG
````
will build `JIGSAW` as a shared library (`libjigsaw`).
-### `Install JIGSAW via conda`
+### `Install via conda`
`JIGSAW` is also available as a `conda` environment. To install and use, follow the steps below:
From 861d631ef539257505b5e8dbd9faf5087111d844 Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Tue, 16 Apr 2019 05:40:09 -0400
Subject: [PATCH 09/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
uni/test_1.c | 33 +++++++++++++++--------------
uni/test_2.c | 54 +++++++++++++++++++++++-----------------------
uni/test_3.c | 60 +++++++++++++++++++++++++++-------------------------
uni/test_4.c | 31 ++++++++++++++-------------
uni/test_5.c | 36 ++++++++++++++++---------------
uni/test_6.c | 36 ++++++++++++++++---------------
6 files changed, 130 insertions(+), 120 deletions(-)
diff --git a/uni/test_1.c b/uni/test_1.c
index 906731e..0f1cde2 100644
--- a/uni/test_1.c
+++ b/uni/test_1.c
@@ -19,11 +19,12 @@
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
+ jigsaw_init_jig_t(&_jjig) ;
+
jigsaw_msh_t _geom ;
- jigsaw_msh_t _mesh ;
-
- jigsaw_init_jig_t(&_jjig) ;
- jigsaw_init_msh_t(&_geom) ;
+ jigsaw_init_msh_t(&_geom) ;
+
+ jigsaw_msh_t _mesh ;
jigsaw_init_msh_t(&_mesh) ;
/*
@@ -31,17 +32,17 @@
* JIGSAW's "mesh" is a piecewise linear complex:
--------------------------------------------------------
*
- * e:2
- * v:3 o---------------o v:2
- * | |
- * | |
- * | |
- * e:3 | | e:1
- * | |
- * | |
- * | |
- * v:0 o---------------o v:1
- * e:0
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | |
+ * | |
+ * e:3 | | e:1
+ * | |
+ * | |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
*
--------------------------------------------------------
*/
@@ -73,7 +74,7 @@
_jjig._verbosity = +1 ;
- _jjig._hfun_hmax = 0.10 ;
+ _jjig._hfun_hmax = 0.25 ;
_jjig._hfun_scal =
JIGSAW_HFUN_RELATIVE;
diff --git a/uni/test_2.c b/uni/test_2.c
index 55a0e82..495416d 100644
--- a/uni/test_2.c
+++ b/uni/test_2.c
@@ -19,13 +19,15 @@
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
+ jigsaw_init_jig_t(&_jjig) ;
+
jigsaw_msh_t _geom ;
+ jigsaw_init_msh_t(&_geom) ;
+
jigsaw_msh_t _hfun ;
- jigsaw_msh_t _mesh ;
-
- jigsaw_init_jig_t(&_jjig) ;
- jigsaw_init_msh_t(&_geom) ;
- jigsaw_init_msh_t(&_hfun) ;
+ jigsaw_init_msh_t(&_hfun) ;
+
+ jigsaw_msh_t _mesh ;
jigsaw_init_msh_t(&_mesh) ;
/*
@@ -33,17 +35,17 @@
* JIGSAW's "mesh" is a piecewise linear complex:
--------------------------------------------------------
*
- * e:2
- * v:3 o---------------o v:2
- * | |
- * | |
- * | |
- * e:3 | | e:1
- * | |
- * | |
- * | |
- * v:0 o---------------o v:1
- * e:0
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | |
+ * | |
+ * e:3 | | e:1
+ * | |
+ * | |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
*
--------------------------------------------------------
*/
@@ -76,15 +78,15 @@
* JIGSAW's "mesh" is a piecewise linear complex:
--------------------------------------------------------
*
- * v:3 o---------------o v:2
- * | \ t:2 / |
- * | \ / |
- * | \ 4 / |
- * | t:3 o t:1 |
- * | / \ |
- * | / \ |
- * | / t:0 \ |
- * v:0 o---------------o v:1
+ * v:3 o---------------o v:2
+ * | \ t:2 / |
+ * | \ / |
+ * | \ 4 / |
+ * | t:3 o t:1 |
+ * | / \ |
+ * | / \ |
+ * | / t:0 \ |
+ * v:0 o---------------o v:1
*
--------------------------------------------------------
*/
@@ -105,7 +107,7 @@
} ;
real_t _hfun_value[5] = {
- .1, .1, .1, .1, .2
+ .2, .2, .2, .2, .5
} ;
_hfun._flags
diff --git a/uni/test_3.c b/uni/test_3.c
index af66002..f42989a 100644
--- a/uni/test_3.c
+++ b/uni/test_3.c
@@ -19,13 +19,15 @@
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
+ jigsaw_init_jig_t(&_jjig) ;
+
jigsaw_msh_t _geom ;
+ jigsaw_init_msh_t(&_geom) ;
+
jigsaw_msh_t _hfun ;
- jigsaw_msh_t _mesh ;
-
- jigsaw_init_jig_t(&_jjig) ;
- jigsaw_init_msh_t(&_geom) ;
- jigsaw_init_msh_t(&_hfun) ;
+ jigsaw_init_msh_t(&_hfun) ;
+
+ jigsaw_msh_t _mesh ;
jigsaw_init_msh_t(&_mesh) ;
/*
@@ -33,17 +35,17 @@
* JIGSAW's "mesh" is a piecewise linear complex:
--------------------------------------------------------
*
- * e:2
- * v:3 o---------------o v:2
- * | |
- * | |
- * | |
- * e:3 | | e:1
- * | |
- * | |
- * | |
- * v:0 o---------------o v:1
- * e:0
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | |
+ * | |
+ * e:3 | | e:1
+ * | |
+ * | |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
*
--------------------------------------------------------
*/
@@ -76,17 +78,17 @@
* JIGSAW's "grid" uses a column-major numbering:
--------------------------------------------------------
*
- * v:5
- * v:2 o-------o-------o v:8
- * | | |
- * | | |
- * | v:4 |
- * v:1 o-------o-------o v:7
- * | | |
- * | | |
- * | | |
- * v:0 o-------o-------o v:6
- * v:3
+ * v:5
+ * v:2 o-------o-------o v:8
+ * | | |
+ * | | |
+ * | v:4 |
+ * v:1 o-------o-------o v:7
+ * | | |
+ * | | |
+ * | | |
+ * v:0 o-------o-------o v:6
+ * v:3
*
--------------------------------------------------------
*/
@@ -100,8 +102,8 @@
} ;
real_t _hfun_value[9] = {
- .1, .1, .2, .1, .2, .3, .2,
- .3, .4
+ .3, .2, .3, .2, .1, .2, .3,
+ .2, .3
} ;
_hfun._flags
diff --git a/uni/test_4.c b/uni/test_4.c
index 0278cba..c206716 100644
--- a/uni/test_4.c
+++ b/uni/test_4.c
@@ -19,11 +19,12 @@
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
+ jigsaw_init_jig_t(&_jjig) ;
+
jigsaw_msh_t _geom ;
- jigsaw_msh_t _mesh ;
-
- jigsaw_init_jig_t(&_jjig) ;
- jigsaw_init_msh_t(&_geom) ;
+ jigsaw_init_msh_t(&_geom) ;
+
+ jigsaw_msh_t _mesh ;
jigsaw_init_msh_t(&_mesh) ;
/*
@@ -31,17 +32,17 @@
* A domain with "interior" constraints
--------------------------------------------------------
*
- * e:2
- * v:3 o---------------o v:2
- * | |
- * | e:6 |
- * | o---o |
- * e:3 | e:7 | | e:5 | e:1
- * | o---o |
- * | e:4 |
- * | |
- * v:0 o---------------o v:1
- * e:0
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | e:6 |
+ * | o---o |
+ * e:3 | e:7 | | e:5 | e:1
+ * | o---o |
+ * | e:4 |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
*
--------------------------------------------------------
*/
diff --git a/uni/test_5.c b/uni/test_5.c
index de96ae5..cb11685 100644
--- a/uni/test_5.c
+++ b/uni/test_5.c
@@ -18,31 +18,33 @@
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
+ jigsaw_init_jig_t(&_jjig) ;
+
jigsaw_msh_t _geom ;
+ jigsaw_init_msh_t(&_geom) ;
+
jigsaw_msh_t _init ;
- jigsaw_msh_t _tria ;
-
- jigsaw_init_jig_t(&_jjig) ;
- jigsaw_init_msh_t(&_geom) ;
- jigsaw_init_msh_t(&_init) ;
+ jigsaw_init_msh_t(&_init) ;
+
+ jigsaw_msh_t _tria ;
jigsaw_init_msh_t(&_tria) ;
/*
--------------------------------------------------------
- * A simple square domain
+ * JIGSAW's "mesh" is a piecewise linear complex:
--------------------------------------------------------
*
- * e:2
- * v:3 o---------------o v:2
- * | |
- * | |
- * | |
- * e:3 | | e:1
- * | |
- * | |
- * | |
- * v:0 o---------------o v:1
- * e:0
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | |
+ * | |
+ * e:3 | | e:1
+ * | |
+ * | |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
*
--------------------------------------------------------
*/
diff --git a/uni/test_6.c b/uni/test_6.c
index bb672a2..4f32da2 100644
--- a/uni/test_6.c
+++ b/uni/test_6.c
@@ -19,31 +19,33 @@
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
+ jigsaw_init_jig_t(&_jjig) ;
+
jigsaw_msh_t _geom ;
+ jigsaw_init_msh_t(&_geom) ;
+
jigsaw_msh_t _init ;
- jigsaw_msh_t _mesh ;
-
- jigsaw_init_jig_t(&_jjig) ;
- jigsaw_init_msh_t(&_geom) ;
- jigsaw_init_msh_t(&_init) ;
+ jigsaw_init_msh_t(&_init) ;
+
+ jigsaw_msh_t _mesh ;
jigsaw_init_msh_t(&_mesh) ;
/*
--------------------------------------------------------
- * A simple square domain
+ * JIGSAW's "mesh" is a piecewise linear complex:
--------------------------------------------------------
*
- * e:2
- * v:3 o---------------o v:2
- * | |
- * | |
- * | |
- * e:3 | | e:1
- * | |
- * | |
- * | |
- * v:0 o---------------o v:1
- * e:0
+ * e:2
+ * v:3 o---------------o v:2
+ * | |
+ * | |
+ * | |
+ * e:3 | | e:1
+ * | |
+ * | |
+ * | |
+ * v:0 o---------------o v:1
+ * e:0
*
--------------------------------------------------------
*/
From d348aef43932d7760eb239f278e11d3c329ad0ff Mon Sep 17 00:00:00 2001
From: dengwirda
Date: Tue, 16 Apr 2019 13:12:28 -0400
Subject: [PATCH 10/13] 0.9.10 updates: "Non-refinable" spec. for init.
conditions
---
README.md | 6 +-
src/geo_load.hpp | 3 +
src/hfn_load.hpp | 3 +
src/ini_load.hpp | 3 +
src/jig_load.hpp | 3 +
src/jigsaw.cpp | 13 +-
src/libcpp/containers/prioritymap.hpp | 28 ++--
src/libcpp/containers/priorityset.hpp | 28 ++--
src/libcpp/geom_base/predicate_k.hpp | 131 +++++++++---------
.../geom_type/geom_mesh_euclidean_2.hpp | 4 +-
.../geom_type/geom_mesh_euclidean_3.hpp | 16 +--
src/libcpp/hashfunc.hpp | 130 ++++++++---------
src/libcpp/rdel_mesh/rdel_create_init_2.inc | 9 +-
src/libcpp/rdel_mesh/rdel_create_init_3.inc | 16 ++-
src/libcpp/rdel_mesh/rdel_refine_topo_2.inc | 6 +-
src/libcpp/rdel_mesh/rdel_refine_topo_3.inc | 8 +-
src/libcpp/tessellate/del_tri_euclidean_2.hpp | 12 +-
src/libcpp/tessellate/del_tri_euclidean_3.hpp | 14 +-
src/marche.hpp | 2 +
src/msh_save.hpp | 14 +-
20 files changed, 238 insertions(+), 211 deletions(-)
diff --git a/README.md b/README.md
index 91dc683..9641d91 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ This process will build a series of executables and the shared library: `jigsaw`
See `example.jig` for documentation on calling the command-line executables, and the headers in `../jigsaw/inc/` for details on the `API`.
-#### `Using g++/llvm`
+#### `Using g++ / llvm`
`JIGSAW` has been successfully built using various versions of the `g++` and `llvm` compilers. The build process is a simple one-liner (from `../jigsaw/src/`):
````
@@ -87,7 +87,7 @@ Each time you want to use `JIGSAW` simply activate the environment using: `conda
Once activated, the various `JIGSAW` command-line utilities will be available in your run path, `JIGSAW`'s shared library (`libjigsaw`) will be available in your library path and its include files in your include path.
-### `A Simple Example`
+### `CMD-LINE Examples`
After compiling the code, try running the following command-line example to get started:
````
@@ -103,7 +103,7 @@ In this example, a high-quality tetrahedral mesh is generated for the 'stanford-
A repository of additional surface models generated using `JIGSAW` can be found here.
-### `API Example Code`
+### `LIBJIGSAW Scripts`
A set of unit-tests and `libjigsaw` example programs are contained in `../jigsaw/uni/`. The `JIGSAW-API` is documented via the header files in `../jigsaw/inc/`.
diff --git a/src/geo_load.hpp b/src/geo_load.hpp
index b453310..2b993a0 100644
--- a/src/geo_load.hpp
+++ b/src/geo_load.hpp
@@ -374,6 +374,9 @@
try
{
+ __unreferenced (_jlog) ;
+ __unreferenced (_jcfg) ;
+
if (_gmsh._flags ==
JIGSAW_EUCLIDEAN_MESH )
{
diff --git a/src/hfn_load.hpp b/src/hfn_load.hpp
index 845e228..1e94ccc 100644
--- a/src/hfn_load.hpp
+++ b/src/hfn_load.hpp
@@ -418,6 +418,9 @@
try
{
+ __unreferenced (_jlog) ;
+ __unreferenced (_jcfg) ;
+
if (_hmsh._flags ==
JIGSAW_EUCLIDEAN_MESH )
{
diff --git a/src/ini_load.hpp b/src/ini_load.hpp
index 110d3bf..46d98ce 100644
--- a/src/ini_load.hpp
+++ b/src/ini_load.hpp
@@ -349,6 +349,9 @@
try
{
+ __unreferenced (_jlog) ;
+ __unreferenced (_jcfg) ;
+
if (_imsh._flags ==
JIGSAW_EUCLIDEAN_MESH )
{
diff --git a/src/jig_load.hpp b/src/jig_load.hpp
index 4a6f2a5..3e8e036 100644
--- a/src/jig_load.hpp
+++ b/src/jig_load.hpp
@@ -457,8 +457,11 @@
)
{
iptr_type _errv = __no_error ;
+
try
{
+ __unreferenced(_jlog) ;
+
/*------------------------------------- MISC keywords */
_jcfg._verbosity =
_jjig._verbosity ;
diff --git a/src/jigsaw.cpp b/src/jigsaw.cpp
index 3bc7c43..768d717 100644
--- a/src/jigsaw.cpp
+++ b/src/jigsaw.cpp
@@ -2,17 +2,18 @@
//
// for cmd-jigsaw:
//
- // g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
- // -D __cmd_jigsaw jigsaw.cpp -o jigsaw
+ // g++ -std=c++11 -pedantic -Wall -Wextra -O3 -flto
+ // -D NDEBUG -D __cmd_jigsaw jigsaw.cpp -o ../bin/jigsaw
//
- // g++ -std=c++11 -pedantic -Wall -s -O3 -flto -D NDEBUG
- // -D __cmd_tripod jigsaw.cpp -o tripod
+ // g++ -std=c++11 -pedantic -Wall -Wextra -O3 -flto
+ // -D NDEBUG -D __cmd_tripod jigsaw.cpp -o ../bin/tripod
//
//
// for lib-jigsaw:
//
- // g++ -std=c++11 -pedantic -Wall -O3 -flto -fPIC
- // -D NDEBUG -D __lib_jigsaw jigsaw.cpp -shared -o libjigsaw.so
+ // g++ -std=c++11 -pedantic -Wall -Wextra -O3 -flto
+ // -fPIC -D NDEBUG -D __lib_jigsaw jigsaw.cpp -shared
+ // -o ../lib/libjigsaw.so
//
/*
diff --git a/src/libcpp/containers/prioritymap.hpp b/src/libcpp/containers/prioritymap.hpp
index 3f40a4d..bfe9167 100644
--- a/src/libcpp/containers/prioritymap.hpp
+++ b/src/libcpp/containers/prioritymap.hpp
@@ -199,31 +199,31 @@
case 8 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 7 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 6 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 5 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 4 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 3 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 2 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
}
/*---------------------- update heap-keys mapping */
_ipos->_data =
@@ -254,31 +254,31 @@
case 8 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 7 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 6 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 5 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 4 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 3 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 2 :
if (this->_pred((--_cpos)->_data ,
_imin ->_data))
- _imin=_cpos;
+ _imin=_cpos; // falls through
}
/*---------------------- update heap-keys mapping */
_ipos->_data =
diff --git a/src/libcpp/containers/priorityset.hpp b/src/libcpp/containers/priorityset.hpp
index a4b7379..9aaf758 100644
--- a/src/libcpp/containers/priorityset.hpp
+++ b/src/libcpp/containers/priorityset.hpp
@@ -166,25 +166,25 @@
{
case 8 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 7 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 6 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 5 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 4 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 3 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 2 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
}
/*------------------------------ swap with "hole" */
*_ipos = std::move(*_imin) ;
@@ -206,25 +206,25 @@
{
case 8 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 7 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 6 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 5 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 4 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 3 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
case 2 :
if (this->_pred(*--_cpos,*_imin))
- _imin=_cpos;
+ _imin=_cpos; // falls through
}
/*------------------------------ swap with "hole" */
*_ipos = std::move( *_imin) ;
diff --git a/src/libcpp/geom_base/predicate_k.hpp b/src/libcpp/geom_base/predicate_k.hpp
index d7f9a18..4f16982 100644
--- a/src/libcpp/geom_base/predicate_k.hpp
+++ b/src/libcpp/geom_base/predicate_k.hpp
@@ -1146,7 +1146,7 @@ REAL orient2dexact (
REAL aterms[4], bterms[4], cterms[4];
REAL aterms3, bterms3, cterms3;
REAL v[8], w[12];
- int vlength, wlength;
+ int vlength=0, wlength=0;
REAL bvirt, avirt, bround, around;
REAL c, abig, ahi, alo, bhi, blo;
@@ -1190,7 +1190,7 @@ REAL orient2dadapt (
REAL det, errbound;
REAL B[4], C1[8], C2[12], D[16];
REAL B3;
- int C1length, C2length, Dlength;
+ int C1length=0, C2length=0, Dlength=0;
REAL u[4];
REAL u3, s1, t1, s0, t0;
@@ -1263,7 +1263,7 @@ REAL orient2d (
REAL detleft, detright, det;
REAL detsum, errbound;
- detleft = (pa[0] - pc[0]) * (pb[1] - pc[1]);
+ detleft = (pa[0] - pc[0]) * (pb[1] - pc[1]);
detright = (pa[1] - pc[1]) * (pb[0] - pc[0]);
det = detleft - detright;
@@ -1326,15 +1326,15 @@ REAL orient3dexact (
REAL bxay0, cxby0, dxcy0, axdy0, cxay0, dxby0;
REAL ab[4], bc[4], cd[4], da[4], ac[4], bd[4];
REAL temp8[8];
- int templen;
+ int templen=0;
REAL abc[12], bcd[12], cda[12], dab[12];
- int abclen, bcdlen, cdalen, dablen;
+ int abclen=0, bcdlen=0, cdalen=0, dablen=0;
REAL adet[24], bdet[24], cdet[24], ddet[24];
- int alen, blen, clen, dlen;
+ int alen=0, blen=0, clen=0, dlen=0;
REAL abdet[48], cddet[48];
- int ablen, cdlen;
+ int ablen=0, cdlen=0;
REAL deter[96];
- int deterlen;
+ int deterlen=0;
int i;
REAL bvirt, avirt, bround, around;
@@ -1406,12 +1406,12 @@ REAL orient3dadapt (
REAL bc[4], ca[4], ab[4];
REAL bc3, ca3, ab3;
REAL adet[8], bdet[8], cdet[8];
- int alen, blen, clen;
+ int alen=0, blen=0, clen=0;
REAL abdet[16];
- int ablen;
+ int ablen=0;
REAL *finnow, *finother, *finswap;
REAL fin1[192], fin2[192];
- int finlength;
+ int finlength=0;
REAL adxtail, bdxtail, cdxtail;
REAL adytail, bdytail, cdytail;
@@ -1420,7 +1420,8 @@ REAL orient3dadapt (
REAL bt_clarge, bt_alarge;
REAL ct_alarge, ct_blarge;
REAL at_b[4], at_c[4], bt_c[4], bt_a[4], ct_a[4], ct_b[4];
- int at_blen, at_clen, bt_clen, bt_alen, ct_alen, ct_blen;
+ int at_blen=0, at_clen=0, bt_clen=0;
+ int bt_alen=0, ct_alen=0, ct_blen=0;
REAL bdxt_cdy1, cdxt_bdy1, cdxt_ady1;
REAL adxt_cdy1, adxt_bdy1, bdxt_ady1;
REAL bdxt_cdy0, cdxt_bdy0, cdxt_ady0;
@@ -1430,14 +1431,14 @@ REAL orient3dadapt (
REAL bdyt_cdx0, cdyt_bdx0, cdyt_adx0;
REAL adyt_cdx0, adyt_bdx0, bdyt_adx0;
REAL bct[8], cat[8], abt[8];
- int bctlen, catlen, abtlen;
+ int bctlen=0, catlen=0, abtlen=0;
REAL bdxt_cdyt1, cdxt_bdyt1, cdxt_adyt1;
REAL adxt_cdyt1, adxt_bdyt1, bdxt_adyt1;
REAL bdxt_cdyt0, cdxt_bdyt0, cdxt_adyt0;
REAL adxt_cdyt0, adxt_bdyt0, bdxt_adyt0;
REAL u[4], v[12], w[16];
REAL u3;
- int vlength, wlength;
+ int vlength=0, wlength=0;
REAL negate;
REAL bvirt, avirt, bround, around;
@@ -1869,17 +1870,17 @@ REAL incircleexact (
REAL bxay0, cxby0, dxcy0, axdy0, cxay0, dxby0;
REAL ab[4], bc[4], cd[4], da[4], ac[4], bd[4];
REAL temp8[8];
- int templen;
+ int templen=0;
REAL abc[12], bcd[12], cda[12], dab[12];
- int abclen, bcdlen, cdalen, dablen;
+ int abclen=0, bcdlen=0, cdalen=0, dablen=0;
REAL det24x[24], det24y[24], det48x[48], det48y[48];
- int xlen, ylen;
+ int xlen=0, ylen=0;
REAL adet[96], bdet[96], cdet[96], ddet[96];
- int alen, blen, clen, dlen;
+ int alen=0, blen=0, clen=0, dlen=0;
REAL abdet[192], cddet[192];
- int ablen, cdlen;
+ int ablen=0, cdlen=0;
REAL deter[384];
- int deterlen;
+ int deterlen=0;
int i;
REAL bvirt, avirt, bround, around;
@@ -1970,16 +1971,16 @@ REAL incircleadapt (
REAL bc[4], ca[4], ab[4];
REAL bc3, ca3, ab3;
REAL axbc[8], axxbc[16], aybc[8], ayybc[16], adet[32];
- int axbclen, axxbclen, aybclen, ayybclen, alen;
+ int axbclen=0, axxbclen=0, aybclen=0, ayybclen=0, alen=0;
REAL bxca[8], bxxca[16], byca[8], byyca[16], bdet[32];
- int bxcalen, bxxcalen, bycalen, byycalen, blen;
+ int bxcalen=0, bxxcalen=0, bycalen=0, byycalen=0, blen=0;
REAL cxab[8], cxxab[16], cyab[8], cyyab[16], cdet[32];
- int cxablen, cxxablen, cyablen, cyyablen, clen;
+ int cxablen=0, cxxablen=0, cyablen=0, cyyablen=0, clen=0;
REAL abdet[64];
- int ablen;
+ int ablen=0;
REAL fin1[1152], fin2[1152];
REAL *finnow, *finother, *finswap;
- int finlength;
+ int finlength=0;
REAL adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail;
REAL adxadx1, adyady1, bdxbdx1, bdybdy1, cdxcdx1, cdycdy1;
@@ -1992,25 +1993,29 @@ REAL incircleadapt (
REAL u3, v3;
REAL temp8[8], temp16a[16], temp16b[16], temp16c[16];
REAL temp32a[32], temp32b[32], temp48[48], temp64[64];
- int temp8len, temp16alen, temp16blen, temp16clen;
- int temp32alen, temp32blen, temp48len, temp64len;
+ int temp8len=0, temp16alen=0, temp16blen=0, temp16clen=0;
+ int temp32alen=0, temp32blen=0, temp48len=0, temp64len=0;
REAL axtbb[8], axtcc[8], aytbb[8], aytcc[8];
- int axtbblen, axtcclen, aytbblen, aytcclen;
+ int axtbblen=0, axtcclen=0, aytbblen=0, aytcclen=0;
REAL bxtaa[8], bxtcc[8], bytaa[8], bytcc[8];
- int bxtaalen, bxtcclen, bytaalen, bytcclen;
+ int bxtaalen=0, bxtcclen=0, bytaalen=0, bytcclen=0;
REAL cxtaa[8], cxtbb[8], cytaa[8], cytbb[8];
- int cxtaalen, cxtbblen, cytaalen, cytbblen;
+ int cxtaalen=0, cxtbblen=0, cytaalen=0, cytbblen=0;
REAL axtbc[8], aytbc[8], bxtca[8], bytca[8], cxtab[8], cytab[8];
- int axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen;
+ int axtbclen=0, aytbclen=0, bxtcalen=0, bytcalen=0, cxtablen=0, cytablen=0;
REAL axtbct[16], aytbct[16], bxtcat[16], bytcat[16], cxtabt[16], cytabt[16];
- int axtbctlen, aytbctlen, bxtcatlen, bytcatlen, cxtabtlen, cytabtlen;
+ int axtbctlen=0, aytbctlen=0;
+ int bxtcatlen=0, bytcatlen=0;
+ int cxtabtlen=0, cytabtlen=0;
REAL axtbctt[8], aytbctt[8], bxtcatt[8];
REAL bytcatt[8], cxtabtt[8], cytabtt[8];
- int axtbcttlen, aytbcttlen, bxtcattlen, bytcattlen, cxtabttlen, cytabttlen;
+ int axtbcttlen=0, aytbcttlen=0;
+ int bxtcattlen=0, bytcattlen=0;
+ int cxtabttlen=0, cytabttlen=0;
REAL abt[8], bct[8], cat[8];
- int abtlen, bctlen, catlen;
+ int abtlen=0, bctlen=0, catlen=0;
REAL abtt[4], bctt[4], catt[4];
- int abttlen, bcttlen, cattlen;
+ int abttlen=0, bcttlen=0, cattlen=0;
REAL abtt3, bctt3, catt3;
REAL negate;
@@ -2610,26 +2615,26 @@ REAL insphereexact (
REAL ab[4], bc[4], cd[4], de[4], ea[4];
REAL ac[4], bd[4], ce[4], da[4], eb[4];
REAL temp8a[8], temp8b[8], temp16[16];
- int temp8alen, temp8blen, temp16len;
+ int temp8alen=0, temp8blen=0, temp16len=0;
REAL abc[24], bcd[24], cde[24], dea[24], eab[24];
REAL abd[24], bce[24], cda[24], deb[24], eac[24];
- int abclen, bcdlen, cdelen, dealen, eablen;
- int abdlen, bcelen, cdalen, deblen, eaclen;
+ int abclen=0, bcdlen=0, cdelen=0, dealen=0, eablen=0;
+ int abdlen=0, bcelen=0, cdalen=0, deblen=0, eaclen=0;
REAL temp48a[48], temp48b[48];
- int temp48alen, temp48blen;
+ int temp48alen=0, temp48blen=0;
REAL abcd[96], bcde[96], cdea[96], deab[96], eabc[96];
- int abcdlen, bcdelen, cdealen, deablen, eabclen;
+ int abcdlen=0, bcdelen=0, cdealen=0, deablen=0, eabclen=0;
REAL temp192[192];
REAL det384x[384], det384y[384], det384z[384];
- int xlen, ylen, zlen;
+ int xlen=0, ylen=0, zlen=0;
REAL detxy[768];
- int xylen;
+ int xylen=0;
REAL adet[1152], bdet[1152], cdet[1152], ddet[1152], edet[1152];
- int alen, blen, clen, dlen, elen;
+ int alen=0, blen=0, clen=0, dlen=0, elen=0;
REAL abdet[2304], cddet[2304], cdedet[3456];
- int ablen, cdlen;
+ int ablen=0, cdlen=0;
REAL deter[5760];
- int deterlen;
+ int deterlen=0;
int i;
REAL bvirt, avirt, bround, around;
@@ -2866,15 +2871,16 @@ REAL insphereadapt (
REAL ab3, bc3, cd3, da3, ac3, bd3;
REAL abeps, bceps, cdeps, daeps, aceps, bdeps;
REAL temp8a[8], temp8b[8], temp8c[8], temp16[16], temp24[24], temp48[48];
- int temp8alen, temp8blen, temp8clen, temp16len, temp24len, temp48len;
+ int temp8alen=0, temp8blen=0, temp8clen=0;
+ int temp16len=0, temp24len=0, temp48len=0;
REAL xdet[96], ydet[96], zdet[96], xydet[192];
- int xlen, ylen, zlen, xylen;
+ int xlen=0, ylen=0, zlen=0, xylen=0;
REAL adet[288], bdet[288], cdet[288], ddet[288];
- int alen, blen, clen, dlen;
+ int alen=0, blen=0, clen=0, dlen=0;
REAL abdet[576], cddet[576];
- int ablen, cdlen;
+ int ablen=0, cdlen=0;
REAL fin1[1152];
- int finlength;
+ int finlength=0;
REAL aextail, bextail, cextail, dextail;
REAL aeytail, beytail, ceytail, deytail;
@@ -3213,21 +3219,21 @@ REAL orient4dexact (
REAL ab[4], bc[4], cd[4], de[4], ea[4];
REAL ac[4], bd[4], ce[4], da[4], eb[4];
REAL temp8a[8], temp8b[8], temp16[16];
- int temp8alen, temp8blen, temp16len;
+ int temp8alen=0, temp8blen=0, temp16len=0;
REAL abc[24], bcd[24], cde[24], dea[24], eab[24];
REAL abd[24], bce[24], cda[24], deb[24], eac[24];
- int abclen, bcdlen, cdelen, dealen, eablen;
- int abdlen, bcelen, cdalen, deblen, eaclen;
+ int abclen=0, bcdlen=0, cdelen=0, dealen=0, eablen=0;
+ int abdlen=0, bcelen=0, cdalen=0, deblen=0, eaclen=0;
REAL temp48a[48], temp48b[48];
- int temp48alen, temp48blen;
+ int temp48alen=0, temp48blen=0;
REAL abcd[96], bcde[96], cdea[96], deab[96], eabc[96];
- int abcdlen, bcdelen, cdealen, deablen, eabclen;
+ int abcdlen=0, bcdelen=0, cdealen=0, deablen=0, eabclen=0;
REAL adet[192], bdet[192], cdet[192], ddet[192], edet[192];
- int alen, blen, clen, dlen, elen;
+ int alen, blen=0, clen=0, dlen=0, elen=0;
REAL abdet[384], cddet[384], cdedet[576];
- int ablen, cdlen;
+ int ablen=0, cdlen=0;
REAL deter[960];
- int deterlen;
+ int deterlen=0;
int i;
REAL bvirt, avirt, bround, around;
@@ -3435,13 +3441,14 @@ REAL orient4dadapt (
REAL ab3, bc3, cd3, da3, ac3, bd3;
REAL abeps, bceps, cdeps, daeps, aceps, bdeps;
REAL temp8a[8], temp8b[8], temp8c[8], temp16[16], temp24[24];
- int temp8alen, temp8blen, temp8clen, temp16len, temp24len;
+ int temp8alen=0, temp8blen=0, temp8clen=0;
+ int temp16len=0, temp24len=0;
REAL adet[48], bdet[48], cdet[48], ddet[48];
- int alen, blen, clen, dlen;
+ int alen=0, blen=0, clen=0, dlen=0;
REAL abdet[96], cddet[96];
- int ablen, cdlen;
+ int ablen=0, cdlen=0;
REAL fin1[192];
- int finlength;
+ int finlength=0;
REAL aextail, bextail, cextail, dextail;
REAL aeytail, beytail, ceytail, deytail;
diff --git a/src/libcpp/geom_type/geom_mesh_euclidean_2.hpp b/src/libcpp/geom_type/geom_mesh_euclidean_2.hpp
index 05154a0..7a75dd3 100644
--- a/src/libcpp/geom_type/geom_mesh_euclidean_2.hpp
+++ b/src/libcpp/geom_type/geom_mesh_euclidean_2.hpp
@@ -1250,7 +1250,7 @@
_set2[_epos].itag() ) ;
this->_hnum += +1;
- }
+ } // falls through
case +1 :
{
@@ -1267,7 +1267,7 @@
this->_find = true ;
this->_hits =_hits ;
- }
+ } // falls through
}
}
}
diff --git a/src/libcpp/geom_type/geom_mesh_euclidean_3.hpp b/src/libcpp/geom_type/geom_mesh_euclidean_3.hpp
index a4fcb77..7280556 100644
--- a/src/libcpp/geom_type/geom_mesh_euclidean_3.hpp
+++ b/src/libcpp/geom_type/geom_mesh_euclidean_3.hpp
@@ -1850,9 +1850,9 @@
switch (_nhit)
{
- /*--------------- call output function on hit */
case +2 :
{
+ /*--------------- call output function on hit */
this->_hfun (_jpos, _hits ,
_geom._tria .
_set2[_epos].feat() ,
@@ -1862,10 +1862,10 @@
_set2[_epos].itag() ) ;
this->_hnum += +1;
- }
- /*--------------- call output function on hit */
+ } // falls through
case +1 :
{
+ /*--------------- call output function on hit */
this->_hfun (_ipos, _hits ,
_geom._tria .
_set2[_epos].feat() ,
@@ -1878,7 +1878,7 @@
this->_find = true ;
this->_hits =_hits ;
- }
+ } // falls through
}
}
}
@@ -1980,9 +1980,9 @@
switch (_nh)
{
- /*--------------- call output function on hit */
case +2 :
{
+ /*--------------- call output function on hit */
this->_hfun (_jpos, _hits ,
_geom._tria .
_set3[_tpos].feat() ,
@@ -1990,10 +1990,10 @@
_set3[_tpos].topo() ,
_geom._tria .
_set3[_tpos].itag() ) ;
- }
- /*--------------- call output function on hit */
+ } // falls through
case +1 :
{
+ /*--------------- call output function on hit */
this->_hfun (_ipos, _hits ,
_geom._tria .
_set3[_tpos].feat() ,
@@ -2003,7 +2003,7 @@
_set3[_tpos].itag() ) ;
this->_find = true ;
- }
+ } // falls through
}
}
}
diff --git a/src/libcpp/hashfunc.hpp b/src/libcpp/hashfunc.hpp
index cd0508a..661e261 100644
--- a/src/libcpp/hashfunc.hpp
+++ b/src/libcpp/hashfunc.hpp
@@ -195,9 +195,9 @@ uint32_t initval) /* the previous hash, or an arbitrary value */
/*------------------------------------------- handle the last 3 uint32_t's */
switch(length) /* all the case statements fall through */
{
- case 3 : c+=k[2];
- case 2 : b+=k[1];
- case 1 : a+=k[0];
+ case 3 : c+=k[2]; /* fall through */
+ case 2 : b+=k[1]; /* fall through */
+ case 1 : a+=k[0]; /* fall through */
final(a,b,c);
case 0: /* case 0: nothing left to add */
break;
@@ -241,9 +241,9 @@ uint32_t *pb) /* IN: more seed OUT: secondary hash value */
/*------------------------------------------- handle the last 3 uint32_t's */
switch(length) /* all the case statements fall through */
{
- case 3 : c+=k[2];
- case 2 : b+=k[1];
- case 1 : a+=k[0];
+ case 3 : c+=k[2]; /* fall through */
+ case 2 : b+=k[1]; /* fall through */
+ case 1 : a+=k[0]; /* fall through */
final(a,b,c);
case 0: /* case 0: nothing left to add */
break;
@@ -341,16 +341,16 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
- case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
- case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
- case 9 : c+=k8[8]; /* fall through */
+ case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
+ case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
+ case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[1]; a+=k[0]; break;
- case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
- case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
- case 5 : b+=k8[4]; /* fall through */
+ case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
+ case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
+ case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]; break;
- case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
- case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
+ case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
+ case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
case 1 : a+=k8[0]; break;
case 0 : return c;
}
@@ -382,23 +382,23 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
+ case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
case 10: c+=k[4];
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 9 : c+=k8[8]; /* fall through */
+ case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
+ case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
case 6 : b+=k[2];
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 5 : b+=k8[4]; /* fall through */
+ case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
+ case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
case 2 : a+=k[0];
break;
case 1 : a+=k8[0];
@@ -432,17 +432,17 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
/*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */
{
- case 12: c+=((uint32_t)k[11])<<24;
- case 11: c+=((uint32_t)k[10])<<16;
- case 10: c+=((uint32_t)k[9])<<8;
- case 9 : c+=k[8];
- case 8 : b+=((uint32_t)k[7])<<24;
- case 7 : b+=((uint32_t)k[6])<<16;
- case 6 : b+=((uint32_t)k[5])<<8;
- case 5 : b+=k[4];
- case 4 : a+=((uint32_t)k[3])<<24;
- case 3 : a+=((uint32_t)k[2])<<16;
- case 2 : a+=((uint32_t)k[1])<<8;
+ case 12: c+=((uint32_t)k[11])<<24; /* fall through */
+ case 11: c+=((uint32_t)k[10])<<16; /* fall through */
+ case 10: c+=((uint32_t)k[9])<<8; /* fall through */
+ case 9 : c+=k[8]; /* fall through */
+ case 8 : b+=((uint32_t)k[7])<<24; /* fall through */
+ case 7 : b+=((uint32_t)k[6])<<16; /* fall through */
+ case 6 : b+=((uint32_t)k[5])<<8; /* fall through */
+ case 5 : b+=k[4]; /* fall through */
+ case 4 : a+=((uint32_t)k[3])<<24; /* fall through */
+ case 3 : a+=((uint32_t)k[2])<<16; /* fall through */
+ case 2 : a+=((uint32_t)k[1])<<8; /* fall through */
case 1 : a+=k[0];
break;
case 0 : return c;
@@ -530,16 +530,16 @@ void hashlittle2(
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
- case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
- case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
- case 9 : c+=k8[8]; /* fall through */
+ case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
+ case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
+ case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[1]; a+=k[0]; break;
- case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
- case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
- case 5 : b+=k8[4]; /* fall through */
+ case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
+ case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
+ case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]; break;
- case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
- case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
+ case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
+ case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
case 1 : a+=k8[0]; break;
case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */
}
@@ -571,23 +571,23 @@ void hashlittle2(
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
+ case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
case 10: c+=k[4];
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 9 : c+=k8[8]; /* fall through */
+ case 9 : c+=k8[8]; /* fall through */
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
+ case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
case 6 : b+=k[2];
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 5 : b+=k8[4]; /* fall through */
+ case 5 : b+=k8[4]; /* fall through */
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
+ case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
case 2 : a+=k[0];
break;
case 1 : a+=k8[0];
@@ -621,17 +621,17 @@ void hashlittle2(
/*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */
{
- case 12: c+=((uint32_t)k[11])<<24;
- case 11: c+=((uint32_t)k[10])<<16;
- case 10: c+=((uint32_t)k[9])<<8;
- case 9 : c+=k[8];
- case 8 : b+=((uint32_t)k[7])<<24;
- case 7 : b+=((uint32_t)k[6])<<16;
- case 6 : b+=((uint32_t)k[5])<<8;
- case 5 : b+=k[4];
- case 4 : a+=((uint32_t)k[3])<<24;
- case 3 : a+=((uint32_t)k[2])<<16;
- case 2 : a+=((uint32_t)k[1])<<8;
+ case 12: c+=((uint32_t)k[11])<<24; /* fall through */
+ case 11: c+=((uint32_t)k[10])<<16; /* fall through */
+ case 10: c+=((uint32_t)k[9])<<8; /* fall through */
+ case 9 : c+=k[8]; /* fall through */
+ case 8 : b+=((uint32_t)k[7])<<24; /* fall through */
+ case 7 : b+=((uint32_t)k[6])<<16; /* fall through */
+ case 6 : b+=((uint32_t)k[5])<<8; /* fall through */
+ case 5 : b+=k[4]; /* fall through */
+ case 4 : a+=((uint32_t)k[3])<<24; /* fall through */
+ case 3 : a+=((uint32_t)k[2])<<16; /* fall through */
+ case 2 : a+=((uint32_t)k[1])<<8; /* fall through */
case 1 : a+=k[0];
break;
case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */
@@ -753,17 +753,17 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval)
/*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */
{
- case 12: c+=k[11];
- case 11: c+=((uint32_t)k[10])<<8;
- case 10: c+=((uint32_t)k[9])<<16;
- case 9 : c+=((uint32_t)k[8])<<24;
- case 8 : b+=k[7];
- case 7 : b+=((uint32_t)k[6])<<8;
- case 6 : b+=((uint32_t)k[5])<<16;
- case 5 : b+=((uint32_t)k[4])<<24;
- case 4 : a+=k[3];
- case 3 : a+=((uint32_t)k[2])<<8;
- case 2 : a+=((uint32_t)k[1])<<16;
+ case 12: c+=k[11]; /* fall through */
+ case 11: c+=((uint32_t)k[10])<<8; /* fall through */
+ case 10: c+=((uint32_t)k[9])<<16; /* fall through */
+ case 9 : c+=((uint32_t)k[8])<<24; /* fall through */
+ case 8 : b+=k[7]; /* fall through */
+ case 7 : b+=((uint32_t)k[6])<<8; /* fall through */
+ case 6 : b+=((uint32_t)k[5])<<16; /* fall through */
+ case 5 : b+=((uint32_t)k[4])<<24; /* fall through */
+ case 4 : a+=k[3]; /* fall through */
+ case 3 : a+=((uint32_t)k[2])<<8; /* fall through */
+ case 2 : a+=((uint32_t)k[1])<<16; /* fall through */
case 1 : a+=((uint32_t)k[0])<<24;
break;
case 0 : return c;
diff --git a/src/libcpp/rdel_mesh/rdel_create_init_2.inc b/src/libcpp/rdel_mesh/rdel_create_init_2.inc
index 1e5f470..660ead3 100644
--- a/src/libcpp/rdel_mesh/rdel_create_init_2.inc
+++ b/src/libcpp/rdel_mesh/rdel_create_init_2.inc
@@ -33,7 +33,7 @@
*
* Last updated: 08 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -118,7 +118,7 @@
__normal_call bool_type have_edge (
mesh_type &_mesh,
iptr_list &_imap,
- iptr_type &_eadj,
+ char_type &_eadj,
iptr_type &_tadj,
iptr_type *_enod
)
@@ -174,7 +174,7 @@
/*--------------------- find all tria's about ENOD[0] */
iptr_list _tset;
- iptr_type _epos;
+ char_type _epos;
_tset.set_alloc( +32) ;
_mesh._tria.walk_node (
@@ -439,7 +439,8 @@
if (_iter->itag() <= -1)
{
/*------------------------------ find edge "in" DTRI. */
- iptr_type _eadj, _tadj ;
+ char_type _eadj ;
+ iptr_type _tadj ;
if (have_edge( _mesh,
_imap,_eadj,_tadj,
&_iter->node( +0 )) )
diff --git a/src/libcpp/rdel_mesh/rdel_create_init_3.inc b/src/libcpp/rdel_mesh/rdel_create_init_3.inc
index 3e44904..571a0d6 100644
--- a/src/libcpp/rdel_mesh/rdel_create_init_3.inc
+++ b/src/libcpp/rdel_mesh/rdel_create_init_3.inc
@@ -33,7 +33,7 @@
*
* Last updated: 08 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -120,7 +120,7 @@
__normal_call bool_type have_edge (
mesh_type &_mesh,
iptr_list &_imap,
- iptr_type &_eadj,
+ char_type &_eadj,
iptr_type &_tadj,
iptr_type *_enod
)
@@ -179,7 +179,7 @@
/*--------------------- find all tria's about ENOD[0] */
iptr_list _tset;
- iptr_type _epos;
+ char_type _epos;
_tset.set_alloc( +32) ;
_mesh._tria.walk_node (
@@ -239,7 +239,7 @@
__normal_call bool_type have_face (
mesh_type &_mesh,
iptr_list &_imap,
- iptr_type &_fadj,
+ char_type &_fadj,
iptr_type &_tadj,
iptr_type *_fnod
)
@@ -300,7 +300,7 @@
/*--------------------- find all tria's about ENOD[0] */
iptr_list _tset;
- iptr_type _fpos;
+ char_type _fpos;
_tset.set_alloc( +32) ;
_mesh._tria.walk_node (
@@ -581,7 +581,8 @@
if (_iter->itag() <= -1)
{
/*------------------------------ find edge "in" DTRI. */
- iptr_type _eadj, _tadj ;
+ char_type _eadj ;
+ iptr_type _tadj ;
if (have_edge( _mesh,
_imap,_eadj,_tadj,
&_iter->node( +0 )) )
@@ -637,7 +638,8 @@
if (_iter->itag() <= -1)
{
/*------------------------------ find face "in" DTRI. */
- iptr_type _fadj, _tadj ;
+ char_type _fadj ;
+ iptr_type _tadj ;
if (have_face( _mesh,
_imap,_fadj,_tadj,
&_iter->node( +0 )) )
diff --git a/src/libcpp/rdel_mesh/rdel_refine_topo_2.inc b/src/libcpp/rdel_mesh/rdel_refine_topo_2.inc
index b30661c..23e0eb8 100644
--- a/src/libcpp/rdel_mesh/rdel_refine_topo_2.inc
+++ b/src/libcpp/rdel_mesh/rdel_refine_topo_2.inc
@@ -155,19 +155,19 @@
std::numeric_limits
::epsilon (), +.75) ;
- real_type _vnrm[3] ;
+ iptr_type _enod[ +3] = {0} ;
+ real_type _vnrm[ +3] ;
_vnrm[0] = (real_type) +0. ;
_vnrm[1] = (real_type) +0. ;
_vnrm[2] = (real_type) +0. ;
_pmax[2] = (real_type) +0. ;
-
+
/*--------------------- find max. SDB in edge-set */
for (auto _edge = _eset.head() ;
_edge != _eset.tend() ;
++_edge )
{
- iptr_type _enod[ +3] ;
mesh_type::tria_type::
tria_type::face_node(
_enod, _edge->_eadj, 2, 1) ;
diff --git a/src/libcpp/rdel_mesh/rdel_refine_topo_3.inc b/src/libcpp/rdel_mesh/rdel_refine_topo_3.inc
index 60286a2..0458d5e 100644
--- a/src/libcpp/rdel_mesh/rdel_refine_topo_3.inc
+++ b/src/libcpp/rdel_mesh/rdel_refine_topo_3.inc
@@ -448,7 +448,8 @@
std::numeric_limits
::epsilon (), +.75) ;
- real_type _vdir[4] ;
+ iptr_type _enod[ +4] = {0} ;
+ real_type _vdir[ +4] ;
_vdir[0] = (real_type) +0. ;
_vdir[1] = (real_type) +0. ;
_vdir[2] = (real_type) +0. ;
@@ -461,7 +462,6 @@
_edge != _eset.tend() ;
++_edge )
{
- iptr_type _enod[ +3] ;
mesh_type::tria_type::
tria_type::face_node(
_enod, _edge->_eadj, 3, 1) ;
@@ -662,7 +662,8 @@
std::numeric_limits
::epsilon (), +.75) ;
- real_type _vnrm[4] ;
+ iptr_type _fnod[ +4] = {0} ;
+ real_type _vnrm[ +4] ;
_vnrm[0] = (real_type) +0. ;
_vnrm[1] = (real_type) +0. ;
_vnrm[2] = (real_type) +0. ;
@@ -675,7 +676,6 @@
_face != _fset.tend() ;
++_face )
{
- iptr_type _fnod[ +4] ;
mesh_type::tria_type::
tria_type::face_node(
_fnod, _face->_fadj, 3, 2) ;
diff --git a/src/libcpp/tessellate/del_tri_euclidean_2.hpp b/src/libcpp/tessellate/del_tri_euclidean_2.hpp
index a596cad..d4642a6 100644
--- a/src/libcpp/tessellate/del_tri_euclidean_2.hpp
+++ b/src/libcpp/tessellate/del_tri_euclidean_2.hpp
@@ -102,11 +102,12 @@
iptr_type &_fmin
) const
{
- bool_type _done = true ;
- iptr_type _fpos ;
- iptr_type _fadj ;
- iptr_type _tadj ;
-
+ bool_type _done = true ;
+ iptr_type _fpos;
+ iptr_type _fadj;
+ iptr_type _tadj;
+ iptr_type _fnod[3] = {0};
+
for(_fpos = 3; _fpos-- != 0; )
{
/*--------------- check dist. wrt. k-th face apex */
@@ -120,7 +121,6 @@
if(_tadj == _mesh.null_flag())
continue ;
- iptr_type _fnod[ 3] ;
mesh_type::tria_type::
face_node(_fnod, _fadj, 2, 1) ;
/*
diff --git a/src/libcpp/tessellate/del_tri_euclidean_3.hpp b/src/libcpp/tessellate/del_tri_euclidean_3.hpp
index 88a2ac6..ebc04ca 100644
--- a/src/libcpp/tessellate/del_tri_euclidean_3.hpp
+++ b/src/libcpp/tessellate/del_tri_euclidean_3.hpp
@@ -101,12 +101,13 @@
iptr_type _tpos,
iptr_type &_fmin
) const
- {
- bool_type _done = true ;
- iptr_type _fpos ;
- iptr_type _tadj ;
- iptr_type _fadj ;
-
+ {
+ bool_type _done = true ;
+ iptr_type _fpos;
+ iptr_type _fadj;
+ iptr_type _tadj;
+ iptr_type _fnod[4] = {0};
+
for(_fpos = 4; _fpos-- != 0; )
{
/*--------------- check dist. wrt. k-th face apex */
@@ -120,7 +121,6 @@
if(_tadj == _mesh.null_flag())
continue ;
- iptr_type _fnod[ 4] ;
mesh_type::tria_type::
face_node(_fnod, _fadj, 3, 2) ;
/*
diff --git a/src/marche.hpp b/src/marche.hpp
index c1d4e9e..77e3bad 100644
--- a/src/marche.hpp
+++ b/src/marche.hpp
@@ -97,6 +97,8 @@
{
iptr_type _retv = +0;
+ __unreferenced(_fmsh) ;
+
hfun_data _ffun ; // FUNC data
jcfg_data _jcfg ;
diff --git a/src/msh_save.hpp b/src/msh_save.hpp
index f31d7dc..5d11f5c 100644
--- a/src/msh_save.hpp
+++ b/src/msh_save.hpp
@@ -779,12 +779,13 @@
{
iptr_type _errv = __no_error ;
- __unreferenced(_jlog) ;
-
try
{
containers::array _nmap;
-
+
+ __unreferenced (_jlog) ;
+ __unreferenced (_jcfg) ;
+
if (_rdel._ndim == +2 && // save 2-dim. mesh
_rdel._kind ==
jmsh_kind::euclidean_mesh)
@@ -1648,12 +1649,13 @@
{
iptr_type _errv = __no_error ;
- __unreferenced(_jlog) ;
-
try
{
containers::array _nmap ;
-
+
+ __unreferenced (_jcfg) ;
+ __unreferenced (_jlog) ;
+
if (_mesh._ndim == +2 && // save 2-dim. mesh
_mesh._kind ==
jmsh_kind::euclidean_mesh)
From a86b16c3b8e6f7815a4da08a56cfcce0ea5c3722 Mon Sep 17 00:00:00 2001
From: Xylar Asay-Davis
Date: Sat, 20 Apr 2019 15:26:53 +0200
Subject: [PATCH 11/13] Update cmake for optional non-local install
---
src/CMakeLists.txt | 26 +++++++++++++++++++++++---
uni/CMakeLists.txt | 15 +++++++++++++--
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c804318..59951d5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,17 +1,37 @@
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set (INSTALL_LOCAL TRUE)
+ message ("installing locally")
+else (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ message ("installing to ${CMAKE_INSTALL_PREFIX}")
+endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+
add_executable (jigsaw-cmd jigsaw.cpp)
target_compile_definitions (jigsaw-cmd PRIVATE __cmd_jigsaw)
set_target_properties (jigsaw-cmd PROPERTIES OUTPUT_NAME jigsaw)
-install (TARGETS jigsaw-cmd DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+if (DEFINED INSTALL_LOCAL)
+ install (TARGETS jigsaw-cmd DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+else ()
+ install (TARGETS jigsaw-cmd DESTINATION bin)
+endif ()
add_executable (tripod-cmd jigsaw.cpp)
target_compile_definitions (tripod-cmd PRIVATE __cmd_tripod)
set_target_properties (tripod-cmd PROPERTIES OUTPUT_NAME tripod)
-install (TARGETS tripod-cmd DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+if (DEFINED INSTALL_LOCAL)
+ install (TARGETS tripod-cmd DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+else ()
+ install (TARGETS tripod-cmd DESTINATION bin)
+endif ()
add_library (jigsaw-lib SHARED jigsaw.cpp)
target_compile_definitions (jigsaw-lib PRIVATE __lib_jigsaw)
set_target_properties (jigsaw-lib PROPERTIES OUTPUT_NAME jigsaw)
-install (TARGETS jigsaw-lib DESTINATION "${PROJECT_SOURCE_DIR}/lib")
+if (DEFINED INSTALL_LOCAL)
+ install (TARGETS jigsaw-lib DESTINATION "${PROJECT_SOURCE_DIR}/lib")
+else ()
+ install (DIRECTORY inc/ DESTINATION include FILES_MATCHING PATTERN "*.h")
+ install (TARGETS jigsaw-lib DESTINATION lib)
+endif ()
diff --git a/uni/CMakeLists.txt b/uni/CMakeLists.txt
index 32898a8..ab30981 100644
--- a/uni/CMakeLists.txt
+++ b/uni/CMakeLists.txt
@@ -1,13 +1,24 @@
cmake_minimum_required (VERSION 3.9.4)
project (JIGSAW_UNIT_TEST)
-find_library (LIBJIGSAW jigsaw HINTS "${PROJECT_SOURCE_DIR}/../lib")
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set (INSTALL_LOCAL TRUE)
+ message ("installing locally")
+else (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ message ("installing to ${CMAKE_INSTALL_PREFIX}")
+endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+
+if (DEFINED INSTALL_LOCAL)
+ find_library (LIBJIGSAW jigsaw HINTS "${PROJECT_SOURCE_DIR}/../lib")
+else ()
+ find_library (LIBJIGSAW jigsaw HINTS "${CMAKE_INSTALL_PREFIX}/lib")
+endif ()
message ("libjigsaw location: ${LIBJIGSAW}")
add_executable (test_1 test_1.c)
target_link_libraries (test_1 ${LIBJIGSAW})
-set_target_properties(test_1 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+set_target_properties(test_1 PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
install (TARGETS test_1 DESTINATION "${PROJECT_SOURCE_DIR}")
add_executable (test_2 test_2.c)
From 8f9cef26066c21647861883ab365e4948d76cbdf Mon Sep 17 00:00:00 2001
From: dengwirda
Date: Mon, 6 May 2019 17:45:37 -0400
Subject: [PATCH 12/13] 0.9.10 updates: unstructured h(x) on the ellipsoid
---
example.jig | 1 +
src/hfn_init.hpp | 32 +-
src/hfn_load.hpp | 306 ++++++++-
src/jigsaw.cpp | 10 +-
src/libcpp/aabb_tree/aabb_tree_k.hpp | 73 +-
src/libcpp/geom_base/intersect_k.hpp | 640 +++++++++++++++++-
.../mesh_func/hfun_grid_ellipsoid_3.hpp | 16 +-
.../mesh_func/hfun_mesh_ellipsoid_3.hpp | 552 +++++++++++++++
.../mesh_func/hfun_mesh_euclidean_2.hpp | 326 ++++-----
.../mesh_func/hfun_mesh_euclidean_3.hpp | 303 ++++-----
src/libcpp/meshfunc.hpp | 6 +-
src/run_iter.hpp | 18 +-
src/run_mesh.hpp | 19 +-
version.txt | 3 +
14 files changed, 1854 insertions(+), 451 deletions(-)
create mode 100644 src/libcpp/mesh_func/hfun_mesh_ellipsoid_3.hpp
diff --git a/example.jig b/example.jig
index 80506a1..37aef8c 100644
--- a/example.jig
+++ b/example.jig
@@ -57,6 +57,7 @@
# INIT_FILE = *.msh
+
# ---> INIT_NEAR - {default = 1.E-8} relative "zip" tol.
# applied when processing initial conditions. In cases
# where "sharp-feature" detection is active, nodes in
diff --git a/src/hfn_init.hpp b/src/hfn_init.hpp
index 8876ae7..86ca443 100644
--- a/src/hfn_init.hpp
+++ b/src/hfn_init.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 14 September, 2017
+ * Last updated: 18 April, 2019
*
- * Copyright 2013-2017
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -111,7 +111,7 @@
if (_geom._kind ==
jmsh_kind::ellipsoid_mesh)
{
- /*--------------------------------- euclidean-mesh-3d */
+ /*--------------------------------- ellipsoid-mesh-3d */
_scal = (real_type) +0. ;
_scal +=
_geom._ellipsoid_mesh_3d._bmax[0] -
@@ -232,6 +232,32 @@
}
}
+ }
+ else
+ if (_hfun._kind ==
+ jmsh_kind::ellipsoid_mesh)
+ {
+ /*--------------------------------- ellipsoid-mesh-3d */
+ for (auto _node = _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.head();
+ _node != _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.tend();
+ ++_node )
+ {
+ if (_node->mark() < 0) continue;
+
+ _node->hval() =
+ _scal * _node->hval();
+
+ _node->hval() =
+ std::min(_node->hval(),
+ _scal *_jcfg._hfun_hmax) ;
+
+ _node->hval() =
+ std::max(_node->hval(),
+ _scal *_jcfg._hfun_hmin) ;
+ }
+
}
else
if (_hfun._kind ==
diff --git a/src/hfn_load.hpp b/src/hfn_load.hpp
index 1e94ccc..aff36a7 100644
--- a/src/hfn_load.hpp
+++ b/src/hfn_load.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 02 February, 2019
+ * Last updated: 30 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -153,7 +153,20 @@
if (this->_kind ==
jmsh_kind::ellipsoid_mesh)
{
- //!! do things
+ std::int32_t _npos ;
+ typename
+ hfun_data::ellipsoid_mesh_3d
+ ::node_type _ndat ;
+ _ndat.pval(0) = _pval[0];
+ _ndat.pval(1) = _pval[1];
+ _ndat.pval(2) = +0.0 ;
+
+ _npos = this->_hfun->
+ _ellipsoid_mesh_3d.
+ _mesh.push_node(_ndat, false) ;
+
+ this->_pmap.
+ push_tail(_npos) ;
}
}
/*-------------------------------- read COORD section */
@@ -227,7 +240,7 @@
_ypos.push_tail(_ppos) ;
}
}
- }
+ }
/*-------------------------------- read VALUE section */
__normal_call void_type push_value (
std:: size_t _ipos ,
@@ -282,6 +295,20 @@
_hmat.push_tail(*_vval) ;
}
else
+ if (this->_kind ==
+ jmsh_kind::ellipsoid_mesh)
+ {
+ if (_ipos < this->_pmap.count())
+ {
+ std::int32_t _nmap ;
+ _nmap = this->_pmap [_ipos];
+
+ this->_hfun->
+ _ellipsoid_mesh_3d._mesh.
+ _set1[_nmap].hval() = *_vval;
+ }
+ }
+ else
if (this->_kind ==
jmsh_kind::ellipsoid_grid)
{
@@ -316,10 +343,20 @@
_mesh.push_tri3(_tdat, false) ;
}
else
- if (this->_ndim == +3)
+ if (this->_kind ==
+ jmsh_kind::ellipsoid_mesh)
{
- // 3-dimensional!!
- }
+ typename
+ hfun_data::ellipsoid_mesh_3d
+ ::tri3_type _tdat ;
+ _tdat.node(0) = _node[0];
+ _tdat.node(1) = _node[1];
+ _tdat.node(2) = _node[2];
+
+ this->_hfun->
+ _ellipsoid_mesh_3d.
+ _mesh.push_tri3(_tdat, false) ;
+ }
}
/*-------------------------------- read TRIA4 section */
__normal_call void_type push_tria4 (
@@ -331,11 +368,6 @@
__unreferenced(_ipos) ;
__unreferenced(_itag) ;
- if (this->_ndim == +2)
- {
- // 2-dimensional!!
- }
- else
if (this->_ndim == +3 &&
this->_kind ==
jmsh_kind::euclidean_mesh)
@@ -353,6 +385,25 @@
_mesh.push_tri4(_tdat, false) ;
}
}
+ /*---------------------------------- parse RADII data */
+ __normal_call void_type push_radii (
+ double *_erad
+ )
+ {
+ this->_hfun->_ellipsoid_mesh_3d.
+ _radA = _erad[ 0] ;
+ this->_hfun->_ellipsoid_mesh_3d.
+ _radB = _erad[ 1] ;
+ this->_hfun->_ellipsoid_mesh_3d.
+ _radC = _erad[ 2] ;
+
+ this->_hfun->_ellipsoid_grid_3d.
+ _radA = _erad[ 0] ;
+ this->_hfun->_ellipsoid_grid_3d.
+ _radB = _erad[ 1] ;
+ this->_hfun->_ellipsoid_grid_3d.
+ _radC = _erad[ 2] ;
+ }
} ;
/*---------------------------------- parse HFUN. file */
@@ -452,7 +503,7 @@
_hfun._euclidean_mesh_2d.
_mesh.push_node(_ndat, false) ;
}
-
+
for (auto _ipos = (size_t) +0 ;
_ipos != _hmsh._tria3._size ;
++_ipos )
@@ -527,6 +578,77 @@
}
}
else
+ if (_hmsh._flags ==
+ JIGSAW_ELLIPSOID_MESH )
+ {
+ /*--------------------------------- ellipsoid-mesh-3d */
+ _hfun._kind
+ = jmsh_kind::ellipsoid_mesh ;
+ _hfun._ndim = +3;
+
+ if (_hmsh._vert2._size !=
+ _hmsh._value._size )
+ return __invalid_argument ;
+
+ if (_hmsh._radii._size==+3)
+ {
+ _hfun._ellipsoid_mesh_3d.
+ _radA = _hmsh._radii._data[0] ;
+ _hfun._ellipsoid_mesh_3d.
+ _radB = _hmsh._radii._data[1] ;
+ _hfun._ellipsoid_mesh_3d.
+ _radC = _hmsh._radii._data[2] ;
+ }
+ else
+ if (_hmsh._radii._size==+1)
+ {
+ _hfun._ellipsoid_mesh_3d.
+ _radA = _hmsh._radii._data[0] ;
+ _hfun._ellipsoid_mesh_3d.
+ _radB = _hmsh._radii._data[0] ;
+ _hfun._ellipsoid_mesh_3d.
+ _radC = _hmsh._radii._data[0] ;
+ }
+
+ for (auto _ipos = (size_t) +0 ;
+ _ipos != _hmsh._vert2._size ;
+ ++_ipos )
+ {
+ typename
+ hfun_data::ellipsoid_mesh_3d
+ ::node_type _ndat ;
+ _ndat.pval(0) = _hmsh.
+ _vert2._data[_ipos]._ppos[0];
+ _ndat.pval(1) = _hmsh.
+ _vert2._data[_ipos]._ppos[1];
+ _ndat.pval(2) = + 0.0 ;
+ _ndat.hval () = _hmsh.
+ _value._data[_ipos] ;
+
+ _hfun._ellipsoid_mesh_3d.
+ _mesh.push_node(_ndat, false) ;
+ }
+
+ for (auto _ipos = (size_t) +0 ;
+ _ipos != _hmsh._tria3._size ;
+ ++_ipos )
+ {
+ typename
+ hfun_data::ellipsoid_mesh_3d
+ ::tri3_type _tdat ;
+ _tdat.node(0) = _hmsh.
+ _tria3._data[_ipos]._node[0];
+ _tdat.node(1) = _hmsh.
+ _tria3._data[_ipos]._node[1];
+ _tdat.node(2) = _hmsh.
+ _tria3._data[_ipos]._node[2];
+
+ _hfun._ellipsoid_mesh_3d.
+ _mesh.push_tri3(_tdat, false) ;
+ }
+
+ }
+ else
if (_hmsh._flags ==
JIGSAW_EUCLIDEAN_GRID )
{
@@ -568,7 +690,7 @@
else
if (_hmsh._zgrid._size!= 0)
{
- /*--------------------------------- euclidean-grid-2d */
+ /*--------------------------------- euclidean-grid-3d */
_hfun._kind
= jmsh_kind::euclidean_grid ;
_hfun._ndim = +3;
@@ -617,11 +739,31 @@
{
if (_hmsh._zgrid._size== 0)
{
- /*--------------------------------- euclidean-grid-2d */
+ /*--------------------------------- ellipsoid-grid-3d */
_hfun._kind
= jmsh_kind::ellipsoid_grid ;
_hfun._ndim = +3;
+ if (_hmsh._radii._size==+3)
+ {
+ _hfun._ellipsoid_grid_3d.
+ _radA = _hmsh._radii._data[0] ;
+ _hfun._ellipsoid_grid_3d.
+ _radB = _hmsh._radii._data[1] ;
+ _hfun._ellipsoid_grid_3d.
+ _radC = _hmsh._radii._data[2] ;
+ }
+ else
+ if (_hmsh._radii._size==+1)
+ {
+ _hfun._ellipsoid_grid_3d.
+ _radA = _hmsh._radii._data[0] ;
+ _hfun._ellipsoid_grid_3d.
+ _radB = _hmsh._radii._data[0] ;
+ _hfun._ellipsoid_grid_3d.
+ _radC = _hmsh._radii._data[0] ;
+ }
+
for (auto _ipos = (size_t) +0 ;
_ipos != _hmsh._xgrid._size ;
++_ipos )
@@ -1053,6 +1195,83 @@
}
}
else
+ if (_hfun._kind ==
+ jmsh_kind::ellipsoid_mesh)
+ {
+ /*--------------------------------- ellipsoid-mesh-3d */
+ real_type _hmin =
+ std::numeric_limits::max() ;
+
+ iptr_type _imin =
+ std::numeric_limits::max() ;
+ iptr_type _imax =
+ std::numeric_limits::min() ;
+
+ iptr_type _nmax = +0 ;
+
+ for (auto _iter = _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.head() ;
+ _iter != _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark() < 0) continue ;
+
+ _hmin = std::min(
+ _hmin, _iter->hval ()) ;
+ }
+
+ for (auto _iter = _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.head() ;
+ _iter != _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark() < 0) continue ;
+
+ _nmax += +1 ;
+ }
+
+ for (auto _iter = _hfun.
+ _ellipsoid_mesh_3d._mesh._set3.head() ;
+ _iter != _hfun.
+ _ellipsoid_mesh_3d._mesh._set3.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark() < 0) continue ;
+
+ _imin = std::min(
+ _imin, _iter->node(0)) ;
+ _imin = std::min(
+ _imin, _iter->node(1)) ;
+ _imin = std::min(
+ _imin, _iter->node(2)) ;
+
+ _imax = std::max(
+ _imax, _iter->node(0)) ;
+ _imax = std::max(
+ _imax, _iter->node(1)) ;
+ _imax = std::max(
+ _imax, _iter->node(2)) ;
+ }
+
+ if (_hmin <= (real_type) +0.)
+ {
+ _jlog.push (
+ "**input error: HFUN. values must be strictly +ve.\n") ;
+
+ _errv = __invalid_argument ;
+ }
+
+ if (_imin < +0 || _imax>=_nmax)
+ {
+ _jlog.push (
+ "**input error: HFUN. tria. indexing is incorrect.\n") ;
+
+ _errv = __invalid_argument ;
+ }
+ }
+ else
if (_hfun._kind ==
jmsh_kind::ellipsoid_grid)
{
@@ -1236,7 +1455,7 @@
}
__dumpINTS("|COORD.|", _num1)
-
+
for (auto _iter = _hfun.
_euclidean_mesh_2d._mesh._set3.head() ;
_iter != _hfun.
@@ -1390,6 +1609,59 @@
__dumpINTS("|YGRID.|", _ynum)
__dumpINTS("|ZGRID.|", _znum)
+ }
+ else
+ if (_hfun._kind ==
+ jmsh_kind::ellipsoid_mesh)
+ {
+ /*--------------------------------- ellipsoid-mesh-3d */
+ _jlog.push(
+ " ELLIPSOID-MESH\n\n") ;
+
+ iptr_type _num1 = +0 ;
+ iptr_type _num3 = +0 ;
+
+ for (auto _iter = _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.head() ;
+ _iter != _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark() < 0) continue ;
+
+ _hmin = std::min (
+ _hmin, _iter->hval()) ;
+ _hmax = std::max (
+ _hmax, _iter->hval()) ;
+ }
+
+ __dumpREAL(".MIN(H).", _hmin)
+ __dumpREAL(".MAX(H).", _hmax)
+
+ _jlog.push(" \n") ;
+
+ for (auto _iter = _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.head() ;
+ _iter != _hfun.
+ _ellipsoid_mesh_3d._mesh._set1.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark()>=+0) _num1 += +1 ;
+ }
+
+ __dumpINTS("|COORD.|", _num1)
+
+ for (auto _iter = _hfun.
+ _ellipsoid_mesh_3d._mesh._set3.head() ;
+ _iter != _hfun.
+ _ellipsoid_mesh_3d._mesh._set3.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark()>=+0) _num3 += +1 ;
+ }
+
+ __dumpINTS("|TRIA-3|", _num3)
+
}
else
if (_hfun._kind ==
@@ -1399,10 +1671,6 @@
_jlog.push(
" ELLIPSOID-GRID\n\n") ;
- __dumpINTS("|NDIMS.|", +3) ;
-
- _jlog.push("\n") ;
-
for (auto _iter = _hfun.
_ellipsoid_grid_3d._hmat.head() ;
_iter != _hfun.
diff --git a/src/jigsaw.cpp b/src/jigsaw.cpp
index 768d717..337e917 100644
--- a/src/jigsaw.cpp
+++ b/src/jigsaw.cpp
@@ -32,7 +32,7 @@
--------------------------------------------------------
*
* JIGSAW release 0.9.10.x
- * Last updated: 10 April, 2019
+ * Last updated: 18 April, 2019
*
* Copyright 2013 -- 2019
* Darren Engwirda
@@ -427,6 +427,10 @@
typedef mesh ::hfun_mesh_euclidean_3d <
real_type,
iptr_type> euclidean_mesh_3d ;
+
+ typedef mesh ::hfun_mesh_ellipsoid_3d <
+ real_type,
+ iptr_type> ellipsoid_mesh_3d ;
typedef mesh ::hfun_grid_euclidean_2d <
real_type,
@@ -451,6 +455,8 @@
euclidean_mesh_2d _euclidean_mesh_2d ;
euclidean_mesh_3d _euclidean_mesh_3d ;
+ ellipsoid_mesh_3d _ellipsoid_mesh_3d ;
+
euclidean_grid_2d _euclidean_grid_2d ;
euclidean_grid_3d _euclidean_grid_3d ;
@@ -473,6 +479,8 @@
_euclidean_mesh_2d.init() ;
this->
_euclidean_mesh_3d.init() ;
+ this->
+ _ellipsoid_mesh_3d.init() ;
this->
_euclidean_grid_2d.init() ;
diff --git a/src/libcpp/aabb_tree/aabb_tree_k.hpp b/src/libcpp/aabb_tree/aabb_tree_k.hpp
index f95a91b..29874a2 100644
--- a/src/libcpp/aabb_tree/aabb_tree_k.hpp
+++ b/src/libcpp/aabb_tree/aabb_tree_k.hpp
@@ -31,7 +31,7 @@
*
------------------------------------------------------------
*
- * Last updated: 16 January, 2019
+ * Last updated: 30 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -717,10 +717,8 @@
real_type _dloc =
_bmin[_idim] - _ppos[_idim];
- _dist += _dloc ;
-
- //_dist =
- // std::max (_dist, _dloc);
+ _dist =
+ std::max (_dist, _dloc);
}
else
if (_ppos[_idim] > _bmax[_idim])
@@ -728,20 +726,18 @@
real_type _dloc =
_ppos[_idim] - _bmax[_idim];
- _dist += _dloc ;
-
- //_dist =
- // std::max (_dist, _dloc);
+ _dist =
+ std::max (_dist, _dloc);
}
}
- return ( _dist ) ;
+ return ( _dist * _dist ) ;
}
/*-------- search collection via recursive aabb traversal */
template <
- typename tree_pred ,// tree intersections
- typename item_pred // item intersections
+ typename tree_pred ,// tree intersections
+ typename item_pred // item intersections
>
__normal_call bool_type find (
tree_pred &_pred,
@@ -796,16 +792,19 @@
}
/*-------- check for nearsest in collection via traversal */
+ template <
+ typename projector
+ >
__normal_call bool_type near (
- real_type *_ppos ,
- item_data*&_near
+ real_type *_ppos ,
+ projector &_proj
)
{
class node_dist
{
/*----------------------------- node/dist type for PQ */
public :
- real_type _dist ;
+ real_type _dsqr ;
node_type *_node ;
} ;
@@ -818,8 +817,8 @@
node_dist const&_adat ,
node_dist const&_bdat
) const
- { return ( _adat. _dist <
- _bdat. _dist ) ;
+ { return ( _adat. _dsqr <
+ _bdat. _dsqr ) ;
}
} ;
@@ -828,13 +827,9 @@
if (this->_root
== nullptr) return _find;
- real_type _dist =
+ real_type _dsqr =
+std::numeric_limits
::infinity() ;
-
- real_type _dloc =
- -std::numeric_limits
- ::infinity() ;
/*----------------- maintain stack of unvisited nodes */
containers::priorityset<
@@ -843,7 +838,7 @@
node_dist _ndat ;
_ndat._node = _root ;
- _ndat._dist =
+ _ndat._dsqr =
calc_rect_dist(_ppos ,
&_root->_pmin[0],
&_root->_pmax[0]) ;
@@ -855,34 +850,18 @@
/*------------------------ test next closest node */
_nnpq._pop_root (_ndat) ;
- if (_ndat._dist<=_dist)
+ if (_ndat._dsqr<=_dsqr)
{
/*------------------------ descend if maybe close */
if (_ndat.
- _node->_hptr != nullptr )
+ _node-> _hptr != nullptr)
{
/*------------------------ leaf: update item-dist */
- for (item_data *_iptr =
- _ndat._node->_hptr ;
- _iptr != nullptr ;
- _iptr = _iptr->_next )
- {
- _dloc =
- calc_rect_dist(_ppos ,
- &_iptr->_data.pmin(0) ,
- &_iptr->_data.pmax(0)
- ) ;
-
- if (_dloc < _dist)
- {
- /*---------------- keep track of min-len. */
- _dist = _dloc;
- _near = _iptr;
- }
- }
+ _find = true ;
- _find = true ;
+ _dsqr = _proj(
+ _ndat._node->_hptr) ;
}
if (_ndat.
@@ -896,17 +875,19 @@
_ndat._node->lower(1) ;
_ndat._node = _inod ;
- _ndat._dist =
+ _ndat._dsqr =
calc_rect_dist(_ppos ,
&_inod->_pmin[ 0],
&_inod->_pmax[ 0]) ;
+
_nnpq.push(_ndat) ;
_ndat._node = _jnod ;
- _ndat._dist =
+ _ndat._dsqr =
calc_rect_dist(_ppos ,
&_jnod->_pmin[ 0],
&_jnod->_pmax[ 0]) ;
+
_nnpq.push(_ndat) ;
}
diff --git a/src/libcpp/geom_base/intersect_k.hpp b/src/libcpp/geom_base/intersect_k.hpp
index df53305..5399b7b 100644
--- a/src/libcpp/geom_base/intersect_k.hpp
+++ b/src/libcpp/geom_base/intersect_k.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 13 April, 2019
+ * Last updated: 30 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -49,6 +49,14 @@
namespace geometry
{
+ typedef char_type hits_type ;
+
+ hits_type null_hits = +0 ;
+ hits_type node_hits = +1 ;
+ hits_type edge_hits = +2 ;
+ hits_type face_hits = +3 ;
+ hits_type tria_hits = +4 ;
+
/*
--------------------------------------------------------
* helper: solve quadratic equations
@@ -84,7 +92,7 @@
std::abs(_xx[1])) ;
data_type _rt =
- +std::numeric_limits::epsilon();
+ std::numeric_limits::epsilon() ;
if (_aa >= _xm * _rt)
{
@@ -359,7 +367,7 @@
__inline_call bool node_rect_2d (
__const_ptr (data_type) _pp, // node
__const_ptr (data_type) _b0, // min. rect. B
- __const_ptr (data_type) _b1 // max. rect. B
+ __const_ptr (data_type) _b1 // max.
)
{
if (_pp[0] >= _b0[0] &&
@@ -381,7 +389,7 @@
__inline_call bool node_rect_3d (
__const_ptr (data_type) _pp, // node
__const_ptr (data_type) _b0, // min. rect. B
- __const_ptr (data_type) _b1 // max. rect. B
+ __const_ptr (data_type) _b1 // max.
)
{
if (_pp[0] >= _b0[0] &&
@@ -404,9 +412,9 @@
>
__inline_call bool rect_rect_2d (
__const_ptr (data_type) _a0, // min. rect. A
- __const_ptr (data_type) _a1, // max. rect. A
+ __const_ptr (data_type) _a1, // max.
__const_ptr (data_type) _b0, // min. rect. B
- __const_ptr (data_type) _b1 // max. rect. B
+ __const_ptr (data_type) _b1 // max.
)
{
if (_a0[0] <= _b1[0] &&
@@ -427,9 +435,9 @@
>
__inline_call bool rect_rect_3d (
__const_ptr (data_type) _a0, // min. rect. A
- __const_ptr (data_type) _a1, // max. rect. A
+ __const_ptr (data_type) _a1, // max.
__const_ptr (data_type) _b0, // min. rect. B
- __const_ptr (data_type) _b1 // max. rect. B
+ __const_ptr (data_type) _b1 // max.
)
{
if (_a0[0] <= _b1[0] &&
@@ -447,6 +455,78 @@
}
}
+ /*
+ --------------------------------------------------------
+ * COPY-NODE-KD: node-node copy helpers.
+ --------------------------------------------------------
+ */
+
+ template <
+ typename data_one_,
+ typename data_two_
+ >
+ __inline_call void copy_node_2d (
+ __write_ptr (data_one_) _pa, // copy: A := B
+ __const_ptr (data_two_) _pb
+ )
+ {
+ _pa [0] = _pb [0] ;
+ _pa [1] = _pb [1] ;
+ }
+
+ template <
+ typename data_one_,
+ typename data_two_
+ >
+ __inline_call void copy_node_3d (
+ __write_ptr (data_one_) _pa, // copy: A := B
+ __const_ptr (data_two_) _pb
+ )
+ {
+ _pa [0] = _pb [0] ;
+ _pa [1] = _pb [1] ;
+ _pa [2] = _pb [2] ;
+ }
+
+ template <
+ typename data_one_,
+ typename data_two_
+ >
+ __inline_call void copy_node_xy (
+ __write_ptr (data_one_) _pa, // copy: A := B
+ __const_ptr (data_two_) _pb
+ )
+ {
+ _pa [0] = _pb [0] ;
+ _pa [1] = _pb [1] ;
+ }
+
+ template <
+ typename data_one_,
+ typename data_two_
+ >
+ __inline_call void copy_node_yz (
+ __write_ptr (data_one_) _pa, // copy: A := B
+ __const_ptr (data_two_) _pb
+ )
+ {
+ _pa [0] = _pb [1] ;
+ _pa [1] = _pb [2] ;
+ }
+
+ template <
+ typename data_one_,
+ typename data_two_
+ >
+ __inline_call void copy_node_xz (
+ __write_ptr (data_one_) _pa, // copy: A := B
+ __const_ptr (data_two_) _pb
+ )
+ {
+ _pa [0] = _pb [0] ;
+ _pa [1] = _pb [2] ;
+ }
+
/*
--------------------------------------------------------
* LINE-FLAT-KD: line-flat intersections
@@ -510,7 +590,7 @@
_ap[1] = _pp[1] - _pa[1] ;
_ap[2] = _pp[2] - _pa[2] ;
- data_type _ep = +100. *
+ data_type _ep = + 1.0 *
std::numeric_limits::epsilon() ;
data_type _d1 =
@@ -634,7 +714,7 @@
_ap[0] = _pp[0] - _pa[0] ;
_ap[1] = _pp[1] - _pa[1] ;
- real_type _ep = +100. *
+ real_type _ep = +1.0 *
std::numeric_limits::epsilon();
real_type _d1 =
@@ -650,6 +730,61 @@
return ( true ) ;
}
+ template <
+ typename real_type
+ >
+ __normal_call bool proj_line_2d (
+ __const_ptr (real_type) _pp,
+ __const_ptr (real_type) _pa, // line nodes
+ __const_ptr (real_type) _pb,
+ __write_ptr (real_type) _qq, // projection
+ hits_type &_ht
+ )
+ {
+ real_type _vv[2], _tt;
+ _vv[0] = _pb[0] - _pa[0] ;
+ _vv[1] = _pb[1] - _pa[1] ;
+
+ if (proj_line_2d(_pp, _pa,
+ _vv, _tt) )
+ {
+ if (_tt <= (real_type)+0.)
+ {
+ _ht = node_hits;
+
+ _qq[0] = _pa[0] ;
+ _qq[1] = _pa[1] ;
+
+ return ( true ) ;
+ }
+ else
+ if (_tt >= (real_type)+1.)
+ {
+ _ht = node_hits;
+
+ _qq[0] = _pb[0] ;
+ _qq[1] = _pb[1] ;
+
+ return ( true ) ;
+ }
+ else
+ {
+ _ht = edge_hits;
+
+ _qq[0] =
+ _pa[0] + _tt*_vv[ 0] ;
+ _qq[1] =
+ _pa[1] + _tt*_vv[ 1] ;
+
+ return ( true ) ;
+ }
+ }
+ else
+ {
+ return ( false ) ;
+ }
+ }
+
template <
typename real_type
>
@@ -667,7 +802,7 @@
_ap[1] = _pp[1] - _pa[1] ;
_ap[2] = _pp[2] - _pa[2] ;
- real_type _ep = +100. *
+ real_type _ep = +1.0 *
std::numeric_limits::epsilon();
real_type _d1 =
@@ -682,7 +817,73 @@
return ( true ) ;
}
-
+
+ template <
+ typename real_type
+ >
+ __normal_call bool proj_line_3d (
+ __const_ptr (real_type) _pp,
+ __const_ptr (real_type) _pa, // line nodes
+ __const_ptr (real_type) _pb,
+ __write_ptr (real_type) _qq, // projection
+ hits_type &_ht
+ )
+ {
+ real_type _vv[3], _tt;
+ _vv[0] = _pb[0] - _pa[0] ;
+ _vv[1] = _pb[1] - _pa[1] ;
+ _vv[2] = _pb[2] - _pa[2] ;
+
+ if (proj_line_3d(_pp, _pa,
+ _vv, _tt) )
+ {
+ if (_tt <= (real_type)+0.)
+ {
+ _ht = node_hits;
+
+ _qq[0] = _pa[0] ;
+ _qq[1] = _pa[1] ;
+ _qq[2] = _pa[2] ;
+
+ return ( true ) ;
+ }
+ else
+ if (_tt >= (real_type)+1.)
+ {
+ _ht = node_hits;
+
+ _qq[0] = _pb[0] ;
+ _qq[1] = _pb[1] ;
+ _qq[2] = _pb[2] ;
+
+ return ( true ) ;
+ }
+ else
+ {
+ _ht = edge_hits;
+
+ _qq[0] =
+ _pa[0] + _tt*_vv[ 0] ;
+ _qq[1] =
+ _pa[1] + _tt*_vv[ 1] ;
+ _qq[2] =
+ _pa[2] + _tt*_vv[ 2] ;
+
+ return ( true ) ;
+ }
+ }
+ else
+ {
+ return ( false ) ;
+ }
+ }
+
+ /*
+ --------------------------------------------------------
+ * PROJ-TRIA-KD: node-tria projections
+ --------------------------------------------------------
+ */
+
template <
typename real_type
>
@@ -702,7 +903,7 @@
_qq[1] = _pi[1] ;
_qq[2] = _pi[2] ;
- real_type _ep = +100. *
+ real_type _ep = +1.0 *
std::numeric_limits::epsilon();
real_type _tt ;
@@ -726,21 +927,416 @@
return ( true ) ;
}
+ template <
+ typename real_type
+ >
+ __normal_call bool proj_tria_2d (
+ __const_ptr (real_type) _pp,
+ __const_ptr (real_type) _pa, // tria nodes
+ __const_ptr (real_type) _pb,
+ __const_ptr (real_type) _pc,
+ __write_ptr (real_type) _qq, // projection
+ hits_type &_ht
+ )
+ {
+
+ /*----------------------- projector for low-dim. face */
+ # define __projface2d(_pi, _pj) \
+ if (proj_line_2d ( \
+ _pp , _pi, _pj, _qt, _ht) ) \
+ { \
+ real_type _dd = \
+ geometry::lensqr_2d(_pp, _qt) ; \
+ \
+ if (_dd < _dm) \
+ { \
+ _qq[0] = _qt[0] ; \
+ _qq[1] = _qt[1] ; \
+ \
+ _dm = _dd; \
+ } \
+ }
+
+ {
+ /*----------------------- test node-tria intersection */
+ double _PA[2] ;
+ copy_node_2d(_PA, _pa) ;
+
+ double _PB[2] ;
+ copy_node_2d(_PB, _pb) ;
+
+ double _PC[2] ;
+ copy_node_2d(_PC, _pc) ;
+
+ double _PP[2] ;
+ copy_node_2d(_PP, _pp) ;
+
+ double _s1 =
+ geompred::orient2d (
+ (double*)_PA ,
+ (double*)_PB ,
+ (double*)_PP ) ;
+
+ double _s2 =
+ geompred::orient2d (
+ (double*)_PB ,
+ (double*)_PC ,
+ (double*)_PP ) ;
+
+ double _s3 =
+ geompred::orient2d (
+ (double*)_PC ,
+ (double*)_PA ,
+ (double*)_PP ) ;
+
+ if (_s1 * _s2 < +0.0 ||
+ _s2 * _s3 < +0.0 ||
+ _s3 * _s1 < +0.0 )
+ {
+
+ real_type _dm = +std::
+ numeric_limits
+ ::infinity() ;
+
+ real_type _qt[2] ;
+
+ _ht = null_hits ;
+
+ __projface2d(_pa, _pb) ;
+ __projface2d(_pb, _pc) ;
+ __projface2d(_pc, _pa) ;
+
+ return ( true ) ;
+ }
+ else
+ {
+
+ _ht = tria_hits ;
+
+ copy_node_2d(_qq, _pp) ;
+
+ return ( true ) ;
+ }
+ }
+
+ # undef __projface2d
+ }
+
+ template <
+ typename real_type
+ >
+ __normal_call void tria_norm_3d (
+ __const_ptr (real_type) _pa, // tria nodes
+ __const_ptr (real_type) _pb,
+ __const_ptr (real_type) _pc,
+ __write_ptr (real_type) _nv
+ ) ;
+
+ template <
+ typename real_type
+ >
+ __normal_call bool proj_tria_3d (
+ __const_ptr (real_type) _pp,
+ __const_ptr (real_type) _pa, // tria nodes
+ __const_ptr (real_type) _pb,
+ __const_ptr (real_type) _pc,
+ __write_ptr (real_type) _qq, // projection
+ hits_type &_ht
+ )
+ {
+
+ /*----------------------- projector for low-dim. face */
+ # define __projface3d(_pi, _pj) \
+ if (proj_line_3d ( \
+ _pp , _pi, _pj, _qt, _ht) ) \
+ { \
+ real_type _dd = \
+ geometry::lensqr_3d(_pp, _qt) ; \
+ \
+ if (_dd < _dm) \
+ { \
+ _qq[0] = _qt[0] ; \
+ _qq[1] = _qt[1] ; \
+ _qq[2] = _qt[2] ; \
+ \
+ _dm = _dd; \
+ } \
+ }
+
+ /*----------------------- test node-tria intersection */
+ double _s1[3], _s2[3], _s3[3];
+
+ real_type _nv[3];
+ tria_norm_3d(_pa, _pb, _pc, _nv);
+
+ real_type _pt[3];
+ proj_flat_3d(_pp, _pa, _nv, _pt);
+
+ {
+ /*----------------------- get orientation in xy-plane */
+ double _TA[2] ;
+ copy_node_xy(_TA, _pa) ;
+
+ double _TB[2] ;
+ copy_node_xy(_TB, _pb) ;
+
+ double _TC[2] ;
+ copy_node_xy(_TC, _pc) ;
+
+ double _TP[2] ;
+ copy_node_xy(_TP, _pp) ;
+
+ _s1[0] =
+ geompred::orient2d (
+ (double*)_TA ,
+ (double*)_TB ,
+ (double*)_TP ) ;
+
+ _s2[0] =
+ geompred::orient2d (
+ (double*)_TB ,
+ (double*)_TC ,
+ (double*)_TP ) ;
+
+ _s3[0] =
+ geompred::orient2d (
+ (double*)_TC ,
+ (double*)_TA ,
+ (double*)_TP ) ;
+ }
+
+ {
+ /*----------------------- get orientation in xz-plane */
+ double _TA[2] ;
+ copy_node_xz(_TA, _pa) ;
+
+ double _TB[2] ;
+ copy_node_xz(_TB, _pb) ;
+
+ double _TC[2] ;
+ copy_node_xz(_TC, _pc) ;
+
+ double _TP[2] ;
+ copy_node_xz(_TP, _pp) ;
+
+ _s1[1] =
+ geompred::orient2d (
+ (double*)_TA ,
+ (double*)_TB ,
+ (double*)_TP ) ;
+
+ _s2[1] =
+ geompred::orient2d (
+ (double*)_TB ,
+ (double*)_TC ,
+ (double*)_TP ) ;
+
+ _s3[1] =
+ geompred::orient2d (
+ (double*)_TC ,
+ (double*)_TA ,
+ (double*)_TP ) ;
+ }
+
+ {
+ /*----------------------- get orientation in yz-plane */
+ double _TA[2] ;
+ copy_node_yz(_TA, _pa) ;
+
+ double _TB[2] ;
+ copy_node_yz(_TB, _pb) ;
+
+ double _TC[2] ;
+ copy_node_yz(_TC, _pc) ;
+
+ double _TP[2] ;
+ copy_node_yz(_TP, _pp) ;
+
+ _s1[2] =
+ geompred::orient2d (
+ (double*)_TA ,
+ (double*)_TB ,
+ (double*)_TP ) ;
+
+ _s2[2] =
+ geompred::orient2d (
+ (double*)_TB ,
+ (double*)_TC ,
+ (double*)_TP ) ;
+
+ _s3[2] =
+ geompred::orient2d (
+ (double*)_TC ,
+ (double*)_TA ,
+ (double*)_TP ) ;
+ }
+
+ {
+ /*----------------------- test node-tria intersection */
+ if (
+ _s1[0] * _s2[0] < +0.0 ||
+ _s2[0] * _s3[0] < +0.0 ||
+ _s3[0] * _s1[0] < +0.0 ||
+ _s1[1] * _s2[1] < +0.0 ||
+ _s2[1] * _s3[1] < +0.0 ||
+ _s3[1] * _s1[1] < +0.0 ||
+ _s1[2] * _s2[2] < +0.0 ||
+ _s2[2] * _s3[2] < +0.0 ||
+ _s3[2] * _s1[2] < +0.0 )
+ {
+
+ real_type _dm = +std::
+ numeric_limits
+ ::infinity() ;
+
+ real_type _qt[3] ;
+
+ _ht = null_hits ;
+
+ __projface3d(_pa, _pb) ;
+ __projface3d(_pb, _pc) ;
+ __projface3d(_pc, _pa) ;
+
+ return ( true ) ;
+ }
+ else
+ {
+
+ _ht = face_hits ;
+
+ copy_node_3d(_qq, _pp) ;
+
+ return ( true ) ;
+ }
+ }
+
+ # undef __projface3d
+ }
+
+ template <
+ typename real_type
+ >
+ __normal_call bool proj_tria_3d (
+ __const_ptr (real_type) _pp,
+ __const_ptr (real_type) _pa, // tria nodes
+ __const_ptr (real_type) _pb,
+ __const_ptr (real_type) _pc,
+ __const_ptr (real_type) _pd,
+ __write_ptr (real_type) _qq, // projection
+ hits_type &_ht
+ )
+ {
+
+ /*----------------------- projector for low-dim. face */
+ # define __projface3d(_pi, _pj, _pk) \
+ if (proj_tria_3d ( \
+ _pp , _pi, _pj, _pk, _qt, _ht)) \
+ { \
+ real_type _dd = \
+ geometry::lensqr_3d(_pp, _qt) ; \
+ \
+ if (_dd < _dm) \
+ { \
+ _qq[0] = _qt[0] ; \
+ _qq[1] = _qt[1] ; \
+ _qq[2] = _qt[2] ; \
+ \
+ _dm = _dd; \
+ } \
+ }
+
+ {
+ /*----------------------- test node-tria intersection */
+ double _PA[3] ;
+ copy_node_3d(_PA, _pa) ;
+
+ double _PB[3] ;
+ copy_node_3d(_PB, _pb) ;
+
+ double _PC[3] ;
+ copy_node_3d(_PC, _pc) ;
+
+ double _PD[3] ;
+ copy_node_3d(_PD, _pd) ;
+
+ double _PP[3] ;
+ copy_node_3d(_PP, _pp) ;
+
+ double _s1 =
+ geompred::orient3d (
+ (double*)_PB ,
+ (double*)_PD ,
+ (double*)_PC ,
+ (double*)_PP ) ;
+
+ double _s2 =
+ geompred::orient3d (
+ (double*)_PC ,
+ (double*)_PD ,
+ (double*)_PA ,
+ (double*)_PP ) ;
+
+ double _s3 =
+ geompred::orient3d (
+ (double*)_PA ,
+ (double*)_PD ,
+ (double*)_PB ,
+ (double*)_PP ) ;
+
+ double _s4 =
+ geompred::orient3d (
+ (double*)_PA ,
+ (double*)_PB ,
+ (double*)_PC ,
+ (double*)_PP ) ;
+
+ if (_s1 * _s2 < +0.0 ||
+ _s2 * _s3 < +0.0 ||
+ _s3 * _s1 < +0.0 ||
+ _s1 * _s4 < +0.0 ||
+ _s2 * _s4 < +0.0 ||
+ _s3 * _s4 < +0.0 )
+ {
+
+ real_type _dm = +std::
+ numeric_limits
+ ::infinity() ;
+
+ real_type _qt[3] ;
+
+ _ht = null_hits ;
+
+ __projface3d(
+ _pb, _pd, _pc) ;
+ __projface3d(
+ _pc, _pd, _pa) ;
+ __projface3d(
+ _pa, _pd, _pb) ;
+ __projface3d(
+ _pa, _pb, _pc) ;
+
+ return ( true ) ;
+ }
+ else
+ {
+
+ _ht = tria_hits ;
+
+ copy_node_3d(_qq, _pp) ;
+
+ return ( true ) ;
+ }
+ }
+
+ # undef __projface3d
+ }
+
/*
--------------------------------------------------------
* linear intersection kernels
--------------------------------------------------------
*/
- typedef char_type hits_type;
-
- hits_type null_hits = +0 ;
- hits_type node_hits = +1 ;
- hits_type edge_hits = +2 ;
- hits_type face_hits = +3 ;
- hits_type tria_hits = +4 ;
-
-
__normal_call double cleave2d (
__const_ptr (double) _pa,
__const_ptr (double) _pb,
diff --git a/src/libcpp/mesh_func/hfun_grid_ellipsoid_3.hpp b/src/libcpp/mesh_func/hfun_grid_ellipsoid_3.hpp
index 053c78c..85bd44d 100644
--- a/src/libcpp/mesh_func/hfun_grid_ellipsoid_3.hpp
+++ b/src/libcpp/mesh_func/hfun_grid_ellipsoid_3.hpp
@@ -74,16 +74,22 @@
public :
+ /*--------------- (x/a)**2 + (y/b)**2 + (z/c)**2 = 1. */
+
+ real_type _radA ;
+ real_type _radB ;
+ real_type _radC ;
+
containers::array <
- real_type, allocator> _xpos;
+ real_type, allocator> _xpos ;
containers::array <
- real_type, allocator> _ypos;
+ real_type, allocator> _ypos ;
containers::array <
- real_type, allocator> _hmat;
+ real_type, allocator> _hmat ;
- bool_type _xvar;
- bool_type _yvar;
+ bool_type _xvar ;
+ bool_type _yvar ;
public :
diff --git a/src/libcpp/mesh_func/hfun_mesh_ellipsoid_3.hpp b/src/libcpp/mesh_func/hfun_mesh_ellipsoid_3.hpp
new file mode 100644
index 0000000..94e2370
--- /dev/null
+++ b/src/libcpp/mesh_func/hfun_mesh_ellipsoid_3.hpp
@@ -0,0 +1,552 @@
+
+ /*
+ --------------------------------------------------------
+ * HFUN-MESH-ELLIPSOID-3D: ellipsoidal H(x) in R^3.
+ --------------------------------------------------------
+ *
+ * This program may be freely redistributed under the
+ * condition that the copyright notices (including this
+ * entire header) are not removed, and no compensation
+ * is received through use of the software. Private,
+ * research, and institutional use is free. You may
+ * distribute modified versions of this code UNDER THE
+ * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE
+ * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE
+ * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE
+ * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR
+ * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution
+ * of this code as part of a commercial system is
+ * permissible ONLY BY DIRECT ARRANGEMENT WITH THE
+ * AUTHOR. (If you are not directly supplying this
+ * code to a customer, and you are instead telling them
+ * how they can obtain it for free, then you are not
+ * required to make any arrangement with me.)
+ *
+ * Disclaimer: Neither I nor: Columbia University, The
+ * Massachusetts Institute of Technology, The
+ * University of Sydney, nor The National Aeronautics
+ * and Space Administration warrant this code in any
+ * way whatsoever. This code is provided "as-is" to be
+ * used at your own risk.
+ *
+ --------------------------------------------------------
+ *
+ * Last updated: 30 April, 2019
+ *
+ * Copyright 2013-2019
+ * Darren Engwirda
+ * de2363@columbia.edu
+ * https://github.com/dengwirda/
+ *
+ --------------------------------------------------------
+ */
+
+# pragma once
+
+# ifndef __HFUN_MESH_ELLIPSOID_3__
+# define __HFUN_MESH_ELLIPSOID_3__
+
+ namespace mesh {
+
+ template <
+ typename R ,
+ typename I ,
+ typename A = allocators::basic_alloc
+ >
+ class hfun_mesh_ellipsoid_3d
+ : public hfun_base_kd
+ {
+ public :
+
+ /*------------------------- euclidean size-fun in R^2 */
+
+ typedef R real_type ;
+ typedef I iptr_type ;
+ typedef A allocator ;
+
+ typedef hfun_mesh_ellipsoid_3d <
+ real_type ,
+ iptr_type > hfun_type ;
+
+ typedef typename hfun_base_kd <
+ iptr_type ,
+ real_type >::hint_type hint_type ;
+
+
+ class node_type: public tria_complex_node_3
+ {
+ /*------------------------------------ loc. node type */
+ public :
+ real_type _hval ;
+
+ public :
+ /*------------------------------------ "write" access */
+ __inline_call real_type& hval (
+ )
+ { return this->_hval ;
+ }
+ /*------------------------------------ "const" access */
+ __inline_call real_type const& hval (
+ ) const
+ { return this->_hval ;
+ }
+
+ } ;
+
+ typedef tria_complex_edge_2 edge_type ;
+ typedef tria_complex_tria_3 tri3_type ;
+
+ typedef mesh::tria_complex_2<
+ node_type,
+ edge_type,
+ tri3_type,
+ allocator > mesh_type ;
+
+ typedef geom_tree::aabb_node_base_k
+ tree_node ;
+
+ typedef geom_tree::aabb_item_rect_k <
+ real_type,
+ iptr_type,
+ + 3 > tree_item ;
+
+ typedef geom_tree::aabb_tree<
+ tree_item,
+ + 3 ,
+ tree_node,
+ allocator > tree_type ;
+
+ typedef geom_tree::aabb_pred_node_3 <
+ real_type,
+ iptr_type > tree_pred ;
+
+ public :
+
+ /*--------------- (x/a)**2 + (y/b)**2 + (z/c)**2 = 1. */
+
+ real_type _radA ;
+ real_type _radB ;
+ real_type _radC ;
+
+ containers::
+ fixed_array _bmin ;
+ containers::
+ fixed_array _bmax ;
+
+ mesh_type _mesh ;
+ tree_type _tree ;
+
+ public :
+
+ /*
+ --------------------------------------------------------
+ * INIT-HFUN: make tree - check signs.
+ --------------------------------------------------------
+ */
+
+ __normal_call void_type init (
+ )
+ {
+ class tria_pred
+ {
+ /*-------------------- TRUE if tree should index tria */
+ public :
+ __inline_call
+ bool_type operator () (
+ tri3_type const& _tdat
+ ) const
+ { return _tdat.mark() >= 0 ;
+ }
+ } ;
+
+ /*----------------------------- init. aabb at -+ inf. */
+ for(auto _idim = 3; _idim-- != 0 ; )
+ {
+ this->_bmin[_idim] =
+ +std::numeric_limits<
+ real_type>::infinity() ;
+
+ this->_bmax[_idim] =
+ -std::numeric_limits<
+ real_type>::infinity() ;
+ }
+
+ /*----------------------------- convert to R^3 coord. */
+ for (auto _iter =
+ this->_mesh._set1.head() ;
+ _iter !=
+ this->_mesh._set1.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark() >= +0)
+ {
+ real_type _alon, _alat ;
+ _alon = _iter->pval(0) ;
+ _alat = _iter->pval(1) ;
+
+ _iter->pval(0) =
+ this-> _radA*
+ std::cos(_alon) *
+ std::cos(_alat) ;
+ _iter->pval(1) =
+ this-> _radB*
+ std::sin(_alon) *
+ std::cos(_alat) ;
+ _iter->pval(2) =
+ this-> _radC*
+ std::sin(_alat) ;
+ }
+ }
+
+ /*----------------------------- calc. aabb for inputs */
+ for (auto _iter =
+ this->_mesh._set1.head() ;
+ _iter !=
+ this->_mesh._set1.tend() ;
+ ++_iter )
+ {
+ if (_iter->mark() >= +0)
+ {
+ this->_bmin[0] = std::min (
+ this->_bmin[0] ,
+ _iter->pval(0) ) ;
+ this->_bmin[1] = std::min (
+ this->_bmin[1] ,
+ _iter->pval(1) ) ;
+ this->_bmin[2] = std::min (
+ this->_bmin[2] ,
+ _iter->pval(2) ) ;
+
+ this->_bmax[0] = std::max (
+ this->_bmax[0] ,
+ _iter->pval(0) ) ;
+ this->_bmax[1] = std::max (
+ this->_bmax[1] ,
+ _iter->pval(1) ) ;
+ this->_bmax[2] = std::max (
+ this->_bmax[2] ,
+ _iter->pval(2) ) ;
+ }
+ }
+
+ real_type static const _RTOL =
+ std::pow (
+ std::numeric_limits
+ ::epsilon(),(real_type).8) ;
+
+ iptr_type static
+ constexpr _NBOX=(iptr_type)+4 ;
+
+ real_type _BTOL[3] ;
+ _BTOL[0] = this->_bmax [ 0 ] -
+ this->_bmin [ 0 ] ;
+ _BTOL[1] = this->_bmax [ 1 ] -
+ this->_bmin [ 1 ] ;
+ _BTOL[2] = this->_bmax [ 2 ] -
+ this->_bmin [ 2 ] ;
+
+ _BTOL[0]*=_RTOL ;
+ _BTOL[1]*=_RTOL ;
+ _BTOL[2]*=_RTOL ;
+
+ /*-------------------- make aabb-tree and init. bbox. */
+ aabb_mesh( this->_mesh._set1 ,
+ this->_mesh._set3 ,
+ this->_tree,_BTOL ,
+ _NBOX , tria_pred()) ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * FIND-TRIA: scan for nearest tria.
+ --------------------------------------------------------
+ */
+
+ class find_tria
+ {
+ public :
+ real_type *_ppos ;
+
+ mesh_type *_mesh ;
+
+ bool_type _find ;
+ iptr_type _tpos ;
+
+ public :
+
+ /*------------------------ make a tree-tria predicate */
+ __inline_call find_tria (
+ real_type*_psrc = nullptr ,
+ mesh_type*_msrc = nullptr
+ ) : _ppos(_psrc) ,
+ _mesh(_msrc) ,
+ _find(false) ,
+ _tpos( -1) {}
+
+ /*------------------------ call pred. on tree matches */
+ __inline_call
+ void_type operator () (
+ typename
+ tree_type::item_data *_iptr
+ )
+ {
+ if (this->_find) return ;
+
+ for ( ; _iptr != nullptr;
+ _iptr = _iptr->_next)
+ {
+ real_type _qtmp[+3];
+ iptr_type _tpos =
+ _iptr->_data.ipos() ;
+
+ if (near_pred ( _ppos ,
+ _qtmp ,*_mesh ,
+ _tpos ) )
+ {
+ /*------------------------ is fully inside: finished! */
+ this->_find = true ;
+ this->_tpos = _tpos ;
+
+ break ;
+
+ }
+ }
+ }
+
+ } ;
+
+ class near_tria
+ {
+ public :
+ real_type *_ppos ;
+ real_type *_qpos ;
+
+ real_type _dsqr ;
+
+ mesh_type *_mesh ;
+
+ bool_type _find ;
+ iptr_type _tpos ;
+
+ public :
+
+ /*------------------------ make a tree-tria predicate */
+ __inline_call near_tria (
+ real_type*_psrc = nullptr ,
+ real_type*_qsrc = nullptr ,
+ mesh_type*_msrc = nullptr
+ ) : _ppos(_psrc) ,
+ _qpos(_qsrc) ,
+ _dsqr(+std::numeric_limits
+ ::infinity()) ,
+ _mesh(_msrc) ,
+ _find(false) ,
+ _tpos( -1) {}
+
+ /*------------------------ call pred. on tree matches */
+ __inline_call
+ real_type operator () (
+ typename
+ tree_type::item_data *_iptr
+ )
+ {
+ if (this->_find) return +0. ;
+
+ for ( ; _iptr != nullptr;
+ _iptr = _iptr->_next)
+ {
+ real_type _qtmp[+3];
+ iptr_type _tpos =
+ _iptr->_data.ipos() ;
+
+ if (near_pred ( _ppos ,
+ _qtmp ,*_mesh ,
+ _tpos ) )
+ {
+ /*------------------------ is fully inside: finished! */
+ this->_dsqr =
+ (real_type) +0. ;
+
+ this->_find = true ;
+ this->_tpos = _tpos ;
+
+ break ;
+
+ }
+ else
+ {
+ /*------------------------ projected match: keep best */
+ real_type _dtmp =
+ geometry::lensqr_3d(_ppos, _qtmp);
+
+ if (_dtmp<_dsqr )
+ {
+ _qpos[0] = _qtmp[0] ;
+ _qpos[1] = _qtmp[1] ;
+ _qpos[2] = _qtmp[2] ;
+
+ this->_dsqr = _dtmp ;
+ this->_tpos = _tpos ;
+ }
+
+ }
+ }
+
+ return ( this->_dsqr ) ;
+ }
+
+ } ;
+
+ /*
+ --------------------------------------------------------
+ * NEAR-PRED: TRUE if PPOS is in TPOS.
+ --------------------------------------------------------
+ */
+
+ __static_call
+ __normal_call bool_type near_pred (
+ real_type*_ppos ,
+ real_type*_qpos ,
+ mesh_type&_mesh ,
+ iptr_type _tpos
+ )
+ {
+ geometry::hits_type _hits ;
+ if (geometry::proj_tria_3d(_ppos,
+ &_mesh._set1[
+ _mesh._set3[
+ _tpos].node(0)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set3[
+ _tpos].node(1)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set3[
+ _tpos].node(2)].pval(0) ,
+ _qpos,_hits) )
+ {
+ return (_hits ==
+ geometry::face_hits) ;
+ }
+ else
+ {
+ return ( false ) ;
+ }
+ }
+
+ /*
+ --------------------------------------------------------
+ * HINT: check for valid index.
+ --------------------------------------------------------
+ */
+
+ __inline_call bool_type hint_okay (
+ hint_type _hint
+ )
+ {
+ /*------------------------ test whether hint is valid */
+ return _hint >= (iptr_type)0
+ && _hint < (iptr_type)
+ this->_mesh._set3.count()
+ && this->_mesh.
+ _set3 [_hint].mark() >= 0 ;
+ }
+
+ /*
+ --------------------------------------------------------
+ * EVAL: eval. size-fun. value.
+ --------------------------------------------------------
+ */
+
+ __normal_call real_type eval (
+ real_type *_ppos ,
+ hint_type &_hint
+ )
+ /*------------------------ find tria + linear interp. */
+ {
+ real_type _QPOS[ 3] ;
+ _QPOS[0] = _ppos[0] ;
+ _QPOS[1] = _ppos[1] ;
+ _QPOS[2] = _ppos[2] ;
+
+ real_type _hval =
+ +std::numeric_limits::infinity() ;
+
+ if (hint_okay(_hint))
+ {
+ /*------------------------ test whether hint is valid */
+ if(!near_pred( _ppos,
+ _QPOS, _mesh,
+ _hint) )
+ {
+ _hint = this->null_hint();
+ }
+ }
+ else
+ {
+ /*------------------------ hint is definitely invalid */
+ _hint = this->null_hint();
+ }
+
+ if (_hint == this->null_hint())
+ {
+ /*------------------------ outside: find nearest tria */
+ near_tria _func (_ppos,
+ _QPOS,&_mesh) ;
+
+ this->
+ _tree.near(_ppos, _func) ;
+
+ _hint = _func._tpos ;
+ }
+
+ if (_hint != this->null_hint())
+ {
+ /*------------------------ linear interp. within tria */
+ real_type _hsum = (real_type)+.0 ;
+ real_type _vsum = (real_type)+.0 ;
+
+ for(auto _fpos = 3; _fpos-- != 0; )
+ {
+ iptr_type _fnod [3] ;
+ tri3_type::
+ face_node(_fnod, _fpos, 2, 1) ;
+
+ _fnod[0] = this->_mesh.
+ _set3[_hint].node(_fnod[0]);
+ _fnod[1] = this->_mesh.
+ _set3[_hint].node(_fnod[1]);
+ _fnod[2] = this->_mesh.
+ _set3[_hint].node(_fnod[2]);
+
+ real_type _tvol =
+ geometry::tria_area_3d (
+ &this->_mesh.
+ _set1[_fnod[0]].pval(0) ,
+ &this->_mesh.
+ _set1[_fnod[1]].pval(0) ,
+ _QPOS) ;
+
+ _hsum += _tvol * this->
+ _mesh._set1[_fnod[2]].hval() ;
+
+ _vsum += _tvol ;
+ }
+
+
+ _hval = _hsum / _vsum ;
+
+ }
+
+ /*------------------------- size-fun interp. to ppos. */
+ return _hval ;
+ }
+
+ } ;
+
+
+ }
+
+# endif //__HFUN_MESH_ELLIPSOID_3__
+
+
+
diff --git a/src/libcpp/mesh_func/hfun_mesh_euclidean_2.hpp b/src/libcpp/mesh_func/hfun_mesh_euclidean_2.hpp
index f0ababa..c3fc696 100644
--- a/src/libcpp/mesh_func/hfun_mesh_euclidean_2.hpp
+++ b/src/libcpp/mesh_func/hfun_mesh_euclidean_2.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 03 October, 2017
+ * Last updated: 30 April, 2019
*
- * Copyright 2013-2017
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -127,8 +127,6 @@
containers::
fixed_array _bmax ;
- real_type _vtol ;
-
mesh_type _mesh ;
tree_type _tree ;
@@ -196,152 +194,200 @@
std::pow (
std::numeric_limits
::epsilon(),(real_type).8) ;
-
+
iptr_type static
constexpr _NBOX=(iptr_type)+4 ;
real_type _BTOL[2] ;
- _BTOL[0] = this->_bmax[0] -
- this->_bmin[0] ;
- _BTOL[1] = this->_bmax[1] -
- this->_bmin[1] ;
-
- real_type _vbox =_BTOL[0] *
- _BTOL[1] ;
+ _BTOL[0] = this->_bmax [ 0 ] -
+ this->_bmin [ 0 ] ;
+ _BTOL[1] = this->_bmax [ 1 ] -
+ this->_bmin [ 1 ] ;
_BTOL[0]*=_RTOL ;
_BTOL[1]*=_RTOL ;
- this->_vtol = _vbox*_RTOL ;
-
/*-------------------- make aabb-tree and init. bbox. */
- aabb_mesh(this->_mesh._set1 ,
- this->_mesh._set3 ,
- this->_tree,_BTOL ,
- _NBOX , tria_pred()) ;
-
- /*--------------------- flip node order - orientations */
- for (auto _tpos =
- this->_mesh._set3.head() ;
- _tpos !=
- this->_mesh._set3.tend() ;
- ++_tpos )
- {
- if (_tpos->mark() >= +0)
- {
- real_type _tvol =
- geometry::tria_area_2d (
- &this->_mesh._set1[
- _tpos->node(0)].pval(0),
- &this->_mesh._set1[
- _tpos->node(1)].pval(0),
- &this->_mesh._set1[
- _tpos->node(2)].pval(0)
- ) ;
-
- if (_tvol < (real_type) +0.)
- std::swap(_tpos->node (0),
- _tpos->node (1)) ;
- }
- }
+ aabb_mesh( this->_mesh._set1 ,
+ this->_mesh._set3 ,
+ this->_tree,_BTOL ,
+ _NBOX , tria_pred()) ;
}
/*
--------------------------------------------------------
- * FIND-TRIA: scan for enclosing tria.
+ * FIND-TRIA: scan for nearest tria.
--------------------------------------------------------
*/
-
+
class find_tria
{
public :
- real_type *_ppos ;
+ real_type *_ppos ;
- mesh_type *_mesh ;
+ mesh_type *_mesh ;
- real_type _vtol ;
- bool_type _find ;
- iptr_type _tpos ;
+ bool_type _find ;
+ iptr_type _tpos ;
public :
/*------------------------ make a tree-tria predicate */
__inline_call find_tria (
real_type*_psrc = nullptr ,
- mesh_type*_msrc = nullptr ,
- real_type _vsrc =
- (real_type) + 0.0
+ mesh_type*_msrc = nullptr
) : _ppos(_psrc) ,
_mesh(_msrc) ,
- _vtol(_vsrc) ,
_find(false) ,
_tpos( -1) {}
/*------------------------ call pred. on tree matches */
__inline_call
void_type operator () (
- typename
- tree_type::item_data *_iptr
+ typename
+ tree_type::item_data *_iptr
)
{
- if (this->_find) return;
+ if (this->_find) return ;
for ( ; _iptr != nullptr;
_iptr = _iptr->_next)
{
+ real_type _qtmp[+2];
iptr_type _tpos =
_iptr->_data.ipos() ;
- if (find_pred ( _ppos ,
- _mesh , _tpos ,
- _vtol ) )
+ if (near_pred ( _ppos ,
+ _qtmp ,*_mesh ,
+ _tpos ) )
{
- this->_find = true ;
- this->_tpos = _tpos ;
-
- break ;
+ /*------------------------ is fully inside: finished! */
+ this->_find = true ;
+ this->_tpos = _tpos ;
+
+ break ;
+
+ }
+ }
+ }
+
+ } ;
+
+ class near_tria
+ {
+ public :
+ real_type *_ppos ;
+ real_type *_qpos ;
+
+ real_type _dsqr ;
+
+ mesh_type *_mesh ;
+
+ bool_type _find ;
+ iptr_type _tpos ;
+
+ public :
+
+ /*------------------------ make a tree-tria predicate */
+ __inline_call near_tria (
+ real_type*_psrc = nullptr ,
+ real_type*_qsrc = nullptr ,
+ mesh_type*_msrc = nullptr
+ ) : _ppos(_psrc) ,
+ _qpos(_qsrc) ,
+ _dsqr(+std::numeric_limits
+ ::infinity()) ,
+ _mesh(_msrc) ,
+ _find(false) ,
+ _tpos( -1) {}
+
+ /*------------------------ call pred. on tree matches */
+ __inline_call
+ real_type operator () (
+ typename
+ tree_type::item_data *_iptr
+ )
+ {
+ if (this->_find) return +0. ;
+
+ for ( ; _iptr != nullptr;
+ _iptr = _iptr->_next)
+ {
+ real_type _qtmp[+2];
+ iptr_type _tpos =
+ _iptr->_data.ipos() ;
+
+ if (near_pred ( _ppos ,
+ _qtmp ,*_mesh ,
+ _tpos ) )
+ {
+ /*------------------------ is fully inside: finished! */
+ this->_dsqr =
+ (real_type) +0. ;
+
+ this->_find = true ;
+ this->_tpos = _tpos ;
+
+ break ;
+
+ }
+ else
+ {
+ /*------------------------ projected match: keep best */
+ real_type _dtmp =
+ geometry::lensqr_2d(_ppos, _qtmp);
+
+ if (_dtmp<_dsqr )
+ {
+ _qpos[0] = _qtmp[0] ;
+ _qpos[1] = _qtmp[1] ;
+
+ this->_dsqr = _dtmp ;
+ this->_tpos = _tpos ;
+ }
+
}
}
+
+ return ( this->_dsqr ) ;
}
} ;
/*
--------------------------------------------------------
- * FIND-PRED: TRUE if PPOS is in TPOS.
+ * NEAR-PRED: TRUE if PPOS is in TPOS.
--------------------------------------------------------
*/
__static_call
- __normal_call bool_type find_pred (
+ __normal_call bool_type near_pred (
real_type*_ppos ,
- mesh_type*_mesh ,
- iptr_type _tpos ,
- real_type _vtol
+ real_type*_qpos ,
+ mesh_type&_mesh ,
+ iptr_type _tpos
)
{
- for (auto _fpos = +3; _fpos-- != +0; )
+ geometry::hits_type _hits ;
+ if (geometry::proj_tria_2d(_ppos,
+ &_mesh._set1[
+ _mesh._set3[
+ _tpos].node(0)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set3[
+ _tpos].node(1)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set3[
+ _tpos].node(2)].pval(0) ,
+ _qpos,_hits) )
{
- iptr_type _fnod[ 3];
- mesh_type::tri3_type::
- face_node(_fnod, _fpos, 2, 1);
- _fnod[0] = _mesh->
- _set3[_tpos].node(_fnod[0]);
- _fnod[1] = _mesh->
- _set3[_tpos].node(_fnod[1]);
-
- real_type _tvol =
- geometry::tria_area_2d (
- &_mesh->
- _set1[ _fnod[0]].pval(0),
- &_mesh->
- _set1[ _fnod[1]].pval(0),
- _ppos) ;
-
- if (_tvol < -_vtol) return false ;
+ return (_hits ==
+ geometry::tria_hits) ;
}
-
- return true ;
+ else
+ {
+ return ( false ) ;
+ }
}
/*
@@ -374,15 +420,19 @@
)
/*------------------------ find tria + linear interp. */
{
+ real_type _QPOS[ 2] ;
+ _QPOS[0] = _ppos[0] ;
+ _QPOS[1] = _ppos[1] ;
+
real_type _hval =
+std::numeric_limits::infinity() ;
if (hint_okay(_hint))
{
/*------------------------ test whether hint is valid */
- if(!find_pred( _ppos,
- &_mesh, _hint,
- this->_vtol ) )
+ if(!near_pred( _ppos,
+ _QPOS, _mesh,
+ _hint) )
{
_hint = this->null_hint();
}
@@ -398,16 +448,27 @@
/*------------------------ scan to find bounding tria */
tree_pred _pred (_ppos) ;
find_tria _func (_ppos,
- &_mesh,
- this->_vtol) ;
+ &_mesh) ;
this->
_tree.find(_pred, _func) ;
- _hint = _func._find ?
- _func._tpos :
+ _hint = _func._find ?
+ _func._tpos :
hfun_type::null_hint () ;
}
+
+ if (_hint == this->null_hint())
+ {
+ /*------------------------ outside: find nearest tria */
+ near_tria _func (_ppos,
+ _QPOS,&_mesh) ;
+
+ this->
+ _tree.near(_ppos, _func) ;
+
+ _hint = _func._tpos ;
+ }
if (_hint != this->null_hint())
{
@@ -420,6 +481,7 @@
iptr_type _fnod [3] ;
tri3_type::
face_node(_fnod, _fpos, 2, 1) ;
+
_fnod[0] = this->_mesh.
_set3[_hint].node(_fnod[0]);
_fnod[1] = this->_mesh.
@@ -430,82 +492,24 @@
real_type _tvol =
geometry::tria_area_2d (
&this->_mesh.
- _set1[ _fnod[0]].pval(0),
+ _set1[_fnod[0]].pval(0) ,
&this->_mesh.
- _set1[ _fnod[1]].pval(0),
- _ppos) ;
+ _set1[_fnod[1]].pval(0) ,
+ _QPOS) ;
_hsum += _tvol * this->
- _mesh._set1[_fnod[2]].hval() ;
+ _mesh._set1[_fnod[2]].hval() ;
_vsum += _tvol ;
}
_hval = _hsum / _vsum ;
-
- }
- else
- {
- /*------------------------- inv-dist. weighted extrap */
- typename tree_type::item_data
- *_nptr = nullptr ;
-
- this->_tree.
- near(_ppos, _nptr) ; // find nearest tria.
-
- if (_nptr != nullptr )
- {
- /*------------------------- extrap. using tria. nodes */
- iptr_type _tpos =
- _nptr->_data.ipos() ;
-
- iptr_type _inod =
- _mesh._set3[_tpos].node(0) ;
- iptr_type _jnod =
- _mesh._set3[_tpos].node(1) ;
- iptr_type _knod =
- _mesh._set3[_tpos].node(2) ;
-
- real_type _isqr =
- geometry::lensqr_2d(_ppos,
- &_mesh._set1[_inod].pval( +0));
- real_type _jsqr =
- geometry::lensqr_2d(_ppos,
- &_mesh._set1[_jnod].pval( +0));
- real_type _ksqr =
- geometry::lensqr_2d(_ppos,
- &_mesh._set1[_knod].pval( +0));
-
- /*------------------------- extrap. as inv-dist. fun. */
- real_type _wsum = (real_type)0. ;
- real_type _hsum = (real_type)0. ;
-
- real_type _iwsc =
- (real_type)+1. / _isqr ;
- real_type _jwsc =
- (real_type)+1. / _jsqr ;
- real_type _kwsc =
- (real_type)+1. / _ksqr ;
-
- _wsum += _iwsc + _jwsc + _kwsc ;
-
- _hsum += _iwsc *
- _mesh._set1[_inod].hval();
- _hsum += _jwsc *
- _mesh._set1[_jnod].hval();
- _hsum += _kwsc *
- _mesh._set1[_knod].hval();
-
-
- _hval = _hsum / _wsum ;
-
+
}
-
- }
-
+
/*------------------------- size-fun interp. to ppos. */
- return _hval ;
+ return _hval ;
}
} ;
diff --git a/src/libcpp/mesh_func/hfun_mesh_euclidean_3.hpp b/src/libcpp/mesh_func/hfun_mesh_euclidean_3.hpp
index 45ef6c3..047694d 100644
--- a/src/libcpp/mesh_func/hfun_mesh_euclidean_3.hpp
+++ b/src/libcpp/mesh_func/hfun_mesh_euclidean_3.hpp
@@ -31,9 +31,9 @@
*
--------------------------------------------------------
*
- * Last updated: 24 July, 2018
+ * Last updated: 30 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -119,10 +119,6 @@
+ 3 ,
tree_node,
allocator > tree_type ;
-
- typedef geom_tree::aabb_pred_node_3 <
- real_type,
- iptr_type > tree_pred ;
public :
@@ -131,9 +127,8 @@
containers::
fixed_array _bmax ;
- real_type _vtol ;
-
mesh_type _mesh ;
+
tree_type _tree ;
public :
@@ -211,157 +206,149 @@
constexpr _NBOX=(iptr_type)+8 ;
real_type _BTOL[3] ;
- _BTOL[0] = this->_bmax[0] -
- this->_bmin[0] ;
- _BTOL[1] = this->_bmax[1] -
- this->_bmin[1] ;
- _BTOL[2] = this->_bmax[2] -
- this->_bmin[2] ;
-
- real_type _vbox =_BTOL[0] *
- _BTOL[1] *
- _BTOL[2] ;
+ _BTOL[0] = this->_bmax [ 0 ] -
+ this->_bmin [ 0 ] ;
+ _BTOL[1] = this->_bmax [ 1 ] -
+ this->_bmin [ 1 ] ;
+ _BTOL[2] = this->_bmax [ 2 ] -
+ this->_bmin [ 2 ] ;
_BTOL[0]*=_RTOL ;
_BTOL[1]*=_RTOL ;
_BTOL[2]*=_RTOL ;
- this->_vtol = _vbox*_RTOL ;
-
/*-------------------- make aabb-tree and init. bbox. */
- aabb_mesh(this->_mesh._set1 ,
- this->_mesh._set4 ,
- this->_tree,_BTOL ,
- _NBOX , tria_pred()) ;
-
- /*--------------------- flip node order - orientations */
- for (auto _tpos =
- this->_mesh._set4.head() ;
- _tpos !=
- this->_mesh._set4.tend() ;
- ++_tpos )
- {
- if (_tpos->mark() >= +0)
- {
- real_type _tvol =
- geometry::tetra_vol_3d (
- &this->_mesh._set1[
- _tpos->node(0)].pval(0),
- &this->_mesh._set1[
- _tpos->node(1)].pval(0),
- &this->_mesh._set1[
- _tpos->node(2)].pval(0),
- &this->_mesh._set1[
- _tpos->node(3)].pval(0)
- ) ;
-
- if (_tvol < (real_type) +0.)
- std::swap(_tpos->node (0),
- _tpos->node (1)) ;
- }
- }
+ aabb_mesh( this->_mesh._set1 ,
+ this->_mesh._set4 ,
+ this->_tree,_BTOL ,
+ _NBOX , tria_pred()) ;
}
/*
--------------------------------------------------------
- * FIND-TRIA: scan for enclosing tria.
+ * NEAR-TRIA: scan for nearest tria.
--------------------------------------------------------
*/
- class find_tria
+ class near_tria
{
public :
- real_type *_ppos ;
+ real_type *_ppos ;
+ real_type *_qpos ;
+
+ real_type _dsqr ;
- mesh_type *_mesh ;
+ mesh_type *_mesh ;
- real_type _vtol ;
- bool_type _find ;
- iptr_type _tpos ;
+ bool_type _find ;
+ iptr_type _tpos ;
public :
/*------------------------ make a tree-tria predicate */
- __inline_call find_tria (
+ __inline_call near_tria (
real_type*_psrc = nullptr ,
- mesh_type*_msrc = nullptr ,
- real_type _vsrc =
- (real_type) + 0.0
+ real_type*_qsrc = nullptr ,
+ mesh_type*_msrc = nullptr
) : _ppos(_psrc) ,
+ _qpos(_qsrc) ,
+ _dsqr(+std::numeric_limits
+ ::infinity()) ,
_mesh(_msrc) ,
- _vtol(_vsrc) ,
_find(false) ,
_tpos( -1) {}
/*------------------------ call pred. on tree matches */
__inline_call
- void_type operator () (
- typename
- tree_type::item_data *_iptr
+ real_type operator () (
+ typename
+ tree_type::item_data *_iptr
)
{
- if (this->_find) return;
+ if (this->_find) return +0. ;
for ( ; _iptr != nullptr;
_iptr = _iptr->_next)
{
+ real_type _qtmp[+3];
iptr_type _tpos =
_iptr->_data.ipos() ;
- if (find_pred ( _ppos ,
- _mesh , _tpos ,
- _vtol ) )
+ if (near_pred ( _ppos ,
+ _qtmp ,*_mesh ,
+ _tpos ) )
{
- this->_find = true ;
- this->_tpos = _tpos ;
-
- break ;
+ /*------------------------ is fully inside: finished! */
+ this->_dsqr =
+ (real_type) +0. ;
+
+ this->_find = true ;
+ this->_tpos = _tpos ;
+
+ break ;
+
+ }
+ else
+ {
+ /*------------------------ projected match: keep best */
+ real_type _dtmp =
+ geometry::lensqr_3d(_ppos, _qtmp);
+
+ if (_dtmp<_dsqr )
+ {
+ _qpos[0] = _qtmp[0] ;
+ _qpos[1] = _qtmp[1] ;
+ _qpos[2] = _qtmp[2] ;
+
+ this->_dsqr = _dtmp ;
+ this->_tpos = _tpos ;
+ }
+
}
}
+
+ return ( this->_dsqr ) ;
}
} ;
/*
--------------------------------------------------------
- * TRIA-PRED: TRUE if PPOS is in TPOS.
+ * NEAR-PRED: TRUE if PPOS is in TPOS.
--------------------------------------------------------
*/
__static_call
- __normal_call bool_type find_pred (
+ __normal_call bool_type near_pred (
real_type*_ppos ,
- mesh_type*_mesh ,
- iptr_type _tpos ,
- real_type _vtol
+ real_type*_qpos ,
+ mesh_type&_mesh ,
+ iptr_type _tpos
)
{
- for (auto _fpos = +4; _fpos-- != +0; )
+ geometry::hits_type _hits ;
+ if (geometry::proj_tria_3d(_ppos,
+ &_mesh._set1[
+ _mesh._set4[
+ _tpos].node(0)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set4[
+ _tpos].node(1)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set4[
+ _tpos].node(2)].pval(0) ,
+ &_mesh._set1[
+ _mesh._set4[
+ _tpos].node(3)].pval(0) ,
+ _qpos,_hits) )
{
- iptr_type _fnod[ 4];
- mesh_type::tri4_type::
- face_node(_fnod, _fpos, 3, 2);
- _fnod[0] = _mesh->
- _set4[_tpos].node(_fnod[0]);
- _fnod[1] = _mesh->
- _set4[_tpos].node(_fnod[1]);
- _fnod[2] = _mesh->
- _set4[_tpos].node(_fnod[2]);
-
- real_type _tvol =
- geometry::tetra_vol_3d (
- &_mesh->
- _set1[ _fnod[0]].pval(0),
- &_mesh->
- _set1[ _fnod[1]].pval(0),
- &_mesh->
- _set1[ _fnod[2]].pval(0),
- _ppos) ;
-
- if (_tvol < -_vtol) return false ;
+ return (_hits ==
+ geometry::tria_hits) ;
}
-
- return true ;
+ else
+ {
+ return ( false ) ;
+ }
}
/*
@@ -394,15 +381,16 @@
)
/*------------------------ find tria + linear interp. */
{
+ real_type _QPOS[ 3] ;
real_type _hval =
+std::numeric_limits::infinity() ;
if (hint_okay(_hint))
{
/*------------------------ test whether hint is valid */
- if(!find_pred( _ppos,
- &_mesh, _hint,
- this->_vtol ) )
+ if(!near_pred( _ppos,
+ _QPOS, _mesh,
+ _hint) )
{
_hint = this->null_hint();
}
@@ -416,17 +404,19 @@
if (_hint == this->null_hint())
{
/*------------------------ scan to find bounding tria */
- tree_pred _pred (_ppos) ;
- find_tria _func (_ppos,
- &_mesh,
- this->_vtol) ;
+ near_tria _proj (_ppos,
+ _QPOS,&_mesh) ;
- this->
- _tree.find(_pred, _func) ;
+ this->_tree.near(_ppos,
+ _proj) ;
- _hint = _func._find ?
- _func._tpos :
- hfun_type::null_hint () ;
+ _hint = _proj._tpos ;
+ }
+ else
+ {
+ _QPOS[0] = _ppos[0] ;
+ _QPOS[1] = _ppos[1] ;
+ _QPOS[2] = _ppos[2] ;
}
if (_hint != this->null_hint())
@@ -440,6 +430,7 @@
iptr_type _fnod [4] ;
tri4_type::
face_node(_fnod, _fpos, 3, 2) ;
+
_fnod[0] = this->_mesh.
_set4[_hint].node(_fnod[0]);
_fnod[1] = this->_mesh.
@@ -452,92 +443,24 @@
real_type _tvol =
geometry::tetra_vol_3d (
&this->_mesh.
- _set1[ _fnod[0]].pval(0),
+ _set1[_fnod[0]].pval(0) ,
&this->_mesh.
- _set1[ _fnod[1]].pval(0),
+ _set1[_fnod[1]].pval(0) ,
&this->_mesh.
- _set1[ _fnod[2]].pval(0),
- _ppos) ;
+ _set1[_fnod[2]].pval(0) ,
+ _QPOS) ;
_hsum += _tvol * this->
- _mesh._set1[_fnod[3]].hval() ;
+ _mesh._set1[_fnod[3]].hval() ;
_vsum += _tvol ;
}
_hval = _hsum / _vsum ;
-
- }
- else
- {
- /*------------------------- inv-dist. weighted extrap */
- typename tree_type::item_data
- *_nptr = nullptr ;
-
- this->_tree.
- near(_ppos, _nptr) ; // find nearest tria.
-
- if (_nptr != nullptr )
- {
- /*------------------------- extrap. using tria. nodes */
- iptr_type _tpos =
- _nptr->_data.ipos() ;
-
- iptr_type _inod =
- _mesh._set4[_tpos].node(0) ;
- iptr_type _jnod =
- _mesh._set4[_tpos].node(1) ;
- iptr_type _knod =
- _mesh._set4[_tpos].node(2) ;
- iptr_type _lnod =
- _mesh._set4[_tpos].node(3) ;
-
- real_type _isqr =
- geometry::lensqr_3d(_ppos,
- &_mesh._set1[_inod].pval( +0));
- real_type _jsqr =
- geometry::lensqr_3d(_ppos,
- &_mesh._set1[_jnod].pval( +0));
- real_type _ksqr =
- geometry::lensqr_3d(_ppos,
- &_mesh._set1[_knod].pval( +0));
- real_type _lsqr =
- geometry::lensqr_3d(_ppos,
- &_mesh._set1[_lnod].pval( +0));
-
- /*------------------------- extrap. as inv-dist. fun. */
- real_type _wsum = (real_type)0. ;
- real_type _hsum = (real_type)0. ;
-
- real_type _iwsc =
- (real_type)+1. / _isqr ;
- real_type _jwsc =
- (real_type)+1. / _jsqr ;
- real_type _kwsc =
- (real_type)+1. / _ksqr ;
- real_type _lwsc =
- (real_type)+1. / _lsqr ;
-
- _wsum += _iwsc + _jwsc +
- _kwsc + _lwsc ;
-
- _hsum += _iwsc *
- _mesh._set1[_inod].hval();
- _hsum += _jwsc *
- _mesh._set1[_jnod].hval();
- _hsum += _kwsc *
- _mesh._set1[_knod].hval();
- _hsum += _lwsc *
- _mesh._set1[_lnod].hval();
-
-
- _hval = _hsum / _wsum ;
-
+
}
-
- }
-
+
/*------------------------- size-fun interp. to ppos. */
return _hval ;
}
diff --git a/src/libcpp/meshfunc.hpp b/src/libcpp/meshfunc.hpp
index 97954f1..dcf1245 100644
--- a/src/libcpp/meshfunc.hpp
+++ b/src/libcpp/meshfunc.hpp
@@ -31,9 +31,9 @@
*
------------------------------------------------------------
*
- * Last updated: 13 August, 2018
+ * Last updated: 18 April, 2019
*
- * Copyright 2013-2018
+ * Copyright 2013-2019
* Darren Engwirda
* de2363@columbia.edu
* https://github.com/dengwirda/
@@ -61,6 +61,8 @@
# include "mesh_func/hfun_mesh_euclidean_2.hpp"
# include "mesh_func/hfun_mesh_euclidean_3.hpp"
+# include "mesh_func/hfun_mesh_ellipsoid_3.hpp"
+
# include "mesh_func/hfun_grid_euclidean_2.hpp"
# include "mesh_func/hfun_grid_euclidean_3.hpp"
diff --git a/src/run_iter.hpp b/src/run_iter.hpp
index 4db1e79..02724b1 100644
--- a/src/run_iter.hpp
+++ b/src/run_iter.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 18 January, 2019
+ * Last updated: 18 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -341,6 +341,22 @@
_args, _jlog) ;
}
else
+ if (_hfun._kind ==
+ jmsh_kind::ellipsoid_mesh)
+ {
+ /*----------- with ellipsoid-mesh HFUN kernel */
+ _mesh._kind =
+ jmsh_kind::euclidean_mesh;
+
+ _mesh._ndim = +3 ;
+
+ iter_ellipsoid_3d (
+ _geom._ellipsoid_mesh_3d,
+ _hfun._ellipsoid_mesh_3d,
+ _mesh._euclidean_mesh_3d,
+ _args, _jlog) ;
+ }
+ else
if (_hfun._ndim == +3 &&
_hfun._kind ==
jmsh_kind::euclidean_mesh)
diff --git a/src/run_mesh.hpp b/src/run_mesh.hpp
index 48c9718..ab1c920 100644
--- a/src/run_mesh.hpp
+++ b/src/run_mesh.hpp
@@ -31,7 +31,7 @@
*
--------------------------------------------------------
*
- * Last updated: 18 January, 2019
+ * Last updated: 18 April, 2019
*
* Copyright 2013-2019
* Darren Engwirda
@@ -384,6 +384,23 @@
_args, _jlog) ;
}
else
+ if (_hfun._kind ==
+ jmsh_kind::ellipsoid_mesh)
+ {
+ /*----------- with ellipsoid-mesh HFUN kernel */
+ _rdel._kind =
+ jmsh_kind::euclidean_mesh;
+
+ _rdel._ndim = +3 ;
+
+ mesh_euclidean_3d (
+ _geom._ellipsoid_mesh_3d,
+ _init._euclidean_mesh_3d,
+ _hfun._ellipsoid_mesh_3d,
+ _rdel._euclidean_rdel_3d,
+ _args, _jlog) ;
+ }
+ else
if (_hfun._ndim == +3 &&
_hfun._kind ==
jmsh_kind::euclidean_mesh)
diff --git a/version.txt b/version.txt
index 1241657..2628334 100644
--- a/version.txt
+++ b/version.txt
@@ -19,6 +19,9 @@
- Improved support for initial conditions, allow-
ing "un-refinable" edges/faces to be specified.
+ - Support for unstructured H(x) specifications on
+ the ellipsoid.
+
* Version 0.9.8 :
--------------
From 6f0d3f71cc294e32de9f2402e2ade0d603787496 Mon Sep 17 00:00:00 2001
From: Darren Engwirda
Date: Mon, 6 May 2019 18:05:17 -0400
Subject: [PATCH 13/13] 0.9.10 updates: unstructured h(x) on the ellipsoid
---
example.jig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/example.jig b/example.jig
index 37aef8c..9d7c6b2 100644
--- a/example.jig
+++ b/example.jig
@@ -16,7 +16,7 @@
#
# This command calls JIGSAW using the config. data contai-
# ned in "example.jig", which, in unmodified form, creates
-# a tetrahedral mesh of the "stanford-bunny" geometry.
+# a tetrahedral mesh of the "stanford-bunny" geometry.
#
# The subsequent sections detail the various configuration