MOAB: Mesh Oriented datABase  (version 5.4.1)
MappingFunction.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2006 Lawrence Livermore National Laboratory.  Under
00005     the terms of Contract B545069 with the University of Wisconsin --
00006     Madison, Lawrence Livermore National Laboratory retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     (2006) [email protected]
00024 
00025   ***************************************************************** */
00026 
00027 #ifndef MSQ_MAPPING_FUNCTION_HPP
00028 #define MSQ_MAPPING_FUNCTION_HPP
00029 
00030 /** \file MappingFunction.hpp
00031  *  \brief Header containg defintion of MappingFunction
00032  *  \author Jason Kraftcheck
00033  */
00034 
00035 #include "Mesquite.hpp"
00036 #include <vector>
00037 #include "MsqMatrix.hpp"
00038 #include "TopologyInfo.hpp"
00039 #include "NodeSet.hpp"
00040 
00041 namespace MBMesquite
00042 {
00043 
00044 class MsqError;
00045 class PatchData;
00046 
00047 /**\brief An interface for a mapping function of the form
00048  * \f$\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\f$,
00049  * where \f$\vec{x_i}\f$ is a point
00050  * in \f$\mathbf{R}^3\f$ (i.e. \f$x_i,y_i,z_i\f$),
00051  * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\f$
00052  * for surface elements and
00053  * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\f$
00054  * for volume elements.
00055  *
00056  * This is an interface for describing a mapping function for a
00057  * single element topology.  A mapping function is assumed to be
00058  * of the following form:
00059  * \f$\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\f$
00060  * where \f$n\f$ is the number of nodes in the element,
00061  * \f$\vec{x_i}\f$ is a point
00062  * in \f$\mathbf{R}^3\f$ (i.e. \f$x_i,y_i,z_i\f$), and
00063  * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\f$
00064  * for surface elements and
00065  * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\f$
00066  * for volume elements.  For example,
00067  * for a linear quadrilateral element, the mapping function will be
00068  * of the form:
00069  * \f$\vec{x}(\xi,\eta)=N_1(\xi,\eta)\vec{x_1}
00070  *                     +N_2(\xi,\eta)\vec{x_2}
00071  *                     +N_3(\xi,\eta)\vec{x_3}
00072  *                     +N_4(\xi,\eta)\vec{x_4}\f$
00073  *
00074  * A single implementation of this interface may support multiple
00075  * types of elements of the same topology.  Element types within
00076  * a topology may vary by the presences or lack there of of mid-edge,
00077  * mid-face, and mid-element nodes.
00078  */
00079 class MESQUITE_EXPORT MappingFunction
00080 {
00081   public:
00082     virtual ~MappingFunction() {}
00083 
00084     /**\brief Get MBMesquite::EntityTopology handled by this mapping function */
00085     virtual EntityTopology element_topology() const = 0;
00086 
00087     /**\brief Get number of nodes in the element type
00088      *
00089      * Get the number of nodes in the element type that the mapping
00090      * function implements.  It is assumed that the result of this
00091      * function, in combination with the element topology, is sufficient
00092      * to determine the element type.
00093      */
00094     virtual int num_nodes() const = 0;
00095 
00096     /**\brief Get sample points at which to evaluate mapping function
00097      *
00098      * Get the points within the element at which TMP quality metrics
00099      * that are a function of the mapping function Jacobian should
00100      * be evaluated.  The default (which may be overridden by individual
00101      * mapping functions) is to evaluate at all nodes.
00102      */
00103     virtual NodeSet sample_points( NodeSet higher_order_nodes ) const;
00104 
00105     /**\brief Mapping Function Coefficients
00106      *
00107      * This function returns the list of scalar values (\f$N_i\f$'s) resulting
00108      * from the evaluation of the mapping function coefficient terms
00109      * \f$N_1(\vec{\xi}), N_2(\vec{\xi}), \ldots, N_n(\vec{\xi})\f$
00110      * for a given \f$\vec{\xi}\f$.
00111      *\param location Where within the element at which to evaluate the coefficients.
00112      *\param nodeset  List of which nodes are present in the element.
00113      *\param coefficients_out The coefficients (\f$N_i(\vec{\xi})\f$) for each
00114      *                vertex in the element.
00115      *\param indices_out  The index ($i$ in $N_i$) for each term in 'coeffs_out'.
00116      *                The assumption is that mapping function implementations
00117      *                will not return zero coefficients.  This is not required,
00118      *                but for element types with large numbers of nodes it may
00119      *                have a significant impact on performance.
00120      */
00121     virtual void coefficients( Sample location,
00122                                NodeSet nodeset,
00123                                double* coeff_out,
00124                                size_t* indices_out,
00125                                size_t& num_coeff_out,
00126                                MsqError& err ) const = 0;
00127 
00128     /*\brief Convert connectivity list indices for different element types.
00129      *
00130      * Given two elements of the same topology but different types
00131      * (number of nodes) and a list of indices into the connectivity
00132      * list for one element type, convert the list to be indices
00133      * into a second element type such that the node in the same logical
00134      * position (e.g. middle of edge 1) is indicated.
00135      */
00136     static inline void convert_connectivity_indices( EntityTopology topology,
00137                                                      int num_nodes_in_input_elem_type,
00138                                                      int num_nodes_in_output_elem_type,
00139                                                      size_t* index_list,
00140                                                      unsigned num_indices,
00141                                                      MsqError& err );
00142 
00143     /*\brief Convert connectivity list indices for different element types.
00144      *
00145      * Given an element type with the same topology as that of this
00146      * mapping function but with a different number of nodes, convert
00147      * indices into the connectivity list of this element type to
00148      * those of the specified element type such that indices indicate
00149      * nodes at the corresponding logical locations (e.g. middle of edge 1).
00150      */
00151     inline void convert_connectivity_indices( int num_nodes_in_output_element_type,
00152                                               size_t* index_list,
00153                                               unsigned num_indices,
00154                                               MsqError& err ) const
00155     {
00156         convert_connectivity_indices( element_topology(), num_nodes(), num_nodes_in_output_element_type, index_list,
00157                                       num_indices, err );
00158     }
00159 
00160   private:
00161     static void convert_connectivity_indices_impl( EntityTopology topology,
00162                                                    int num_nodes_in_input_elem_type,
00163                                                    int num_nodes_in_output_elem_type,
00164                                                    size_t* index_list,
00165                                                    unsigned num_indices,
00166                                                    MsqError& err );
00167 };
00168 
00169 /**\brief MappingFunction for topologically 2D (surface) elements. */
00170 class MESQUITE_EXPORT MappingFunction2D : public MappingFunction
00171 {
00172   public:
00173     virtual ~MappingFunction2D() {}
00174 
00175     /**\brief Mapping Function Derivatives
00176      *
00177      * This function returns the partial derivatives of the mapping
00178      * function coefficient terms
00179      * \f$\nabla N_1(\vec{\xi}), \nabla N_2(\vec{\xi}), \ldots, \nabla N_n(\vec{\xi})\f$
00180      * evaluated for a given \f$\vec{\xi}\f$, where \f$\vec{x_i}\f$ is a point
00181      * in \f$\mathbf{R}^3\f$ (i.e. \f$x_i,y_i,z_i\f$).
00182      * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\f$
00183      * for surface elements and
00184      * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\f$
00185      * for volume elements.
00186      *
00187      * The list of returned partial derivatives may be considered list of elements
00188      * of a matrix \f$\mathbf{D}\f$ in row major order.  For surface elements,
00189      * \f$\mathbf{D}\f$ is a \f$n\times 2\f$ matrix and for volume elements it
00190      * is a \f$n \times 3\f$ matrix.  Each row of
00191      * \f$\mathbf{D}\f$ corresponds to one of the
00192      * coefficient functions \f$N_i(\vec{\xi})\f$ and each column corresponds
00193      * to one of the components of \f$\vec{\xi}\f$
00194      * that the corresponding coefficient function is differentiated with
00195      * respect to.
00196      *
00197      * \f$ \mathbf{D} = \left[ \begin{array}{ccc}
00198      *     \frac{\delta N_1}{\delta \xi} & \frac{\delta N_1}{\delta \eta} & \ldots \\
00199      *     \frac{\delta N_2}{\delta \xi} & \frac{\delta N_2}{\delta \eta} & \ldots \\
00200      *     \vdots & \vdots & \ddots \end{array} \right]\f$
00201      *
00202      * The Jacobian matrix (\f$\mathbf{J}\f$) of the mapping function can be calculated
00203      * as follows. Define a matrix \f$\mathbf{X}\f$ such that each column contains
00204      * the coordinates of the element nodes.
00205      *
00206      * \f$ \mathbf{X} = \left[ \begin{array}{ccc}
00207      *                   x_1 & x_2 & \ldots \\
00208      *                   y_1 & y_2 & \ldots \\
00209      *                   z_1 & z_2 & \ldots
00210      *                  \end{array}\right]\f$
00211      *
00212      * The Jacobian matrix is then:
00213      *
00214      * \f$\mathbf{J} = \mathbf{X} \times \mathbf{D}\f$
00215      *
00216      * \f$\mathbf{X}\f$ is always \f$3\times n\f$, so \f$\mathbf{J}\f$ is
00217      * either \f$3\times 2\f$ (surface elements) or \f$3\times 3\f$ (volume
00218      * elements) depending on the dimensions of \f$\mathbf{D}\f$.
00219      *
00220      * If the Jacobian matrix of the mapping function is considered as a
00221      * function of the element vertex coordinates \f$\mathbf{J}(\vec{x_1},\vec{x_2},\ldots)\f$
00222      * with \f$\vec{\xi}\f$ constant, then the gradient of that Jacobian matrix
00223      * function (with respect
00224      * to the vertex coordinates) can be obtained from the same output list of
00225      * partial deravitves.
00226      *
00227      * \f$\frac{\delta \mathbf{J}}{\delta x_i} =
00228      *         \left[ \begin{array}{ccc}
00229      *         \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \\
00230      *         0 & 0 & \ldots \\
00231      *         0 & 0 & \ldots
00232      *         \end{array} \right]\f$
00233      * \f$\frac{\delta \mathbf{J}}{\delta y_i} =
00234      *         \left[ \begin{array}{ccc}
00235      *         0 & 0 & \ldots \\
00236      *         \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \\
00237      *         0 & 0 & \ldots
00238      *         \end{array} \right]\f$
00239      * \f$\frac{\delta \mathbf{J}}{\delta z_i} =
00240      *         \left[ \begin{array}{ccc}
00241      *         0 & 0 & \ldots \\
00242      *         0 & 0 & \ldots \\
00243      *         \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots
00244      *         \end{array} \right]\f$
00245      *
00246      *
00247      *\param location Where within the element at which to evaluate the derivatives.
00248      *\param nodeset  List of which nodes are present in the element.
00249      *\param vertices_out The list of vertices for which the corresponding
00250      *                coefficient in the mapping function is non-zero.  The
00251      *                vertices are specified by their index in the canonical
00252      *                ordering for an element with all mid-nodes present (i.e.
00253      *                first all the corner nodes, then the mid-edge nodes, ...).
00254      *\param d_coeff_d_xi_out The mapping function is composed of a series of
00255      *                coefficient functions \f$N_i(\vec{\xi})\f$, one correspoding
00256      *                to the position \f$\vec{x_i}\f$ of each node in the
00257      *                element such that the mapping function is of the form:
00258      *                \f$\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\f$.
00259      *                For each vertex indicated in vertex_indices_out,
00260      *                this list contains the partial derivatives of the cooresponding
00261      *                coefficient function \f$N_i\f$ with respect to each
00262      *                component of \f$\vec{\xi}\f$ in the same order as the
00263      *                corresponding nodes in vertex_indices_out.
00264      *\param num_vtx  Output: The number of vertex indices and derivitive
00265      *                tuples returned in vertices_out and d_coeff_d_xi_out,
00266      *                respectively.
00267      */
00268     virtual void derivatives( Sample location,
00269                               NodeSet nodeset,
00270                               size_t* vertex_indices_out,
00271                               MsqVector< 2 >* d_coeff_d_xi_out,
00272                               size_t& num_vtx,
00273                               MsqError& err ) const = 0;
00274 
00275     /**\brief Mapping function derivatives and Jacobian
00276      *
00277      * This function returns the partial derivatives of the mapping
00278      * function coefficient terms and the Jacobian calculated from
00279      * those terms and the cooresponding vertex coordinates.
00280      *
00281      * This function returns the same logical data as 'derivatives',
00282      * except that it also calculates the Jacobian from the actual
00283      * vertex coordinates.  Also, unlike the 'derivatives' function
00284      * which returns the vertex indices as positions in the element
00285      * connectivity list, this function is expected to
00286      * a) return the actual indices of the vertices in the PatchData
00287      *    vertex list and
00288      * b) remove from the list of indices and derivatives and values
00289      *    corresponding to fixed vertices.
00290      *
00291      * The default implementation of this function will calculate the
00292      * Jacobian and modify the vertex and derivative lists returned
00293      * from "derivatives".  The default implementation serves as a
00294      * utility function for other classes using this one.  The function
00295      * is virtual to allow mapping function implementations to provide
00296      * an optimized version that avoids extra calculations for zero terms
00297      * in the derivative list.
00298      *
00299      *\param pd  The PatchData instance containing the vertex coordinates
00300      *           and element connectcivity.
00301      *\param element_number  The index of the mesh element in the PatchData.
00302      *\param nodeset         List of which nodes are present in the element.
00303      *\param location Where within the element at which to evaluate the Jacobian.
00304      *\param vertex_patch_indices_out  For each free vertex in the element
00305      *                       the influences the mapping function value at
00306      *                       the specified logical location, the index of
00307      *                       that vertex in the PatchData.
00308      *\param d_coeff_d_xi_out For each vertex in 'vertex_patch_indices_out',
00309      *                       the partial derivatives of the corresponding
00310      *                       coefficient of the mapping function.
00311      *\param num_vtx_out     The number of values passed back in
00312      *                       'vertex_patch_indices_out' and 'd_coeff_d_xi_out'.
00313      *\param jacobian_out    The Jacobian of the mapping function at the
00314      *                       specified logical location.
00315      */
00316     virtual void jacobian( const PatchData& pd,
00317                            size_t element_number,
00318                            NodeSet nodeset,
00319                            Sample location,
00320                            size_t* vertex_patch_indices_out,
00321                            MsqVector< 2 >* d_coeff_d_xi_out,
00322                            size_t& num_vtx_out,
00323                            MsqMatrix< 3, 2 >& jacobian_out,
00324                            MsqError& err ) const;
00325 
00326     /**\brief Get ideal Jacobian matrix
00327      *
00328      * Returns the Jacobian matrix of an ideal element.  The orientation
00329      * of element or corresponding matrix is arbitrary.  The "ideal" element
00330      * should be scaled such the Jacobian (determinant of the Jacobian
00331      * matrix) is 1.0.
00332      *
00333      *\param location Where within the element at which to evaluate the Jacobian.
00334      *                Typically doesn't matter except for degenerate elements
00335      *                (e.g. pyramid as degenerate hex.)
00336      *\param jacobian_out    The Jacobian of the mapping function at the
00337      *                       specified logical location.
00338      */
00339     virtual void ideal( Sample location, MsqMatrix< 3, 2 >& jacobian_out, MsqError& err ) const;
00340 };
00341 
00342 /**\brief MappingFunction for topologically 3D (volume) elements. */
00343 class MESQUITE_EXPORT MappingFunction3D : public MappingFunction
00344 {
00345   public:
00346     virtual ~MappingFunction3D() {}
00347 
00348     /**\brief Mapping Function Derivatives
00349      *
00350      * This group of methods return the partial derivatives of the mapping
00351      * function coefficient terms
00352      * \f$\nabla N_1(\vec{\xi}), \nabla N_2(\vec{\xi}), \ldots, \nabla N_n(\vec{\xi})\f$
00353      * evaluated for a given \f$\vec{\xi}\f$, where \f$\vec{x_i}\f$ is a point
00354      * in \f$\mathbf{R}^3\f$ (i.e. \f$x_i,y_i,z_i\f$).
00355      * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\f$
00356      * for surface elements and
00357      * \f$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\f$
00358      * for volume elements.
00359      *
00360      * The list of returned partial derivatives may be considered list of elements
00361      * of a matrix \f$\mathbf{D}\f$ in row major order.  For surface elements,
00362      * \f$\mathbf{D}\f$ is a \f$n\times 2\f$ matrix and for volume elements it
00363      * is a \f$n \times 3\f$ matrix.  Each row of
00364      * \f$\mathbf{D}\f$ corresponds to one of the
00365      * coefficient functions \f$N_i(\vec{\xi})\f$ and each column corresponds
00366      * to one of the components of \f$\vec{\xi}\f$
00367      * that the corresponding coefficient function is differentiated with
00368      * respect to.
00369      *
00370      * \f$ \mathbf{D} = \left[ \begin{array}{ccc}
00371      *     \frac{\delta N_1}{\delta \xi} & \frac{\delta N_1}{\delta \eta} & \ldots \\
00372      *     \frac{\delta N_2}{\delta \xi} & \frac{\delta N_2}{\delta \eta} & \ldots \\
00373      *     \vdots & \vdots & \ddots \end{array} \right]\f$
00374      *
00375      * The Jacobian matrix (\f$\mathbf{J}\f$) of the mapping function can be calculated
00376      * as follows. Define a matrix \f$\mathbf{X}\f$ such that each column contains
00377      * the coordinates of the element nodes.
00378      *
00379      * \f$ \mathbf{X} = \left[ \begin{array}{ccc}
00380      *                   x_1 & x_2 & \ldots \\
00381      *                   y_1 & y_2 & \ldots \\
00382      *                   z_1 & z_2 & \ldots
00383      *                  \end{array}\right]\f$
00384      *
00385      * The Jacobian matrix is then:
00386      *
00387      * \f$\mathbf{J} = \mathbf{X} \times \mathbf{D}\f$
00388      *
00389      * \f$\mathbf{X}\f$ is always \f$3\times n\f$, so \f$\mathbf{J}\f$ is
00390      * either \f$3\times 2\f$ (surface elements) or \f$3\times 3\f$ (volume
00391      * elements) depending on the dimensions of \f$\mathbf{D}\f$.
00392      *
00393      * If the Jacobian matrix of the mapping function is considered as a
00394      * function of the element vertex coordinates \f$\mathbf{J}(\vec{x_1},\vec{x_2},\ldots)\f$
00395      * with \f$\vec{\xi}\f$ constant, then the gradient of that Jacobian matrix
00396      * function (with respect
00397      * to the vertex coordinates) can be obtained from the same output list of
00398      * partial deravitves.
00399      *
00400      * \f$\frac{\delta \mathbf{J}}{\delta x_i} =
00401      *         \left[ \begin{array}{ccc}
00402      *         \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \\
00403      *         0 & 0 & \ldots \\
00404      *         0 & 0 & \ldots
00405      *         \end{array} \right]\f$
00406      * \f$\frac{\delta \mathbf{J}}{\delta y_i} =
00407      *         \left[ \begin{array}{ccc}
00408      *         0 & 0 & \ldots \\
00409      *         \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \\
00410      *         0 & 0 & \ldots
00411      *         \end{array} \right]\f$
00412      * \f$\frac{\delta \mathbf{J}}{\delta z_i} =
00413      *         \left[ \begin{array}{ccc}
00414      *         0 & 0 & \ldots \\
00415      *         0 & 0 & \ldots \\
00416      *         \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots
00417      *         \end{array} \right]\f$
00418      *
00419      *
00420      *\param location Where within the element at which to evaluate the derivatives.
00421      *\param nodeset  List of which nodes are present in the element.
00422      *\param vertices_out The list of vertices for which the corresponding
00423      *                coefficient in the mapping function is non-zero.  The
00424      *                vertices are specified by their index in the canonical
00425      *                ordering for an element with all mid-nodes present (i.e.
00426      *                first all the corner nodes, then the mid-edge nodes, ...).
00427      *\param d_coeff_d_xi_out The mapping function is composed of a series of
00428      *                coefficient functions \f$N_i(\vec{\xi})\f$, one correspoding
00429      *                to the position \f$\vec{x_i}\f$ of each node in the
00430      *                element such that the mapping function is of the form:
00431      *                \f$\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\f$.
00432      *                For each vertex indicated in vertex_indices_out,
00433      *                this list contains the partial derivatives of the cooresponding
00434      *                coefficient function \f$N_i\f$ with respect to each
00435      *                component of \f$\vec{\xi}\f$ in the same order as the
00436      *                corresponding nodes in vertex_indices_out.
00437      *\param num_vtx  Output: The number of vertex indices and derivitive
00438      *                tuples returned in vertices_out and d_coeff_d_xi_out,
00439      *                respectively.
00440      */
00441     virtual void derivatives( Sample location,
00442                               NodeSet nodeset,
00443                               size_t* vertex_indices_out,
00444                               MsqVector< 3 >* d_coeff_d_xi_out,
00445                               size_t& num_vtx,
00446                               MsqError& err ) const = 0;
00447 
00448     /**\brief Mapping function derivatives and Jacobian
00449      *
00450      * This function returns the partial derivatives of the mapping
00451      * function coefficient terms and the Jacobian calculated from
00452      * those terms and the cooresponding vertex coordinates.
00453      *
00454      * This function returns the same logical data as 'derivatives',
00455      * except that it also calculates the Jacobian from the actual
00456      * vertex coordinates.  Also, unlike the 'derivatives' function
00457      * which returns the vertex indices as positions in the element
00458      * connectivity list, this function is expected to
00459      * a) return the actual indices of the vertices in the PatchData
00460      *    vertex list and
00461      * b) remove from the list of indices and derivatives and values
00462      *    corresponding to fixed vertices.
00463      *
00464      * The default implementation of this function will calculate the
00465      * Jacobian and modify the vertex and derivative lists returned
00466      * from "derivatives".  The default implementation serves as a
00467      * utility function for other classes using this one.  The function
00468      * is virtual to allow mapping function implementations to provide
00469      * an optimized version that avoids extra calculations for zero terms
00470      * in the derivative list.
00471      *\param pd  The PatchData instance containing the vertex coordinates
00472      *           and element connectcivity.
00473      *\param element_number  The index of the mesh element in the PatchData.
00474      *\param nodeset         List of which nodes are present in the element.
00475      *\param location Where within the element at which to evaluate the Jacobian.
00476      *\param vertex_patch_indices_out  For each free vertex in the element
00477      *                       the influences the mapping function value at
00478      *                       the specified logical location, the index of
00479      *                       that vertex in the PatchData.
00480      *\param d_coeff_d_xi_out For each vertex in 'vertex_patch_indices_out',
00481      *                       the partial derivatives of the corresponding
00482      *                       coefficient of the mapping function.
00483      *\param num_vtx_out     The number of values passed back in
00484      *                       'vertex_patch_indices_out' and 'd_coeff_d_xi_out'.
00485      *\param jacobian_out    The Jacobian of the mapping function at the
00486      *                       specified logical location.
00487      */
00488     virtual void jacobian( const PatchData& pd,
00489                            size_t element_number,
00490                            NodeSet nodeset,
00491                            Sample location,
00492                            size_t* vertex_patch_indices_out,
00493                            MsqVector< 3 >* d_coeff_d_xi_out,
00494                            size_t& num_vtx_out,
00495                            MsqMatrix< 3, 3 >& jacobian_out,
00496                            MsqError& err ) const;
00497 
00498     /**\brief Get ideal Jacobian matrix
00499      *
00500      * Returns the Jacobian matrix of an ideal element.  The orientation
00501      * of element or corresponding matrix is arbitrary.  The "ideal" element
00502      * should be scaled such the Jacobian (determinant of the Jacobian
00503      * matrix) is 1.0.
00504      *
00505      *\param location Where within the element at which to evaluate the Jacobian.
00506      *                Typically doesn't matter except for degenerate elements
00507      *                (e.g. pyramid as degenerate hex.)
00508      *\param jacobian_out    The Jacobian of the mapping function at the
00509      *                       specified logical location.
00510      */
00511     virtual void ideal( Sample location, MsqMatrix< 3, 3 >& jacobian_out, MsqError& err ) const;
00512 };
00513 
00514 inline void MappingFunction::convert_connectivity_indices( EntityTopology topo,
00515                                                            int input_type,
00516                                                            int output_type,
00517                                                            size_t* index_list,
00518                                                            unsigned num_indices,
00519                                                            MsqError& err )
00520 {
00521     // If the types are the same or either type has only corner
00522     // vertices, then no conversion is necessary.
00523     const int num_corners = TopologyInfo::corners( topo );
00524     if( input_type != output_type && input_type != num_corners && output_type != num_corners )
00525         convert_connectivity_indices_impl( topo, input_type, output_type, index_list, num_indices, err );
00526 }
00527 
00528 }  // namespace MBMesquite
00529 
00530 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines