MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /*! \file HiReconstruction.hpp 00002 * This class implements a high order surface/curve reconstruction method which takes a 00003 * surface/curve mesh as input and compute local polynomial fittings (in monomial basis) around user 00004 * specified vertices. Little noise is allowed and least square will be used in such case. This 00005 * method assumes the underlying geometry of input mesh is smooth. The local fitting results could 00006 * be used for estimate the exact geometry of the surface. For instance, if mesh refinement is 00007 * perform on the input mesh, then the position of new vertices introduced by refinement could be 00008 * estimated by the local fitting, rather than using linear interpolation. 00009 * Implementations are based on the WALF method in paper: 00010 * Jiao, Xiangmin, and Duo Wang. "Reconstructing high-order surfaces for meshing." Engineering with 00011 * Computers 28.4 (2012): 361-373. 00012 */ 00013 00014 #ifndef HI_RECONSTRUCTION_HPP 00015 #define HI_RECONSTRUCTION_HPP 00016 00017 #include "moab/Range.hpp" 00018 #include "moab/HalfFacetRep.hpp" 00019 00020 #ifdef MOAB_HAVE_MPI 00021 #include "moab/ParallelComm.hpp" 00022 #endif 00023 00024 #include <vector> 00025 00026 namespace moab 00027 { 00028 enum GEOMTYPE 00029 { 00030 HISURFACE, 00031 HI3DCURVE, 00032 HI2DCURVE 00033 }; 00034 00035 class Core; 00036 class HalfFaceRep; 00037 class ParallelComm; 00038 00039 class HiReconstruction 00040 { 00041 public: 00042 HiReconstruction( Core* impl, 00043 ParallelComm* comm = 0, 00044 EntityHandle meshIn = 0, 00045 int minpnts = 5, 00046 bool recwhole = true ); 00047 00048 ~HiReconstruction(); 00049 00050 ErrorCode initialize( bool recwhole ); 00051 00052 //! \brief Reconstruct a high order surface on given surface mesh 00053 /** Given a mesh, compute vertex based polynomial fittings for all vertices hosted by current 00054 * processor. The result will be stored interally for later usage of evalution. The inputs are: 00055 * a) degree, which is the order of polynomial used for vertex based fitting. b) interp, if it's 00056 * true, then interpolation will be applied for local fitting, otherwise it's least square 00057 * fitting. c) safeguard, specifies whether to use safeguarded numeric method. d) reset, if 00058 * fittings have been computed and stored in current object, then reset=true will recompute the 00059 * fittings based on user input and replace the existing one. \param degree Integer, order of 00060 * polynomials used for local fittings. \param interp Boolean, true=Interpolation, false=least 00061 * square fitting. \param safeguard Boolean, true=using safe guarded method in numerical 00062 * computing. \param reset Boolean, reset=true will recompute the fittings based on user input 00063 * and replace the existing one. 00064 */ 00065 ErrorCode reconstruct3D_surf_geom( int degree, bool interp, bool safeguard, bool reset = false ); 00066 00067 //! \brief Reconstruct a high order surface on given surface mesh 00068 /** Given a mesh, compute vertex based polynomial fittings for all vertices hosted by current 00069 * processor. User could specify various degrees for different vertices. It assumes that the 00070 * input degrees for vertices stored in the same order as that this class stores vertices: 1) 00071 * reconstruction will be only performed at vertices hosted by current processor, thus input 00072 * npts should match the number of hosted vertices. 2) all hosted vertices will be stored in a 00073 * MOAB::Range object, degrees for all these vertices should be stored in degrees as the same 00074 * order in the MOAB::Range object The result will be stored interally for later usage of 00075 * evalution. \param npts Integer size of array pointed by degrees, used for check \param 00076 * degrees Integer arrray, order of polynomials for local fitting at all hosted vertices \param 00077 * interp Boolean, true=Interpolation, false=least square fitting. \param safeguard Boolean, 00078 * true=using safe guarded method in numerical computing. \param reset Boolean, reset=true will 00079 * recompute the fittings based on user input and replace the existing one. 00080 */ 00081 ErrorCode reconstruct3D_surf_geom( size_t npts, int* degrees, bool* interps, bool safeguard, bool reset = false ); 00082 00083 //! \brief Reconstruct a high order curve on given curve mesh 00084 /** Given a curve mesh, compute vertex based polynomail fittings for all vertices hosted by 00085 * current processor. The vertex based fitting is done by perfoming three one-parameter fittings 00086 * along each axis, i.e. x,y,z. The result will be stored interally for later usage of 00087 * evalution. \param degree Integer, order of polynomials used for local fittings. \param interp 00088 * Boolean, true=Interpolation, false=least square fitting. \param safeguard Boolean, true=using 00089 * safe guarded method in numerical computing. \param reset Boolean, reset=true will recompute 00090 * the fittings based on user input and replace the existing one. 00091 */ 00092 ErrorCode reconstruct3D_curve_geom( int degree, bool interp, bool safeguard, bool reset = false ); 00093 00094 //! \brief Reconstruct a high order curve on given curve mesh 00095 /** Given a curve mesh, compute vertex based polynomail fittings for all vertices hosted by 00096 * current processor. The vertex based fitting is done by perfoming three one-parameter fittings 00097 * along each axis, i.e. x,y,z. User could specify various degrees for different vertices. It 00098 * assumes that the input degrees for vertices stored in the same order as that this class 00099 * stores vertices: 1) reconstruction will be only performed at vertices hosted by current 00100 * processor, thus input npts should match the number of hosted vertices. 2) all hosted vertices 00101 * will be stored in a MOAB::Range object, degrees for all these vertices should be stored in 00102 * degrees as the same order in the MOAB::Range object The result will be stored interally for 00103 * later usage of evalution. \param npts Integer size of array pointed by degrees, used for 00104 * check \param degrees Integer arrray, order of polynomials for local fitting at all hosted 00105 * vertices. \param interp Boolean, true=Interpolation, false=least square fitting. \param 00106 * safeguard Boolean, true=using safe guarded method in numerical computing. \param reset 00107 * Boolean, reset=true will recompute the fittings based on user input and replace the existing 00108 * one. 00109 */ 00110 ErrorCode reconstruct3D_curve_geom( size_t npts, int* degrees, bool* interps, bool safeguard, bool reset = false ); 00111 00112 //! \brief Construct vertex based polynomial fitting on a surface mesh 00113 /** Given a vertex on a surface mesh, construct a local fitting around this vertex. Stencils 00114 * around this vertex will be selected according to input degree and if data is noise. Local 00115 * uv-plane will be the estimated tangent plane at this vertex. minpnts will be used to specify 00116 * the minimum number allowed in the local stencil. The result will be returned to user by 00117 * preallocated memory coords, degree_out, coeffs. \param vid EntityHandle, the fitting will be 00118 * performed around this vertex for the local height function over the uv-plane. \param interp 00119 * Boolean, true=Interpolation, false=least square fitting. \param degree Integer, order of 00120 * polynomials used for local fittings. \param minpnts Integer, the allowed minimum number of 00121 * vertices in local stencil. If too small, the resulted fitting might be low order accurate. If 00122 * too large, it may introduce overfitting. \param safeguard Boolean, true=using safe guarded 00123 * method in numerical computing. \param coords Pointer to double, preallocated memory by user, 00124 * should have at least 9 doubles; stores the global coordinates of local coordinates system uvw 00125 * directions. \param degree_out Pointer to integer, used to store the degree of resulted 00126 * fitting \param coeffs, Pointer to double, preallocated memory for coefficients of local 00127 * fittings, should have at least (degree+2)(degree+1)/2 doubles. 00128 */ 00129 ErrorCode polyfit3d_walf_surf_vertex( const EntityHandle vid, 00130 const bool interp, 00131 int degree, 00132 int minpnts, 00133 const bool safeguard, 00134 const int ncoords, 00135 double* coords, 00136 int* degree_out, 00137 const int ncoeffs, 00138 double* coeffs ); 00139 00140 //! \brief Construct vertex based polynomial fitting on a curve mesh 00141 /** Given a vertex on a curve mesh, construct three one-parameter local fittings for each 00142 * coordinates axis around this vertex. Stencils around this vertex will be selected according 00143 * to input degree and if data is noise. Local u-line, or the single parameter will be the 00144 * estimated tangent line at this vertex. On each axis of xyz, a polynomial fitting will be 00145 * performed according to user input. minpnts will be used to specify the minimum number allowed 00146 * in the local stencil. The result will be returned to user by preallocated memory coords, 00147 * degree_out, coeffs. \param vid EntityHandle, the fittings will be performed around this 00148 * vertex. \param interp Boolean, true=Interpolation, false=least square fitting. \param degree 00149 * Integer, order of polynomials used for local fittings. \param minpnts Integer, the allowed 00150 * minimum number of vertices in local stencil. If too small, the resulted fitting might be low 00151 * order accurate. If too large, it may introduce overfitting. \param safeguard Boolean, 00152 * true=using safe guarded method in numerical computing. \param coords Pointer to double, 00153 * preallocated memory by user, should have at least 3 doubles; stores the global coordinates of 00154 * local coordinate system u direction. \param degree_out Pointer to integer, used to store the 00155 * degree of resulted fitting \param coeffs, Pointer to double, preallocated memory for 00156 * coefficients of local fittings, should have at least 3*(degree+1) doubles. 00157 */ 00158 ErrorCode polyfit3d_walf_curve_vertex( const EntityHandle vid, 00159 const bool interp, 00160 int degree, 00161 int minpnts, 00162 const bool safeguard, 00163 const int ncoords, 00164 double* coords, 00165 int* degree_out, 00166 const int ncoeffs, 00167 double* coeffs ); 00168 00169 //! \brief Perform high order projection of points in an element, using estimated geometry by 00170 //! reconstruction class 00171 /** Given an element on the input mesh, and new points in this element, represented as natural 00172 * coordinates in element, estimate their position in surface. This is done by weighted 00173 * averaging of local fittings: for each vertex of this elment, a fitting has been computed and 00174 * the new points could be projected by this fitting. The final result of projection is the 00175 * weighted average of these projections, weights are chosen as the barycentric coordinates of 00176 * the point in this element. The result will be returned to the user preallocated memory \param 00177 * elem EntityHandle, the element on which to perform high order projection. \param nvpe 00178 * Integer, number of nodes of this element, triangle is 3, quad is four. \param npts2fit 00179 * Integer, number of points lying in elem to be projected. \param naturalcoords2fit Pointer to 00180 * array of doubles, size=nvpe*npts2fit, natural coordinates in elem of points to be projected. 00181 * \param newcoords Pointer to array of doubles, preallocated by user, size=3*npts2fit, 00182 * estimated positions of input points. 00183 */ 00184 ErrorCode hiproj_walf_in_element( EntityHandle elem, 00185 const int nvpe, 00186 const int npts2fit, 00187 const double* naturalcoords2fit, 00188 double* newcoords ); 00189 00190 //! \brief Perform high order projection of points around a vertex, using estimated geometry by 00191 //! reconstruction class 00192 /** Given an vertex on the input mesh, and new points around this vertex, estimate their 00193 * position in surface. This is done by first projecting input points onto the local uv-plane 00194 * around this vertex and use the precomputed local fitting to estimate the ideal position of 00195 * input points. The result will be returned to the user preallocated memory \param vid 00196 * EntityHandle, the vertex around which to perform high order projection. \param npts2fit 00197 * Integer, number of points lying around vid to be fitted. \param coords2fit Pointer to array 00198 * of doubles, size=3*npts2fit, current coordinates of points to be projected. \param newcoords 00199 * Pointer to array of doubles, preallocated by user, size=3*npts2fit, estimated positions of 00200 * input points. 00201 */ 00202 ErrorCode hiproj_walf_around_vertex( EntityHandle vid, 00203 const int npts2fit, 00204 const double* coords2fit, 00205 double* hiproj_new ); 00206 00207 //! \brief Perform high order projection of points around a center vertex, assume geometry is 00208 //! surface 00209 /** Given a vertex position and the local fitting parameter around this vertex, estimate the 00210 * ideal position of input position according to the local fitting. This is done by first 00211 * projecting input points onto the local uv-plane around this vertex and use the given fitting 00212 * to estimate the ideal position of input points. The result will be returned to user 00213 * preallocated memory \param local_origin Pointer to 3 doubles, coordinates of the center 00214 * vertex \param local_coords Pointer to 9 doubles, global coordinates of directions of local 00215 * uvw coordinates axis at center vertex \param local_deg Integer, order of local polynomial 00216 * fitting \param local_coeffs Pointer to array of doubles, size=(local_deg+2)(local_deg+1)/2, 00217 * coefficients of local polynomial fittings, in monomial basis \param interp Boolean, 00218 * true=local fitting is interpolation, false=local fitting is least square fitting \param 00219 * npts2fit Integer, number of points to be estimated, around the center vertices \param 00220 * coords2fit Pointer to array of doubles, size=3*npts2fit, current coordinates of points to be 00221 * estimated \param hiproj_new Pointer to array of doubles, size=3*npts2fit, memory preallocated 00222 * by user to store the fitting/estimated positions of input points. 00223 */ 00224 void walf3d_surf_vertex_eval( const double* local_origin, 00225 const double* local_coords, 00226 const int local_deg, 00227 const double* local_coeffs, 00228 const bool interp, 00229 const int npts2fit, 00230 const double* coords2fit, 00231 double* hiproj_new ); 00232 00233 //! \brief Perform high order projection of points around a center vertex, assume geometry is 00234 //! curve 00235 /** Given a vertex position and the local one-parameter fittings parameter around this vertex, 00236 * estimate the ideal position of input position according to the local fittings. This is done 00237 * by first projecting input points onto the local u-direction at this vertex and then use the 00238 * value u as parameter for the three fittings, one for each coordinates axis of xyz. The result 00239 * will be returned to user preallocated memory \param local_origin Pointer to 3 doubles, 00240 * coordinates of the center vertex \param local_coords Pointer to 3 doubles, global coordinates 00241 * of direction of local u coordinate axis at center vertex \param local_deg Integer, order of 00242 * local polynomial fitting \param local_coeffs Pointer to array of doubles, 00243 * size=3*(local_deg+1), coefficients of three local polynomial fittings, in monomial basis. For 00244 * each fitting, local_deg+1 parameters. \param interp Boolean, true=local fitting is 00245 * interpolation, false=local fitting is least square fitting \param npts2fit Integer, number of 00246 * points to be estimated, around the center vertices \param coords2fit Pointer to array of 00247 * doubles, size=3*npts2fit, current coordinates of points to be estimated \param hiproj_new 00248 * Pointer to array of doubles, size=3*npts2fit, memory preallocated by user to store the 00249 * fitting/estimated positions of input points. 00250 */ 00251 void walf3d_curve_vertex_eval( const double* local_origin, 00252 const double* local_coords, 00253 const int local_deg, 00254 const double* local_coeffs, 00255 const bool interp, 00256 const int npts2fit, 00257 const double* coords2fit, 00258 double* hiproj_new ); 00259 00260 //! \brief Get interally stored fitting results 00261 /** Get fittings results of a vertex, stored internally, results will be writtend to user 00262 * provided memory \param vid EntityHandle, a vertex in _verts2rec \param geomtype GEOMTYPE, one 00263 * of HISURFACE,HI3DCURVE,HI2DCURVE \param coords vector, global coordinates of local uvw 00264 * coordinate system axis directions will be appended to the end of coords \param degree_out 00265 * Reference to Integer, order of polynomial fittings for vid \param coeffs vector, coefficients 00266 * of local polynomial fittings in monomial basis will be appended to the end of coeffs \param 00267 * interp Reference to Boolean, true = interpolation 00268 */ 00269 bool get_fittings_data( EntityHandle vid, 00270 GEOMTYPE& geomtype, 00271 std::vector< double >& coords, 00272 int& degree_out, 00273 std::vector< double >& coeffs, 00274 bool& interp ); 00275 00276 // Helper function: estimate require number of ghost layers in parallel setting 00277 static int estimate_num_ghost_layers( int degree, bool interp = false ) 00278 { 00279 return 1 + ( interp ? ( ( degree + 1 ) >> 1 ) + ( ( degree + 1 ) & 1 ) 00280 : ( ( degree + 2 ) >> 1 ) + ( ( degree + 2 ) & 1 ) ); 00281 }; 00282 00283 protected: 00284 Core* mbImpl; 00285 ParallelComm* pcomm; 00286 HalfFacetRep* ahf; 00287 // prevent copying 00288 HiReconstruction( const HiReconstruction& source ); 00289 HiReconstruction& operator=( const HiReconstruction& right ); 00290 00291 // mesh on which to perform reconstruction 00292 EntityHandle _mesh2rec; 00293 //_verts2rec all locally hosted vertices, in parallel might be different from _invert which is 00294 // all the vertices in _mesh2rec, including ghost vertices 00295 Range _verts2rec, _inverts, _inedges, _infaces, _incells; 00296 size_t _nv2rec; // size of _verts2rec 00297 00298 int _MAXPNTS, _MINPNTS; 00299 double _MINEPS; 00300 00301 // in curve mesh, _hasderiv=true means vertex tangent vectors have been computed over _verts2rec 00302 // in surface mesh, _hasderiv=true means vertex normals have been computed over _verts2rec 00303 bool _hasderiv; 00304 00305 GEOMTYPE _geom; 00306 int _dim; 00307 bool _hasfittings; 00308 bool _initfittings; 00309 std::vector< double > _local_coords; 00310 std::vector< double > _local_fit_coeffs; 00311 std::vector< size_t > _vertID2coeffID; 00312 std::vector< int > _degrees_out; 00313 std::vector< bool > _interps; 00314 00315 // Estimate stencil size 00316 int estimate_num_rings( int degree, bool interp ); 00317 00318 //! \brief Given a vertex, return the incident elements with dimension elemdim 00319 /** Wrapper of MOAB Core->get_adjacencies and HalfRep->get_up_adjacencies, depends on if USE_AHF 00320 * is defined \param vid EntityHandle of vertex \param elemdim Integer, dimension of elements 00321 * incidented in vid \param adjents vector<EntityHandle>, container which push incident elements 00322 * in 00323 */ 00324 ErrorCode vertex_get_incident_elements( const EntityHandle& vid, 00325 const int elemdim, 00326 std::vector< EntityHandle >& adjents ); 00327 00328 //! \brief Get n-ring neighbor vertices, assuming curve/surface mesh, not volume mesh 00329 /** Given a vertex, find its n-ring neighbor vertices including itself in _mesrh2rec. 00330 * 1-ring neighbor vertices of a vertex are the vertices connected with this vertex with an edge 00331 * n-ring vertices are obtained first get the 1-ring vertices and then get the 1-ring of these 00332 * vertices, and so on \param vid EntityHandle, vertex around which to get n-ring vertices 00333 * \param ring Integer, number of rings 00334 * \param minpnts Integer, number of minimum vertices to obtain, if the input ring could not 00335 * provide enough vertices, i.e. more than minpnts, then expand the number of rings \param ngbvs 00336 * Range, the n-ring vertices of vid, including vid. If too many points found, i.e. more than 00337 * _MAXPNTS, then terminate early. 00338 */ 00339 ErrorCode obtain_nring_ngbvs( const EntityHandle vid, int ring, const int minpnts, Range& ngbvs ); 00340 00341 /** Initialize the storage for fitting results over _mesh2rec, curve/surface mesh 00342 * Two options are provided: a) use uniform degree for all vertices b) use customized degrees 00343 * for different vertices After calling of initializing functions, _initfitting is set to be 00344 * true, the fitting result could be stored internally 00345 */ 00346 void initialize_surf_geom( const int degree ); 00347 void initialize_surf_geom( const size_t npts, const int* degrees ); 00348 void initialize_3Dcurve_geom( const int degree ); 00349 void initialize_3Dcurve_geom( const size_t npts, const int* degrees ); 00350 00351 /** Save fitting results of a vertex into internal storage 00352 * \param vid EntityHandle, a vertex in _mesh2rec, in _verts2rec 00353 * \param coords Pointer to double array, global coordinates of local uvw coordinate system axis 00354 * directions \param degree_out Integer, order of polynomial fittings for vid \param coeffs 00355 * Pointer to double array, coefficients of local polynomial fittings in monomial basis \param 00356 * interp Boolean, true = interpolation 00357 */ 00358 // ErrorCode set_geom_data_surf(const EntityHandle vid, const double* coords, const double 00359 // degree_out, const double* coeffs, bool interp); ErrorCode set_geom_data_3Dcurve(const 00360 // EntityHandle vid, const double* coords, const double degree_out, const double* coeffs, bool 00361 // interp); 00362 00363 /** Compute area weighted average vertex normals for given vertex, assuming surface mesh 00364 * For arbitrary polygon mesh, use incident two edges of each incident polygon of this vertex to 00365 * form a triangle, then use these incident "triangles" to compute area weighted average vertex 00366 * normals \param vid EntityHandle, vertex in _mesh2rec, might be ghost vertex \param nrm 00367 * Pointer to 3-doubles array, preallocated by user 00368 */ 00369 ErrorCode average_vertex_normal( const EntityHandle vid, double* nrm ); 00370 00371 /** Compute weighted average vertex normals for all vertices in _verts2rec, not including ghost 00372 * vertices, results are stored interally in _local_coords 00373 */ 00374 ErrorCode compute_average_vertex_normals_surf(); 00375 00376 /** Return the normals of given vertices in a Range, writing to preallocated memory 00377 * If normals have been computed and stored, just access them 00378 * If not, compute on the fly 00379 * \param vertsh Range, EntityHandles of vertices 00380 * \param nrms Pointer of array of doubles, size = 3*vertsh.size() 00381 */ 00382 ErrorCode get_normals_surf( const Range& vertsh, double* nrms ); 00383 00384 /** Compute area weighted average vertex tangent vector for given vertex, assuming curve mesh 00385 * Use incident two edges of vertex as estimatation of tangent vectors, weighted by length 00386 * \param vid EntityHandle, vertex in _mesh2rec, might be ghost vertex 00387 * \param tang Pointer to 3-doubles array, preallocated by user 00388 */ 00389 ErrorCode average_vertex_tangent( const EntityHandle vid, double* tang ); 00390 00391 /** Compute weighted average vertex tangent vectors for all vertices in _verts2rec, not 00392 * including ghost vertices, results are stored interally in _local_coords 00393 */ 00394 ErrorCode compute_average_vertex_tangents_curve(); 00395 00396 /** Return the tangent vectors of given vertices in a Range, writing to preallocated memory 00397 * If tangent vectors have been computed and stored, just access them 00398 * If not, compute on the fly 00399 * \param vertsh Range, EntityHandles of vertices 00400 * \param tangs Pointer of array of doubles, size = 3*vertsh.size() 00401 */ 00402 ErrorCode get_tangents_curve( const Range& vertsh, double* tangs ); 00403 00404 //! \brief Compute local coordinates system of a vertex, and perform vertex based polynomial 00405 //! fittings of local height function 00406 /** This function take the first vertex of input as center, and build local uv-plane by 00407 * estimating vertex normals and tangent planes Then other vertices forms vectors starting from 00408 * center and then are projectd onto this uv-plane to form a local height function. Local 00409 * fitting of this local height function is performed in WLS sense, according if interpolation 00410 * required or not. \param nverts Integer, number of vertices of input \param ngbcors Pointer to 00411 * array of doubles, size = 3*nverts, coordinates of input vertices, first will be center \param 00412 * ngbnrms Pointer to array of doubles, size = 3*nverts, vertex normals of input vertices \param 00413 * degree Integer, user specified fitting degree \param interp Boolean, user input, 00414 * interpolation or not \param safeguard Boolean, true = use safeguarded numerical method in 00415 * computing \param ncoords Integer, size of *coords, should be 9, used for check \param coords 00416 * Pointer to array of doubles, preallocated memory for storing the glocal coordinates of local 00417 * uvw axis directions \param ncoeffs Integer, size of *coeffs, should be 00418 * (degree+2)(degree+1)/2, used for check \param coeffs Pointer to array of doubles, 00419 * preallocated memory for storing coefficients of local fittings in monomial basis \param 00420 * degree_out Pointer to integer, order of resulted polynomial of fitting, could be downgraded 00421 * due to numerical issues \param degree_pnt Pointer to integer, polynomial fitting order 00422 * determined by stencil size/number of points \param degree_qr Pointer to integer, polynomial 00423 * fitting order determined by Vandermonde system condition number 00424 */ 00425 void polyfit3d_surf_get_coeff( const int nverts, 00426 const double* ngbcors, 00427 const double* ngbnrms, 00428 int degree, 00429 const bool interp, 00430 const bool safeguard, 00431 const int ncoords, 00432 double* coords, 00433 const int ncoeffs, 00434 double* coeffs, 00435 int* degree_out, 00436 int* degree_pnt, 00437 int* degree_qr ); 00438 //! \brief Form and solve Vandermonde system of bi-variables 00439 void eval_vander_bivar_cmf( const int npts2fit, 00440 const double* us, 00441 const int ndim, 00442 double* bs, 00443 int degree, 00444 const double* ws, 00445 const bool interp, 00446 const bool safeguard, 00447 int* degree_out, 00448 int* degree_pnt, 00449 int* degree_qr ); 00450 00451 //! \brief Compute local single variable coordinate system of a vertex, and perform vertex based 00452 //! polynomial fittings of three global coordinates axis 00453 /** This function take the first vertex of input as center, and build local u-line by estimating 00454 * tangent vector Then other vertices form vectors originating from center and vectors then are 00455 * projectd onto this u-plane to form three local height functions, one for each coordinates 00456 * axis. Local fitting of these local height functions are performed in WLS sense, according if 00457 * interpolation required or not. \param nverts Integer, number of vertices of input \param 00458 * ngbcors Pointer to array of doubles, size = 3*nverts, coordinates of input vertices, first 00459 * will be center \param ngbtangs Pointer to array of doubles, size = 3*nverts, vertex tangent 00460 * vectors of input vertices \param degree Integer, user specified fitting degree \param interp 00461 * Boolean, user input, interpolation or not \param safeguard Boolean, true = use safeguarded 00462 * numerical method in computing \param ncoords Integer, size of *coords, should be 3, used for 00463 * check \param coords Pointer to array of doubles, preallocated memory for storing the glocal 00464 * coordinates of local u axis direction \param ncoeffs Integer, size of *coeffs, should be 00465 * 3*(degree+1), used for check \param coeffs Pointer to array of doubles, preallocated memory 00466 * for storing coefficients of local fittings in monomial basis \param degree_out Pointer to 00467 * integer, order of resulted polynomial of fitting, could be downgraded due to numerical issues 00468 */ 00469 void polyfit3d_curve_get_coeff( const int nverts, 00470 const double* ngbcors, 00471 const double* ngbtangs, 00472 int degree, 00473 const bool interp, 00474 const bool safeguard, 00475 const int ncoords, 00476 double* coords, 00477 const int ncoeffs, 00478 double* coeffs, 00479 int* degree_out ); 00480 //! \brief Form and solve Vandermonde system of single-variables 00481 void eval_vander_univar_cmf( const int npts2fit, 00482 const double* us, 00483 const int ndim, 00484 double* bs, 00485 int degree, 00486 const double* ws, 00487 const bool interp, 00488 const bool safeguard, 00489 int* degree_out ); 00490 //! \brief Compute weights for points selected in weighted least square fittigns 00491 int compute_weights( const int nrows, 00492 const int ncols, 00493 const double* us, 00494 const int nngbs, 00495 const double* ngbnrms, 00496 const int degree, 00497 const double toler, 00498 double* ws ); 00499 //! \brief Check the correctness of barycentric coordination, wi>=0 and sum(wi)=1 00500 bool check_barycentric_coords( const int nws, const double* naturalcoords ); 00501 }; // class HiReconstruction 00502 } // namespace moab 00503 #endif