MOAB: Mesh Oriented datABase  (version 5.4.0)
TMPQualityMetric.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 TMPQualityMetric.hpp
00028  *  \brief
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #ifndef MSQ_TMP_QUALITY_METRIC_HPP
00033 #define MSQ_TMP_QUALITY_METRIC_HPP
00034 
00035 #include "Mesquite.hpp"
00036 #include "ElemSampleQM.hpp"
00037 #include "MsqMatrix.hpp"
00038 
00039 namespace MBMesquite
00040 {
00041 
00042 class TargetCalculator;
00043 class WeightCalculator;
00044 class TRel2DMetric;
00045 class TRel3DMetric;
00046 class NodeSet;
00047 class Mesh;
00048 class MeshDomain;
00049 class Settings;
00050 
00051 /**\brief Compare targets to mapping function Jacobian matrices
00052  *
00053  * Base class for various TMP QualityMetric implementations
00054  */
00055 class TMPQualityMetric : public ElemSampleQM
00056 {
00057   public:
00058     /**
00059      *\param tc   The target calculator
00060      *\param wc   The weight calculator
00061      */
00062     TMPQualityMetric( TargetCalculator* tc, WeightCalculator* wc ) : targetCalc( tc ), weightCalc( wc ) {}
00063 
00064     MESQUITE_EXPORT virtual int get_negate_flag() const;
00065 
00066     MESQUITE_EXPORT virtual void get_evaluations( PatchData& pd,
00067                                                   std::vector< size_t >& handles,
00068                                                   bool free_vertices_only,
00069                                                   MsqError& err );
00070 
00071     MESQUITE_EXPORT static void get_patch_evaluations( PatchData& pd,
00072                                                        std::vector< size_t >& handles,
00073                                                        bool free_vertices_only,
00074                                                        MsqError& err );
00075 
00076     MESQUITE_EXPORT virtual void get_element_evaluations( PatchData& pd,
00077                                                           size_t elem_index,
00078                                                           std::vector< size_t >& handles,
00079                                                           MsqError& err );
00080 
00081     MESQUITE_EXPORT virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err );
00082 
00083     MESQUITE_EXPORT virtual bool evaluate_with_indices( PatchData& pd,
00084                                                         size_t handle,
00085                                                         double& value,
00086                                                         std::vector< size_t >& indices,
00087                                                         MsqError& err );
00088 
00089     MESQUITE_EXPORT
00090     void set_target_calculator( TargetCalculator* tc )
00091     {
00092         targetCalc = tc;
00093     }
00094     MESQUITE_EXPORT
00095     void set_weight_calculator( WeightCalculator* wc )
00096     {
00097         weightCalc = wc;
00098     }
00099     MESQUITE_EXPORT
00100     TargetCalculator* get_target_calculator() const
00101     {
00102         return targetCalc;
00103     }
00104     MESQUITE_EXPORT
00105     WeightCalculator* get_weight_calculator() const
00106     {
00107         return weightCalc;
00108     }
00109 
00110     MESQUITE_EXPORT
00111     virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
00112 
00113   protected:
00114     MESQUITE_EXPORT virtual bool evaluate_internal( PatchData& pd,
00115                                                     size_t handle,
00116                                                     double& value,
00117                                                     size_t* indices,
00118                                                     size_t& num_indices,
00119                                                     MsqError& err ) = 0;
00120 
00121     MESQUITE_EXPORT
00122     bool evaluate_surface_common(  // input:
00123         PatchData& pd,
00124         Sample sample,
00125         size_t element_index,
00126         const NodeSet& bits,
00127         // output:
00128         size_t* indices,
00129         size_t& num_indices,
00130         MsqVector< 2 >* derivs,
00131         MsqMatrix< 2, 2 >& W,
00132         MsqMatrix< 2, 2 >& A,
00133         MsqMatrix< 3, 2 >& S_a_transpose_Theta,
00134         MsqError& err );
00135 
00136     MESQUITE_EXPORT
00137     void weight( PatchData& pd,
00138                  Sample sample,
00139                  size_t elem,
00140                  int num_points,
00141                  double& value,
00142                  Vector3D* grad,
00143                  SymMatrix3D* diag,
00144                  Matrix3D* hess,
00145                  MsqError& err );
00146 
00147     enum
00148     {
00149         MAX_ELEM_NODES = 27
00150     };
00151     size_t mIndices[MAX_ELEM_NODES];
00152     std::vector< MsqMatrix< 2, 2 > > hess2d;
00153     MsqVector< 3 > mDerivs3D[MAX_ELEM_NODES];
00154     MsqVector< 2 > mDerivs2D[MAX_ELEM_NODES];
00155 
00156     TargetCalculator* targetCalc;
00157 
00158   private:
00159     WeightCalculator* weightCalc;
00160 };
00161 
00162 }  // namespace MBMesquite
00163 
00164 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines