This file is indexed.

/usr/include/gmsh/OptHomObjContribMetricMin.h is in libgmsh-dev 2.10.1+dfsg1-1ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// TODO: Copyright

#ifndef _OPTHOMOBJCONTRIBMETRICMIN_H_
#define _OPTHOMOBJCONTRIBMETRICMIN_H_

#include "MeshOptPatch.h"
#include "MeshOptObjContrib.h"


template<class FuncType>
class ObjContribMetricMin : public ObjContrib, public FuncType
{
public:
  ObjContribMetricMin(double weight);
  virtual ~ObjContribMetricMin() {}
  virtual ObjContrib *copy() const;
  virtual void initialize(Patch *mesh);
  virtual bool fail() { return false; }
  virtual bool addContrib(double &Obj, alglib::real_1d_array &gradObj);
  virtual void updateParameters() { FuncType::updateParameters(_min, _max); }
  virtual bool targetReached() { return FuncType::targetReached(_min, _max); }
  virtual bool stagnated() { return FuncType::stagnated(_min, _max); }
  virtual void updateMinMax();

protected:
  Patch *_mesh;
  double _weight;
};


template<class FuncType>
ObjContribMetricMin<FuncType>::ObjContribMetricMin(double weight) :
  ObjContrib("MetricMin", FuncType::getNamePrefix()+"MetricMin"),
  _mesh(0), _weight(weight)
{
}


template<class FuncType>
ObjContrib *ObjContribMetricMin<FuncType>::copy() const
{
  return new ObjContribMetricMin<FuncType>(*this);
}


template<class FuncType>
void ObjContribMetricMin<FuncType>::initialize(Patch *mesh)
{
  _mesh = mesh;
  _mesh->initScaledJac();
  updateMinMax();
  FuncType::initialize(_min, _max);
}


template<class FuncType>
bool ObjContribMetricMin<FuncType>::addContrib(double &Obj, alglib::real_1d_array &gradObj)
{
  _min = BIGVAL;
  _max = -BIGVAL;

  for (int iEl = 0; iEl < _mesh->nEl(); iEl++) {
    std::vector<double> mM(_mesh->nBezEl(iEl));                                     // Min. of Metric
    std::vector<double> gMM(_mesh->nBezEl(iEl)*_mesh->nPCEl(iEl));                  // Dummy gradients of metric min.
    _mesh->metricMinAndGradients(iEl, mM, gMM);
    for (int l = 0; l < _mesh->nBezEl(iEl); l++) {                                  // Add contribution for each Bezier coeff.
      Obj += _weight * FuncType::compute(mM[l]);
      const double dfact = _weight * FuncType::computeDiff(mM[l]);
      for (int iPC = 0; iPC < _mesh->nPCEl(iEl); iPC++)
        gradObj[_mesh->indPCEl(iEl,iPC)] += dfact *  gMM[_mesh->indGSJ(iEl, l, iPC)];
      _min = std::min(_min, mM[l]);
      _max = std::max(_max, mM[l]);
    }
  }

  return true;
}


template<class FuncType>
void ObjContribMetricMin<FuncType>::updateMinMax()
{
  _min = BIGVAL;
  _max = -BIGVAL;

  for (int iEl = 0; iEl < _mesh->nEl(); iEl++) {
    std::vector<double> mM(_mesh->nBezEl(iEl));                         // Min. of Metric
    std::vector<double> dumGMM(_mesh->nBezEl(iEl)*_mesh->nPCEl(iEl));   // Dummy gradients of metric min.
    _mesh->metricMinAndGradients(iEl, mM, dumGMM);
    for (int l = 0; l < _mesh->nBezEl(iEl); l++) {                      // Check each Bezier coeff.
      _min = std::min(_min, mM[l]);
      _max = std::max(_max, mM[l]);
    }
  }
}


#endif /* _OPTHOMOBJCONTRIBMETRICMIN_H_ */