1 /*! \file HiReconstruction.hpp
2 * This class implements a high order surface/curve reconstruction method which takes a
3 * surface/curve mesh as input and compute local polynomial fittings (in monomial basis) around user
4 * specified vertices. Little noise is allowed and least square will be used in such case. This
5 * method assumes the underlying geometry of input mesh is smooth. The local fitting results could
6 * be used for estimate the exact geometry of the surface. For instance, if mesh refinement is
7 * perform on the input mesh, then the position of new vertices introduced by refinement could be
8 * estimated by the local fitting, rather than using linear interpolation.
9 * Implementations are based on the WALF method in paper:
10 * Jiao, Xiangmin, and Duo Wang. "Reconstructing high-order surfaces for meshing." Engineering with
11 * Computers 28.4 (2012): 361-373.
12 */
13
14 #ifndef HI_RECONSTRUCTION_HPP
15 #define HI_RECONSTRUCTION_HPP
16
17 #include "moab/Range.hpp"
18 #include "moab/HalfFacetRep.hpp"
19
20 #ifdef MOAB_HAVE_MPI
21 #include "moab/ParallelComm.hpp"
22 #endif
23
24 #include <vector>
25
26 namespace moab
27 {
28 enum GEOMTYPE
29 {
30 HISURFACE,
31 HI3DCURVE,
32 HI2DCURVE
33 };
34
35 class Core;
36 class HalfFaceRep;
37 class ParallelComm;
38
39 class HiReconstruction
40 {
41 public:
42 HiReconstruction( Core* impl,
43 ParallelComm* comm = 0,
44 EntityHandle meshIn = 0,
45 int minpnts = 5,
46 bool recwhole = true );
47
48 ~HiReconstruction();
49
50 ErrorCode initialize( bool recwhole );
51
52 //! \brief Reconstruct a high order surface on given surface mesh
53 /** Given a mesh, compute vertex based polynomial fittings for all vertices hosted by current
54 * processor. The result will be stored interally for later usage of evalution. The inputs are:
55 * a) degree, which is the order of polynomial used for vertex based fitting. b) interp, if it's
56 * true, then interpolation will be applied for local fitting, otherwise it's least square
57 * fitting. c) safeguard, specifies whether to use safeguarded numeric method. d) reset, if
58 * fittings have been computed and stored in current object, then reset=true will recompute the
59 * fittings based on user input and replace the existing one. \param degree Integer, order of
60 * polynomials used for local fittings. \param interp Boolean, true=Interpolation, false=least
61 * square fitting. \param safeguard Boolean, true=using safe guarded method in numerical
62 * computing. \param reset Boolean, reset=true will recompute the fittings based on user input
63 * and replace the existing one.
64 */
65 ErrorCode reconstruct3D_surf_geom( int degree, bool interp, bool safeguard, bool reset = false );
66
67 //! \brief Reconstruct a high order surface on given surface mesh
68 /** Given a mesh, compute vertex based polynomial fittings for all vertices hosted by current
69 * processor. User could specify various degrees for different vertices. It assumes that the
70 * input degrees for vertices stored in the same order as that this class stores vertices: 1)
71 * reconstruction will be only performed at vertices hosted by current processor, thus input
72 * npts should match the number of hosted vertices. 2) all hosted vertices will be stored in a
73 * MOAB::Range object, degrees for all these vertices should be stored in degrees as the same
74 * order in the MOAB::Range object The result will be stored interally for later usage of
75 * evalution. \param npts Integer size of array pointed by degrees, used for check \param
76 * degrees Integer arrray, order of polynomials for local fitting at all hosted vertices \param
77 * interp Boolean, true=Interpolation, false=least square fitting. \param safeguard Boolean,
78 * true=using safe guarded method in numerical computing. \param reset Boolean, reset=true will
79 * recompute the fittings based on user input and replace the existing one.
80 */
81 ErrorCode reconstruct3D_surf_geom( size_t npts, int* degrees, bool* interps, bool safeguard, bool reset = false );
82
83 //! \brief Reconstruct a high order curve on given curve mesh
84 /** Given a curve mesh, compute vertex based polynomail fittings for all vertices hosted by
85 * current processor. The vertex based fitting is done by perfoming three one-parameter fittings
86 * along each axis, i.e. x,y,z. The result will be stored interally for later usage of
87 * evalution. \param degree Integer, order of polynomials used for local fittings. \param interp
88 * Boolean, true=Interpolation, false=least square fitting. \param safeguard Boolean, true=using
89 * safe guarded method in numerical computing. \param reset Boolean, reset=true will recompute
90 * the fittings based on user input and replace the existing one.
91 */
92 ErrorCode reconstruct3D_curve_geom( int degree, bool interp, bool safeguard, bool reset = false );
93
94 //! \brief Reconstruct a high order curve on given curve mesh
95 /** Given a curve mesh, compute vertex based polynomail fittings for all vertices hosted by
96 * current processor. The vertex based fitting is done by perfoming three one-parameter fittings
97 * along each axis, i.e. x,y,z. User could specify various degrees for different vertices. It
98 * assumes that the input degrees for vertices stored in the same order as that this class
99 * stores vertices: 1) reconstruction will be only performed at vertices hosted by current
100 * processor, thus input npts should match the number of hosted vertices. 2) all hosted vertices
101 * will be stored in a MOAB::Range object, degrees for all these vertices should be stored in
102 * degrees as the same order in the MOAB::Range object The result will be stored interally for
103 * later usage of evalution. \param npts Integer size of array pointed by degrees, used for
104 * check \param degrees Integer arrray, order of polynomials for local fitting at all hosted
105 * vertices. \param interp Boolean, true=Interpolation, false=least square fitting. \param
106 * safeguard Boolean, true=using safe guarded method in numerical computing. \param reset
107 * Boolean, reset=true will recompute the fittings based on user input and replace the existing
108 * one.
109 */
110 ErrorCode reconstruct3D_curve_geom( size_t npts, int* degrees, bool* interps, bool safeguard, bool reset = false );
111
112 //! \brief Construct vertex based polynomial fitting on a surface mesh
113 /** Given a vertex on a surface mesh, construct a local fitting around this vertex. Stencils
114 * around this vertex will be selected according to input degree and if data is noise. Local
115 * uv-plane will be the estimated tangent plane at this vertex. minpnts will be used to specify
116 * the minimum number allowed in the local stencil. The result will be returned to user by
117 * preallocated memory coords, degree_out, coeffs. \param vid EntityHandle, the fitting will be
118 * performed around this vertex for the local height function over the uv-plane. \param interp
119 * Boolean, true=Interpolation, false=least square fitting. \param degree Integer, order of
120 * polynomials used for local fittings. \param minpnts Integer, the allowed minimum number of
121 * vertices in local stencil. If too small, the resulted fitting might be low order accurate. If
122 * too large, it may introduce overfitting. \param safeguard Boolean, true=using safe guarded
123 * method in numerical computing. \param coords Pointer to double, preallocated memory by user,
124 * should have at least 9 doubles; stores the global coordinates of local coordinates system uvw
125 * directions. \param degree_out Pointer to integer, used to store the degree of resulted
126 * fitting \param coeffs, Pointer to double, preallocated memory for coefficients of local
127 * fittings, should have at least (degree+2)(degree+1)/2 doubles.
128 */
129 ErrorCode polyfit3d_walf_surf_vertex( const EntityHandle vid,
130 const bool interp,
131 int degree,
132 int minpnts,
133 const bool safeguard,
134 const int ncoords,
135 double* coords,
136 int* degree_out,
137 const int ncoeffs,
138 double* coeffs );
139
140 //! \brief Construct vertex based polynomial fitting on a curve mesh
141 /** Given a vertex on a curve mesh, construct three one-parameter local fittings for each
142 * coordinates axis around this vertex. Stencils around this vertex will be selected according
143 * to input degree and if data is noise. Local u-line, or the single parameter will be the
144 * estimated tangent line at this vertex. On each axis of xyz, a polynomial fitting will be
145 * performed according to user input. minpnts will be used to specify the minimum number allowed
146 * in the local stencil. The result will be returned to user by preallocated memory coords,
147 * degree_out, coeffs. \param vid EntityHandle, the fittings will be performed around this
148 * vertex. \param interp Boolean, true=Interpolation, false=least square fitting. \param degree
149 * Integer, order of polynomials used for local fittings. \param minpnts Integer, the allowed
150 * minimum number of vertices in local stencil. If too small, the resulted fitting might be low
151 * order accurate. If too large, it may introduce overfitting. \param safeguard Boolean,
152 * true=using safe guarded method in numerical computing. \param coords Pointer to double,
153 * preallocated memory by user, should have at least 3 doubles; stores the global coordinates of
154 * local coordinate system u direction. \param degree_out Pointer to integer, used to store the
155 * degree of resulted fitting \param coeffs, Pointer to double, preallocated memory for
156 * coefficients of local fittings, should have at least 3*(degree+1) doubles.
157 */
158 ErrorCode polyfit3d_walf_curve_vertex( const EntityHandle vid,
159 const bool interp,
160 int degree,
161 int minpnts,
162 const bool safeguard,
163 const int ncoords,
164 double* coords,
165 int* degree_out,
166 const int ncoeffs,
167 double* coeffs );
168
169 //! \brief Perform high order projection of points in an element, using estimated geometry by
170 //! reconstruction class
171 /** Given an element on the input mesh, and new points in this element, represented as natural
172 * coordinates in element, estimate their position in surface. This is done by weighted
173 * averaging of local fittings: for each vertex of this elment, a fitting has been computed and
174 * the new points could be projected by this fitting. The final result of projection is the
175 * weighted average of these projections, weights are chosen as the barycentric coordinates of
176 * the point in this element. The result will be returned to the user preallocated memory \param
177 * elem EntityHandle, the element on which to perform high order projection. \param nvpe
178 * Integer, number of nodes of this element, triangle is 3, quad is four. \param npts2fit
179 * Integer, number of points lying in elem to be projected. \param naturalcoords2fit Pointer to
180 * array of doubles, size=nvpe*npts2fit, natural coordinates in elem of points to be projected.
181 * \param newcoords Pointer to array of doubles, preallocated by user, size=3*npts2fit,
182 * estimated positions of input points.
183 */
184 ErrorCode hiproj_walf_in_element( EntityHandle elem,
185 const int nvpe,
186 const int npts2fit,
187 const double* naturalcoords2fit,
188 double* newcoords );
189
190 //! \brief Perform high order projection of points around a vertex, using estimated geometry by
191 //! reconstruction class
192 /** Given an vertex on the input mesh, and new points around this vertex, estimate their
193 * position in surface. This is done by first projecting input points onto the local uv-plane
194 * around this vertex and use the precomputed local fitting to estimate the ideal position of
195 * input points. The result will be returned to the user preallocated memory \param vid
196 * EntityHandle, the vertex around which to perform high order projection. \param npts2fit
197 * Integer, number of points lying around vid to be fitted. \param coords2fit Pointer to array
198 * of doubles, size=3*npts2fit, current coordinates of points to be projected. \param newcoords
199 * Pointer to array of doubles, preallocated by user, size=3*npts2fit, estimated positions of
200 * input points.
201 */
202 ErrorCode hiproj_walf_around_vertex( EntityHandle vid,
203 const int npts2fit,
204 const double* coords2fit,
205 double* hiproj_new );
206
207 //! \brief Perform high order projection of points around a center vertex, assume geometry is
208 //! surface
209 /** Given a vertex position and the local fitting parameter around this vertex, estimate the
210 * ideal position of input position according to the local fitting. This is done by first
211 * projecting input points onto the local uv-plane around this vertex and use the given fitting
212 * to estimate the ideal position of input points. The result will be returned to user
213 * preallocated memory \param local_origin Pointer to 3 doubles, coordinates of the center
214 * vertex \param local_coords Pointer to 9 doubles, global coordinates of directions of local
215 * uvw coordinates axis at center vertex \param local_deg Integer, order of local polynomial
216 * fitting \param local_coeffs Pointer to array of doubles, size=(local_deg+2)(local_deg+1)/2,
217 * coefficients of local polynomial fittings, in monomial basis \param interp Boolean,
218 * true=local fitting is interpolation, false=local fitting is least square fitting \param
219 * npts2fit Integer, number of points to be estimated, around the center vertices \param
220 * coords2fit Pointer to array of doubles, size=3*npts2fit, current coordinates of points to be
221 * estimated \param hiproj_new Pointer to array of doubles, size=3*npts2fit, memory preallocated
222 * by user to store the fitting/estimated positions of input points.
223 */
224 void walf3d_surf_vertex_eval( const double* local_origin,
225 const double* local_coords,
226 const int local_deg,
227 const double* local_coeffs,
228 const bool interp,
229 const int npts2fit,
230 const double* coords2fit,
231 double* hiproj_new );
232
233 //! \brief Perform high order projection of points around a center vertex, assume geometry is
234 //! curve
235 /** Given a vertex position and the local one-parameter fittings parameter around this vertex,
236 * estimate the ideal position of input position according to the local fittings. This is done
237 * by first projecting input points onto the local u-direction at this vertex and then use the
238 * value u as parameter for the three fittings, one for each coordinates axis of xyz. The result
239 * will be returned to user preallocated memory \param local_origin Pointer to 3 doubles,
240 * coordinates of the center vertex \param local_coords Pointer to 3 doubles, global coordinates
241 * of direction of local u coordinate axis at center vertex \param local_deg Integer, order of
242 * local polynomial fitting \param local_coeffs Pointer to array of doubles,
243 * size=3*(local_deg+1), coefficients of three local polynomial fittings, in monomial basis. For
244 * each fitting, local_deg+1 parameters. \param interp Boolean, true=local fitting is
245 * interpolation, false=local fitting is least square fitting \param npts2fit Integer, number of
246 * points to be estimated, around the center vertices \param coords2fit Pointer to array of
247 * doubles, size=3*npts2fit, current coordinates of points to be estimated \param hiproj_new
248 * Pointer to array of doubles, size=3*npts2fit, memory preallocated by user to store the
249 * fitting/estimated positions of input points.
250 */
251 void walf3d_curve_vertex_eval( const double* local_origin,
252 const double* local_coords,
253 const int local_deg,
254 const double* local_coeffs,
255 const bool interp,
256 const int npts2fit,
257 const double* coords2fit,
258 double* hiproj_new );
259
260 //! \brief Get interally stored fitting results
261 /** Get fittings results of a vertex, stored internally, results will be writtend to user
262 * provided memory \param vid EntityHandle, a vertex in _verts2rec \param geomtype GEOMTYPE, one
263 * of HISURFACE,HI3DCURVE,HI2DCURVE \param coords vector, global coordinates of local uvw
264 * coordinate system axis directions will be appended to the end of coords \param degree_out
265 * Reference to Integer, order of polynomial fittings for vid \param coeffs vector, coefficients
266 * of local polynomial fittings in monomial basis will be appended to the end of coeffs \param
267 * interp Reference to Boolean, true = interpolation
268 */
269 bool get_fittings_data( EntityHandle vid,
270 GEOMTYPE& geomtype,
271 std::vector< double >& coords,
272 int& degree_out,
273 std::vector< double >& coeffs,
274 bool& interp );
275
276 // Helper function: estimate require number of ghost layers in parallel setting
277 static int estimate_num_ghost_layers( int degree, bool interp = false )
278 {
279 return 1 + ( interp ? ( ( degree + 1 ) >> 1 ) + ( ( degree + 1 ) & 1 )
280 : ( ( degree + 2 ) >> 1 ) + ( ( degree + 2 ) & 1 ) );
281 };
282
283 protected:
284 Core* mbImpl;
285 ParallelComm* pcomm;
286 HalfFacetRep* ahf;
287 // prevent copying
288 HiReconstruction( const HiReconstruction& source );
289 HiReconstruction& operator=( const HiReconstruction& right );
290
291 // mesh on which to perform reconstruction
292 EntityHandle _mesh2rec;
293 //_verts2rec all locally hosted vertices, in parallel might be different from _invert which is
294 // all the vertices in _mesh2rec, including ghost vertices
295 Range _verts2rec, _inverts, _inedges, _infaces, _incells;
296 size_t _nv2rec; // size of _verts2rec
297
298 int _MAXPNTS, _MINPNTS;
299 double _MINEPS;
300
301 // in curve mesh, _hasderiv=true means vertex tangent vectors have been computed over _verts2rec
302 // in surface mesh, _hasderiv=true means vertex normals have been computed over _verts2rec
303 bool _hasderiv;
304
305 GEOMTYPE _geom;
306 int _dim;
307 bool _hasfittings;
308 bool _initfittings;
309 std::vector< double > _local_coords;
310 std::vector< double > _local_fit_coeffs;
311 std::vector< size_t > _vertID2coeffID;
312 std::vector< int > _degrees_out;
313 std::vector< bool > _interps;
314
315 // Estimate stencil size
316 int estimate_num_rings( int degree, bool interp );
317
318 //! \brief Given a vertex, return the incident elements with dimension elemdim
319 /** Wrapper of MOAB Core->get_adjacencies and HalfRep->get_up_adjacencies, depends on if USE_AHF
320 * is defined \param vid EntityHandle of vertex \param elemdim Integer, dimension of elements
321 * incidented in vid \param adjents vector<EntityHandle>, container which push incident elements
322 * in
323 */
324 ErrorCode vertex_get_incident_elements( const EntityHandle& vid,
325 const int elemdim,
326 std::vector< EntityHandle >& adjents );
327
328 //! \brief Get n-ring neighbor vertices, assuming curve/surface mesh, not volume mesh
329 /** Given a vertex, find its n-ring neighbor vertices including itself in _mesrh2rec.
330 * 1-ring neighbor vertices of a vertex are the vertices connected with this vertex with an edge
331 * n-ring vertices are obtained first get the 1-ring vertices and then get the 1-ring of these
332 * vertices, and so on \param vid EntityHandle, vertex around which to get n-ring vertices
333 * \param ring Integer, number of rings
334 * \param minpnts Integer, number of minimum vertices to obtain, if the input ring could not
335 * provide enough vertices, i.e. more than minpnts, then expand the number of rings \param ngbvs
336 * Range, the n-ring vertices of vid, including vid. If too many points found, i.e. more than
337 * _MAXPNTS, then terminate early.
338 */
339 ErrorCode obtain_nring_ngbvs( const EntityHandle vid, int ring, const int minpnts, Range& ngbvs );
340
341 /** Initialize the storage for fitting results over _mesh2rec, curve/surface mesh
342 * Two options are provided: a) use uniform degree for all vertices b) use customized degrees
343 * for different vertices After calling of initializing functions, _initfitting is set to be
344 * true, the fitting result could be stored internally
345 */
346 void initialize_surf_geom( const int degree );
347 void initialize_surf_geom( const size_t npts, const int* degrees );
348 void initialize_3Dcurve_geom( const int degree );
349 void initialize_3Dcurve_geom( const size_t npts, const int* degrees );
350
351 /** Save fitting results of a vertex into internal storage
352 * \param vid EntityHandle, a vertex in _mesh2rec, in _verts2rec
353 * \param coords Pointer to double array, global coordinates of local uvw coordinate system axis
354 * directions \param degree_out Integer, order of polynomial fittings for vid \param coeffs
355 * Pointer to double array, coefficients of local polynomial fittings in monomial basis \param
356 * interp Boolean, true = interpolation
357 */
358 // ErrorCode set_geom_data_surf(const EntityHandle vid, const double* coords, const double
359 // degree_out, const double* coeffs, bool interp); ErrorCode set_geom_data_3Dcurve(const
360 // EntityHandle vid, const double* coords, const double degree_out, const double* coeffs, bool
361 // interp);
362
363 /** Compute area weighted average vertex normals for given vertex, assuming surface mesh
364 * For arbitrary polygon mesh, use incident two edges of each incident polygon of this vertex to
365 * form a triangle, then use these incident "triangles" to compute area weighted average vertex
366 * normals \param vid EntityHandle, vertex in _mesh2rec, might be ghost vertex \param nrm
367 * Pointer to 3-doubles array, preallocated by user
368 */
369 ErrorCode average_vertex_normal( const EntityHandle vid, double* nrm );
370
371 /** Compute weighted average vertex normals for all vertices in _verts2rec, not including ghost
372 * vertices, results are stored interally in _local_coords
373 */
374 ErrorCode compute_average_vertex_normals_surf();
375
376 /** Return the normals of given vertices in a Range, writing to preallocated memory
377 * If normals have been computed and stored, just access them
378 * If not, compute on the fly
379 * \param vertsh Range, EntityHandles of vertices
380 * \param nrms Pointer of array of doubles, size = 3*vertsh.size()
381 */
382 ErrorCode get_normals_surf( const Range& vertsh, double* nrms );
383
384 /** Compute area weighted average vertex tangent vector for given vertex, assuming curve mesh
385 * Use incident two edges of vertex as estimatation of tangent vectors, weighted by length
386 * \param vid EntityHandle, vertex in _mesh2rec, might be ghost vertex
387 * \param tang Pointer to 3-doubles array, preallocated by user
388 */
389 ErrorCode average_vertex_tangent( const EntityHandle vid, double* tang );
390
391 /** Compute weighted average vertex tangent vectors for all vertices in _verts2rec, not
392 * including ghost vertices, results are stored interally in _local_coords
393 */
394 ErrorCode compute_average_vertex_tangents_curve();
395
396 /** Return the tangent vectors of given vertices in a Range, writing to preallocated memory
397 * If tangent vectors have been computed and stored, just access them
398 * If not, compute on the fly
399 * \param vertsh Range, EntityHandles of vertices
400 * \param tangs Pointer of array of doubles, size = 3*vertsh.size()
401 */
402 ErrorCode get_tangents_curve( const Range& vertsh, double* tangs );
403
404 //! \brief Compute local coordinates system of a vertex, and perform vertex based polynomial
405 //! fittings of local height function
406 /** This function take the first vertex of input as center, and build local uv-plane by
407 * estimating vertex normals and tangent planes Then other vertices forms vectors starting from
408 * center and then are projectd onto this uv-plane to form a local height function. Local
409 * fitting of this local height function is performed in WLS sense, according if interpolation
410 * required or not. \param nverts Integer, number of vertices of input \param ngbcors Pointer to
411 * array of doubles, size = 3*nverts, coordinates of input vertices, first will be center \param
412 * ngbnrms Pointer to array of doubles, size = 3*nverts, vertex normals of input vertices \param
413 * degree Integer, user specified fitting degree \param interp Boolean, user input,
414 * interpolation or not \param safeguard Boolean, true = use safeguarded numerical method in
415 * computing \param ncoords Integer, size of *coords, should be 9, used for check \param coords
416 * Pointer to array of doubles, preallocated memory for storing the glocal coordinates of local
417 * uvw axis directions \param ncoeffs Integer, size of *coeffs, should be
418 * (degree+2)(degree+1)/2, used for check \param coeffs Pointer to array of doubles,
419 * preallocated memory for storing coefficients of local fittings in monomial basis \param
420 * degree_out Pointer to integer, order of resulted polynomial of fitting, could be downgraded
421 * due to numerical issues \param degree_pnt Pointer to integer, polynomial fitting order
422 * determined by stencil size/number of points \param degree_qr Pointer to integer, polynomial
423 * fitting order determined by Vandermonde system condition number
424 */
425 void polyfit3d_surf_get_coeff( const int nverts,
426 const double* ngbcors,
427 const double* ngbnrms,
428 int degree,
429 const bool interp,
430 const bool safeguard,
431 const int ncoords,
432 double* coords,
433 const int ncoeffs,
434 double* coeffs,
435 int* degree_out,
436 int* degree_pnt,
437 int* degree_qr );
438 //! \brief Form and solve Vandermonde system of bi-variables
439 void eval_vander_bivar_cmf( const int npts2fit,
440 const double* us,
441 const int ndim,
442 double* bs,
443 int degree,
444 const double* ws,
445 const bool interp,
446 const bool safeguard,
447 int* degree_out,
448 int* degree_pnt,
449 int* degree_qr );
450
451 //! \brief Compute local single variable coordinate system of a vertex, and perform vertex based
452 //! polynomial fittings of three global coordinates axis
453 /** This function take the first vertex of input as center, and build local u-line by estimating
454 * tangent vector Then other vertices form vectors originating from center and vectors then are
455 * projectd onto this u-plane to form three local height functions, one for each coordinates
456 * axis. Local fitting of these local height functions are performed in WLS sense, according if
457 * interpolation required or not. \param nverts Integer, number of vertices of input \param
458 * ngbcors Pointer to array of doubles, size = 3*nverts, coordinates of input vertices, first
459 * will be center \param ngbtangs Pointer to array of doubles, size = 3*nverts, vertex tangent
460 * vectors of input vertices \param degree Integer, user specified fitting degree \param interp
461 * Boolean, user input, interpolation or not \param safeguard Boolean, true = use safeguarded
462 * numerical method in computing \param ncoords Integer, size of *coords, should be 3, used for
463 * check \param coords Pointer to array of doubles, preallocated memory for storing the glocal
464 * coordinates of local u axis direction \param ncoeffs Integer, size of *coeffs, should be
465 * 3*(degree+1), used for check \param coeffs Pointer to array of doubles, preallocated memory
466 * for storing coefficients of local fittings in monomial basis \param degree_out Pointer to
467 * integer, order of resulted polynomial of fitting, could be downgraded due to numerical issues
468 */
469 void polyfit3d_curve_get_coeff( const int nverts,
470 const double* ngbcors,
471 const double* ngbtangs,
472 int degree,
473 const bool interp,
474 const bool safeguard,
475 const int ncoords,
476 double* coords,
477 const int ncoeffs,
478 double* coeffs,
479 int* degree_out );
480 //! \brief Form and solve Vandermonde system of single-variables
481 void eval_vander_univar_cmf( const int npts2fit,
482 const double* us,
483 const int ndim,
484 double* bs,
485 int degree,
486 const double* ws,
487 const bool interp,
488 const bool safeguard,
489 int* degree_out );
490 //! \brief Compute weights for points selected in weighted least square fittigns
491 int compute_weights( const int nrows,
492 const int ncols,
493 const double* us,
494 const int nngbs,
495 const double* ngbnrms,
496 const int degree,
497 const double toler,
498 double* ws );
499 //! \brief Check the correctness of barycentric coordination, wi>=0 and sum(wi)=1
500 bool check_barycentric_coords( const int nws, const double* naturalcoords );
501 }; // class HiReconstruction
502 } // namespace moab
503 #endif