File: simplifytest.cpp

package info (click to toggle)
psurface 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: cpp: 12,339; makefile: 111; awk: 38
file content (85 lines) | stat: -rw-r--r-- 1,953 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
79
80
81
82
83
84
85
#include "config.h"

#include "fenv.h"

#include <exception>
#include <iostream>
#include <memory>
#include <string>
#include <vector>


#ifdef PSURFACE_STANDALONE
#include "TargetSurface.h"
#else
#include "hxsurface/Surface.h"
#endif

#include "PSurface.h"
#include "GmshIO.h"

#include "MultiDimOctree.h"
#include "EdgeIntersectionFunctor.h"
#include "QualityRequest.h"
#include "HxParamToolBox.h"


using namespace std;
using namespace psurface;

typedef vector<string> StringVector;


int main(int argc, char* argv[])
{
  feenableexcept(FE_INVALID);

  //// Meshes to test.
  const string basepath("examplefiles/");
  StringVector input(2);
  input[0] = "tricube-anticlockwise.msh";
  input[1] = "tricube-clockwise.msh";

  // Read in a mesh, remove a node and check for consistency.
  try {
    for (StringVector::const_iterator it = input.begin(); it != input.end(); ++it) {
      const string filename = basepath + *it;

      cout << "Testing using " << filename << endl;

      // Remove the first eight nodes individually.
      for (size_t index = 0; index < 8; ++index) {
        // Read mesh.
        auto_ptr<PSurface<2,float> > par(GmshIO<float,2>::readGmsh(filename));

        // Remove node.
        cout << "   Removing node " << index << "." << endl;

        Box<float, 3> box;
        par->getBoundingBox(box);
        EdgeIntersectionFunctor ef(&(par->vertices(0)));
        MultiDimOctree<Edge, EdgeIntersectionFunctor, float, 3> edgebox(box, &ef);

        QualityRequest req;
        //req.intersections = true;
        //req.smallDihedralAngles = true;
        //req.paths = false;

        ParamToolBox::removeRegularPoint(par.get(), index, req, &edgebox);

        cout << "   Node removed." << endl;

        // Check consistency.
        par->checkConsistency(filename.c_str());
      }

      cout << "Done." << endl;
    }
  } catch (const exception& e) {
    cout << e.what() << endl;

    return 1;
  }

  return 0;
}