File: main.cc

package info (click to toggle)
madlib 1.3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,912 kB
  • sloc: cpp: 39,850; sh: 10,088; makefile: 476
file content (78 lines) | stat: -rw-r--r-- 2,352 bytes parent folder | download | duplicates (3)
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
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information. 
// You should have received a copy of these files along with MAdLib. 
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------

#include "MAdLib.h"

#include <iostream>
using std::cout;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <stdlib.h>

using namespace MAd;

// ----------------------------------------------------------------------
int main(int argc, char* argv[]) {

  // Check input
  // ------------
  if ( argc != 2 ) {
    printf("Error: usage: \'executable mshFile\'\n");
    exit(0);
  }
  string meshFile = argv[1];

  // Build tools
  // ------------
  pGModel model = 0;
  pMesh mesh = M_new(model);
  M_load(mesh,meshFile.c_str());

  PWLSField * sizeField = new PWLSField(mesh);
  sizeField->setCurrentSize();
//   vector<string> h, e0, e1, e2;
//   h.push_back("0.50"); h.push_back("0.05"); h.push_back("0.01");
//   e0.push_back("1.0"); e0.push_back("0.0"); e0.push_back("0.0");
//   e1.push_back("0.0"); e1.push_back("1.0"); e1.push_back("0.0");
//   e2.push_back("0.0"); e2.push_back("0.0"); e2.push_back("1.0");
//   AnalyticalSField* asf = new AnalyticalSField(h, e0, e1, e2);
  
//   MeshAdapter* ma = new MeshAdapter(mesh,asf);
  MeshAdapter* ma = new MeshAdapter(mesh,sizeField);

  // Output situation before optimization
  // -------------------------------------
  printf ("Statistics before optimization: \n");
  ma->printStatistics(std::cout);
  ma->writePos("meanRatioBefore.pos",OD_MEANRATIO);

  // Optimize
  // ---------
  printf ("Optimizing mesh %s...\n\n",meshFile.c_str());
  ma->run();

  // Outputs final mesh
  // -------------------
  printf ("Statistics after optimization: \n");
  ma->printStatistics(std::cout);
  ma->writePos("meanRatioAfter.pos",OD_MEANRATIO);
  M_writeMsh (mesh, "result.msh", 2, NULL);

  // Cleaning
  // ---------
  if (ma) delete ma;
  if (sizeField) delete sizeField;
}

// ----------------------------------------------------------------------