MOAB: Mesh Oriented datABase  (version 5.2.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) kraftche@cae.wisc.edu
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 <stddef.h>
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, size_t element, Sample sample, MsqMatrix< 3, 3 >& W_out,
00070                                 MsqError& err ) = 0;
00071 
00072     /**\brief Get a target matrix
00073      *
00074      *\param pd      The current PatchData
00075      *\param element The index an element within the patch data.
00076      *\param sample  The sample point in the element.
00077      *\param W_out   The resulting target matrix.
00078      */
00079     virtual bool get_surface_target( PatchData& pd, size_t element, Sample sample, MsqMatrix< 3, 2 >& W_out,
00080                                      MsqError& err ) = 0;
00081 
00082     /**\brief Get a target matrix
00083      *
00084      *\param pd      The current PatchData
00085      *\param element The index an element within the patch data.
00086      *\param sample  The sample point in the element.
00087      *\param W_out   The resulting target matrix.
00088      */
00089     virtual bool get_2D_target( PatchData& pd, size_t element, Sample sample, MsqMatrix< 2, 2 >& W_out,
00090                                 MsqError& err ) = 0;
00091 
00092     /**\brief Use 3x2 W for surface elements if true, 2x2 W if false
00093      *
00094      * If true, then the targets for surface elements attempt some
00095      * control of orientation and therefore get_surface_target must
00096      * be used to get the targets.  If false, then the target contains
00097      * no orientation data and is therefore the same as the corresponding
00098      * 2D target for surface elements.  In this case, get_2D_target should
00099      * be used.
00100      */
00101     virtual bool have_surface_orient() const = 0;
00102 
00103     /**\brief Factor some existing target or Jacobian matrix
00104      *
00105      * Utility method for subclasses to use in their implementation
00106      * of get_3D_target.
00107      *\param W       The matrix to factor
00108      *\param Lambda  Output: the size factor of W
00109      *\praam V       Output: the orientation factor of V
00110      *\param Q       Output: the skew factor of W
00111      *\param Delta   Output: the aspect ratio factor of W
00112      *\return bool   True if W can be factored, false otherwise.
00113      */
00114     static bool factor_3D( const MsqMatrix< 3, 3 >& W, double& Lambda, MsqMatrix< 3, 3 >& V, MsqMatrix< 3, 3 >& Q,
00115                            MsqMatrix< 3, 3 >& Delta, MsqError& err );
00116 
00117     /**\brief Factor some existing target or Jacobian matrix
00118      *
00119      * Utility method for subclasses to use in their implementation
00120      * of get_2D_target
00121      *\param W       The matrix to factor
00122      *\param Lambda  Output: the size factor of W
00123      *\praam V       Output: the orientation factor of V
00124      *\param Q       Output: the skew factor of W
00125      *\param Delta   Output: the aspect ratio factor of W
00126      *\return bool   True if W can be factored, false otherwise.
00127      */
00128     static bool factor_surface( const MsqMatrix< 3, 2 >& W, double& Lambda, MsqMatrix< 3, 2 >& V, MsqMatrix< 2, 2 >& Q,
00129                                 MsqMatrix< 2, 2 >& Delta, MsqError& err );
00130 
00131     /**\brief Factor some existing target or Jacobian matrix
00132      *
00133      * Utility method for subclasses to use in their implementation
00134      * of get_2D_target
00135      *\param W       The matrix to factor
00136      *\param Lambda  Output: the size factor of W
00137      *\praam V       Output: the orientation factor of V
00138      *\param Q       Output: the skew factor of W
00139      *\param Delta   Output: the aspect ratio factor of W
00140      *\return bool   True if W can be factored, false otherwise.
00141      */
00142     static bool factor_2D( const MsqMatrix< 2, 2 >& W, double& Lambda, MsqMatrix< 2, 2 >& V, MsqMatrix< 2, 2 >& Q,
00143                            MsqMatrix< 2, 2 >& Delta, MsqError& err );
00144 
00145     /**\brief Get size component of W */
00146     static double size( const MsqMatrix< 3, 3 >& W );
00147     /**\brief Get size component of W */
00148     static double size( const MsqMatrix< 3, 2 >& W );
00149     /**\brief Get size component of W */
00150     static double size( const MsqMatrix< 2, 2 >& W );
00151 
00152     /**\brief Get skew component of W */
00153     static MsqMatrix< 3, 3 > skew( const MsqMatrix< 3, 3 >& W );
00154     /**\brief Get skew component of W */
00155     static MsqMatrix< 2, 2 > skew( const MsqMatrix< 3, 2 >& W );
00156     /**\brief Get skew component of W */
00157     static MsqMatrix< 2, 2 > skew( const MsqMatrix< 2, 2 >& W );
00158 
00159     /**\brief Get skew component of W */
00160     static MsqMatrix< 3, 3 > aspect( const MsqMatrix< 3, 3 >& W );
00161     /**\brief Get skew component of W */
00162     static MsqMatrix< 2, 2 > aspect( const MsqMatrix< 3, 2 >& W );
00163     /**\brief Get skew component of W */
00164     static MsqMatrix< 2, 2 > aspect( const MsqMatrix< 2, 2 >& W );
00165 
00166     /**\brief Get shape (skew and aspect) component of W */
00167     static MsqMatrix< 3, 3 > shape( const MsqMatrix< 3, 3 >& W );
00168     /**\brief Get skew component of W */
00169     static MsqMatrix< 2, 2 > shape( const MsqMatrix< 3, 2 >& W );
00170     /**\brief Get skew component of W */
00171     static MsqMatrix< 2, 2 > shape( const MsqMatrix< 2, 2 >& W );
00172 
00173     /**\brief Create a new orientation matrix
00174      *
00175      * Create an orientation matrix such that
00176      * the first and second Jacobian columns of W are aligned to
00177      * the passed vectors.
00178      */
00179     static MsqMatrix< 3, 3 > new_orientation_3D( const MsqVector< 3 >& b1, const MsqVector< 3 >& b2 );
00180     /**\brief Create a new orientation matrix
00181      *
00182      * Create an orientation matrix such that
00183      * the first and second Jacobian columns of W are aligned to
00184      * the passed vectors.
00185      */
00186     static MsqMatrix< 3, 2 > new_orientation_2D( const MsqVector< 3 >& b1, const MsqVector< 3 >& b2 );
00187 
00188     /**\brief Get skew matrix for an ideally shaped element */
00189     static void ideal_skew_3D( EntityTopology element_type, Sample s, const PatchData& pd, MsqMatrix< 3, 3 >& W,
00190                                MsqError& err );
00191 
00192     /**\brief Get skew matrix for an ideally shaped element */
00193     static void ideal_skew_2D( EntityTopology element_type, Sample s, const PatchData& pd, MsqMatrix< 2, 2 >& W,
00194                                MsqError& err );
00195 
00196     /**\brief Get skew matrix for an ideally shaped element */
00197     static void ideal_shape_3D( EntityTopology element_type, Sample s, const PatchData& pd, MsqMatrix< 3, 3 >& W,
00198                                 MsqError& err );
00199 
00200     /**\brief Get skew matrix for an ideally shaped element */
00201     static void ideal_shape_2D( EntityTopology element_type, Sample s, const PatchData& pd, MsqMatrix< 2, 2 >& W,
00202                                 MsqError& err );
00203 
00204     /**\brief Create a new aspect ratio matrix
00205      *
00206      * Create an aspect ratio matrix such that the ratio of column
00207      * lengths is proportional to the ratio of the corresponding pair
00208      * of values in the passed vector.
00209      */
00210     static MsqMatrix< 3, 3 > new_aspect_3D( const MsqVector< 3 >& r );
00211 
00212     /**\brief Create a new aspect ratio matrix
00213      *
00214      * Create an aspect ratio matrix such that the ratio of column
00215      * lengths is proportional to the ratio of the corresponding pair
00216      * of values in the passed vector.
00217      */
00218     static MsqMatrix< 2, 2 > new_aspect_2D( const MsqVector< 2 >& r );
00219 
00220     /**\brief Create a new aspect ratio matrix
00221      *
00222      * Create an aspect ratio matrix such that the ratio of column
00223      * lengths is the passed value.
00224      */
00225     static MsqMatrix< 2, 2 > new_aspect_2D( double rho );
00226 
00227     /**\brief Calculate the Jacobian given element vertex coordinates */
00228     static void jacobian_3D( PatchData& pd,  // for mapping function list
00229                              EntityTopology element_type, int num_nodes, Sample location, const Vector3D* coords,
00230                              MsqMatrix< 3, 3 >& W_out, MsqError& err );
00231 
00232     /**\brief Calculate the Jacobian given element vertex coordinates */
00233     static void jacobian_2D( PatchData& pd,  // for mapping function list
00234                              EntityTopology element_type, int num_nodes, Sample location, const Vector3D* coords,
00235                              MsqMatrix< 3, 2 >& W_out, MsqError& err );
00236 
00237     static void get_refmesh_Jacobian_3D( ReferenceMeshInterface* ref_mesh, PatchData& active_mesh, size_t element_no,
00238                                          Sample sample_no, MsqMatrix< 3, 3 >& W_out, MsqError& err );
00239 
00240     static void get_refmesh_Jacobian_2D( ReferenceMeshInterface* ref_mesh, PatchData& active_mesh, size_t element_no,
00241                                          Sample sample_no, MsqMatrix< 3, 2 >& W_out, MsqError& err );
00242 };
00243 
00244 }  // namespace MBMesquite
00245 
00246 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines