LCOV - code coverage report
Current view: top level - src/moab/DiscreteGeometry - HiReconstruction.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 3 0.0 %
Date: 2020-12-16 07:07:30 Functions: 0 1 0.0 %
Branches: 0 2 0.0 %

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

Generated by: LCOV version 1.11