Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
inks/CompositeOFScalarAdd.cpp
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  ***************************************************************** */
35 #include <math.h>
36 #include "CompositeOFScalarAdd.hpp"
37 #include "PatchData.hpp"
38 #include "MsqTimer.hpp"
39 using namespace Mesquite;
40 
41 
52  objFunc=Obj1;
53  mAlpha=alp;
54  set_negate_flag(1);
56 }
57 
58 
59 //Michael: need to clean up here
61 
62 }
63 
73  MsqError &err){
74  //if invalid return false without calculating fval.
75  bool b = objFunc->evaluate(patch, fval, err);
76  if( MSQ_CHKERR(err) || !b ){
77  fval = 0.0;
78  return false;
79  }
80 
81  fval+=mAlpha;
82  return true;
83 }
84 
86 msq_std::list<QualityMetric*> CompositeOFScalarAdd::get_quality_metric_list(){
88 }
89 
100  Vector3D *const &grad,
101  double &OF_val,
102  MsqError &err,
103  size_t array_size)
104 {
105  MSQ_FUNCTION_TIMER( "CompositeOFScalarAdd::compute_analytical_gradient" );
106  bool rval=objFunc->compute_gradient(patch, grad, OF_val,err, array_size); MSQ_ERRZERO(err);
107  OF_val+=mAlpha;
108  return rval;
109 }
110 
void set_gradient_type(GRADIENT_TYPE grad)
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT.
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
void set_quality_metric(QualityMetric *qm)
Set the value of qMetric.
Used to hold the error state and return it to the application.
virtual msq_std::list< QualityMetric * > get_quality_metric_list()
Returns the QualityMetric list assossiated with objFunc.
bool evaluate(PatchData &patch, double &fval, MsqError &err)
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
every differentiable function should have an analytical gradient implemented.
virtual msq_std::list< QualityMetric * > get_quality_metric_list()
Definition: patch.h:74
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
bool compute_gradient(PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size=0)
Calls either compute_numerical_gradient or compute_analytical_gradient depending on the value of grad...
void set_negate_flag(int neg)
Set the value of ObjectiveFunction&#39;s negateFlag. Unless composite, concrete ObjectiveFunctions should...
bool compute_analytical_gradient(PatchData &patch, Vector3D *const &grad, double &OF_val, MsqError &err, size_t array_size)
Base class for concrete Objective Functions ObjectiveFunction contains a pointer to a QualityMetric...
virtual bool concrete_evaluate(PatchData &patch, double &fval, MsqError &err)