MOAB: Mesh Oriented datABase  (version 5.4.1)
QualityAssessor.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     (2006) [email protected]
00027 
00028   ***************************************************************** */
00029 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3
00030 // -*-
00031 
00032 /*! \file QualityAssessor.hpp
00033 
00034 Header file for the MBMesquite::QualityAssessor class
00035 
00036   \author Thomas Leurent
00037   \date   2002-05-01
00038   \author Jason Kraftcheck
00039   \date   2005-03-09
00040  */
00041 
00042 #ifndef MSQ_QUALITYASSESSOR_HPP
00043 #define MSQ_QUALITYASSESSOR_HPP
00044 
00045 #include "Mesquite.hpp"
00046 #include "Instruction.hpp"
00047 #include "MeshInterface.hpp"
00048 
00049 #include <list>
00050 #include <string>
00051 #include <vector>
00052 #include <iosfwd>
00053 
00054 namespace MBMesquite
00055 {
00056 
00057 class QualityMetric;
00058 class MsqError;
00059 class ParallelHelper;
00060 
00061 /*! \class QualityAssessor
00062 
00063     \brief A QualityAssessor instance can be inserted into an
00064     InstructionQueue to calculate and summarize registered
00065     QualityMetric or QualityMetrics for the mesh.
00066 
00067     QualityAssessor provides a summary of the mesh quality.  An
00068     instance of QualityAssessor may be inserted in the InstructionQueue
00069     at any point to print a summary of the mesh quality at that
00070     time during the optimization.  The application is expected to
00071     register QualityMetric instances to be used in assessing the
00072     mesh quality.  If no QualityMetrics are registered, the only
00073     assessment that will be performed is a simple count of inverted
00074     elements.
00075 
00076     The "stopping assessor" and "stopping function", if set,
00077     determinte the value reported to Mesquite for the overall
00078     run of of the QualityAssessor.
00079 
00080     All summary data except the histogram and custom power-means is
00081     accumulated for all registered metrics.  QualityAssessment data
00082     can be obtained through three different mechanisms:
00083       - QualityAssessor can print a summary to std::out or a specified
00084         output stream after they are calculated.
00085       - The get_results and get_all_results methods can be used to
00086         obtain the sumary data programatically.
00087       - Quality measures for element-based or vertex-based metrics can
00088         be stored on the corresponding entities using "tags".
00089 
00090 */
00091 class QualityAssessor : public Instruction
00092 {
00093   public:
00094     /**\brief Simple consturctor.  Metrics registered separately.
00095      *\param print_summary_to_std_out If true, summary of mesh quality
00096      *                will be written to std::out.  If false, quality
00097      *                assessment will be available via the get_results
00098      *                and get_all_results methods, but will not be printed.
00099      *\param free_elements_only If true, only quality values that depend
00100      *                on at least one free vertex will be uses.
00101      *\param  inverted_element_tag_name  If a non-null value is specified,
00102      *                an integer tag with the specified name will be used
00103      *                it store value of 0 for normal elements and 1 for
00104      *                inverted elements.
00105      *\param  name    Name to include in output.  Useful if several QualityAssessors
00106      *                are in use at the same time.
00107      */
00108     MESQUITE_EXPORT
00109     QualityAssessor( bool print_summary_to_std_out         = true,
00110                      bool free_elements_only               = true,
00111                      const char* inverted_element_tag_name = 0,
00112                      std::string name                      = std::string() );
00113 
00114     /**\brief Simple consturctor.  Metrics registered separately.
00115      *\param output_stream IO stream to which to write a summary of the
00116      *                mesh quality.
00117      *\param free_elements_only If true, only quality values that depend
00118      *                on at least one free vertex will be uses.
00119      *\param  inverted_element_tag_name  If a non-null value is specified,
00120      *                an integer tag with the specified name will be used
00121      *                it store value of 0 for normal elements and 1 for
00122      *                inverted elements.
00123      *\param  name    Name to include in output.  Useful if several QualityAssessors
00124      *                are in use at the same time.
00125      */
00126     MESQUITE_EXPORT
00127     QualityAssessor( std::ostream& output_stream,
00128                      bool free_elements_only               = true,
00129                      const char* inverted_element_tag_name = 0,
00130                      std::string name                      = std::string() );
00131 
00132     /**\brief Construct and register a QualityMetric
00133      *\param output_stream IO stream to which to write a summary of the
00134      *                mesh quality.
00135      *\param metric   QualtiyMetric to register for use in assessing mesh
00136      *                quality.  Will also be used as the "stopping assessment".
00137      *\param historgram_intervals If non-zero, a histogram of quality metric
00138      *                values composed of the specified number of intervals
00139      *                will be generated.
00140      *\param power_mean If non-zero, in addition to the normal summary
00141      *                statistics for the quality metric, an additional
00142      *                general power mean with the specified power will
00143      *                be calculated.
00144      *\param metric_value_tag_name  If a non-null value is specified,
00145      *                a tag with the specified name will be populated
00146      *                with quality values for individual elements or
00147      *                vertices if metric is an element-based or vertex-
00148      *                based metric.  If metric is not element-based or
00149      *                vertex-based, this argument has no effect.
00150      *\param free_elements_only If true, only quality values that depend
00151      *                on at least one free vertex will be uses.
00152      *\param inverted_element_tag_name  If a non-null value is specified,
00153      *                an integer tag with the specified name will be used
00154      *                it store value of 0 for normal elements and 1 for
00155      *                inverted elements.
00156      *\param  name    Name to include in output.  Useful if several QualityAssessors
00157      *                are in use at the same time.
00158      */
00159     MESQUITE_EXPORT
00160     QualityAssessor( std::ostream& output_stream,
00161                      QualityMetric* metric,
00162                      int histogram_intervals               = 0,
00163                      double power_mean                     = 0.0,
00164                      bool free_elements_only               = true,
00165                      const char* metric_value_tag_name     = 0,
00166                      const char* inverted_element_tag_name = 0,
00167                      std::string name                      = std::string() );
00168 
00169     /**\brief Construct and register a QualityMetric
00170      *\param print_summary_to_std_out If true, summary of mesh quality
00171      *                will be written to std::out.  If false, quality
00172      *                assessment will be available via the get_results
00173      *                and get_all_results methods, but will not be printed.
00174      *\param metric   QualtiyMetric to register for use in assessing mesh
00175      *                quality.  Will also be used as the "stopping assessment".
00176      *\param historgram_intervals If non-zero, a histogram of quality metric
00177      *                values composed of the specified number of intervals
00178      *                will be generated.
00179      *\param power_mean If non-zero, in addition to the normal summary
00180      *                statistics for the quality metric, an additional
00181      *                general power mean with the specified power will
00182      *                be calculated.
00183      *\param metric_value_tag_name  If a non-null value is specified,
00184      *                a tag with the specified name will be populated
00185      *                with quality values for individual elements or
00186      *                vertices if metric is an element-based or vertex-
00187      *                based metric.  If metric is not element-based or
00188      *                vertex-based, this argument has no effect.
00189      *\param free_elements_only If true, only quality values that depend
00190      *                on at least one free vertex will be uses.
00191      *\param  inverted_element_tag_name  If a non-null value is specified,
00192      *                an integer tag with the specified name will be used
00193      *                it store value of 0 for normal elements and 1 for
00194      *                inverted elements.
00195      *\param  name    Name to include in output.  Useful if several QualityAssessors
00196      *                are in use at the same time.
00197      */
00198     MESQUITE_EXPORT
00199     QualityAssessor( QualityMetric* metric,
00200                      int histogram_intervals               = 0,
00201                      double power_mean                     = 0.0,
00202                      bool free_elements_only               = true,
00203                      const char* metric_value_tag_name     = 0,
00204                      bool print_summary_to_std_out         = true,
00205                      const char* inverted_element_tag_name = 0,
00206                      std::string name                      = std::string() );
00207 
00208     MESQUITE_EXPORT virtual ~QualityAssessor();
00209 
00210     //! Provides a name to the QualityAssessor (use it for default name in constructor).
00211     MESQUITE_EXPORT void set_name( std::string name )
00212     {
00213         qualityAssessorName = name;
00214     };
00215     //! Retrieves the QualityAssessor name. A default name should be set in the constructor.
00216     MESQUITE_EXPORT virtual std::string get_name() const
00217     {
00218         return qualityAssessorName;
00219     }
00220 
00221     /**\brief All elements or only improvable ones.
00222      *
00223      * If set to true, the quality assessment results will include
00224      * quality values only for those elements (or more precisely metric
00225      * sample points) which are influenced by at least one free vertex.
00226      * That is, quality for elements (or sample points) that the sovler
00227      * cannot improve (e.g. an element with all vertices fixed) will not
00228      * be included in the quality assessment.
00229      *
00230      * If set to false, quality for all elements will be assessed.
00231      */
00232     MESQUITE_EXPORT void measure_free_samples_only( bool yesno )
00233     {
00234         skipFixedSamples = yesno;
00235     }
00236 
00237     /**\brief All elements or only improvable ones.
00238      *
00239      * If set to true, the quality assessment results will include
00240      * quality values only for those elements (or more precisely metric
00241      * sample points) which are influenced by at least one free vertex.
00242      * That is, quality for elements (or sample points) that the sovler
00243      * cannot improve (e.g. an element with all vertices fixed) will not
00244      * be included in the quality assessment.
00245      *
00246      * If set to false, quality for all elements will be assessed.
00247      */
00248     MESQUITE_EXPORT bool measuring_free_samples_only() const
00249     {
00250         return skipFixedSamples;
00251     }
00252 
00253     /**\brief Register a QualityMetric for use in quality assessment.
00254      *
00255      * Add a quality metric to the list of metrics used to assess
00256      * the quality of the mesh.
00257      *
00258      *\param metric   QualtiyMetric to register for use in assessing mesh
00259      *                quality.  Will also be used as the "stopping assessment".
00260      *\param historgram_intervals If non-zero, a histogram of quality metric
00261      *                values composed of the specified number of intervals
00262      *                will be generated.
00263      *\param power_mean If non-zero, in addition to the normal summary
00264      *                statistics for the quality metric, an additional
00265      *                general power mean with the specified power will
00266      *                be calculated.
00267      *\param metric_value_tag_name  If a non-null value is specified,
00268      *                a tag with the specified name will be populated
00269      *                with quality values for individual elements or
00270      *                vertices if metric is an element-based or vertex-
00271      *                based metric.  If metric is not element-based or
00272      *                vertex-based, this argument has no effect.
00273      *\param  inverted_element_tag_name  If a non-null value is specified,
00274      *                an integer tag with the specified name will be used
00275      *                it store value of 0 for normal elements and 1 for
00276      *                inverted elements.
00277      */
00278     MESQUITE_EXPORT
00279     void add_quality_assessment( QualityMetric* metric,
00280                                  int histogram_intervals           = 0,
00281                                  double power_mean                 = 0.0,
00282                                  const char* metric_value_tag_name = 0,
00283                                  const char* metric_label          = 0 );
00284 
00285     /**\brief Same as add_quality_assessment, except that the average
00286      *        metric value is also used as the return value from loop_over_mesh.
00287      *        Specify a power_mean value to control which average is used.
00288      */
00289     MESQUITE_EXPORT
00290     void set_stopping_assessment( QualityMetric* metric,
00291                                   int histogram_intervals           = 0,
00292                                   double power_mean                 = 0.0,
00293                                   const char* metric_value_tag_name = 0,
00294                                   const char* metric_label          = 0 );
00295 
00296     /**\brief Register a QualityMetric for use in quality assessment.
00297      *
00298      * Add a quality metric to the list of metrics used to assess
00299      * the quality of the mesh.  Specify more parameters controlling
00300      * histogram.
00301      *
00302      *\param metric   QualtiyMetric to register for use in assessing mesh
00303      *                quality.  Will also be used as the "stopping assessment".
00304      *\param min      Minimum of histogram rnage.
00305      *\param max      Maximum of histogram range.
00306      *\param intervals Histogram intervals.
00307      *\param power_mean If non-zero, in addition to the normal summary
00308      *                statistics for the quality metric, an additional
00309      *                general power mean with the specified power will
00310      *                be calculated.
00311      *\param metric_value_tag_name  If a non-null value is specified,
00312      *                a tag with the specified name will be populated
00313      *                with quality values for individual elements or
00314      *                vertices if metric is an element-based or vertex-
00315      *                based metric.  If metric is not element-based or
00316      *                vertex-based, this argument has no effect.
00317      *\param  inverted_element_tag_name  If a non-null value is specified,
00318      *                an integer tag with the specified name will be used
00319      *                it store value of 0 for normal elements and 1 for
00320      *                inverted elements.
00321      */
00322     MESQUITE_EXPORT
00323     void add_histogram_assessment( QualityMetric* qm,
00324                                    double min,
00325                                    double max,
00326                                    int intervals,
00327                                    double power_mean                 = 0.0,
00328                                    const char* metric_value_tag_name = 0,
00329                                    const char* metric_label          = 0 );
00330 
00331     virtual MESQUITE_EXPORT void initialize_queue( MeshDomainAssoc* mesh_and_domain,
00332                                                    const Settings* settings,
00333                                                    MsqError& err );
00334 
00335     //! Does one sweep over the mesh and assess the quality with the metrics previously added.
00336     virtual MESQUITE_EXPORT double loop_over_mesh( MeshDomainAssoc* mesh_and_domain,
00337                                                    const Settings* settings,
00338                                                    MsqError& err );
00339 
00340     //! Does one sweep over the mesh and assess the quality with the metrics previously added.
00341     virtual MESQUITE_EXPORT double loop_over_mesh( ParallelMesh* mesh,
00342                                                    MeshDomain* domain,
00343                                                    const Settings* settings,
00344                                                    MsqError& err );
00345 
00346     //! Do not print results of assessment.
00347     MESQUITE_EXPORT void disable_printing_results()
00348     {
00349         printSummary = false;
00350     }
00351 
00352     //! Print accumulated summary data to specified stream.
00353     MESQUITE_EXPORT void print_summary( std::ostream& stream ) const;
00354 
00355     //! True if any metric evaluated to an invalid value
00356     //! for any element
00357     MESQUITE_EXPORT bool invalid_elements() const;
00358 
00359     //! Provides the number of inverted elements, inverted_elmes,
00360     //!  and the number of elements whose orientation can not be
00361     //!  determined, undefined_elems.
00362     //! Returns false if this information is not yet available.
00363     //! Returns true, otherwise.
00364     MESQUITE_EXPORT bool get_inverted_element_count( int& inverted_elems, int& inverted_samples, MsqError& err );
00365 
00366     //! Reset calculated data
00367     MESQUITE_EXPORT void reset_data();
00368 
00369     //! Produces two historgrams on a single scale from a before
00370     //! optimization histogram and an after optimization histogram.
00371     //! The histogram intervals are adjusted to include the enitre
00372     //! range of both histograms, the horizontal interval value bars
00373     //! are adjusted to be on the same scale, and the metric quality
00374     //! values are placed in the correct quality value 'bin' based
00375     //! on the new interval scale.
00376 
00377     MESQUITE_EXPORT void scale_histograms( QualityAssessor* optimal );
00378 
00379     MESQUITE_EXPORT void tag_inverted_elements( std::string tagname )
00380     {
00381         invertedTagName = tagname;
00382     }
00383     MESQUITE_EXPORT void dont_tag_inverted_elements()
00384     {
00385         invertedTagName.clear();
00386     }
00387     MESQUITE_EXPORT bool tagging_inverted_elements() const
00388     {
00389         return !invertedTagName.empty();
00390     }
00391 
00392     MESQUITE_EXPORT void tag_fixed_elements( std::string tagname )
00393     {
00394         fixedTagName = tagname;
00395     }
00396     MESQUITE_EXPORT void dont_tag_fixed_elements()
00397     {
00398         fixedTagName.clear();
00399     }
00400     MESQUITE_EXPORT bool tagging_fixed_elements() const
00401     {
00402         return !fixedTagName.empty();
00403     }
00404 
00405     /** \brief Per-metric QualityAssessor data
00406      *
00407      * The Assessor class holds QualityAssessor data for
00408      * each metric added by the calling application, including
00409      * a pointer to the metric instance, QAFunction flags
00410      * dictating what is to be calculated and output, histogram
00411      * parameters, and the variables used to accumulate results as
00412      * the QualityAssessor is running.  It also provides
00413      * methods to access the calculated data once the QualityAssessor
00414      * pass is completed.
00415      */
00416     class Assessor
00417     {
00418       public:
00419         MESQUITE_EXPORT Assessor( QualityMetric* metric, const char* name = 0 );
00420 
00421         MESQUITE_EXPORT double get_average() const;
00422         MESQUITE_EXPORT double get_maximum() const
00423         {
00424             return maximum;
00425         }
00426         MESQUITE_EXPORT double get_minimum() const
00427         {
00428             return minimum;
00429         }
00430         MESQUITE_EXPORT double get_rms() const;
00431         MESQUITE_EXPORT double get_stddev() const;
00432         MESQUITE_EXPORT double get_power_mean() const;
00433         MESQUITE_EXPORT double get_power() const
00434         {
00435             return pMean;
00436         }
00437         MESQUITE_EXPORT int get_count() const
00438         {
00439             return count;
00440         }
00441 
00442         MESQUITE_EXPORT bool have_power_mean() const
00443         {
00444             return 0.0 != pMean;
00445         }
00446 
00447         MESQUITE_EXPORT int get_invalid_element_count() const
00448         {
00449             return numInvalid;
00450         }
00451 
00452         /** Get historgram of data, if calculated.
00453          *\param lower_bound_out  The lower bound of the histogram
00454          *\param upper_bound_out  The upper bound of the histogram
00455          *\param counts_out       An array of counts of elements where
00456          *              the first entry is the number of elements for
00457          *              which the metric is below the lower bound, the
00458          *              last entry is the number of elements above the
00459          *              upper bound, and all other values are the counts
00460          *              for histogram intervals between the lower and
00461          *              upper bounds.
00462          */
00463         MESQUITE_EXPORT
00464         void get_histogram( double& lower_bound_out,
00465                             double& upper_bound_out,
00466                             std::vector< int >& counts_out,
00467                             MsqError& err ) const;
00468 
00469         /** Reset all calculated data */
00470         MESQUITE_EXPORT void reset_data();
00471 
00472         /** Print the histogram */
00473         MESQUITE_EXPORT void print_histogram( std::ostream&, int width = 0 ) const;
00474 
00475         /** Get the QualityMetric */
00476         MESQUITE_EXPORT QualityMetric* get_metric() const
00477         {
00478             return qualMetric;
00479         }
00480 
00481         MESQUITE_EXPORT const std::string& get_label() const
00482         {
00483             return mLabel;
00484         }
00485 
00486         /** Add a value to the running counts */
00487         MESQUITE_EXPORT void add_value( double metric_value );
00488 
00489         /** Add a value to the hisogram data */
00490         MESQUITE_EXPORT void add_hist_value( double metric_value );
00491 
00492         /** Note invalid result */
00493         MESQUITE_EXPORT void add_invalid_value();
00494 
00495         MESQUITE_EXPORT bool have_histogram() const
00496         {
00497             return !histogram.empty();
00498         }
00499 
00500         /** If range of histogram has not yet been determined,
00501          * calculate it from the min/max values.
00502          */
00503         MESQUITE_EXPORT void calculate_histogram_range();
00504 
00505         MESQUITE_EXPORT bool write_to_tag() const
00506         {
00507             return !tagName.empty();
00508         }
00509 
00510         MESQUITE_EXPORT void set_stopping_function( bool value )
00511         {
00512             stoppingFunction = value;
00513         }
00514 
00515         MESQUITE_EXPORT bool stopping_function() const
00516         {
00517             return stoppingFunction;
00518         }
00519 
00520         MESQUITE_EXPORT double stopping_function_value() const;
00521 
00522       private:
00523         friend class QualityAssessor;
00524 
00525         QualityMetric* const qualMetric;  //< The quality metric
00526         std::string mLabel;
00527 
00528         unsigned long count;  //< The total number of times the metric was evaluated
00529 
00530         double sum;                //< The sum of the metric over all elements
00531         double maximum;            //< The maximum of the metric
00532         double minimum;            //< The minimum value of the metric
00533         double sqrSum;             //< The sum of the square of the metric values
00534         double pSum;               //< The sum of the metric values raised to the pMean power
00535         unsigned long numInvalid;  //< Count of invalid metric values
00536 
00537         double pMean;  //< Power for general power-mean.
00538 
00539         /** The histogram counts, where the first and last values are
00540          * counts of values below the lower bound and above the upper
00541          * bound, respectively.  The remaining values are the histogram
00542          * counts.
00543          */
00544         bool haveHistRange;
00545         double histMin;  //< Lower bound of histogram
00546         double histMax;  //< Upper bound of histogram
00547         std::vector< int > histogram;
00548 
00549         std::string tagName;  //< Tag to which to write metric values.
00550         /** Cached tag handle */
00551         TagHandle tagHandle;
00552 
00553         /** Value is return value for all of QualityAssessor */
00554         bool stoppingFunction;
00555 
00556         int referenceCount;
00557 
00558         enum AssessSchemes assessScheme;
00559     };
00560 
00561     typedef std::list< Assessor* > list_type;
00562 
00563     /** \brief Request summary data for a specific QualityMetric
00564      * This method allows the application to request the summary
00565      * data for a metric it has registered with the QualityAssessor.
00566      * If the passed QualityMetric has not been registered with the
00567      * QualityAssessor instance, NULL is returned.
00568      */
00569     MESQUITE_EXPORT
00570     const Assessor* get_results( QualityMetric* metric ) const;
00571 
00572     /** \brief Request summary data for a specific QualityMetric
00573      * This method allows the application to request the summary
00574      * data for a metric it has registered with the QualityAssessor.
00575      * If the passed QualityMetric has not been registered with the
00576      * QualityAssessor instance, NULL is returned.
00577      */
00578     MESQUITE_EXPORT
00579     const Assessor* get_results( const char* metric_name ) const;
00580 
00581     /** \brief Get list of all summary data.
00582      *  Return a const reference to the internal list of
00583      *  calculated data.
00584      */
00585     const list_type& get_all_results() const
00586     {
00587         return assessList;
00588     }
00589 
00590     MESQUITE_EXPORT
00591     QualityAssessor( const QualityAssessor& copy );
00592 
00593     MESQUITE_EXPORT
00594     QualityAssessor& operator=( const QualityAssessor& copy );
00595 
00596   private:
00597     struct Data
00598     {
00599         /** Count of inverted elements. */
00600         int invertedElementCount;
00601 
00602         /** Count of inverted Jacobians within elements.*/
00603         int invertedSampleCount;
00604 
00605         /** Number of elements */
00606         size_t elementCount;
00607 
00608         /** Total number of element Jacobians tested for inversion */
00609         size_t sampleCount;
00610 
00611         /** Number of elements with at least one free vertex */
00612         size_t freeElementCount;
00613 
00614         int referenceCount;
00615 
00616         Data() : referenceCount( 1 )
00617         {
00618             clear();
00619         }
00620 
00621         void clear()
00622         {
00623             invertedElementCount = invertedSampleCount = -1;
00624             elementCount = sampleCount = freeElementCount = 0;
00625         }
00626     };
00627 
00628     Data* myData;
00629 
00630     //! Common code for serial and parallel loop_over_mesh
00631     double loop_over_mesh_internal( MeshDomainAssoc* mesh_and_domain,
00632                                     const Settings* settings,
00633                                     ParallelHelper* helper,
00634                                     MsqError& err );
00635 
00636     /** Find an Assessor corresponding to the passed
00637      *  QualityMetric, or create it if is not found in
00638      *  the list.
00639      */
00640     list_type::iterator find_or_add( QualityMetric* qm, const char* label = 0 );
00641 
00642     /** Find an Assessor corresponding to the passed
00643      *  QualityMetric, or create it if is not found in
00644      *  the list.
00645      */
00646     list_type::iterator find_stopping_assessment();
00647 
00648     /** Find or create tag */
00649     TagHandle get_tag( Mesh* mesh, std::string name, Mesh::TagType type, unsigned size, MsqError& err );
00650 
00651     /** Try to determine if output stream is a terminal and if so,
00652         the width of that terminal.  Returns zero if width cannot
00653         be determined. */
00654     int get_terminal_width() const;
00655 
00656     static std::string element_name_as_string( int enum_name );
00657 
00658     static double round_to_3_significant_digits( double number );
00659 
00660     /** Name */
00661     std::string qualityAssessorName;
00662 
00663     /** List of quality metrics and corresponding data */
00664     list_type assessList;
00665 
00666     /** Stream to which to write summary of metric data */
00667     std::ostream& outputStream;
00668     /** Disable printing */
00669     bool printSummary;
00670 
00671     std::string invertedTagName, fixedTagName;
00672 
00673     bool skipFixedSamples;
00674 
00675     int elementTypeCount[MIXED - POLYGON + 1];
00676 
00677     bool invalid_values;  // set to true when a target metric contains inverted elements
00678 };
00679 
00680 }  // namespace MBMesquite
00681 
00682 #endif  // QualityAssessor_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines