MOAB: Mesh Oriented datABase  (version 5.4.1)
MultiplyQualityMetric.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 Sandia Corporation and Argonne National
00005     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
00006     with Sandia Corporation, the U.S. Government 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     [email protected], [email protected], [email protected],
00024     [email protected], [email protected], [email protected]
00025 
00026   ***************************************************************** */
00027 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3
00028 // -*-
00029 
00030 /*! \file MultiplyQualityMetric.hpp
00031 \brief
00032 Header file for the MBMesquite::MultiplyQualityMetric class
00033 
00034   \author Michael Brewer
00035   \date   2002-09-05
00036  */
00037 
00038 #ifndef MultiplyQualityMetric_hpp
00039 #define MultiplyQualityMetric_hpp
00040 
00041 #include "Mesquite.hpp"
00042 #include "QualityMetric.hpp"
00043 
00044 namespace MBMesquite
00045 {
00046 class Vector3D;
00047 class MsqError;
00048 class PatchData;
00049 class MsqMeshEntity;
00050 class MsqVertex;
00051 
00052 /*! \class MultiplyQualityMetric
00053   \brief Combines two quality metrics (qMetric1 and qMetric2 defined
00054   in the parent class CompositeQualityMetric) by multiplication for two-
00055   and three-diminsional elements.  Note:  This function should not
00056   be used to combine a node-based metric with an element-based
00057   metric.
00058 */
00059 class MultiplyQualityMetric : public QualityMetric
00060 {
00061   public:
00062     /*! Ensures that qm1 and qm2 are not NULL.  If either qm1 or qm2
00063       are valid only on a feasible region, then the composite
00064       metric's feasibility flag is set to one.  If qm1 and qm2 have
00065       different negateFlags, then a warning is printed, and the composite
00066       metric's negate flag is set to one.  Otherwise, the composite
00067       metric's negateFlag is set to qm1's negateFlag (and, thus, qm2's
00068       negateFlag).
00069     */
00070     MultiplyQualityMetric( QualityMetric* qm1, QualityMetric* qm2, MsqError& err );
00071 
00072     // virtual destructor ensures use of polymorphism during destruction
00073     virtual ~MultiplyQualityMetric();
00074 
00075     MetricType get_metric_type() const;
00076 
00077     std::string get_name() const;
00078 
00079     int get_negate_flag() const;
00080 
00081     QualityMetric* get_first_metric() const
00082     {
00083         return &metric1;
00084     }
00085     QualityMetric* get_second_metric() const
00086     {
00087         return &metric2;
00088     }
00089 
00090     virtual void get_evaluations( PatchData& pd,
00091                                   std::vector< size_t >& handles,
00092                                   bool free_vertices_only,
00093                                   MsqError& err );
00094 
00095     virtual bool evaluate( PatchData& pd, size_t handle, double& value, MsqError& err );
00096 
00097     virtual bool evaluate_with_indices( PatchData& pd,
00098                                         size_t handle,
00099                                         double& value,
00100                                         std::vector< size_t >& indices,
00101                                         MsqError& err );
00102 
00103     virtual bool evaluate_with_gradient( PatchData& pd,
00104                                          size_t handle,
00105                                          double& value,
00106                                          std::vector< size_t >& indices,
00107                                          std::vector< Vector3D >& gradient,
00108                                          MsqError& err );
00109 
00110     virtual bool evaluate_with_Hessian( PatchData& pd,
00111                                         size_t handle,
00112                                         double& value,
00113                                         std::vector< size_t >& indices,
00114                                         std::vector< Vector3D >& gradient,
00115                                         std::vector< Matrix3D >& Hessian,
00116                                         MsqError& err );
00117 
00118   private:
00119     QualityMetric& metric1;
00120     QualityMetric& metric2;
00121     mutable std::vector< size_t > mHandles;
00122     mutable std::vector< size_t > indices1, indices2;
00123     mutable std::vector< Vector3D > grad1, grad2;
00124     mutable std::vector< Matrix3D > Hess1, Hess2;
00125 };
00126 
00127 }  // namespace MBMesquite
00128 
00129 #endif  // MultiplyQualityMetric_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines