1 /* *****************************************************************
2     MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4     Copyright 2004 Sandia Corporation and Argonne National
5     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
6     with Sandia Corporation, the U.S. Government retains certain
7     rights in this software.
8 
9     This library is free software; you can redistribute it and/or
10     modify it under the terms of the GNU Lesser General Public
11     License as published by the Free Software Foundation; either
12     version 2.1 of the License, or (at your option) any later version.
13 
14     This library is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17     Lesser General Public License for more details.
18 
19     You should have received a copy of the GNU Lesser General Public License
20     (lgpl.txt) along with this library; if not, write to the Free Software
21     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 
23     diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
24     pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
25 
26   ***************************************************************** */
27 /*!
28   \file   QualityImprover.hpp
29   \brief
30 
31   The Quality Improver Class is the base class for all the algorythms
32 
33   \author Thomas Leurent
34   \date   2002-01-17
35 */
36 
37 #ifndef Mesquite_QualityImprover_hpp
38 #define Mesquite_QualityImprover_hpp
39 
40 #include <string>
41 
42 #include "Mesquite.hpp"
43 #include "Instruction.hpp"
44 #include "TerminationCriterion.hpp"
45 
46 namespace MBMesquite
47 {
48   class PatchSet;
49   class MsqError;
50   class Mesh;
51   class MeshDomain;
52   class Settings;
53 
54 
55   /*! \class QualityImprover
56     \brief Base class for all quality improvers.
57     Mote that the PatchData settings are inherited from the PathDataUser class.
58 
59   */
60   class MESQUITE_EXPORT QualityImprover : public Instruction
61   {
62   public:
63 
64     // Constructor is protected ... see below.
65 
66      // virtual destructor ensures use of polymorphism during destruction
67     virtual ~QualityImprover();
68 
69       //!Sets in the termination criterion for the concrete solver's
70       //! optimization.
set_inner_termination_criterion(TerminationCriterion * crit)71     void set_inner_termination_criterion(TerminationCriterion* crit)
72       {
73         innerTerminationCriterion=crit;
74       }
75       //!Sets in the termination criterion for the outer loop over
76       //! patches.
set_outer_termination_criterion(TerminationCriterion * crit)77     void set_outer_termination_criterion(TerminationCriterion* crit)
78       {
79         outerTerminationCriterion=crit;
80       }
81 
82     virtual PatchSet* get_patch_set() = 0;
83 
84     virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain,
85                                    const Settings* settings,
86                                    MsqError& err );
87 
88   protected:
89 
90     /*! The default constructor initialises a few member variables
91         to default values.
92         This can be reused by concrete class constructor. */
93     QualityImprover();
94 
95       //!return the outer termination criterion pointer
get_outer_termination_criterion()96     TerminationCriterion* get_outer_termination_criterion()
97       { return outerTerminationCriterion; }
98       //!return the inner termination criterion pointer
get_inner_termination_criterion()99     TerminationCriterion* get_inner_termination_criterion()
100       { return innerTerminationCriterion; }
101 
102   private:
103 
104     TerminationCriterion* innerTerminationCriterion;
105     TerminationCriterion* outerTerminationCriterion;
106       //default TerminationCriterion for outer loop will be set in constructor
107     TerminationCriterion* defaultOuterCriterion;
108       //default TerminationCriterion for inner loop set by concrete improver
109     TerminationCriterion* defaultInnerCriterion;
110   };
111 
112 }
113 
114 #endif
115