MOAB: Mesh Oriented datABase  (version 5.2.1)
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, std::vector< size_t >& handles,
00067                                                   bool free_vertices_only, MsqError& err );
00068 
00069     MESQUITE_EXPORT static void get_patch_evaluations( PatchData& pd, std::vector< size_t >& handles,
00070                                                        bool free_vertices_only, MsqError& err );
00071 
00072     MESQUITE_EXPORT virtual void get_element_evaluations( PatchData& pd, size_t elem_index,
00073                                                           std::vector< size_t >& handles, MsqError& err );
00074 
00075     MESQUITE_EXPORT virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err );
00076 
00077     MESQUITE_EXPORT virtual bool evaluate_with_indices( PatchData& pd, size_t handle, double& value,
00078                                                         std::vector< size_t >& indices, MsqError& err );
00079 
00080     MESQUITE_EXPORT
00081     void set_target_calculator( TargetCalculator* tc )
00082     {
00083         targetCalc = tc;
00084     }
00085     MESQUITE_EXPORT
00086     void set_weight_calculator( WeightCalculator* wc )
00087     {
00088         weightCalc = wc;
00089     }
00090     MESQUITE_EXPORT
00091     TargetCalculator* get_target_calculator() const
00092     {
00093         return targetCalc;
00094     }
00095     MESQUITE_EXPORT
00096     WeightCalculator* get_weight_calculator() const
00097     {
00098         return weightCalc;
00099     }
00100 
00101     MESQUITE_EXPORT
00102     virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
00103 
00104   protected:
00105     MESQUITE_EXPORT virtual bool evaluate_internal( PatchData& pd, size_t handle, double& value, size_t* indices,
00106                                                     size_t& num_indices, MsqError& err ) = 0;
00107 
00108     MESQUITE_EXPORT
00109     bool evaluate_surface_common(  // input:
00110         PatchData& pd, Sample sample, size_t element_index, const NodeSet& bits,
00111         // output:
00112         size_t* indices, size_t& num_indices, MsqVector< 2 >* derivs, MsqMatrix< 2, 2 >& W, MsqMatrix< 2, 2 >& A,
00113         MsqMatrix< 3, 2 >& S_a_transpose_Theta, MsqError& err );
00114 
00115     MESQUITE_EXPORT
00116     void weight( PatchData& pd, Sample sample, size_t elem, int num_points, double& value, Vector3D* grad,
00117                  SymMatrix3D* diag, Matrix3D* hess, MsqError& err );
00118 
00119     enum
00120     {
00121         MAX_ELEM_NODES = 27
00122     };
00123     size_t mIndices[MAX_ELEM_NODES];
00124     std::vector< MsqMatrix< 2, 2 > > hess2d;
00125     MsqVector< 3 > mDerivs3D[MAX_ELEM_NODES];
00126     MsqVector< 2 > mDerivs2D[MAX_ELEM_NODES];
00127 
00128     TargetCalculator* targetCalc;
00129 
00130   private:
00131     WeightCalculator* weightCalc;
00132 };
00133 
00134 }  // namespace MBMesquite
00135 
00136 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines