Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/TerminationCriterion.hpp
Go to the documentation of this file.
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 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3 -*-
28 
39 #ifndef TerminationCriterion_hpp
40 #define TerminationCriterion_hpp
41 
42 #include "Mesquite.hpp"
43 #include "PatchDataUser.hpp"
44 #include "MsqTimer.hpp"
45 
46 #include <string>
47 
48 #ifdef MSQ_USE_OLD_STD_HEADERS
49 # include <vector.h>
50 #else
51 # include <vector>
52 #endif
53 
54 namespace Mesquite
55 {
56  class MeshSet;
57  class MsqError;
58  class ObjectiveFunction;
59 
120  {
121  public:
122 
124  enum TCType {
125  NONE = 0,
146  KKT = 16,
158  CPU_TIME = 256,
179  };
180 
183 
186 
187  //Functions with which the user can specify the criteria to be used
189  void add_criterion_type_with_double(TCType tc_type, double eps,
190  MsqError &err);
192  void add_criterion_type_with_int(TCType tc_type, int bound,
193  MsqError &err);
195  void remove_criterion_type(TCType tc_type, MsqError &err);
196 
199  void set_culling_type(TCType tc_type, double eps, MsqError &err);
202  void remove_culling(MsqError &err);
203 
205  void reset_outer( MeshSet& ms, ObjectiveFunction* of, MsqError& err );
206 
208  void reset_inner( PatchData& pd, ObjectiveFunction* of, MsqError& err );
209 
211  void reset_patch( PatchData& pd, MsqError& err );
212 
214  void accumulate_inner( PatchData& pd, MsqError& err );
215 
217  void accumulate_inner( PatchData& pd, double of_value, Vector3D* of_grads,
218  MsqError& err );
219 
222  void accumulate_patch( PatchData& pd, MsqError& err );
223 
224  void accumulate_outer( MeshSet& ms, MsqError& err );
225 
227  bool terminate();
228 
229 
231  bool cull_vertices(PatchData &pd, ObjectiveFunction* obj_ptr, MsqError &err);
233  void cleanup(MeshSet &ms, MsqError &err);
234 
236 
241  {return currentOFValue;}
242 
244  { debugLevel = i; }
245 
246  protected:
247 
248  private:
249  //PRIVATE DATA MEMBERS
250  long unsigned int terminationCriterionFlag;
251  long unsigned int cullingMethodFlag;
252  //epsiloon used in culling methods.
253  double cullingEps;
254 
255  // ObjectiveFunction pointer
257 
258  //Data not specific to a single criterion
262  double lowerOFBound;
263 
264  //Data specific to termination criterion 1 (gradient bounds)
265  msq_std::vector<Vector3D> mGrad;
274  //Data specific to termination criterion 2 (KKT)
275  //???????????????????????????????????????????
276  //Data specific to termination criterion 3 (Quality Improvement)
279  //Data specific to termination criterion 4 (inner iterations)
282  //Data specific to termination criterion 5 (cpu time)
284  double timeBound;
285  //Data specific to termination criterion 6 (vertex movement)
292 
293  //Data specific to termination criterion 7 (successive improvement to F)
296  //crit 8
299 
301 
302  };
303 
304 } //namespace
305 
306 
307 #endif // TerminationCriterion_hpp
double get_current_function_value()
This function returns the current function value.
Terminates when a the maximum distance moved by any vertex during the previous iteration is below the...
Terminates when the decrease in the objective function value since the previous iteration is below th...
void cleanup(MeshSet &ms, MsqError &err)
Cleans up after the TerminationCriterion is finished.
Terminates when any vertex leaves the bounding box, defined by the given value, d.
Used to hold the error state and return it to the application.
void accumulate_patch(PatchData &pd, MsqError &err)
Common code for both inner and outer termination criteria during inner iteration. ...
The TerminationCriterion class contains functionality to terminate the VertexMover&#39;s optimization...
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
checks the gradient of objective function against a double and stops when
TerminationCriterion()
Constructor which does not take any arguements.
void reset_outer(MeshSet &ms, ObjectiveFunction *of, MsqError &err)
Clear any data accumulated during an outer iteration.
Terminates when a the maximum distance moved by any vertex during the previous iteration is below the...
void reset_inner(PatchData &pd, ObjectiveFunction *of, MsqError &err)
Clear any data accumulated during an inner iteration.
bool terminate()
Check if termination criterion has been met.
terminates on the j_th iteration when That is, terminates when the norm of the gradient is small tha...
bool cull_vertices(PatchData &pd, ObjectiveFunction *obj_ptr, MsqError &err)
Function which determines whether this patch should be &#39;culled&#39;.
void reset_patch(PatchData &pd, MsqError &err)
Shared inner and outer initialization during inner loop.
Terminates when the decrease in the objective function value since the previous iteration is below th...
Terminates when the objective function value is smaller than the given scalar value.
Terminates when the algorithm exceeds an allotted time limit (given in seconds).
blockLoc i
Definition: read.cpp:79
void set_culling_type(TCType tc_type, double eps, MsqError &err)
Sets the type of criterion that the user would like to use for culling purposes (along with the assoc...
void add_criterion_type_with_double(TCType tc_type, double eps, MsqError &err)
Sets the criterion by specifing the TCType and the eps value.
long unsigned int terminationCriterionFlag
Bit flag of termination crit.
void accumulate_inner(PatchData &pd, MsqError &err)
Accumulate data during inner iteration.
Terminates when the number of iterations exceeds a given integer.
void remove_criterion_type(TCType tc_type, MsqError &err)
Removes the criterion by specifing just the TCType.
void remove_culling(MsqError &err)
Removes any previously set culling types (sets the culling type to be NONE).
void accumulate_outer(MeshSet &ms, MsqError &err)
Contains a copy of the coordinates of a PatchData.
Terminates when the objective function value is smaller than the given scalar value times the origina...
void add_criterion_type_with_int(TCType tc_type, int bound, MsqError &err)
Sets the criterion by specifing the TCType and the integer value.
checks the gradient of objective function against a double and stops when
Base class for concrete Objective Functions ObjectiveFunction contains a pointer to a QualityMetric...
The MeshSet class stores one or more Mesquite::Mesh pointers and manages access to the mesh informati...