MOAB: Mesh Oriented datABase  (version 5.4.1)
TargetCalculator.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2006 Sandia National Laboratories.  Developed at the
00005     University of Wisconsin--Madison under SNL contract number
00006     624796.  The U.S. Government and the University of Wisconsin
00007     retain certain rights to 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 /** \file TargetCalculator.hpp
00028  *  \brief
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #ifndef MSQ_TARGET_CALCULATOR_HPP
00033 #define MSQ_TARGET_CALCULATOR_HPP
00034 
00035 #include "Mesquite.hpp"
00036 #include "Sample.hpp"
00037 #include "MsqMatrix.hpp"
00038 #include "MeshInterface.hpp"
00039 #include <cstddef>
00040 
00041 namespace MBMesquite
00042 {
00043 
00044 class PatchData;
00045 class MsqError;
00046 class ReferenceMeshInterface;
00047 class Mesh;
00048 class MeshDomain;
00049 class Settings;
00050 
00051 class MESQUITE_EXPORT TargetCalculator
00052 {
00053   public:
00054     virtual ~TargetCalculator();
00055 
00056     //!\brief Called at start of instruction queue processing
00057     //!
00058     //! Do any preliminary global initialization, consistency checking,
00059     //! etc.  Default implementation does nothing.
00060     virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
00061 
00062     /**\brief Get a target matrix
00063      *
00064      *\param pd      The current PatchData
00065      *\param element The index an element within the patch data.
00066      *\param sample  The sample point in the element.
00067      *\param W_out   The resulting target matrix.
00068      */
00069     virtual bool get_3D_target( PatchData& pd,
00070                                 size_t element,
00071                                 Sample sample,
00072                                 MsqMatrix< 3, 3 >& W_out,
00073                                 MsqError& err ) = 0;
00074 
00075     /**\brief Get a target matrix
00076      *
00077      *\param pd      The current PatchData
00078      *\param element The index an element within the patch data.
00079      *\param sample  The sample point in the element.
00080      *\param W_out   The resulting target matrix.
00081      */
00082     virtual bool get_surface_target( PatchData& pd,
00083                                      size_t element,
00084                                      Sample sample,
00085                                      MsqMatrix< 3, 2 >& W_out,
00086                                      MsqError& err ) = 0;
00087 
00088     /**\brief Get a target matrix
00089      *
00090      *\param pd      The current PatchData
00091      *\param element The index an element within the patch data.
00092      *\param sample  The sample point in the element.
00093      *\param W_out   The resulting target matrix.
00094      */
00095     virtual bool get_2D_target( PatchData& pd,
00096                                 size_t element,
00097                                 Sample sample,
00098                                 MsqMatrix< 2, 2 >& W_out,
00099                                 MsqError& err ) = 0;
00100 
00101     /**\brief Use 3x2 W for surface elements if true, 2x2 W if false
00102      *
00103      * If true, then the targets for surface elements attempt some
00104      * control of orientation and therefore get_surface_target must
00105      * be used to get the targets.  If false, then the target contains
00106      * no orientation data and is therefore the same as the corresponding
00107      * 2D target for surface elements.  In this case, get_2D_target should
00108      * be used.
00109      */
00110     virtual bool have_surface_orient() const = 0;
00111 
00112     /**\brief Factor some existing target or Jacobian matrix
00113      *
00114      * Utility method for subclasses to use in their implementation
00115      * of get_3D_target.
00116      *\param W       The matrix to factor
00117      *\param Lambda  Output: the size factor of W
00118      *\praam V       Output: the orientation factor of V
00119      *\param Q       Output: the skew factor of W
00120      *\param Delta   Output: the aspect ratio factor of W
00121      *\return bool   True if W can be factored, false otherwise.
00122      */
00123     static bool factor_3D( const MsqMatrix< 3, 3 >& W,
00124                            double& Lambda,
00125                            MsqMatrix< 3, 3 >& V,
00126                            MsqMatrix< 3, 3 >& Q,
00127                            MsqMatrix< 3, 3 >& Delta,
00128                            MsqError& err );
00129 
00130     /**\brief Factor some existing target or Jacobian matrix
00131      *
00132      * Utility method for subclasses to use in their implementation
00133      * of get_2D_target
00134      *\param W       The matrix to factor
00135      *\param Lambda  Output: the size factor of W
00136      *\praam V       Output: the orientation factor of V
00137      *\param Q       Output: the skew factor of W
00138      *\param Delta   Output: the aspect ratio factor of W
00139      *\return bool   True if W can be factored, false otherwise.
00140      */
00141     static bool factor_surface( const MsqMatrix< 3, 2 >& W,
00142                                 double& Lambda,
00143                                 MsqMatrix< 3, 2 >& V,
00144                                 MsqMatrix< 2, 2 >& Q,
00145                                 MsqMatrix< 2, 2 >& Delta,
00146                                 MsqError& err );
00147 
00148     /**\brief Factor some existing target or Jacobian matrix
00149      *
00150      * Utility method for subclasses to use in their implementation
00151      * of get_2D_target
00152      *\param W       The matrix to factor
00153      *\param Lambda  Output: the size factor of W
00154      *\praam V       Output: the orientation factor of V
00155      *\param Q       Output: the skew factor of W
00156      *\param Delta   Output: the aspect ratio factor of W
00157      *\return bool   True if W can be factored, false otherwise.
00158      */
00159     static bool factor_2D( const MsqMatrix< 2, 2 >& W,
00160                            double& Lambda,
00161                            MsqMatrix< 2, 2 >& V,
00162                            MsqMatrix< 2, 2 >& Q,
00163                            MsqMatrix< 2, 2 >& Delta,
00164                            MsqError& err );
00165 
00166     /**\brief Get size component of W */
00167     static double size( const MsqMatrix< 3, 3 >& W );
00168     /**\brief Get size component of W */
00169     static double size( const MsqMatrix< 3, 2 >& W );
00170     /**\brief Get size component of W */
00171     static double size( const MsqMatrix< 2, 2 >& W );
00172 
00173     /**\brief Get skew component of W */
00174     static MsqMatrix< 3, 3 > skew( const MsqMatrix< 3, 3 >& W );
00175     /**\brief Get skew component of W */
00176     static MsqMatrix< 2, 2 > skew( const MsqMatrix< 3, 2 >& W );
00177     /**\brief Get skew component of W */
00178     static MsqMatrix< 2, 2 > skew( const MsqMatrix< 2, 2 >& W );
00179 
00180     /**\brief Get skew component of W */
00181     static MsqMatrix< 3, 3 > aspect( const MsqMatrix< 3, 3 >& W );
00182     /**\brief Get skew component of W */
00183     static MsqMatrix< 2, 2 > aspect( const MsqMatrix< 3, 2 >& W );
00184     /**\brief Get skew component of W */
00185     static MsqMatrix< 2, 2 > aspect( const MsqMatrix< 2, 2 >& W );
00186 
00187     /**\brief Get shape (skew and aspect) component of W */
00188     static MsqMatrix< 3, 3 > shape( const MsqMatrix< 3, 3 >& W );
00189     /**\brief Get skew component of W */
00190     static MsqMatrix< 2, 2 > shape( const MsqMatrix< 3, 2 >& W );
00191     /**\brief Get skew component of W */
00192     static MsqMatrix< 2, 2 > shape( const MsqMatrix< 2, 2 >& W );
00193 
00194     /**\brief Create a new orientation matrix
00195      *
00196      * Create an orientation matrix such that
00197      * the first and second Jacobian columns of W are aligned to
00198      * the passed vectors.
00199      */
00200     static MsqMatrix< 3, 3 > new_orientation_3D( const MsqVector< 3 >& b1, const MsqVector< 3 >& b2 );
00201     /**\brief Create a new orientation matrix
00202      *
00203      * Create an orientation matrix such that
00204      * the first and second Jacobian columns of W are aligned to
00205      * the passed vectors.
00206      */
00207     static MsqMatrix< 3, 2 > new_orientation_2D( const MsqVector< 3 >& b1, const MsqVector< 3 >& b2 );
00208 
00209     /**\brief Get skew matrix for an ideally shaped element */
00210     static void ideal_skew_3D( EntityTopology element_type,
00211                                Sample s,
00212                                const PatchData& pd,
00213                                MsqMatrix< 3, 3 >& W,
00214                                MsqError& err );
00215 
00216     /**\brief Get skew matrix for an ideally shaped element */
00217     static void ideal_skew_2D( EntityTopology element_type,
00218                                Sample s,
00219                                const PatchData& pd,
00220                                MsqMatrix< 2, 2 >& W,
00221                                MsqError& err );
00222 
00223     /**\brief Get skew matrix for an ideally shaped element */
00224     static void ideal_shape_3D( EntityTopology element_type,
00225                                 Sample s,
00226                                 const PatchData& pd,
00227                                 MsqMatrix< 3, 3 >& W,
00228                                 MsqError& err );
00229 
00230     /**\brief Get skew matrix for an ideally shaped element */
00231     static void ideal_shape_2D( EntityTopology element_type,
00232                                 Sample s,
00233                                 const PatchData& pd,
00234                                 MsqMatrix< 2, 2 >& W,
00235                                 MsqError& err );
00236 
00237     /**\brief Create a new aspect ratio matrix
00238      *
00239      * Create an aspect ratio matrix such that the ratio of column
00240      * lengths is proportional to the ratio of the corresponding pair
00241      * of values in the passed vector.
00242      */
00243     static MsqMatrix< 3, 3 > new_aspect_3D( const MsqVector< 3 >& r );
00244 
00245     /**\brief Create a new aspect ratio matrix
00246      *
00247      * Create an aspect ratio matrix such that the ratio of column
00248      * lengths is proportional to the ratio of the corresponding pair
00249      * of values in the passed vector.
00250      */
00251     static MsqMatrix< 2, 2 > new_aspect_2D( const MsqVector< 2 >& r );
00252 
00253     /**\brief Create a new aspect ratio matrix
00254      *
00255      * Create an aspect ratio matrix such that the ratio of column
00256      * lengths is the passed value.
00257      */
00258     static MsqMatrix< 2, 2 > new_aspect_2D( double rho );
00259 
00260     /**\brief Calculate the Jacobian given element vertex coordinates */
00261     static void jacobian_3D( PatchData& pd,  // for mapping function list
00262                              EntityTopology element_type,
00263                              int num_nodes,
00264                              Sample location,
00265                              const Vector3D* coords,
00266                              MsqMatrix< 3, 3 >& W_out,
00267                              MsqError& err );
00268 
00269     /**\brief Calculate the Jacobian given element vertex coordinates */
00270     static void jacobian_2D( PatchData& pd,  // for mapping function list
00271                              EntityTopology element_type,
00272                              int num_nodes,
00273                              Sample location,
00274                              const Vector3D* coords,
00275                              MsqMatrix< 3, 2 >& W_out,
00276                              MsqError& err );
00277 
00278     static void get_refmesh_Jacobian_3D( ReferenceMeshInterface* ref_mesh,
00279                                          PatchData& active_mesh,
00280                                          size_t element_no,
00281                                          Sample sample_no,
00282                                          MsqMatrix< 3, 3 >& W_out,
00283                                          MsqError& err );
00284 
00285     static void get_refmesh_Jacobian_2D( ReferenceMeshInterface* ref_mesh,
00286                                          PatchData& active_mesh,
00287                                          size_t element_no,
00288                                          Sample sample_no,
00289                                          MsqMatrix< 3, 2 >& W_out,
00290                                          MsqError& err );
00291 };
00292 
00293 }  // namespace MBMesquite
00294 
00295 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines