main.cc.autosave 2.19 KB
Newer Older
Pit Nestle's avatar
Pit Nestle committed
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 99 100 101 102

//== COMPILE-TIME PACKAGE REQUIREMENTS ========================================
#include <CoMISo/Config/config.hh>
#include <iostream>

#if (COMISO_ADOLC_AVAILABLE && COMISO_EIGEN3_AVAILABLE)

#include <CoMISo/Utils/StopWatch.hh>
#include <vector>
#include <CoMISo/NSolver/LinearConstraint.hh>
#include <CoMISo/NSolver/NPDerivativeChecker.hh>
#include <CoMISo/NSolver/NProblemInterfaceADOLC.hh>
#include <CoMISo/NSolver/IPOPTSolver.hh>
#include <CoMISo/NSolver/NewtonSolver.hh>


class Problem_Distortion : public COMISO::NProblemInterfaceADOLC
{
public:
  typedef Eigen::Matrix<adouble, 2, 2> Matrix2ad;

  //Base Mesh
  std::vector<Eigen::Vector3d> mesh_vertices;
  unsigned int mesh_vertex_count;  
  
  //Parametrization Mesh
  std::vector<Eigen::Vector2d> param_vertices;
  unsigned int param_vertex_count; 
  
  //Triangle Vertex Indices
  std::vector<unsigned int[3]> triangles;
  
  Problem_Distortion() : COMISO::NProblemInterfaceADOLC(), vertex_count(0)
  {}

  virtual int n_unknowns()
  {
    return 0;
  }

  virtual void initial_x(double* _x)
  {

  }

  virtual adouble eval_f_adouble(const adouble* _x)
  {
    adouble result = 0;
    return result;
  }

  virtual void store_result(const double* _x)
  {

  }

  virtual bool constant_gradient() const { return false; }
  virtual bool constant_hessian()  const { return false; }
  virtual bool sparse_gradient() { return false;}
  virtual bool sparse_hessian () { return true;}

  void addMeshVertex(double x, double y, double z)
  {
    this->mesh_vertices.push_back(Eigen::Vector3d(x,y,z));
    this->vertex_count++;
  }

  void addParamVertex(double x, double y, double z)
  {
    this->param_vertices.push_back(Eigen::Vector3d(x,y,z));
    this->param_evertex_count++;
  }
  
  bool addTriangle(unsigned int v0, unsigned int v1, unsigned int v2)
  {
      
      if (vertex_count < v0 || vertex_count < v1 || vertex_count < c2)
      {
          std::cerr << "Problem_Distorion::addTriangle() : Vertex index out of range." << std::endl;
      }
      
  }

};

// Example main
int main(void)
{

  return 0;
}

#else

int main(void)
{
  std::cerr << "Warning: Example cannot be executed since either EIGEN3 or ADOLC is not available..." << std::endl;
  return 0;
}

#endif